# HG changeset patch # User Peter Meerwald # Date 1277473858 -7200 # Node ID 26cd8f1ef0b10ed645213c15842ae6ae358a7c98 # Parent c6c5a16ce2f2f5dbe139b5912f385b16a3fd184f import spandsp-0.0.6pre17 diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/AUTHORS --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/AUTHORS Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1 @@ +Steve Underwood diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/COPYING --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/COPYING Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,853 @@ +The spandsp library is licenced under LGPL 2.1. The test suite, and some of +the supporting code, are licenced under GPL 2. The full text of both licences +may be found below. + + + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin St, 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. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.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 St, 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. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + + + + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 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. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/ChangeLog --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/ChangeLog Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,47 @@ +07.08.29 - 0.0.4 - Steve Underwood + - + +06.05.23 - 0.0.3 - Steve Underwood + - T.38 now implemented, though it needs further polishing. + - G.726 and G.722 now implemented. + +04.08.29 - 0.0.2 - Steve Underwood + - T.4 no longer uses libtiff for compresion and decompression on the line side + (it is still used to handle the TIFF files). Spandsp no longer depends on + accessing the "internals" of libtiff. New 1D and 2D compression and + decompression code now handles the line side. This should be more robust than + using libtiff, and handles the fudging of bad scan lines rather better. + - T.30 line turn-around timing corrected. + - T.30 DCS header contents corrected. + - T.30 provision for V.17 added, as an option. + - T.30 now has a statistics interface, for applications to find details about + image transfers. + - T.30 processing now correctly closes TIFF files are they have been sent. + - FAX header line insertion is now supported for transmitted FAXes. + - asynchronous serial processing now has a V.14 compatible rate adaption option. + - V.8 modem negotiation module added. + - OKI ADPCM now supports Dialogic compatible operation at 6k samples/second, as + well as 8k samples/second, using its own sample rate converter. + - message queuing added to ease things like T.31 handling + - incomplete skeleton (still rather nasty, to be honest) T.31 processing. + - incomplete skeleton of V.22bis added. There is probably quite a bit to do + to get this complete and robust. It probably requires the T.31 processing + be expanded to something more like V.250, so it doesn't just handle FAX. + - Incomplete V.17 added (there could be an IBM patent related to the TCM part of + V.17, but I think it has expired. Don't distribute binaries of spandsp built + with V.17 enabled until this is resolved - and the modem is completed, of + course :-) ). The current version transmits OK. It receives OK with the + long training sequence, but the symbol and carrier syncing isn't good enough + for robust receiving with the short training sequence. + - A basic BER tester has been added. + - The faster modems now have proper shutdown procedures, whether one is defined in + the spec. or not. + - The modems (except simple FSK) now have APIs to access performance information. + - A common GUI (using FLTK) added for the modem tests. + - A bit more documentation added. + - Some API inconsistencies cleaned up. + - The usual bundle of assorted buglet fixes and polishing. + +04.04.29 - 0.0.1k - Steve Underwood + - The first version which gives solid faxing for a large number of people. + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/DueDiligence --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/DueDiligence Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,55 @@ +Intellectual Property Due Diligence +----------------------------------- + +Modems and voice coding are heavily patented areas. Implementing these without +serious consideration of IP issues would be foolish. This document describes +the basis on which the software has been implemented. + + +A check of the intellectual property information at the ITU web site shows a +number of patent claims against the current standards implemented by spandsp. +It is important to realise, however, that some of these patents have long +since expired (group III fax dates back to the 1970s). Also, many are +related to recent additions to the FAX standard, such as colour FAX handling, +which few people ever use. + +The V.14 rate adaption standard seems free of patent encumberance. + +One patent is listed as relevant to the V.17 standard. It is a patent from +IBM, but the ITU database does not specify its nature. I believe it is +related to the trellis coding used, and I think it has expired. I do not +know for sure. The techniques used in the implementation should be free of +patent encumberance. Most of the implementation is similar to the V.29 +modem. The key addition the trellis code processing. The trellis encoding +is trivial. The decoding uses Viterbi techniques, which are quite old. + +The V.21 standard dates from the 1950s. The V.23 standard is also very old. +There is no possibility that any patents related to it are still in force. +However, the implementation also needs to be free of patented techniques. +The implementation only uses very mature numerical oscillator and quadrature +correlation techniques, so there should be no patent issues. + +Only one patent is listed as relevant to the V.29 standard. This dates from +the 1970s, and must have expired. The modem has been implemented using only +very mature techniques, none of which can be less than 20 years old. There +seem no possibility, therefore, that any patents are still in force related +to the techniques used. + +Some aspect of the V.8 standard seems to have patents associated with it, +according to the ITU patent database. I am unclear what these are. V.8 is a +very simple standard. There seems to be nothing innovative about it. + +Many patents are listed as relevant to the T.30 standard. However, they all +appear to relate to newer features, such as colour FAX, added in recent years. +The current implementation only covers the original features from the late +1970s, where there appear to be patent issues. + +The T.4 standard defines the image compression and decompression techniques +used for group 3 FAXes. The spandsp implementation is based on code derived +from freely available implementations of T.4. These have existed for a number +of years without IP issues. The standard is old enough for any patents to have +expired, anyway. + +V.42bis compression uses the LZW algorithm. This is the same algorithm used in +GIF files. Unisys patented this algorithm. However, the Unisys patent has now +expired. diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/INSTALL --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/INSTALL Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,255 @@ +Building and installing spandsp +=============================== + +A number of distributions include spandsp, but they usually use older versions +of the library, which lack a lot of the features of the current version. Before +installing spandsp, make sure there are no older versions already on your +machine. Make sure libtiff is installed on your machine. Versions 3.5.7, +3.6.0, 3.7.1 and 3.8.2 seem to work OK. There have been several bugs related +to FAX document handling in some versions of libtiff. Also, some people have +had trouble using spandsp because they had more than one version of libtiff +on their machine. Take care with this. If you are using an RPM based system, +such as RedHat or Fedora, you will need the libtiff and libtiff-devel RPMs +installed to be able to build spandsp. + +You can use the usual: + + ./configure + make + make install + +process to build the spandsp library. Note that if you use configure in this +way, the software will be installed in /usr/local. In this case make sure your +/etc/ld.so.conf file has an entry for /usr/local/lib. If you wish the software +to be installed in /usr, you should build it with the commands. + + ./configure --prefix=/usr + make + make install + + +Building the programming documentation +====================================== + +If you wish to build the programming documentation for spandsp, configure +spandsp with: + + ./configure --enable-doc + +You need doxygen installed on your machine. + + +Building the test suite +======================= + +Most sections of the spandsp library have an accompanying test program in the +test directory. If you wish to build these test programs, configure spandsp +with: + + ./configure --enable-tests + +To build these tests you will need libaudiofile installed on your machine. To +build the modem tests, with the GUI monitoring feature you will need Fltk 1.1.4 +or later, an audio meter module and a cartesian plotting module. Fltk may be +obtained from http://www.fltk.org. The audio meter module may be obtained from +http://www.soft-switch.org/downloads/Fl_Audio_Meter.tgz . The cartesian plotting +module may be obtained from http://134.226.68.29/fltk. However, there is no +suitable makefile supplied with that. You can find a version at +http://www.soft-switch.org/downloads/Fl_Cartesian.tgz which will build as a +Linux library. The actual code in both these versions is identical. +You need to have Fltk 1.1.4 or later installed before building the plotting +library. + + +Applications +============ + +Applications support for spandsp is built into packages such as Callweaver, +FreeSwitch and iaxmodem. Code to add spandsp based FAX support to Asterisk may +be found at http://sourceforge.net/projects/agx-ast-addons. + + + + +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.ac' is used to create `configure' by a program +called `autoconf'. You only need `configure.ac' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/Makefile.am Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,94 @@ +## +## SpanDSP - a series of DSP components for telephony +## +## Makefile.am - Process this file with automake to produce Makefile.in +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU Lesser General Public License version 2.1, +## as published by the Free Software Foundation. +## +## 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 Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this program; if not, write to the Free Software +## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +## +## $Id: Makefile.am,v 1.49 2009/05/30 05:55:22 steveu Exp $ + +AM_CFLAGS = $(COMP_VENDOR_CFLAGS) +AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) + +noinst_SCRIPTS = spandsp.spec + +MAINTAINERCLEANFILES = Makefile.in + +EXTRA_DIST = autogen.sh \ + DueDiligence \ + debian/changelog \ + debian/compat \ + debian/control \ + debian/copyright \ + debian/libspandsp6.install \ + debian/libspandsp-dev.install \ + debian/libspandsp-doc.install \ + debian/rules \ + debian/watch \ + README.testdata \ + spandsp.pc \ + spandsp.spec \ + spandsp/fax-tests.dtd \ + spandsp/global-tones.xml \ + spandsp/tones.dtd \ + spandsp/tsb85.xml \ + unpack_g722_data.sh \ + unpack_g726_data.sh \ + unpack_gsm0610_data.sh \ + unpack_v56ter_data.sh \ + wrapper.xsl + +if COND_DOC + MAYBE_DOC=doc +endif +if COND_TESTDATA + MAYBE_TESTDATA=test-data +endif +if COND_TESTS + MAYBE_TESTDATA=test-data + MAYBE_TESTS=spandsp-sim tests +endif +SUBDIRS = src $(MAYBE_DOC) $(MAYBE_TESTDATA) $(MAYBE_TESTS) + +DIST_SUBDIRS = src doc test-data spandsp-sim tests + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = spandsp.pc + +faq: faq.xml + cd faq ; xsltproc ../wrapper.xsl ../faq.xml + +rpm: rpm-build + +rpm-build: + $(MAKE) -$(MAKEFLAGS) bump.rpm.release + $(MAKE) -$(MAKEFLAGS) dist + rm -rf rpm/BUILD/* + rm -f rpm/RPMS/*/* + rm -f rpm/SOURCES/* + rm -f rpm/SPECS/* + rm -f rpm/SRPMS/* + rpmbuild -ta --sign @PACKAGE@-@VERSION@.tar.gz + +bump.rpm.release: spandsp.spec + VERSION="x"; \ + test -f $(srcdir)/rpm.release && . $(srcdir)/rpm.release; \ + NEXT_RELEASE=0; \ + test "$$VERSION" = "@VERSION@" && NEXT_RELEASE="$$RELEASE"; \ + RELEASE=`expr $$NEXT_RELEASE + 1`; \ + echo "VERSION=@VERSION@" >$(srcdir)/rpm.release; \ + echo "RELEASE=$$RELEASE" >>$(srcdir)/rpm.release; \ + sed 's/^Release: .*/Release: '$$RELEASE'/' \ + spandsp.spec.new; \ + mv spandsp.spec.new spandsp.spec diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/Makefile.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/Makefile.in Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,742 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = . +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/spandsp.pc.in \ + $(srcdir)/spandsp.spec.in $(top_srcdir)/configure AUTHORS \ + COPYING ChangeLog INSTALL NEWS config/config.guess \ + config/config.sub config/depcomp config/install-sh \ + config/ltmain.sh config/missing +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/config/ax_compiler_vendor.m4 \ + $(top_srcdir)/config/ax_check_real_file.m4 \ + $(top_srcdir)/config/ax_fixed_point_machine.m4 \ + $(top_srcdir)/config/ax_misaligned_access_fails.m4 \ + $(top_srcdir)/config/ax_c99_features.m4 \ + $(top_srcdir)/config/ax_check_export_capability.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno configure.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = spandsp.pc spandsp.spec +SCRIPTS = $(noinst_SCRIPTS) +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(pkgconfigdir)" +pkgconfigDATA_INSTALL = $(INSTALL_DATA) +DATA = $(pkgconfig_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_FOR_BUILD = @CC_FOR_BUILD@ +CFLAGS = @CFLAGS@ +COMP_VENDOR_CFLAGS = @COMP_VENDOR_CFLAGS@ +COMP_VENDOR_LDFLAGS = @COMP_VENDOR_LDFLAGS@ +COND_DOC_FALSE = @COND_DOC_FALSE@ +COND_DOC_TRUE = @COND_DOC_TRUE@ +COND_MMX_FALSE = @COND_MMX_FALSE@ +COND_MMX_TRUE = @COND_MMX_TRUE@ +COND_SSE2_FALSE = @COND_SSE2_FALSE@ +COND_SSE2_TRUE = @COND_SSE2_TRUE@ +COND_SSE3_FALSE = @COND_SSE3_FALSE@ +COND_SSE3_TRUE = @COND_SSE3_TRUE@ +COND_SSE4A_FALSE = @COND_SSE4A_FALSE@ +COND_SSE4A_TRUE = @COND_SSE4A_TRUE@ +COND_SSE4_1_FALSE = @COND_SSE4_1_FALSE@ +COND_SSE4_1_TRUE = @COND_SSE4_1_TRUE@ +COND_SSE4_2_FALSE = @COND_SSE4_2_FALSE@ +COND_SSE4_2_TRUE = @COND_SSE4_2_TRUE@ +COND_SSE5_FALSE = @COND_SSE5_FALSE@ +COND_SSE5_TRUE = @COND_SSE5_TRUE@ +COND_SSE_FALSE = @COND_SSE_FALSE@ +COND_SSE_TRUE = @COND_SSE_TRUE@ +COND_SSSE3_FALSE = @COND_SSSE3_FALSE@ +COND_SSSE3_TRUE = @COND_SSSE3_TRUE@ +COND_TESTDATA_FALSE = @COND_TESTDATA_FALSE@ +COND_TESTDATA_TRUE = @COND_TESTDATA_TRUE@ +COND_TESTS_FALSE = @COND_TESTS_FALSE@ +COND_TESTS_TRUE = @COND_TESTS_TRUE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSERT_INTTYPES_HEADER = @INSERT_INTTYPES_HEADER@ +INSERT_MATH_HEADER = @INSERT_MATH_HEADER@ +INSERT_STDINT_HEADER = @INSERT_STDINT_HEADER@ +INSERT_TGMATH_HEADER = @INSERT_TGMATH_HEADER@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIMLIBS = @SIMLIBS@ +SPANDSP_LT_AGE = @SPANDSP_LT_AGE@ +SPANDSP_LT_CURRENT = @SPANDSP_LT_CURRENT@ +SPANDSP_LT_REVISION = @SPANDSP_LT_REVISION@ +SPANDSP_MISALIGNED_ACCESS_FAILS = @SPANDSP_MISALIGNED_ACCESS_FAILS@ +SPANDSP_USE_EXPORT_CAPABILITY = @SPANDSP_USE_EXPORT_CAPABILITY@ +SPANDSP_USE_FIXED_POINT = @SPANDSP_USE_FIXED_POINT@ +STRIP = @STRIP@ +TESTLIBS = @TESTLIBS@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DSYMUTIL = @ac_ct_DSYMUTIL@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_NMEDIT = @ac_ct_NMEDIT@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AM_CFLAGS = $(COMP_VENDOR_CFLAGS) +AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) +noinst_SCRIPTS = spandsp.spec +MAINTAINERCLEANFILES = Makefile.in +EXTRA_DIST = autogen.sh \ + DueDiligence \ + debian/changelog \ + debian/compat \ + debian/control \ + debian/copyright \ + debian/libspandsp6.install \ + debian/libspandsp-dev.install \ + debian/libspandsp-doc.install \ + debian/rules \ + debian/watch \ + README.testdata \ + spandsp.pc \ + spandsp.spec \ + spandsp/fax-tests.dtd \ + spandsp/global-tones.xml \ + spandsp/tones.dtd \ + spandsp/tsb85.xml \ + unpack_g722_data.sh \ + unpack_g726_data.sh \ + unpack_gsm0610_data.sh \ + unpack_v56ter_data.sh \ + wrapper.xsl + +@COND_DOC_TRUE@MAYBE_DOC = doc +@COND_TESTDATA_TRUE@MAYBE_TESTDATA = test-data +@COND_TESTS_TRUE@MAYBE_TESTDATA = test-data +@COND_TESTS_TRUE@MAYBE_TESTS = spandsp-sim tests +SUBDIRS = src $(MAYBE_DOC) $(MAYBE_TESTDATA) $(MAYBE_TESTS) +DIST_SUBDIRS = src doc test-data spandsp-sim tests +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = spandsp.pc +all: all-recursive + +.SUFFIXES: +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ + cd $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +spandsp.pc: $(top_builddir)/config.status $(srcdir)/spandsp.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +spandsp.spec: $(top_builddir)/config.status $(srcdir)/spandsp.spec.in + cd $(top_builddir) && $(SHELL) ./config.status $@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + test -z "$(pkgconfigdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfigdir)" + @list='$(pkgconfig_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ + $(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \ + done + +uninstall-pkgconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgconfig_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config-h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config-h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config-h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config-h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + $(mkdir_p) $(distdir)/. $(distdir)/config $(distdir)/debian $(distdir)/doc $(distdir)/spandsp $(distdir)/src + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile $(SCRIPTS) $(DATA) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(pkgconfigdir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: install-pkgconfigDATA + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am uninstall-pkgconfigDATA + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ + check-am clean clean-generic clean-libtool clean-recursive \ + ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ + dist-shar dist-tarZ dist-zip distcheck distclean \ + distclean-generic distclean-libtool distclean-recursive \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-pkgconfigDATA \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am uninstall-info-am \ + uninstall-pkgconfigDATA + + +faq: faq.xml + cd faq ; xsltproc ../wrapper.xsl ../faq.xml + +rpm: rpm-build + +rpm-build: + $(MAKE) -$(MAKEFLAGS) bump.rpm.release + $(MAKE) -$(MAKEFLAGS) dist + rm -rf rpm/BUILD/* + rm -f rpm/RPMS/*/* + rm -f rpm/SOURCES/* + rm -f rpm/SPECS/* + rm -f rpm/SRPMS/* + rpmbuild -ta --sign @PACKAGE@-@VERSION@.tar.gz + +bump.rpm.release: spandsp.spec + VERSION="x"; \ + test -f $(srcdir)/rpm.release && . $(srcdir)/rpm.release; \ + NEXT_RELEASE=0; \ + test "$$VERSION" = "@VERSION@" && NEXT_RELEASE="$$RELEASE"; \ + RELEASE=`expr $$NEXT_RELEASE + 1`; \ + echo "VERSION=@VERSION@" >$(srcdir)/rpm.release; \ + echo "RELEASE=$$RELEASE" >>$(srcdir)/rpm.release; \ + sed 's/^Release: .*/Release: '$$RELEASE'/' \ + spandsp.spec.new; \ + mv spandsp.spec.new spandsp.spec +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/NEWS --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/NEWS Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1 @@ +No news is good news! \ No newline at end of file diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/README Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,35 @@ +spandsp 0.0.5 - A DSP library for telephony +------------------------------------------- + +SpanDSP is a library of DSP functions for telephony, in the 8000 sample per +second world of E1s, T1s, and higher order PCM channels. It contains low level +functions, such as basic filters. It also contains higher level functions, such +as cadenced supervisory tone detection, and a complete software FAX machine. +The software has been designed to avoid intellectual property issues, using +mature techniques where all relevant patents have expired. See the file +DueDiligence for important information about these intellectual property issues. + +The library is licenced under the LGPL 2.1 licence. The test suite, and some support +programs are licenced under the GPL 2 licence. The full text of these licences can +be found in the file COPYING. + +Dependencies +------------ + +spandsp depends on various other packages for various tasks. Most of these +dependencies relate to building the test suite. + +libtiff (and libtiff-devel on most Linux distributions) is required to +build the spandsp library. + +libaudiofile (and libaudiofile-devel) is required to build the test suite +fftw (and fftw-devel) is required to build the test suite. Version 2 or 3 of +FFTW may be used. Spandsp adapts to the differences between them. + +fltk (and fltk-devel), Fl_Cartesian and Fl_Audio_Meter are required to build +the test suite with GUI interfaces for some of the tests. The tests will build +without these packages, but the GUI features will not be available. +Fl_Cartesian and Fl_Audio_Meter can be downloaded from +http://www.soft-switch.org/downloads. + +Steve Underwood diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/README.testdata --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/README.testdata Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,53 @@ +Setting up test data for the supplied suite of test programs. +------------------------------------------------------------- + +Some of the tests in the test suite for this package require test data files. These test +data files fall into four categories: + + - Some data files, such as those for some of the FAX tests, are generated by programs + in the package. + + - Some are freely distributable data files, from various sources. These are supplied + with the package. + + - Some are test data files from a standards body. These are the copyright material of + the standards body, and so cannot be distributed with this package. However, most of + these files can currently be downloaded at no charge from the standards body's web + site. This file describes which files are needed, and how they may be processed to + produce the right files in the right places for the tests. + + - The two industry standard sources of test data for DTMF decoders are Bellcore/Telcordia + and Mitel. Neither of these is either free, or supplied in a form directly usable + with the test suite. These data sources are expected by several tests, and not just + the DTMF decoder tests. Sad to say, you are on your own when trying to source data + for these tests. + +For the G.722 tests, obtain the file T-REC-G.722-198703-I!AppII!ZPF-E.zip from the ITU web site, +and place it in this directory. Then run + +./unpack_g722_data.sh + +For the G.726 tests, obtain the file T-REC-G.726-199103-I!AppII!SOFT-ZST-E.zip from the ITU web +site, and place it in this directory. Then run + +./unpack_g726_data.sh + +For the GSM 06.10 tests, obtain the file en_300961v080101p0.zip from the ETSI web site, +and place it in this directory. If you are able to run .exe (i.e. MS DOS or Windows) +files you can simply run + +./unpack_gsm0610_data.sh + +If you are unable to run .exe files on the machine you are using (e.e. you are not using Cygwin, +Mingw, Wine, FreeDOS or something of that sort) you will need to find a machine which will. First, +run + +./unpack_gsm0610_data.sh --no-exe + +This will leave 6 .EXE files in the etsitetss/gsm0610 directory. Take these to a machine which +can run .EXE files, and execute all of them. This should result in a number of files which end +with .COD, INP and .OUT. Copy these to the etsitests/gsm0610 directory, and run + +./unpack_gsm0610_data.sh --no-exe-continue + +The remainder of the extraction and repacking of files should then take place. diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/aclocal.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/aclocal.m4 Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,7489 @@ +# generated automatically by aclocal 1.9.6 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- + +# serial 52 AC_PROG_LIBTOOL + + +# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ----------------------------------------------------------- +# If this macro is not defined by Autoconf, define it here. +m4_ifdef([AC_PROVIDE_IFELSE], + [], + [m4_define([AC_PROVIDE_IFELSE], + [m4_ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# AC_PROG_LIBTOOL +# --------------- +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl +dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX +dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AC_LIBTOOL_CXX], + [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX + ])]) +dnl And a similar setup for Fortran 77 support + AC_PROVIDE_IFELSE([AC_PROG_F77], + [AC_LIBTOOL_F77], + [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 +])]) + +dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run +dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. + AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [ifdef([AC_PROG_GCJ], + [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([A][M_PROG_GCJ], + [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([LT_AC_PROG_GCJ], + [define([LT_AC_PROG_GCJ], + defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) +])])# AC_PROG_LIBTOOL + + +# _AC_PROG_LIBTOOL +# ---------------- +AC_DEFUN([_AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Prevent multiple expansion +define([AC_PROG_LIBTOOL], []) +])# _AC_PROG_LIBTOOL + + +# AC_LIBTOOL_SETUP +# ---------------- +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.50)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl + +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl +AC_LIBTOOL_SYS_MAX_CMD_LEN +AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +AC_LIBTOOL_OBJDIR + +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +_LT_AC_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] + +# Same as above, but do not quote variable references. +[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +AC_CHECK_TOOL(AR, ar, false) +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +_LT_REQUIRED_DARWIN_CHECKS + +AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +enable_win32_dll=yes, enable_win32_dll=no) + +AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +AC_ARG_WITH([pic], + [AC_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +AC_LIBTOOL_LANG_C_CONFIG +_LT_AC_TAGCONFIG +])# AC_LIBTOOL_SETUP + + +# _LT_AC_SYS_COMPILER +# ------------------- +AC_DEFUN([_LT_AC_SYS_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_AC_SYS_COMPILER + + +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +AC_DEFUN([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +]) + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +AC_DEFUN([_LT_COMPILER_BOILERPLATE], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +AC_DEFUN([_LT_LINKER_BOILERPLATE], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm -r conftest* +])# _LT_LINKER_BOILERPLATE + +# _LT_REQUIRED_DARWIN_CHECKS +# -------------------------- +# Check for some things on darwin +AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS],[ + case $host_os in + rhapsody* | darwin*) + AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) + AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) + + AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], + [lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + echo "int foo(void){return 1;}" > conftest.c + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib ${wl}-single_module conftest.c + if test -f libconftest.dylib; then + lt_cv_apple_cc_single_mod=yes + rm -rf libconftest.dylib* + fi + rm conftest.c + fi]) + AC_CACHE_CHECK([for -exported_symbols_list linker flag], + [lt_cv_ld_exported_symbols_list], + [lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [lt_cv_ld_exported_symbols_list=yes], + [lt_cv_ld_exported_symbols_list=no]) + LDFLAGS="$save_LDFLAGS" + ]) + case $host_os in + rhapsody* | darwin1.[[0123]]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[[012]]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}" + fi + if test "$DSYMUTIL" != ":"; then + _lt_dsymutil="~$DSYMUTIL \$lib || :" + else + _lt_dsymutil= + fi + ;; + esac +]) + +# _LT_AC_SYS_LIBPATH_AIX +# ---------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_AC_SYS_LIBPATH_AIX + + +# _LT_AC_SHELL_INIT(ARG) +# ---------------------- +AC_DEFUN([_LT_AC_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_AC_SHELL_INIT + + +# _LT_AC_PROG_ECHO_BACKSLASH +# -------------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], +[_LT_AC_SHELL_INIT([ +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +echo=${ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null 2>&1 && unset CDPATH + +if test -z "$ECHO"; then +if test "X${echo_test_string+set}" != Xset; then +# find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string=`eval $cmd`) 2>/dev/null && + echo_test_string=`eval $cmd` && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(ECHO) +])])# _LT_AC_PROG_ECHO_BACKSLASH + + +# _LT_AC_LOCK +# ----------- +AC_DEFUN([_LT_AC_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + libsuff=64 + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; + ]) +esac + +need_locks="$enable_libtool_lock" + +])# _LT_AC_LOCK + + +# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], +[AC_REQUIRE([LT_AC_PROG_SED]) +AC_CACHE_CHECK([$1], [$2], + [$2=no + ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $rm conftest* +]) + +if test x"[$]$2" = xyes; then + ifelse([$5], , :, [$5]) +else + ifelse([$6], , :, [$6]) +fi +])# AC_LIBTOOL_COMPILER_OPTION + + +# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ------------------------------------------------------------ +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $rm -r conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$4], , :, [$4]) +else + ifelse([$5], , :, [$5]) +fi +])# AC_LIBTOOL_LINKER_OPTION + + +# AC_LIBTOOL_SYS_MAX_CMD_LEN +# -------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], +[# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ + = "XX$teststring") >/dev/null 2>&1 && + new_result=`expr "X$teststring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + teststring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +])# AC_LIBTOOL_SYS_MAX_CMD_LEN + + +# _LT_AC_CHECK_DLFCN +# ------------------ +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h)dnl +])# _LT_AC_CHECK_DLFCN + + +# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# --------------------------------------------------------------------- +AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + exit (status); +}] +EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_AC_TRY_DLOPEN_SELF + + +# AC_LIBTOOL_DLOPEN_SELF +# ---------------------- +AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +])# AC_LIBTOOL_DLOPEN_SELF + + +# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) +# --------------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler +AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* +]) +])# AC_LIBTOOL_PROG_CC_C_O + + +# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) +# ----------------------------------------- +# Check to see if we can do hard links to lock some files if needed +AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], +[AC_REQUIRE([_LT_AC_LOCK])dnl + +hard_links="nottested" +if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS + + +# AC_LIBTOOL_OBJDIR +# ----------------- +AC_DEFUN([AC_LIBTOOL_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +])# AC_LIBTOOL_OBJDIR + + +# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) +# ---------------------------------------------- +# Check hardcoding attributes. +AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_AC_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ + test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ + test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_AC_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_AC_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_AC_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH + + +# AC_LIBTOOL_SYS_LIB_STRIP +# ------------------------ +AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], +[striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) +fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +])# AC_LIBTOOL_SYS_LIB_STRIP + + +# AC_LIBTOOL_SYS_DYNAMIC_LINKER +# ----------------------------- +# PORTME Fill in your ld.so characteristics +AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +m4_if($1,[],[ +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'` + else + lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + sys_lib_search_path_spec=`echo $lt_search_path_spec` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi]) +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[[4-9]]*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[123]]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[[3-9]]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no + +AC_CACHE_VAL([lt_cv_sys_lib_search_path_spec], +[lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"]) +sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +AC_CACHE_VAL([lt_cv_sys_lib_dlsearch_path_spec], +[lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"]) +sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi +])# AC_LIBTOOL_SYS_DYNAMIC_LINKER + + +# _LT_AC_TAGCONFIG +# ---------------- +AC_DEFUN([_LT_AC_TAGCONFIG], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_ARG_WITH([tags], + [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], + [include additional configurations @<:@automatic@:>@])], + [tagnames="$withval"]) + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) + else + AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) + fi + fi + if test -z "$LTCFLAGS"; then + eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in + "") ;; + *) AC_MSG_ERROR([invalid tag name: $tagname]) + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + AC_MSG_ERROR([tag name \"$tagname\" already exists]) + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_LIBTOOL_LANG_CXX_CONFIG + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + AC_LIBTOOL_LANG_F77_CONFIG + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + AC_LIBTOOL_LANG_GCJ_CONFIG + else + tagname="" + fi + ;; + + RC) + AC_LIBTOOL_LANG_RC_CONFIG + ;; + + *) + AC_MSG_ERROR([Unsupported tag name: $tagname]) + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + AC_MSG_ERROR([unable to update list of available tagged configurations.]) + fi +fi +])# _LT_AC_TAGCONFIG + + +# AC_LIBTOOL_DLOPEN +# ----------------- +# enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], + [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_DLOPEN + + +# AC_LIBTOOL_WIN32_DLL +# -------------------- +# declare package support for building win32 DLLs +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_WIN32_DLL + + +# AC_ENABLE_SHARED([DEFAULT]) +# --------------------------- +# implement the --enable-shared flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([shared], + [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]AC_ENABLE_SHARED_DEFAULT) +])# AC_ENABLE_SHARED + + +# AC_DISABLE_SHARED +# ----------------- +# set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no) +])# AC_DISABLE_SHARED + + +# AC_ENABLE_STATIC([DEFAULT]) +# --------------------------- +# implement the --enable-static flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([static], + [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]AC_ENABLE_STATIC_DEFAULT) +])# AC_ENABLE_STATIC + + +# AC_DISABLE_STATIC +# ----------------- +# set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no) +])# AC_DISABLE_STATIC + + +# AC_ENABLE_FAST_INSTALL([DEFAULT]) +# --------------------------------- +# implement the --enable-fast-install flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([fast-install], + [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) +])# AC_ENABLE_FAST_INSTALL + + +# AC_DISABLE_FAST_INSTALL +# ----------------------- +# set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no) +])# AC_DISABLE_FAST_INSTALL + + +# AC_LIBTOOL_PICMODE([MODE]) +# -------------------------- +# implement the --with-pic flag +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default) +])# AC_LIBTOOL_PICMODE + + +# AC_PROG_EGREP +# ------------- +# This is predefined starting with Autoconf 2.54, so this conditional +# definition can be removed once we require Autoconf 2.54 or later. +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], +[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], + [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi]) + EGREP=$ac_cv_prog_egrep + AC_SUBST([EGREP]) +])]) + + +# AC_PATH_TOOL_PREFIX +# ------------------- +# find a file program which can recognize shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +])# AC_PATH_TOOL_PREFIX + + +# AC_PATH_MAGIC +# ------------- +# find a file program which can recognize a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# AC_PATH_MAGIC + + +# AC_PROG_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH([gnu-ld], + [AC_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no]) +AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[[3-9]]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown +])# AC_DEPLIBS_CHECK_METHOD + + +# AC_PROG_NM +# ---------- +# find the pathname to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +])# AC_PROG_NM + + +# AC_CHECK_LIBM +# ------------- +# check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +])# AC_CHECK_LIBM + + +# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, +# it is assumed to be `libltdl'. LIBLTDL will be prefixed with +# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/' +# (note the single quotes!). If your package is not flat and you're not +# using automake, define top_builddir and top_srcdir appropriately in +# the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_CONVENIENCE + + +# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl installable library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, +# and an installed libltdl is not found, it is assumed to be `libltdl'. +# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and top_srcdir +# appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, lt_dlinit, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_INSTALLABLE + + +# AC_LIBTOOL_CXX +# -------------- +# enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], +[AC_REQUIRE([_LT_AC_LANG_CXX]) +])# AC_LIBTOOL_CXX + + +# _LT_AC_LANG_CXX +# --------------- +AC_DEFUN([_LT_AC_LANG_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([_LT_AC_PROG_CXXCPP]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) +])# _LT_AC_LANG_CXX + +# _LT_AC_PROG_CXXCPP +# ------------------ +AC_DEFUN([_LT_AC_PROG_CXXCPP], +[ +AC_REQUIRE([AC_PROG_CXX]) +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_PROG_CXXCPP +fi +])# _LT_AC_PROG_CXXCPP + +# AC_LIBTOOL_F77 +# -------------- +# enable support for Fortran 77 libraries +AC_DEFUN([AC_LIBTOOL_F77], +[AC_REQUIRE([_LT_AC_LANG_F77]) +])# AC_LIBTOOL_F77 + + +# _LT_AC_LANG_F77 +# --------------- +AC_DEFUN([_LT_AC_LANG_F77], +[AC_REQUIRE([AC_PROG_F77]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) +])# _LT_AC_LANG_F77 + + +# AC_LIBTOOL_GCJ +# -------------- +# enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ], +[AC_REQUIRE([_LT_AC_LANG_GCJ]) +])# AC_LIBTOOL_GCJ + + +# _LT_AC_LANG_GCJ +# --------------- +AC_DEFUN([_LT_AC_LANG_GCJ], +[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], + [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], + [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], + [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) +])# _LT_AC_LANG_GCJ + + +# AC_LIBTOOL_RC +# ------------- +# enable support for Windows resource files +AC_DEFUN([AC_LIBTOOL_RC], +[AC_REQUIRE([LT_AC_PROG_RC]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) +])# AC_LIBTOOL_RC + + +# AC_LIBTOOL_LANG_C_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) +AC_DEFUN([_LT_AC_LANG_C_CONFIG], +[lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF + +# Report which library types will actually be built +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case $host_os in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_C_CONFIG + + +# AC_LIBTOOL_LANG_CXX_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) +AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], +[AC_LANG_PUSH(C++) +AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([_LT_AC_PROG_CXXCPP]) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Dependencies to place before and after the object being linked: +_LT_AC_TAGVAR(predep_objects, $1)= +_LT_AC_TAGVAR(postdep_objects, $1)= +_LT_AC_TAGVAR(predeps, $1)= +_LT_AC_TAGVAR(postdeps, $1)= +_LT_AC_TAGVAR(compiler_lib_search_path, $1)= +_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)= + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + $as_unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + $as_unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' +else + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + AC_PROG_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +_LT_AC_TAGVAR(ld_shlibs, $1)=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + darwin* | rhapsody*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" + if test "$GXX" = yes ; then + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "$lt_cv_apple_cc_single_mod" != "yes"; then + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" + fi + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + freebsd[[12]]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + freebsd-elf*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + ;; + gnu*) + ;; + hpux9*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) ;; + *) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + interix[[3-9]]*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + linux* | k*bsd*-gnu) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc*) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + m88k*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + openbsd2*) + # C++ shared libraries are fairly broken + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + osf3*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + # So that behaviour is only enabled if SCOABSPATH is set to a + # non-empty value in the environment. Most likely only useful for + # creating official distributions of packages. + # This is a hack until libtool officially supports absolute path + # names for shared libraries. + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; +esac +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_AC_TAGVAR(GCC, $1)="$GXX" +_LT_AC_TAGVAR(LD, $1)="$LD" + +AC_LIBTOOL_POSTDEP_PREDEP($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +])# AC_LIBTOOL_LANG_CXX_CONFIG + +# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) +# ------------------------------------ +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + # + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + if test "$solaris_use_stlport4" != yes; then + _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + +solaris*) + case $cc_basename in + CC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + if test "$solaris_use_stlport4" != yes; then + _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; +esac +]) +case " $_LT_AC_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; +esac +])# AC_LIBTOOL_POSTDEP_PREDEP + +# AC_LIBTOOL_LANG_F77_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)]) +AC_DEFUN([_LT_AC_LANG_F77_CONFIG], +[AC_REQUIRE([AC_PROG_F77]) +AC_LANG_PUSH(Fortran 77) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="\ + subroutine t + return + end +" + +# Code to be used in simple link tests +lt_simple_link_test_code="\ + program t + end +" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${F77-"f77"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) + +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case $host_os in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; +aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +_LT_AC_TAGVAR(GCC, $1)="$G77" +_LT_AC_TAGVAR(LD, $1)="$LD" + +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_F77_CONFIG + + +# AC_LIBTOOL_LANG_GCJ_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)]) +AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG], +[AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${GCJ-"gcj"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds + +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_RESTORE +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_GCJ_CONFIG + + +# AC_LIBTOOL_LANG_RC_CONFIG +# ------------------------- +# Ensure that the configuration vars for the Windows resource compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)]) +AC_DEFUN([_LT_AC_LANG_RC_CONFIG], +[AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${RC-"windres"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) +_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_RESTORE +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_RC_CONFIG + + +# AC_LIBTOOL_CONFIG([TAGNAME]) +# ---------------------------- +# If TAGNAME is not passed, then create an initial libtool script +# with a default configuration from the untagged config vars. Otherwise +# add code to config.status for appending the configuration named by +# TAGNAME from the matching tagged config vars. +AC_DEFUN([AC_LIBTOOL_CONFIG], +[# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + _LT_AC_TAGVAR(compiler, $1) \ + _LT_AC_TAGVAR(CC, $1) \ + _LT_AC_TAGVAR(LD, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \ + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \ + _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \ + _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \ + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \ + _LT_AC_TAGVAR(old_archive_cmds, $1) \ + _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \ + _LT_AC_TAGVAR(predep_objects, $1) \ + _LT_AC_TAGVAR(postdep_objects, $1) \ + _LT_AC_TAGVAR(predeps, $1) \ + _LT_AC_TAGVAR(postdeps, $1) \ + _LT_AC_TAGVAR(compiler_lib_search_path, $1) \ + _LT_AC_TAGVAR(compiler_lib_search_dirs, $1) \ + _LT_AC_TAGVAR(archive_cmds, $1) \ + _LT_AC_TAGVAR(archive_expsym_cmds, $1) \ + _LT_AC_TAGVAR(postinstall_cmds, $1) \ + _LT_AC_TAGVAR(postuninstall_cmds, $1) \ + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \ + _LT_AC_TAGVAR(allow_undefined_flag, $1) \ + _LT_AC_TAGVAR(no_undefined_flag, $1) \ + _LT_AC_TAGVAR(export_symbols_cmds, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \ + _LT_AC_TAGVAR(hardcode_automatic, $1) \ + _LT_AC_TAGVAR(module_cmds, $1) \ + _LT_AC_TAGVAR(module_expsym_cmds, $1) \ + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \ + _LT_AC_TAGVAR(fix_srcfile_path, $1) \ + _LT_AC_TAGVAR(exclude_expsyms, $1) \ + _LT_AC_TAGVAR(include_expsyms, $1); do + + case $var in + _LT_AC_TAGVAR(old_archive_cmds, $1) | \ + _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \ + _LT_AC_TAGVAR(archive_cmds, $1) | \ + _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \ + _LT_AC_TAGVAR(module_cmds, $1) | \ + _LT_AC_TAGVAR(module_expsym_cmds, $1) | \ + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \ + _LT_AC_TAGVAR(export_symbols_cmds, $1) | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\[$]0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'` + ;; + esac + +ifelse([$1], [], + [cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + AC_MSG_NOTICE([creating $ofile])], + [cfgfile="$ofile"]) + + cat <<__EOF__ >> "$cfgfile" +ifelse([$1], [], +[#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit , 1996 +# +# 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="$SED -e 1s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG], +[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) + +# Is the compiler the GNU C compiler? +with_gcc=$_LT_AC_TAGVAR(GCC, $1) + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_[]_LT_AC_TAGVAR(LD, $1) + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) + +# Commands used to build and install a shared archive. +archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) +archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) +module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) + +# The directories searched by this compiler when creating a shared +# library +compiler_lib_search_dirs=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_dirs, $1) + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to yes if exported symbols are required. +always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) + +# The commands to list exported symbols. +export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) + +# Symbols that must always be exported. +include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) + +ifelse([$1],[], +[# ### END LIBTOOL CONFIG], +[# ### END LIBTOOL TAG CONFIG: $tagname]) + +__EOF__ + +ifelse([$1],[], [ + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +]) +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi +])# AC_LIBTOOL_CONFIG + + +# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl + +_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI + + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([LT_AC_PROG_SED]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +linux* | k*bsd*-gnu) + if test "$host_cpu" = ia64; then + symcode='[[ABCDGIRSTW]]' + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[[]] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + + +# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) +# --------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], +[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) + ifelse([$1],[CXX],[ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix[[4-9]]*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + icpc* | ecpc*) + # Intel C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler. + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + hpux9* | hpux10* | hpux11*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + newsos6) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + linux* | k*bsd*-gnu) + case $cc_basename in + icc* | ecc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + esac + ;; + esac + ;; + + osf3* | osf4* | osf5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + rdos*) + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then + AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], + _LT_AC_TAGVAR(lt_cv_prog_compiler_pic_works, $1), + [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" + ;; +esac + +# +# Check to make sure the static flag actually works. +# +wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\" +AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_AC_TAGVAR(lt_cv_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) +]) + + +# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) +# ------------------------------------ +# See if the linker supports building shared libraries. +AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +ifelse([$1],[CXX],[ + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix[[4-9]]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + ;; + *) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] +],[ + runpath_var= + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)= + _LT_AC_TAGVAR(archive_expsym_cmds, $1)= + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown + _LT_AC_TAGVAR(hardcode_automatic, $1)=no + _LT_AC_TAGVAR(module_cmds, $1)= + _LT_AC_TAGVAR(module_expsym_cmds, $1)= + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_AC_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. +dnl Note also adjust exclude_expsyms for C++ above. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + _LT_CC_BASENAME([$compiler]) + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[[3-9]]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + interix[[3-9]]*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | k*bsd*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + *) + tmp_sharedflag='-shared' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + # see comment about different semantics on the GNU ld section + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + bsdi[[45]]*) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi + ;; + + dgux*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + os2*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_AC_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $rm conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac + fi + ;; +esac +])# AC_LIBTOOL_PROG_LD_SHLIBS + + +# _LT_AC_FILE_LTDLL_C +# ------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ +])# _LT_AC_FILE_LTDLL_C + + +# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) +# --------------------------------- +AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) + + +# old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +# This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL]) + +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + +AC_DEFUN([LT_AC_PROG_RC], +[AC_CHECK_TOOL(RC, windres, no) +]) + + +# Cheap backport of AS_EXECUTABLE_P and required macros +# from Autoconf 2.59; we should not use $as_executable_p directly. + +# _AS_TEST_PREPARE +# ---------------- +m4_ifndef([_AS_TEST_PREPARE], +[m4_defun([_AS_TEST_PREPARE], +[if test -x / >/dev/null 2>&1; then + as_executable_p='test -x' +else + as_executable_p='test -f' +fi +])])# _AS_TEST_PREPARE + +# AS_EXECUTABLE_P +# --------------- +# Check whether a file is executable. +m4_ifndef([AS_EXECUTABLE_P], +[m4_defun([AS_EXECUTABLE_P], +[AS_REQUIRE([_AS_TEST_PREPARE])dnl +$as_executable_p $1[]dnl +])])# AS_EXECUTABLE_P + +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +# LT_AC_PROG_SED +# -------------- +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +AC_DEFUN([LT_AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if AS_EXECUTABLE_P(["$as_dir/$lt_ac_prog$ac_exec_ext"]); then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_SUBST([SED]) +AC_MSG_RESULT([$SED]) +]) + +# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.9.6])]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 7 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH]) +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 3 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 12 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.58])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $1 | $1:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. +# +# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories +# created by `make install' are always world readable, even if the +# installer happens to have an overly restrictive umask (e.g. 077). +# This was a mistake. There are at least two reasons why we must not +# use `-m 0755': +# - it causes special bits like SGID to be ignored, +# - it may be too restrictive (some setups expect 775 directories). +# +# Do not use -m 0755 and let people choose whatever they expect by +# setting umask. +# +# We cannot accept any implementation of `mkdir' that recognizes `-p'. +# Some implementations (such as Solaris 8's) are not thread-safe: if a +# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' +# concurrently, both version can detect that a/ is missing, but only +# one can create it and the other will error out. Consequently we +# restrict ourselves to GNU make (using the --version option ensures +# this.) +AC_DEFUN([AM_PROG_MKDIR_P], +[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi +AC_SUBST([mkdir_p])]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/autogen.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/autogen.sh Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,145 @@ +#!/usr/bin/env sh +# +# SpanDSP - a series of DSP components for telephony +# +# autogen script +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 2.1, +# as published by the Free Software Foundation. +# +# 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 Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# $Id: autogen.sh,v 1.6 2008/03/30 18:33:24 steveu Exp $ +# + +UNAME=`uname` + +if [ "x$UNAME" = "xFreeBSD" ]; then + echo "" + echo "" + echo "******************************************" + echo "*** NOTICE ***" + echo "******************************************" + echo " " + echo "FreeBSD is buggy. Please use this " + echo "workaround if you want to bootstrap " + echo "on FreeBSD. " + echo " " + echo "cd /usr/local/share/aclocal19 " + echo "ln -s ../aclocal/libtool15.m4 . " + echo "ln -s ../aclocal/ltdl15.m4 . " + echo " " + echo "******************************************" + echo "" +fi + +debug () +{ + # Outputs debug statments if DEBUG var is set + if [ ! -z "$DEBUG" ]; then + echo "DEBUG: $1" + fi +} + +version_compare() +{ + # Checks a command is found and the version is high enough + PROGRAM=$1 + MAJOR=$2 + MINOR=$3 + MICRO=$4 + test -z "$MAJOR" && MAJOR=0 + test -z "$MINOR" && MINOR=0 + test -z "$MICRO" && MICRO=0 + + debug "Checking $PROGRAM >= $MAJOR.$MINOR.$MICRO" + + WHICH_PATH=`whereis which | cut -f2 -d' '` + COMMAND=`$WHICH_PATH $PROGRAM` + if [ -z $COMMAND ]; then + echo "$PROGRAM-$MAJOR.$MINOR.$MICRO is required and was not found." + return 1 + else + debug "Found $COMMAND" + fi + + INS_VER=`$COMMAND --version | head -1 | sed 's/[^0-9]*//' | cut -d' ' -f1` + INS_MAJOR=`echo $INS_VER | cut -d. -f1 | sed s/[a-zA-Z\-].*//g` + INS_MINOR=`echo $INS_VER | cut -d. -f2 | sed s/[a-zA-Z\-].*//g` + INS_MICRO=`echo $INS_VER | cut -d. -f3 | sed s/[a-zA-Z\-].*//g` + test -z "$INS_MAJOR" && INS_MAJOR=0 + test -z "$INS_MINOR" && INS_MINOR=0 + test -z "$INS_MICRO" && INS_MICRO=0 + debug "Installed version: $INS_VER" + + if [ "$INS_MAJOR" -gt "$MAJOR" ]; then + debug "MAJOR: $INS_MAJOR > $MAJOR" + return 0 + elif [ "$INS_MAJOR" -eq "$MAJOR" ]; then + debug "MAJOR: $INS_MAJOR = $MAJOR" + if [ "$INS_MINOR" -gt "$MINOR" ]; then + debug "MINOR: $INS_MINOR > $MINOR" + return 0 + elif [ "$INS_MINOR" -eq "$MINOR" ]; then + if [ "$INS_MICRO" -ge "$MICRO" ]; then + debug "MICRO: $INS_MICRO >= $MICRO" + return 0 + else + debug "MICRO: $INS_MICRO < $MICRO" + fi + else + debug "MINOR: $INS_MINOR < $MINOR" + fi + else + debug "MAJOR: $INS_MAJOR < $MAJOR" + fi + + echo "You have the wrong version of $PROGRAM. The minimum required version is $MAJOR.$MINOR.$MICRO" + echo " and the version installed is $INS_MAJOR.$INS_MINOR.$INS_MICRO ($COMMAND)." + return 1 +} + +# Check for required version and die if unhappy + +if [ "x$UNAME" = "xFreeBSD" ]; then +version_compare libtoolize 1 5 16 || exit 1 +version_compare automake19 1 9 5 || exit 1 +version_compare autoconf259 2 59 || exit 1 +ACLOCAL=aclocal19 +AUTOHEADER=autoheader259 +AUTOMAKE=automake19 +AUTOCONF=autoconf259 +else +version_compare libtoolize 1 5 16 || exit 1 +version_compare automake 1 9 5 || exit 1 +version_compare autoconf 2 59 || exit 1 +ACLOCAL=aclocal +AUTOHEADER=autoheader +AUTOMAKE=automake +AUTOCONF=autoconf +fi + +libtoolize --copy --force --ltdl +#NetBSD seems to need this file writable +chmod u+w libltdl/configure + +$ACLOCAL +$AUTOHEADER --force +$AUTOMAKE --copy --add-missing +$AUTOCONF --force + +#chmod ug+x debian/rules + +if [ "x$UNAME" = "xNetBSD" ]; then +echo "" +echo "Please remember to run gmake instead of make on NetBSD" +echo "" +fi diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/config-h.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/config-h.in Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,319 @@ +/* config-h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the acosf() function. */ +#undef HAVE_ACOSF + +/* Define to 1 if you have the asinf() function. */ +#undef HAVE_ASINF + +/* Define to 1 if you have the atan2f() function. */ +#undef HAVE_ATAN2F + +/* Define to 1 if you have the atanf() function. */ +#undef HAVE_ATANF + +/* Define to 1 if you have the ceilf() function. */ +#undef HAVE_CEILF + +/* Define to 1 if you have the cosf() function. */ +#undef HAVE_COSF + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +#undef HAVE_DOPRNT + +/* Define to 1 if you have the `drand48' function. */ +#undef HAVE_DRAND48 + +/* Define to 1 if you have the expf() function. */ +#undef HAVE_EXPF + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FFTW3_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FFTW_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FLOAT_H + +/* Define to 1 if you have the floorf() function. */ +#undef HAVE_FLOORF + +/* Define to 1 if you have the header file. */ +#undef HAVE_FL_FL_AUDIO_METER_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FL_FL_CARTESIAN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FL_FL_DRAW_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FL_FL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FL_FL_LIGHT_BUTTON_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FL_FL_OVERLAY_WINDOW_H + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `m' library (-lm). */ +#undef HAVE_LIBM + +/* Define to 1 if you have the `tiff' library (-ltiff). */ +#undef HAVE_LIBTIFF + +/* Define to 1 if you have the 'libxml2' library (-lxml2). */ +#undef HAVE_LIBXML2 + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBXML_PARSER_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBXML_XINCLUDE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBXML_XMLMEMORY_H + +/* Define if you have C99's llrint function. */ +#undef HAVE_LLRINT + +/* Define if you have C99's llrintf function. */ +#undef HAVE_LLRINTF + +/* Define to 1 if you have the log10f() function. */ +#undef HAVE_LOG10F + +/* Define to 1 if you have the logf() function. */ +#undef HAVE_LOGF + +/* Define to 1 if the system has the type `long double'. */ +#undef HAVE_LONG_DOUBLE + +/* Define to 1 if the system has the type `long long'. */ +#undef HAVE_LONG_LONG + +/* Define if you have C99's lrint function. */ +#undef HAVE_LRINT + +/* Define if you have C99's lrintf function. */ +#undef HAVE_LRINTF + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#undef HAVE_MALLOC + +/* Define to 1 if you have the header file. */ +#undef HAVE_MALLOC_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MATH_H + +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `memset' function. */ +#undef HAVE_MEMSET + +/* Define to 1 if you have the powf() function. */ +#undef HAVE_POWF + +/* Define to 1 if you have the header file. */ +#undef HAVE_PTHREAD_H + +/* Define to 1 if your system has a GNU libc compatible `realloc' function, + and to 0 otherwise. */ +#undef HAVE_REALLOC + +/* Define to 1 if you have the `select' function. */ +#undef HAVE_SELECT + +/* Define to 1 if you have the sinf() function. */ +#undef HAVE_SINF + +/* Define to 1 if you have the header file. */ +#undef HAVE_SNDFILE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strstr' function. */ +#undef HAVE_STRSTR + +/* Define to 1 if you have the `strtol' function. */ +#undef HAVE_STRTOL + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_FCNTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + +/* Define to 1 if you have the tanf() function. */ +#undef HAVE_TANF + +/* Define to 1 if you have the header file. */ +#undef HAVE_TGMATH_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TIFFIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vprintf' function. */ +#undef HAVE_VPRINTF + +/* Define to 1 if you have the header file. */ +#undef HAVE_X11_X_H + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* Define to the type of arg 1 for `select'. */ +#undef SELECT_TYPE_ARG1 + +/* Define to the type of args 2, 3 and 4 for `select'. */ +#undef SELECT_TYPE_ARG234 + +/* Define to the type of arg 5 for `select'. */ +#undef SELECT_TYPE_ARG5 + +/* Do not expect a misaligned memory access to work correctly */ +#undef SPANDSP_MISALIGNED_ACCESS_FAILS + +/* Use the library symbol export capability of the compiler */ +#undef SPANDSP_USE_EXPORT_CAPABILITY + +/* Enable fixed point processing, where possible, instead of floating point */ +#undef SPANDSP_USE_FIXED_POINT + +/* Use the MMX instruction set (i386 and x86_64 only). */ +#undef SPANDSP_USE_MMX + +/* Use the SSE instruction set (i386 and x86_64 only). */ +#undef SPANDSP_USE_SSE + +/* Use the SSE2 instruction set (i386 and x86_64 only). */ +#undef SPANDSP_USE_SSE2 + +/* Use the SSE3 instruction set (i386 and x86_64 only). */ +#undef SPANDSP_USE_SSE3 + +/* Use the SSE4A instruction set (i386 and x86_64 only). */ +#undef SPANDSP_USE_SSE4A + +/* Use the SSE4.1 instruction set (i386 and x86_64 only). */ +#undef SPANDSP_USE_SSE4_1 + +/* Use the SSE4.2 instruction set (i386 and x86_64 only). */ +#undef SPANDSP_USE_SSE4_2 + +/* Use the SSE5 instruction set (i386 and x86_64 only). */ +#undef SPANDSP_USE_SSE5 + +/* Use the SSSE3 instruction set (i386 and x86_64 only). */ +#undef SPANDSP_USE_SSSE3 + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* Version number of package */ +#undef VERSION + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to rpl_malloc if the replacement function should be used. */ +#undef malloc + +/* Define to rpl_realloc if the replacement function should be used. */ +#undef realloc + +/* Define to empty if the keyword `volatile' does not work. Warning: valid + code using `volatile' can become incorrect without. Disable with care. */ +#undef volatile diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/config/ax_c99_features.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/config/ax_c99_features.m4 Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,181 @@ +# @synopsis AX_C99_FLEXIBLE_ARRAY +# +# Does the compiler support the 1999 ISO C Standard "struct hack". +# @version 1.1 Mar 15 2004 +# @author Erik de Castro Lopo +# +# Permission to use, copy, modify, distribute, and sell this file for any +# purpose is hereby granted without fee, provided that the above copyright +# and this permission notice appear in all copies. No representations are +# made about the suitability of this software for any purpose. It is +# provided "as is" without express or implied warranty. + +AC_DEFUN([AX_C99_FLEXIBLE_ARRAY], +[AC_CACHE_CHECK(if have C99 struct flexible array support, + ac_cv_c99_flexible_array, + +# Initialize to unknown +ac_cv_c99_flexible_array=no + +AC_TRY_LINK([[ + #include + + typedef struct { + int k; + char buffer [] ; + } MY_STRUCT ; + ]], + [ MY_STRUCT *p = calloc (1, sizeof (MY_STRUCT) + 42); ], + ac_cv_c99_flexible_array=yes, + ac_cv_c99_flexible_array=no + ))] +) # AX_C99_FLEXIBLE_ARRAY + +# @synopsis AX_C99_FUNC_LRINT +# +# Check whether C99's lrint function is available. +# @version 1.3 Feb 12 2002 +# @author Erik de Castro Lopo +# +# Permission to use, copy, modify, distribute, and sell this file for any +# purpose is hereby granted without fee, provided that the above copyright +# and this permission notice appear in all copies. No representations are +# made about the suitability of this software for any purpose. It is +# provided "as is" without express or implied warranty. +# +AC_DEFUN([AX_C99_FUNC_LRINT], +[AC_CACHE_CHECK(for lrint, + ac_cv_c99_lrint, +[ +lrint_save_CFLAGS=$CFLAGS +CFLAGS="-lm" +AC_TRY_LINK([ +#define _ISOC9X_SOURCE 1 +#define _ISOC99_SOURCE 1 +#define __USE_ISOC99 1 +#define __USE_ISOC9X 1 + +#include +], if (!lrint(3.14159)) lrint(2.7183);, ac_cv_c99_lrint=yes, ac_cv_c99_lrint=no) + +CFLAGS=$lrint_save_CFLAGS + +]) + +if test "$ac_cv_c99_lrint" = yes; then + AC_DEFINE(HAVE_LRINT, 1, + [Define if you have C99's lrint function.]) +fi +])# AX_C99_FUNC_LRINT + +# @synopsis AX_C99_FUNC_LRINTF +# +# Check whether C99's lrintf function is available. +# @version 1.3 Feb 12 2002 +# @author Erik de Castro Lopo +# +# Permission to use, copy, modify, distribute, and sell this file for any +# purpose is hereby granted without fee, provided that the above copyright +# and this permission notice appear in all copies. No representations are +# made about the suitability of this software for any purpose. It is +# provided "as is" without express or implied warranty. +# +AC_DEFUN([AX_C99_FUNC_LRINTF], +[AC_CACHE_CHECK(for lrintf, + ac_cv_c99_lrintf, +[ +lrintf_save_CFLAGS=$CFLAGS +CFLAGS="-lm" +AC_TRY_LINK([ +#define _ISOC9X_SOURCE 1 +#define _ISOC99_SOURCE 1 +#define __USE_ISOC99 1 +#define __USE_ISOC9X 1 + +#include +], if (!lrintf(3.14159)) lrintf(2.7183);, ac_cv_c99_lrintf=yes, ac_cv_c99_lrintf=no) + +CFLAGS=$lrintf_save_CFLAGS + +]) + +if test "$ac_cv_c99_lrintf" = yes; then + AC_DEFINE(HAVE_LRINTF, 1, + [Define if you have C99's lrintf function.]) +fi +])# AX_C99_FUNC_LRINTF + +# @synopsis AX_C99_FUNC_LLRINT +# +# Check whether C99's llrint function is available. +# @version 1.1 Sep 30 2002 +# @author Erik de Castro Lopo +# +# Permission to use, copy, modify, distribute, and sell this file for any +# purpose is hereby granted without fee, provided that the above copyright +# and this permission notice appear in all copies. No representations are +# made about the suitability of this software for any purpose. It is +# provided "as is" without express or implied warranty. +# +AC_DEFUN([AX_C99_FUNC_LLRINT], +[AC_CACHE_CHECK(for llrint, + ac_cv_c99_llrint, +[ +llrint_save_CFLAGS=$CFLAGS +CFLAGS="-lm" +AC_TRY_LINK([ +#define ISOC9X_SOURCE 1 +#define _ISOC99_SOURCE 1 +#define __USE_ISOC99 1 +#define __USE_ISOC9X 1 + +#include +], long long int x ; x = llrint(3.14159) ;, ac_cv_c99_llrint=yes, ac_cv_c99_llrint=no) + +CFLAGS=$llrint_save_CFLAGS + +]) + +if test "$ac_cv_c99_llrint" = yes; then + AC_DEFINE(HAVE_LLRINT, 1, + [Define if you have C99's llrint function.]) +fi +])# AX_C99_FUNC_LLRINT + + +# @synopsis AX_C99_FUNC_LLRINTF +# +# Check whether C99's llrintf function is available. +# @version 1.1 Sep 30 2002 +# @author Erik de Castro Lopo +# +# Permission to use, copy, modify, distribute, and sell this file for any +# purpose is hereby granted without fee, provided that the above copyright +# and this permission notice appear in all copies. No representations are +# made about the suitability of this software for any purpose. It is +# provided "as is" without express or implied warranty. +# +AC_DEFUN([AX_C99_FUNC_LLRINTF], +[AC_CACHE_CHECK(for llrintf, + ac_cv_c99_llrintf, +[ +llrintf_save_CFLAGS=$CFLAGS +CFLAGS="-lm" +AC_TRY_LINK([ +#define _ISOC9X_SOURCE 1 +#define _ISOC99_SOURCE 1 +#define __USE_ISOC99 1 +#define __USE_ISOC9X 1 + +#include +], long long int x ; x = llrintf(3.14159) ;, ac_cv_c99_llrintf=yes, ac_cv_c99_llrintf=no) + +CFLAGS=$llrintf_save_CFLAGS + +]) + +if test "$ac_cv_c99_llrintf" = yes; then + AC_DEFINE(HAVE_LLRINTF, 1, + [Define if you have C99's llrintf function.]) +fi +])# AX_C99_FUNC_LLRINTF diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/config/ax_check_export_capability.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/config/ax_check_export_capability.m4 Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,61 @@ +# @synopsis AX_CHECK_EXPORT_CAPABILITY +# +# Does the compiler support the exporting of library symbols? +# @version 1.0 Jan 31 2009 +# @author Steve Underwood +# +# Permission to use, copy, modify, distribute, and sell this file for any +# purpose is hereby granted without fee, provided that the above copyright +# and this permission notice appear in all copies. No representations are +# made about the suitability of this software for any purpose. It is +# provided "as is" without express or implied warranty. + +AC_DEFUN([AX_CHECK_EXPORT_CAPABILITY], +[AC_CACHE_CHECK([if $1 supports library symbol export], + ac_cv_symbol_export_capability, + +[# Initialize to unknown +ac_cv_symbol_export_capability="no" + +case "${ax_cv_c_compiler_vendor}" in +gnu) + save_CFLAGS="${CFLAGS}" + CFLAGS="${CFLAGS} -fvisibility=hidden" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [int foo __attribute__ ((visibility("default")));], + [;] + )], + + [AC_MSG_RESULT([yes]) + COMP_VENDOR_CFLAGS="-fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 $COMP_VENDOR_CFLAGS" + COMP_VENDOR_CXXFLAGS="-fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 $COMP_VENDOR_CXXFLAGS" + ac_cv_symbol_export_capability="yes"], + + [AC_MSG_RESULT([no])] + ) + CFLAGS="${save_CFLAGS}" + ;; + +sun) + save_CFLAGS="${CFLAGS}" + CFLAGS="${CFLAGS} -xldscope=hidden" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [int foo __attribute__ ((visibility("default")));], + [;] + )], + + [AC_MSG_RESULT([yes]) + COMP_VENDOR_CFLAGS="-xldscope=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 $COMP_VENDOR_CFLAGS" + COMP_VENDOR_CXXFLAGS="-xldscope=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 $COMP_VENDOR_CXXFLAGS" + ac_cv_symbol_export_capability="yes"], + + [AC_MSG_RESULT([no])] + ) + CFLAGS="${save_CFLAGS}" + ;; + +esac]) +AS_IF([test AS_VAR_GET(ac_cv_symbol_export_capability) = yes], [$2], [$3])[]dnl +]) # AX_CHECK_EXPORT_CAPABILITY diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/config/ax_check_real_file.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/config/ax_check_real_file.m4 Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,27 @@ +# AX_CHECK_REAL_FILE(FILE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------------------------------ +# +# Check for the existence of FILE, and make sure it is a real file or +# directory, and not a symbolic link. +# +AC_DEFUN([AX_CHECK_REAL_FILE], +[AC_DIAGNOSE([cross], + [cannot check for file existence when cross compiling])dnl +AS_VAR_PUSHDEF([ac_RealFile], [ac_cv_real_file_$1])dnl +AC_CACHE_CHECK([for $1], ac_RealFile, +[test "$cross_compiling" = yes && + AC_MSG_ERROR([cannot check for file existence when cross compiling]) +if test -r "$1" +then + if test -h "$1" + then + AS_VAR_SET(ac_RealFile, no) + else + AS_VAR_SET(ac_RealFile, yes) + fi +else + AS_VAR_SET(ac_RealFile, no) +fi]) +AS_IF([test AS_VAR_GET(ac_RealFile) = yes], [$2], [$3])[]dnl +AS_VAR_POPDEF([ac_RealFile])dnl +])# AX_CHECK_REAL_FILE diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/config/ax_compiler_vendor.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/config/ax_compiler_vendor.m4 Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,64 @@ +# =========================================================================== +# http://autoconf-archive.cryp.to/ax_compiler_vendor.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_COMPILER_VENDOR +# +# DESCRIPTION +# +# Determine the vendor of the C/C++ compiler, e.g., gnu, intel, ibm, sun, +# hp, borland, comeau, dec, cray, kai, lcc, metrowerks, sgi, microsoft, +# watcom, etc. The vendor is returned in the cache variable +# $ax_cv_c_compiler_vendor for C and $ax_cv_cxx_compiler_vendor for C++. +# +# LAST MODIFICATION +# +# 2008-04-12 +# +# COPYLEFT +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2008 Matteo Frigo +# +# 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 . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Macro Archive. When you make and +# distribute a modified version of the Autoconf Macro, you may extend this +# special exception to the GPL to apply to your modified version as well. + +AC_DEFUN([AX_COMPILER_VENDOR], +[AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, + [ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown + # note: don't check for gcc first since some other compilers define __GNUC__ + for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ pathscale:__PATHCC__,__PATHSCALE__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do + vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ +#if !($vencpp) + thisisanerror; +#endif +])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break]) + done + ]) +]) diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/config/ax_fixed_point_machine.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/config/ax_fixed_point_machine.m4 Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,35 @@ +# AX_FIXED_POINT_MACHINE(MACHINE, [ACTION-IF-FIXED-POINT], [ACTION-IF-NOT-FIXED-POINT]) +# ------------------------------------------------------------------------------------- +# +# Check if a specified machine type is a fixed point only machine. That is, if it lacks +# fast floating point support. +# +# This is a simple lookup amongst machines known to the current autotools. So far we deal +# with the embedded ARM, Blackfin, MIPS, TI DSP and XScale processors as things which lack +# fast hardware floating point. +# +# Other candidates would be the small embedded Power PCs. +# +AC_DEFUN([AX_FIXED_POINT_MACHINE], +[AS_VAR_PUSHDEF([ac_FixedPoint], [ac_cv_fixed_point_machine_$1])dnl +AC_CACHE_CHECK([if $1 is fixed point only], ac_FixedPoint, +[case $1 in + arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] \ + | bfin \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | tic54x | c54x* | tic55x | c55x* | tic6x | c6x* \ + | xscale | xscalee[bl] \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | bfin-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | xscale-* | xscalee[bl]-* ) + AS_VAR_SET(ac_FixedPoint, yes) + ;; + *) + AS_VAR_SET(ac_FixedPoint, no) + ;; +esac]) +AS_IF([test AS_VAR_GET(ac_FixedPoint) = yes], [$2], [$3])[]dnl +AS_VAR_POPDEF([ac_FixedPoint])dnl +])# AX_FIXED_POINT_MACHINE diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/config/ax_misaligned_access_fails.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/config/ax_misaligned_access_fails.m4 Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,33 @@ +# AX_MISALIGNED_ACCESS_FAILS(MACHINE, [ACTION-IF-MISALIGNED-FAILS], [ACTION-IF-MISALIGNED-OK]) +# ------------------------------------------------------------------------------------- +# +# Check if a specified machine type cannot handle misaligned data. That is, multi-byte data +# types which are not properly aligned in memory fail. Many machines are happy to work with +# misaligned data, but slowing down a bit. Other machines just won't tolerate such data. +# +# This is a simple lookup amongst machines known to the current autotools. So far we only deal +# with the ARM and sparc. +# A lookup is used, as many of the devices which cannot handled misaligned access are embedded +# processors, for which the code normally be cross-compiled. +# +AC_DEFUN([AX_MISALIGNED_ACCESS_FAILS], +[AS_VAR_PUSHDEF([ac_MisalignedAccessFails], [ac_cv_misaligned_access_fails_$1])dnl +AC_CACHE_CHECK([if $1 fails on misaligned memory access], ac_MisalignedAccessFails, +[case $1 in + arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] \ + | bfin \ + | sparc \ + | xscale | xscalee[bl] \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | bfin-* \ + | sparc-* \ + | xscale-* | xscalee[bl]-* ) + AS_VAR_SET(ac_MisalignedAccessFails, yes) + ;; + *) + AS_VAR_SET(ac_MisalignedAccessFails, no) + ;; +esac]) +AS_IF([test AS_VAR_GET(ac_MisalignedAccessFails) = yes], [$2], [$3])[]dnl +AS_VAR_POPDEF([ac_MisalignedAccessFails])dnl +])# MISALIGNED_ACCESS_FAILS diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/config/config.guess --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/config/config.guess Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1526 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. + +timestamp='2008-01-23' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[456]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:[3456]*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T | authenticamd) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/config/config.sub --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/config/config.sub Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1658 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. + +timestamp='2008-01-16' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | score \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tile*) + basic_machine=tile-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/config/depcomp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/config/depcomp Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,530 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2005-07-09.11 + +# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. + +# 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, 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. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + stat=$? + + if test -f "$tmpdepfile"; then : + else + stripped=`echo "$stripped" | sed 's,^.*/,,'` + tmpdepfile="$stripped.u" + fi + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + outname="$stripped.o" + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mecanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/config/install-sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/config/install-sh Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,323 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2005-05-14.22 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# 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 +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +chmodcmd="$chmodprog 0755" +chowncmd= +chgrpcmd= +stripcmd= +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src= +dst= +dir_arg= +dstarg= +no_target_directory= + +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: +-c (ignored) +-d create directories instead of installing files. +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. +--help display this help and exit. +--version display version info and exit. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" + +while test -n "$1"; do + case $1 in + -c) shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + --help) echo "$usage"; exit $?;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t) dstarg=$2 + shift + shift + continue;; + + -T) no_target_directory=true + shift + continue;; + + --version) echo "$0 $scriptversion"; exit $?;; + + *) # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + test -n "$dir_arg$dstarg" && break + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done + break;; + esac +done + +if test -z "$1"; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + src= + + if test -d "$dst"; then + mkdircmd=: + chmodcmd= + else + mkdircmd=$mkdirprog + fi + else + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi + dst=$dst/`basename "$src"` + fi + fi + + # This sed command emulates the dirname command. + dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` + + # Make sure that the destination directory exists. + + # Skip lots of stat calls in the usual case. + if test ! -d "$dstdir"; then + defaultIFS=' + ' + IFS="${IFS-$defaultIFS}" + + oIFS=$IFS + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + shift + IFS=$oIFS + + pathcomp= + + while test $# -ne 0 ; do + pathcomp=$pathcomp$1 + shift + if test ! -d "$pathcomp"; then + $mkdirprog "$pathcomp" + # mkdir can fail with a `File exist' error in case several + # install-sh are creating the directory concurrently. This + # is OK. + test -d "$pathcomp" || exit + fi + pathcomp=$pathcomp/ + done + fi + + if test -n "$dir_arg"; then + $doit $mkdircmd "$dst" \ + && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } + + else + dstfile=`basename "$dst"` + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + trap '(exit $?); exit' 1 2 13 15 + + # Copy the file name to the temp name. + $doit $cpprog "$src" "$dsttmp" && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit 1 + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + } + } + fi || { (exit 1); exit 1; } +done + +# The final little trick to "correctly" pass the exit status to the exit trap. +{ + (exit 0); exit 0 +} + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/config/ltmain.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/config/ltmain.sh Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,6956 @@ +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun configure. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, +# 2007, 2008 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +basename="s,^.*/,,g" + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + +# The name of this program: +progname=`echo "$progpath" | $SED $basename` +modename="$progname" + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION=1.5.26 +TIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)" + +# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$progpath" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +duplicate_deps=no +preserve_args= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" +extracted_archives= +extracted_serial=0 + +##################################### +# Shell function definitions: +# This seems to be the best place for them + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $mkdir "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || { + $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 + exit $EXIT_FAILURE + } + fi + + $echo "X$my_tmpdir" | $Xsed +} + + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +func_win32_libid () +{ + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ + $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | \ + $SED -n -e '1,100{ + / I /{ + s,.*,import, + p + q + } + }'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $echo $win32_libid_type +} + + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case "$@ " in + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit $EXIT_FAILURE +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + + $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" + $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 + exit $EXIT_FAILURE + fi +} + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + my_status="" + + $show "${rm}r $my_gentop" + $run ${rm}r "$my_gentop" + $show "$mkdir $my_gentop" + $run $mkdir "$my_gentop" + my_status=$? + if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then + exit $my_status + fi + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + extracted_serial=`expr $extracted_serial + 1` + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir="$my_gentop/$my_xlib_u" + + $show "${rm}r $my_xdir" + $run ${rm}r "$my_xdir" + $show "$mkdir $my_xdir" + $run $mkdir "$my_xdir" + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then + exit $exit_status + fi + case $host in + *-darwin*) + $show "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + if test -z "$run"; then + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` + darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` + if test -n "$darwin_arches"; then + darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + $show "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we have a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + lipo -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + ${rm}r unfat-$$ + cd "$darwin_orig_dir" + else + cd "$darwin_orig_dir" + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + fi # $run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + func_extract_archives_result="$my_oldobjs" +} +# End of Shell function definitions +##################################### + +# Darwin sucks +eval std_shrext=\"$shrext_cmds\" + +disable_libs=no + +# Parse our command line options once, thoroughly. +while test "$#" -gt 0 +do + arg="$1" + shift + + case $arg in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + execute_dlfiles) + execute_dlfiles="$execute_dlfiles $arg" + ;; + tag) + tagname="$arg" + preserve_args="${preserve_args}=$arg" + + # Check whether tagname contains only valid characters + case $tagname in + *[!-_A-Za-z0-9,/]*) + $echo "$progname: invalid tag name: $tagname" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $tagname in + CC) + # Don't test for the "default" C tag, as we know, it's there, but + # not specially marked. + ;; + *) + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then + taglist="$taglist $tagname" + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" + else + $echo "$progname: ignoring unknown tag $tagname" 1>&2 + fi + ;; + esac + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case $arg in + --help) + show_help=yes + ;; + + --version) + echo "\ +$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP + +Copyright (C) 2008 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + exit $? + ;; + + --config) + ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath + # Now print the configurations for the tags. + for tagname in $taglist; do + ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" + done + exit $? + ;; + + --debug) + $echo "$progname: enabling shell trace mode" + set -x + preserve_args="$preserve_args $arg" + ;; + + --dry-run | -n) + run=: + ;; + + --features) + $echo "host: $host" + if test "$build_libtool_libs" = yes; then + $echo "enable shared libraries" + else + $echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + $echo "enable static libraries" + else + $echo "disable static libraries" + fi + exit $? + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --preserve-dup-deps) duplicate_deps="yes" ;; + + --quiet | --silent) + show=: + preserve_args="$preserve_args $arg" + ;; + + --tag) + prevopt="--tag" + prev=tag + preserve_args="$preserve_args --tag" + ;; + --tag=*) + set tag "$optarg" ${1+"$@"} + shift + prev=tag + preserve_args="$preserve_args --tag" + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE +fi + +case $disable_libs in +no) + ;; +shared) + build_libtool_libs=no + build_old_libs=yes + ;; +static) + build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` + ;; +esac + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 + $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 + case $nonopt in + *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) + mode=link + for arg + do + case $arg in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case $mode in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; + + target ) + libobj="$arg" + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + if test -n "$libobj" ; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit $EXIT_FAILURE + fi + arg_mode=target + continue + ;; + + -static | -prefer-pic | -prefer-non-pic) + later="$later $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + base_compile="$base_compile $lastarg" + continue + ;; + + * ) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + case $lastarg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, and some SunOS ksh mistreat backslash-escaping + # in scan sets (worked around with variable expansion), + # and furthermore cannot handle '|' '&' '(' ')' in scan sets + # at all, so we specify them separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + base_compile="$base_compile $lastarg" + done # for arg + + case $arg_mode in + arg) + $echo "$modename: you must specify an argument for -Xcompile" + exit $EXIT_FAILURE + ;; + target) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit $EXIT_FAILURE + ;; + *) + # Get the name of the library object. + [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSifmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.ii) xform=ii ;; + *.class) xform=class ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.[fF][09]?) xform=[fF][09]. ;; + *.for) xform=for ;; + *.java) xform=java ;; + *.obj) xform=obj ;; + *.sx) xform=sx ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -static) + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` + case $qlibobj in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qlibobj="\"$qlibobj\"" ;; + esac + test "X$libobj" != "X$qlibobj" \ + && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." + objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir= + else + xdir=$xdir/ + fi + lobj=${xdir}$objdir/$objname + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $run ln "$progpath" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + $echo "$srcfile" > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` + case $qsrcfile in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qsrcfile="\"$qsrcfile\"" ;; + esac + + $run $rm "$libobj" "${libobj}T" + + # Create a libtool object file (analogous to a ".la" file), + # but don't create it if we're doing a dry run. + test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + $show "$mv $output_obj $lobj" + if $run $mv $output_obj $lobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the PIC object to the libtool object file. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the non-PIC object the libtool object file. + # Only append if the libtool object file exists. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + shift + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test + ;; + *) qarg=$arg ;; + esac + libtool_args="$libtool_args $qarg" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit $EXIT_FAILURE + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat $save_arg` + do +# moreargs="$moreargs $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + done + else + $echo "$modename: link input file \`$save_arg' does not exist" + exit $EXIT_FAILURE + fi + arg=$save_arg + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit $EXIT_FAILURE + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + compile_command="$compile_command $wl$qarg" + finalize_command="$finalize_command $wl$qarg" + continue + ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + darwin_framework|darwin_framework_skip) + test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + prev= + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: more than one -exported-symbols argument is not allowed" + exit $EXIT_FAILURE + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework|-arch|-isysroot) + case " $CC " in + *" ${arg} ${1} "* | *" ${arg} ${1} "*) + prev=darwin_framework_skip ;; + *) compiler_flags="$compiler_flags $arg" + prev=darwin_framework ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + ;; + esac + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + notinst_path="$notinst_path $dir" + fi + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs -framework System" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + -model) + compile_command="$compile_command $arg" + compiler_flags="$compiler_flags $arg" + finalize_command="$finalize_command $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + + -multi_module) + single_module="${wl}-multi_module" + continue + ;; + + -module) + module=yes + continue + ;; + + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler + # -r[0-9][0-9]* specifies the processor on the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler + # +DA*, +DD* enable 64-bit mode on the HP compiler + # -q* pass through compiler args for the IBM compiler + # -m* pass through architecture-specific compiler args for GCC + # -m*, -t[45]*, -txscale* pass through architecture-specific + # compiler args for GCC + # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC + # -F/path gives path to uninstalled frameworks, gcc on darwin + # @file GCC response files + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) + + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + compiler_flags="$compiler_flags $arg" + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 + $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit $EXIT_FAILURE + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Wl,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $wl$flag" + linker_flags="$linker_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + + *.$objext) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done # argument parsing loop + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + # Create the object directory. + if test ! -d "$output_objdir"; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then + exit $exit_status + fi + fi + + # Determine the type of output + case $output in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + case $host in + *cygwin* | *mingw* | *pw32*) + # don't eliminate duplications in $postdeps and $predeps + duplicate_compiler_generated_deps=yes + ;; + *) + duplicate_compiler_generated_deps=$duplicate_deps + ;; + esac + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if test "X$duplicate_deps" = "Xyes" ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + libs="$libs $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + case $linkmode in + lib) + passes="conv link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 + exit $EXIT_FAILURE + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + for pass in $passes; do + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + compiler_flags="$compiler_flags $deplib" + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + if test "$linkmode" = lib; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if (${SED} -e '2q' $lib | + grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + library_names= + old_library= + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + *) + $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + if eval $echo \"$deplib\" 2>/dev/null \ + | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + $echo + $echo "*** Warning: Trying to link with static lib archive $deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because the file extensions .$libext of this argument makes me believe" + $echo "*** that it is just a static archive that I should not used here." + else + $echo + $echo "*** Warning: Linking the shared library $output against the" + $echo "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + if test "$found" = yes || test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 + exit $EXIT_FAILURE + fi + + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + elif test "$linkmode" != prog && test "$linkmode" != lib; then + $echo "$modename: \`$lib' is not a convenience library" 1>&2 + exit $EXIT_FAILURE + fi + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + abs_ladir="$ladir" + fi + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + $echo "$modename: warning: library \`$lib' was moved." 1>&2 + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi + fi # $installed = yes + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { { test "$prefer_static_libs" = no || + test "$prefer_static_libs,$installed" = "built,yes"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $absdir" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes ; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + # This is a shared library + + # Warn about portability, can't link against -module's on + # some systems (darwin) + if test "$shouldnotlink" = yes && test "$pass" = link ; then + $echo + if test "$linkmode" = prog; then + $echo "*** Warning: Linking the executable $output against the loadable module" + else + $echo "*** Warning: Linking the shared library $output against the loadable module" + fi + $echo "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + libname=`eval \\$echo \"$libname_spec\"` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw*) + major=`expr $current - $age` + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + soname=`$echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + save_ifs="$IFS"; IFS='~' + cmds=$extract_expsyms_cmds + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + save_ifs="$IFS"; IFS='~' + cmds=$old_archive_from_expsyms_cmds + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a module then we can not link against + # it, someone is ignoring the new warnings I added + if /usr/bin/file -L $add 2> /dev/null | + $EGREP ": [^:]* bundle" >/dev/null ; then + $echo "** Warning, lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $echo + $echo "** And there doesn't seem to be a static archive available" + $echo "** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit $EXIT_FAILURE + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + $echo + $echo "*** Warning: This system can not link to static lib archive $lib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + $echo "*** But as you try to build a module library, libtool will still create " + $echo "*** a static module, that should work as long as the dlopening application" + $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$deplib" && dir="." + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + fi + ;; + esac + if grep "^installed=no" $deplib > /dev/null; then + path="$absdir/$objdir" + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + if test "$absdir" != "$libdir"; then + $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 + fi + path="$absdir" + fi + depdepl= + case $host in + *-*-darwin*) + # we do not want to link against static libs, + # but need to link against shared + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$deplibdir/$depdepl" ; then + depdepl="$deplibdir/$depdepl" + elif test -f "$path/$depdepl" ; then + depdepl="$path/$depdepl" + else + # Can't find it, oh well... + depdepl= + fi + # do not add paths which are already there + case " $newlib_search_path " in + *" $path "*) ;; + *) newlib_search_path="$newlib_search_path $path";; + esac + fi + path="" + ;; + *) + path="-L$path" + ;; + esac + ;; + -l*) + case $host in + *-*-darwin*) + # Again, we only want to link against shared libraries + eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` + for tmp in $newlib_search_path ; do + if test -f "$tmp/lib$tmp_libs.dylib" ; then + eval depdepl="$tmp/lib$tmp_libs.dylib" + break + fi + done + path="" + ;; + *) continue ;; + esac + ;; + *) continue ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + case " $deplibs " in + *" $depdepl "*) ;; + *) deplibs="$depdepl $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + case " $deplibs" in + *\ -l* | *\ -L*) + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;; + esac + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 + exit $EXIT_FAILURE + else + $echo + $echo "*** Warning: Linking the shared library $output against the non-libtool" + $echo "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + if test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test "$#" -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$2" + number_minor="$3" + number_revision="$4" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows|none) + current=`expr $number_major + $number_minor` + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + current=`expr $number_major + $number_minor` + age="$number_minor" + revision="$number_minor" + lt_irix_increment=no + ;; + esac + ;; + no) + current="$2" + revision="$3" + age="$4" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + if test "$age" -gt "$current"; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + minor_current=`expr $current + 1` + xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + irix | nonstopux) + if test "X$lt_irix_increment" = "Xno"; then + major=`expr $current - $age` + else + major=`expr $current - $age + 1` + fi + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=.`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + major=`expr $current - $age` + versuffix="-$major" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + fi + + if test "$mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$echo "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + removelist="$removelist $p" + ;; + *) ;; + esac + done + if test -n "$removelist"; then + $show "${rm}r $removelist" + $run ${rm}r $removelist + fi + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` + # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` + # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs -framework System" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for file magic test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a file magic. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name=`expr $a_deplib : '-l\(.*\)'` + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval $echo \"$potent_lib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a regex pattern. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` + done + fi + if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ + | grep . >/dev/null; then + $echo + if test "X$deplibs_check_method" = "Xnone"; then + $echo "*** Warning: inter-library dependencies are not supported in this platform." + else + $echo "*** Warning: inter-library dependencies are not known to be supported." + fi + $echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + $echo + $echo "*** Warning: libtool could not satisfy all declared inter-library" + $echo "*** dependencies of module $libname. Therefore, libtool will create" + $echo "*** a static module, that should work as long as the dlopening" + $echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + $echo "*** The inter-library dependencies that have been dropped here will be" + $echo "*** automatically added whenever a program is linked with this library" + $echo "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + $echo + $echo "*** Since this library must not contain undefined symbols," + $echo "*** because either the platform does not support them or" + $echo "*** it was explicitly requested with -no-undefined," + $echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + deplibs="$new_libs" + + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + if test -n "$hardcode_libdir_flag_spec_ld"; then + case $archive_cmds in + *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;; + *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;; + esac + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + linknames="$linknames $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + if len=`expr "X$cmd" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + $show "$cmd" + $run eval "$cmd" || exit $? + skipped_export=false + else + # The command line is too long to execute in one step. + $show "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + tmp_deplibs="$tmp_deplibs $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + libobjs="$libobjs $func_extract_archives_result" + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise. + $echo "creating reloadable object files..." + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + output_la=`$echo "X$output" | $Xsed -e "$basename"` + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + delfiles= + last_robj= + k=1 + output=$output_objdir/$output_la-${k}.$objext + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + eval test_cmds=\"$reload_cmds $objlist $last_robj\" + if test "X$objlist" = X || + { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len"; }; then + objlist="$objlist $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + k=`expr $k + 1` + output=$output_objdir/$output_la-${k}.$objext + objlist=$obj + len=1 + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + + if ${skipped_export-false}; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + libobjs=$output + # Append the command to create the export file. + eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" + fi + + # Set up a command to remove the reloadable object files + # after they are used. + i=0 + while test "$i" -lt "$k" + do + i=`expr $i + 1` + delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" + done + + $echo "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + + # Append the command to remove the reloadable object files + # to the just-reset $cmds. + eval cmds=\"\$cmds~\$rm $delfiles\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + case " $deplibs" in + *\ -l* | *\ -L*) + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;; + esac + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case $output in + *.lo) + if test -n "$objs$old_deplibs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit $EXIT_FAILURE + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec and hope we can get by with + # turning comma into space.. + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` + else + gentop="$output_objdir/${obj}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + cmds=$reload_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $run eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + cmds=$reload_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + esac + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + case $host in + *darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + if test "$tagname" = CXX ; then + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + fi + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case $dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $run $rm $export_symbols + $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* ) + $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + else + $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* ) + $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval '$echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + $echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +" + + case $host in + *cygwin* | *mingw* ) + $echo >> "$output_objdir/$dlsyms" "\ +/* DATA imports from DLLs on WIN32 can't be const, because + runtime relocations are performed -- see ld's documentation + on pseudo-relocs */ +struct { +" + ;; + * ) + $echo >> "$output_objdir/$dlsyms" "\ +const struct { +" + ;; + esac + + + $echo >> "$output_objdir/$dlsyms" "\ + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{\ +" + + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + case $host in + *cygwin* | *mingw* ) + if test -f "$output_objdir/${outputname}.def" ; then + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` + else + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` + fi + ;; + * ) + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` + ;; + esac + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` + fi + + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + exit_status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $exit_status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $run $rm $output + # Link the executable and exit + $show "$link_command" + $run eval "$link_command" || exit $? + exit $EXIT_SUCCESS + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then + case $progpath in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; + *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + output_name=`basename $output` + output_path=`dirname $output` + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $rm $cwrappersource $cwrapper + trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + cat > $cwrappersource <> $cwrappersource<<"EOF" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +/* -DDEBUG is fairly common in CFLAGS. */ +#undef DEBUG +#if defined DEBUGWRAPPER +# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) +#else +# define DEBUG(format, ...) +#endif + +const char *program_name = NULL; + +void * xmalloc (size_t num); +char * xstrdup (const char *string); +const char * base_name (const char *name); +char * find_executable(const char *wrapper); +int check_executable(const char *path); +char * strendzap(char *str, const char *pat); +void lt_fatal (const char *message, ...); + +int +main (int argc, char *argv[]) +{ + char **newargz; + int i; + + program_name = (char *) xstrdup (base_name (argv[0])); + DEBUG("(main) argv[0] : %s\n",argv[0]); + DEBUG("(main) program_name : %s\n",program_name); + newargz = XMALLOC(char *, argc+2); +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" + newargz[1] = find_executable(argv[0]); + if (newargz[1] == NULL) + lt_fatal("Couldn't find %s", argv[0]); + DEBUG("(main) found exe at : %s\n",newargz[1]); + /* we know the script has the same name, without the .exe */ + /* so make sure newargz[1] doesn't end in .exe */ + strendzap(newargz[1],".exe"); + for (i = 1; i < argc; i++) + newargz[i+1] = xstrdup(argv[i]); + newargz[argc+1] = NULL; + + for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" + return 127; +} + +void * +xmalloc (size_t num) +{ + void * p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL +; +} + +const char * +base_name (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha ((unsigned char)name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return base; +} + +int +check_executable(const char * path) +{ + struct stat st; + + DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); + if ((!path) || (!*path)) + return 0; + + if ((stat (path, &st) >= 0) && + ( + /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ +#if defined (S_IXOTH) + ((st.st_mode & S_IXOTH) == S_IXOTH) || +#endif +#if defined (S_IXGRP) + ((st.st_mode & S_IXGRP) == S_IXGRP) || +#endif + ((st.st_mode & S_IXUSR) == S_IXUSR)) + ) + return 1; + else + return 0; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise */ +char * +find_executable (const char* wrapper) +{ + int has_slash = 0; + const char* p; + const char* p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char* concat_name; + + DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char* path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char* q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR(*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + return NULL; +} + +char * +strendzap(char *str, const char *pat) +{ + size_t len, patlen; + + assert(str != NULL); + assert(pat != NULL); + + len = strlen(str); + patlen = strlen(pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp(str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char * mode, + const char * message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} +EOF + # we should really use a build-platform specific compiler + # here, but OTOH, the wrappers (shell script and this C one) + # are only useful if you want to execute the "real" binary. + # Since the "real" binary is built for $host, then this + # wrapper might as well be built for $host, too. + $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource + ;; + esac + $rm $output + trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='${SED} -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $echo >> $output "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + $echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $echo \"\$relink_command_output\" >&2 + $rm \"\$progdir/\$file\" + exit $EXIT_FAILURE + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + $echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \$*\" + exit $EXIT_FAILURE + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + $echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit $EXIT_FAILURE + fi +fi\ +" + chmod +x $output + fi + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $addlibs + oldobjs="$oldobjs $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "copying selected object files to avoid basename conflicts..." + + if test -z "$gentop"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$gentop"; then + exit $exit_status + fi + fi + + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + counter=`expr $counter + 1` + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + $run ln "$obj" "$gentop/$newobj" || + $run cp "$obj" "$gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + + eval cmds=\"$old_archive_cmds\" + + if len=`expr "X$cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + $echo "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + for obj in $save_oldobjs + do + oldobjs="$objlist $obj" + objlist="$objlist $obj" + eval test_cmds=\"$old_archive_cmds\" + if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + eval cmd=\"$cmd\" + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + for lib in $dlfiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdlfiles="$newdlfiles $libdir/$name" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdlprefiles="$newdlprefiles $libdir/$name" + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" + fi + $rm $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $echo >> $output "\ +relink_command=\"$relink_command\"" + fi + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? + ;; + esac + exit $EXIT_SUCCESS + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $echo "X$nonopt" | grep shtool > /dev/null; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + case " $install_prog " in + *[\\\ /]cp\ *) ;; + *) prev=$arg ;; + esac + ;; + -g | -m | -o) prev=$arg ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test "$#" -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + library_names= + old_library= + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + if test "$inst_prefix_dir" = "$destdir"; then + $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 + exit $EXIT_FAILURE + fi + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP` + else + relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP` + fi + + $echo "$modename: warning: relinking \`$file'" 1>&2 + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + exit $EXIT_FAILURE + fi + fi + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$srcname $destdir/$realname" + $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? + if test -n "$stripme" && test -n "$striplib"; then + $show "$striplib $destdir/$realname" + $run eval "$striplib $destdir/$realname" || exit $? + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" + $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + cmds=$postinstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + file=`$echo $file|${SED} 's,.exe$,,'` + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin*|*mingw*) + wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` + ;; + *) + wrapper=$file + ;; + esac + if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + notinst_deplibs= + relink_command= + + # Note that it is not necessary on cygwin/mingw to append a dot to + # foo even if both foo and FILE.exe exist: automatic-append-.exe + # behavior happens only for exec(3), not for open(2)! Also, sourcing + # `FILE.' does not work on cygwin managed mounts. + # + # If there is no directory component, then add one. + case $wrapper in + */* | *\\*) . ${wrapper} ;; + *) . ./${wrapper} ;; + esac + + # Check the variables that should have been set. + if test -z "$notinst_deplibs"; then + $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 + exit $EXIT_FAILURE + fi + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + relink_command= + # Note that it is not necessary on cygwin/mingw to append a dot to + # foo even if both foo and FILE.exe exist: automatic-append-.exe + # behavior happens only for exec(3), not for open(2)! Also, sourcing + # `FILE.' does not work on cygwin managed mounts. + # + # If there is no directory component, then add one. + case $wrapper in + */* | *\\*) . ${wrapper} ;; + *) . ./${wrapper} ;; + esac + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir=`func_mktempdir` + file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` + ;; + esac + ;; + esac + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + if test -n "$stripme" && test -n "$old_striplib"; then + $show "$old_striplib $oldlib" + $run eval "$old_striplib $oldlib" || exit $? + fi + + # Do each command in the postinstall commands. + cmds=$old_postinstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + cmds=$finish_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = : && exit $EXIT_SUCCESS + + $echo "X----------------------------------------------------------------------" | $Xsed + $echo "Libraries have been installed in:" + for libdir in $libdirs; do + $echo " $libdir" + done + $echo + $echo "If you ever happen to want to link against installed libraries" + $echo "in a given directory, LIBDIR, you must either use libtool, and" + $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + $echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + $echo " during execution" + fi + if test -n "$runpath_var"; then + $echo " - add LIBDIR to the \`$runpath_var' environment variable" + $echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + $echo + $echo "See any operating system documentation about shared libraries for" + $echo "more information, such as the ld(1) and ld.so(8) manual pages." + $echo "X----------------------------------------------------------------------" | $Xsed + exit $EXIT_SUCCESS + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit $EXIT_FAILURE + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + if test ! -f "$dir/$dlname"; then + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit $EXIT_FAILURE + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit $EXIT_SUCCESS + fi + ;; + + # libtool clean and uninstall mode + clean | uninstall) + modename="$modename: $mode" + rm="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) rm="$rm $arg"; rmforce=yes ;; + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + rmdirs= + + origobjdir="$objdir" + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$file"; then + dir=. + objdir="$origobjdir" + else + objdir="$dir/$origobjdir" + fi + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + test "$mode" = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if (test -L "$file") >/dev/null 2>&1 \ + || (test -h "$file") >/dev/null 2>&1 \ + || test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + + case "$mode" in + clean) + case " $library_names " in + # " " in the beginning catches empty $dlname + *" $dlname "*) ;; + *) rmfiles="$rmfiles $objdir/$dlname" ;; + esac + test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + cmds=$postuninstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + cmds=$old_postuninstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + + # Read the .lo file + . $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" \ + && test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" \ + && test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + file=`$echo $file|${SED} 's,.exe$,,'` + noexename=`$echo $name|${SED} 's,.exe$,,'` + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$noexename + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 + done + objdir="$origobjdir" + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + $show "rmdir $dir" + $run rmdir $dir >/dev/null 2>&1 + fi + done + + exit $exit_status + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + if test -z "$exec_cmd"; then + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit $EXIT_FAILURE + fi +fi # test -z "$show_help" + +if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit $EXIT_FAILURE +fi + +# We need to display help for each of the modes. +case $mode in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG + --version print version information + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE. + +Report bugs to ." + exit $EXIT_SUCCESS + ;; + +clean) + $echo \ +"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; +esac + +$echo +$echo "Try \`$modename --help' for more information about other modes." + +exit $? + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +disable_libs=shared +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +disable_libs=static +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/config/missing --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/config/missing Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,360 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2005-06-08.21 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# 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, 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. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). +case "$1" in + lex|yacc) + # Not GNU programs, they don't have --version. + ;; + + tar) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + tar) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/configure --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/configure Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,33418 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.59. +# +# Copyright (C) 2003 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` + ;; +esac + +echo=${ECHO-echo} +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null 2>&1 && unset CDPATH + +if test -z "$ECHO"; then +if test "X${echo_test_string+set}" != Xset; then +# find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string=`eval $cmd`) 2>/dev/null && + echo_test_string=`eval $cmd` && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL $0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" +fi + + + + +tagnames=${tagnames+${tagnames},}CXX + +tagnames=${tagnames+${tagnames},}F77 + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="src/tone_generate.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS SPANDSP_LT_CURRENT SPANDSP_LT_REVISION SPANDSP_LT_AGE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CPP EGREP SED LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS COND_DOC_TRUE COND_DOC_FALSE COND_TESTS_TRUE COND_TESTS_FALSE COND_TESTDATA_TRUE COND_TESTDATA_FALSE COND_MMX_TRUE COND_MMX_FALSE COND_SSE_TRUE COND_SSE_FALSE COND_SSE2_TRUE COND_SSE2_FALSE COND_SSE3_TRUE COND_SSE3_FALSE COND_SSSE3_TRUE COND_SSSE3_FALSE COND_SSE4_1_TRUE COND_SSE4_1_FALSE COND_SSE4_2_TRUE COND_SSE4_2_FALSE COND_SSE4A_TRUE COND_SSE4A_FALSE COND_SSE5_TRUE COND_SSE5_FALSE CC_FOR_BUILD CPPFLAGS_FOR_BUILD COMP_VENDOR_CFLAGS COMP_VENDOR_LDFLAGS SIMLIBS TESTLIBS SPANDSP_USE_FIXED_POINT SPANDSP_MISALIGNED_ACCESS_FAILS SPANDSP_USE_EXPORT_CAPABILITY INSERT_INTTYPES_HEADER INSERT_STDINT_HEADER INSERT_TGMATH_HEADER INSERT_MATH_HEADER LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CXX_set=${CXX+set} +ac_env_CXX_value=$CXX +ac_cv_env_CXX_set=${CXX+set} +ac_cv_env_CXX_value=$CXX +ac_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_env_CXXFLAGS_value=$CXXFLAGS +ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_cv_env_CXXFLAGS_value=$CXXFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP +ac_env_CXXCPP_set=${CXXCPP+set} +ac_env_CXXCPP_value=$CXXCPP +ac_cv_env_CXXCPP_set=${CXXCPP+set} +ac_cv_env_CXXCPP_value=$CXXCPP +ac_env_F77_set=${F77+set} +ac_env_F77_value=$F77 +ac_cv_env_F77_set=${F77+set} +ac_cv_env_F77_value=$F77 +ac_env_FFLAGS_set=${FFLAGS+set} +ac_env_FFLAGS_value=$FFLAGS +ac_cv_env_FFLAGS_set=${FFLAGS+set} +ac_cv_env_FFLAGS_value=$FFLAGS + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --enable-shared[=PKGS] + build shared libraries [default=yes] + --enable-static[=PKGS] + build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + --enable-doc Build the documentation + --enable-tests Build the test programs + --enable-test-data Build TIFF test files for some ITU test images + --enable-mmx Enable MMX support + --enable-sse Enable SSE support + --enable-sse2 Enable SSE2 support + --enable-sse3 Enable SSE3 support + --enable-ssse3 Enable SSSE3 support + --enable-sse4-1 Enable SSE4.1 support + --enable-sse4-2 Enable SSE4.2 support + --enable-sse4a Enable SSE4A support + --enable-sse5 Enable SSE5 support + --enable-fixed-point Enable fixed point support + --enable-builtin-tiff build with builtin libtiff + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-pic try to use only PIC/non-PIC objects [default=use + both] + --with-tags[=TAGS] + include additional configurations [automatic] + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CXX C++ compiler command + CXXFLAGS C++ compiler flags + CPP C preprocessor + CXXCPP C++ preprocessor + F77 Fortran 77 compiler command + FFLAGS Fortran 77 compiler flags + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF + +Copyright (C) 2003 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + + +# =========================================================================== +# http://autoconf-archive.cryp.to/ax_compiler_vendor.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_COMPILER_VENDOR +# +# DESCRIPTION +# +# Determine the vendor of the C/C++ compiler, e.g., gnu, intel, ibm, sun, +# hp, borland, comeau, dec, cray, kai, lcc, metrowerks, sgi, microsoft, +# watcom, etc. The vendor is returned in the cache variable +# $ax_cv_c_compiler_vendor for C and $ax_cv_cxx_compiler_vendor for C++. +# +# LAST MODIFICATION +# +# 2008-04-12 +# +# COPYLEFT +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2008 Matteo Frigo +# +# 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 . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Macro Archive. When you make and +# distribute a modified version of the Autoconf Macro, you may extend this +# special exception to the GPL to apply to your modified version as well. + + + +# AX_CHECK_REAL_FILE(FILE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------------------------------ +# +# Check for the existence of FILE, and make sure it is a real file or +# directory, and not a symbolic link. +# +# AX_CHECK_REAL_FILE + +# AX_FIXED_POINT_MACHINE(MACHINE, [ACTION-IF-FIXED-POINT], [ACTION-IF-NOT-FIXED-POINT]) +# ------------------------------------------------------------------------------------- +# +# Check if a specified machine type is a fixed point only machine. That is, if it lacks +# fast floating point support. +# +# This is a simple lookup amongst machines known to the current autotools. So far we deal +# with the embedded ARM, Blackfin, MIPS, TI DSP and XScale processors as things which lack +# fast hardware floating point. +# +# Other candidates would be the small embedded Power PCs. +# +# AX_FIXED_POINT_MACHINE + +# AX_MISALIGNED_ACCESS_FAILS(MACHINE, [ACTION-IF-MISALIGNED-FAILS], [ACTION-IF-MISALIGNED-OK]) +# ------------------------------------------------------------------------------------- +# +# Check if a specified machine type cannot handle misaligned data. That is, multi-byte data +# types which are not properly aligned in memory fail. Many machines are happy to work with +# misaligned data, but slowing down a bit. Other machines just won't tolerate such data. +# +# This is a simple lookup amongst machines known to the current autotools. So far we only deal +# with the ARM and sparc. +# A lookup is used, as many of the devices which cannot handled misaligned access are embedded +# processors, for which the code normally be cross-compiled. +# +# MISALIGNED_ACCESS_FAILS + +# @synopsis AX_C99_FLEXIBLE_ARRAY +# +# Does the compiler support the 1999 ISO C Standard "struct hack". +# @version 1.1 Mar 15 2004 +# @author Erik de Castro Lopo +# +# Permission to use, copy, modify, distribute, and sell this file for any +# purpose is hereby granted without fee, provided that the above copyright +# and this permission notice appear in all copies. No representations are +# made about the suitability of this software for any purpose. It is +# provided "as is" without express or implied warranty. + + # AX_C99_FLEXIBLE_ARRAY + +# @synopsis AX_C99_FUNC_LRINT +# +# Check whether C99's lrint function is available. +# @version 1.3 Feb 12 2002 +# @author Erik de Castro Lopo +# +# Permission to use, copy, modify, distribute, and sell this file for any +# purpose is hereby granted without fee, provided that the above copyright +# and this permission notice appear in all copies. No representations are +# made about the suitability of this software for any purpose. It is +# provided "as is" without express or implied warranty. +# +# AX_C99_FUNC_LRINT + +# @synopsis AX_C99_FUNC_LRINTF +# +# Check whether C99's lrintf function is available. +# @version 1.3 Feb 12 2002 +# @author Erik de Castro Lopo +# +# Permission to use, copy, modify, distribute, and sell this file for any +# purpose is hereby granted without fee, provided that the above copyright +# and this permission notice appear in all copies. No representations are +# made about the suitability of this software for any purpose. It is +# provided "as is" without express or implied warranty. +# +# AX_C99_FUNC_LRINTF + +# @synopsis AX_C99_FUNC_LLRINT +# +# Check whether C99's llrint function is available. +# @version 1.1 Sep 30 2002 +# @author Erik de Castro Lopo +# +# Permission to use, copy, modify, distribute, and sell this file for any +# purpose is hereby granted without fee, provided that the above copyright +# and this permission notice appear in all copies. No representations are +# made about the suitability of this software for any purpose. It is +# provided "as is" without express or implied warranty. +# +# AX_C99_FUNC_LLRINT + + +# @synopsis AX_C99_FUNC_LLRINTF +# +# Check whether C99's llrintf function is available. +# @version 1.1 Sep 30 2002 +# @author Erik de Castro Lopo +# +# Permission to use, copy, modify, distribute, and sell this file for any +# purpose is hereby granted without fee, provided that the above copyright +# and this permission notice appear in all copies. No representations are +# made about the suitability of this software for any purpose. It is +# provided "as is" without express or implied warranty. +# +# AX_C99_FUNC_LLRINTF + +# @synopsis AX_CHECK_EXPORT_CAPABILITY +# +# Does the compiler support the exporting of library symbols? +# @version 1.0 Jan 31 2009 +# @author Steve Underwood +# +# Permission to use, copy, modify, distribute, and sell this file for any +# purpose is hereby granted without fee, provided that the above copyright +# and this permission notice appear in all copies. No representations are +# made about the suitability of this software for any purpose. It is +# provided "as is" without express or implied warranty. + + # AX_CHECK_EXPORT_CAPABILITY + + +SPANDSP_MAJOR_VERSION=0 +SPANDSP_MINOR_VERSION=0 +SPANDSP_MICRO_VERSION=6 + +SPANDSP_LT_CURRENT=2 +SPANDSP_LT_REVISION=0 +SPANDSP_LT_AGE=0 + +VERSION=$SPANDSP_MAJOR_VERSION.$SPANDSP_MINOR_VERSION.$SPANDSP_MICRO_VERSION +PACKAGE=spandsp + + + + + + +ac_aux_dir= +for ac_dir in config $srcdir/config; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config $srcdir/config" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in config $srcdir/config" >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + + ac_config_headers="$ac_config_headers src/config.h:config-h.in" + +am__api_version="1.9" +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +test "$program_prefix" != NONE && + program_transform_name="s,^,$program_prefix,;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE=$PACKAGE + VERSION=$VERSION + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +#AC_CANONICAL_BUILD +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +DEPDIR="${am__leading_dot}deps" + + ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6 +rm -f confinc confmf + +# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then + enableval="$enable_dependency_tracking" + +fi; +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +echo "${ECHO_T}$ac_ct_CXX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CXX" && break +done +test -n "$ac_ct_CXX" || ac_ct_CXX="g++" + + CXX=$ac_ct_CXX +fi + + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C++ compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 +if test "${ac_cv_cxx_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 +GXX=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cxx_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cxx_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CXX" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +if test $ac_cv_c_compiler_gnu = yes; then + echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 +echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 +if test "${ac_cv_prog_gcc_traditional+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_pattern="Autoconf.*'x'" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +Autoconf TIOCGETP +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "$ac_pattern" >/dev/null 2>&1; then + ac_cv_prog_gcc_traditional=yes +else + ac_cv_prog_gcc_traditional=no +fi +rm -f conftest* + + + if test $ac_cv_prog_gcc_traditional = no; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +Autoconf TCGETA +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "$ac_pattern" >/dev/null 2>&1; then + ac_cv_prog_gcc_traditional=yes +fi +rm -f conftest* + + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 +echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi + +# Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_shared=yes +fi; + +# Check whether --enable-static or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=yes +fi; + +# Check whether --enable-fast-install or --disable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval="$enable_fast_install" + p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi; + +echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 +if test "${lt_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done + +fi + +SED=$lt_cv_path_SED + +echo "$as_me:$LINENO: result: $SED" >&5 +echo "${ECHO_T}$SED" >&6 + + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi; +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo "$as_me:$LINENO: checking for ld used by $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 +else + echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 +fi +if test "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +echo "${ECHO_T}$LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 +if test "${lt_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + + +echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 +echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 +if test "${lt_cv_ld_reload_flag+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_ld_reload_flag='-r' +fi +echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 +echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + +echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 +echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 +if test "${lt_cv_path_NM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi +fi +echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 +echo "${ECHO_T}$lt_cv_path_NM" >&6 +NM="$lt_cv_path_NM" + +echo "$as_me:$LINENO: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6 +fi + +echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5 +echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6 +if test "${lt_cv_deplibs_check_method+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 +echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + +fi; +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 4628 "configure"' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + libsuff=64 + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 +echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 +if test "${lt_cv_cc_needs_belf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + lt_cv_cc_needs_belf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +lt_cv_cc_needs_belf=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 +echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + + +esac + +need_locks="$enable_libtool_lock" + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +for ac_header in dlfcn.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 +echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6 +if test -z "$CXXCPP"; then + if test "${ac_cv_prog_CXXCPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +echo "$as_me:$LINENO: result: $CXXCPP" >&5 +echo "${ECHO_T}$CXXCPP" >&6 +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +fi + + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$F77"; then + ac_cv_prog_F77="$F77" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_F77="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +F77=$ac_cv_prog_F77 +if test -n "$F77"; then + echo "$as_me:$LINENO: result: $F77" >&5 +echo "${ECHO_T}$F77" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$F77" && break + done +fi +if test -z "$F77"; then + ac_ct_F77=$F77 + for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_F77"; then + ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_F77="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_F77=$ac_cv_prog_ac_ct_F77 +if test -n "$ac_ct_F77"; then + echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 +echo "${ECHO_T}$ac_ct_F77" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_F77" && break +done + + F77=$ac_ct_F77 +fi + + +# Provide some information about the compiler. +echo "$as_me:5540:" \ + "checking for Fortran 77 compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +rm -f a.out + +# If we don't use `.F' as extension, the preprocessor is not run on the +# input file. (Note that this only needs to work for GNU compilers.) +ac_save_ext=$ac_ext +ac_ext=F +echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 +if test "${ac_cv_f77_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF + program main +#ifndef __GNUC__ + choke me +#endif + + end +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_f77_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 +ac_ext=$ac_save_ext +ac_test_FFLAGS=${FFLAGS+set} +ac_save_FFLAGS=$FFLAGS +FFLAGS= +echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 +echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_f77_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + FFLAGS=-g +cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_f77_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_f77_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 +echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 +if test "$ac_test_FFLAGS" = set; then + FFLAGS=$ac_save_FFLAGS +elif test $ac_cv_prog_f77_g = yes; then + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-g -O2" + else + FFLAGS="-g" + fi +else + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-O2" + else + FFLAGS= + fi +fi + +G77=`test $ac_compiler_gnu = yes && echo yes` +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +# find the maximum length of command line arguments +echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 +echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 +if test "${lt_cv_sys_max_cmd_len+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ + = "XX$teststring") >/dev/null 2>&1 && + new_result=`expr "X$teststring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + teststring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 +echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 +else + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 +fi + + + + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 +echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +linux* | k*bsd*-gnu) + if test "$host_cpu" = ia64; then + symcode='[ABCDGIRSTW]' + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 +else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 +fi + +echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6 +if test "${lt_cv_objdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 +echo "${ECHO_T}$lt_cv_objdir" >&6 +objdir=$lt_cv_objdir + + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false" +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 +echo "${ECHO_T}$ac_ct_AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + AR=$ac_ct_AR +else + AR="$ac_cv_prog_AR" +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 +echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + echo "$as_me:$LINENO: checking for file" >&5 +echo $ECHO_N "checking for file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + + + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_DSYMUTIL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + echo "$as_me:$LINENO: result: $DSYMUTIL" >&5 +echo "${ECHO_T}$DSYMUTIL" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_DSYMUTIL" && ac_cv_prog_ac_ct_DSYMUTIL=":" +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + echo "$as_me:$LINENO: result: $ac_ct_DSYMUTIL" >&5 +echo "${ECHO_T}$ac_ct_DSYMUTIL" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + DSYMUTIL=$ac_ct_DSYMUTIL +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_NMEDIT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + echo "$as_me:$LINENO: result: $NMEDIT" >&5 +echo "${ECHO_T}$NMEDIT" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_NMEDIT" && ac_cv_prog_ac_ct_NMEDIT=":" +fi +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + echo "$as_me:$LINENO: result: $ac_ct_NMEDIT" >&5 +echo "${ECHO_T}$ac_ct_NMEDIT" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + NMEDIT=$ac_ct_NMEDIT +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi + + + echo "$as_me:$LINENO: checking for -single_module linker flag" >&5 +echo $ECHO_N "checking for -single_module linker flag... $ECHO_C" >&6 +if test "${lt_cv_apple_cc_single_mod+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + echo "int foo(void){return 1;}" > conftest.c + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib ${wl}-single_module conftest.c + if test -f libconftest.dylib; then + lt_cv_apple_cc_single_mod=yes + rm -rf libconftest.dylib* + fi + rm conftest.c + fi +fi +echo "$as_me:$LINENO: result: $lt_cv_apple_cc_single_mod" >&5 +echo "${ECHO_T}$lt_cv_apple_cc_single_mod" >&6 + echo "$as_me:$LINENO: checking for -exported_symbols_list linker flag" >&5 +echo $ECHO_N "checking for -exported_symbols_list linker flag... $ECHO_C" >&6 +if test "${lt_cv_ld_exported_symbols_list+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + lt_cv_ld_exported_symbols_list=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +lt_cv_ld_exported_symbols_list=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_cv_ld_exported_symbols_list" >&5 +echo "${ECHO_T}$lt_cv_ld_exported_symbols_list" >&6 + case $host_os in + rhapsody* | darwin1.[0123]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[012]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}" + fi + if test "$DSYMUTIL" != ":"; then + _lt_dsymutil="~$DSYMUTIL \$lib || :" + else + _lt_dsymutil= + fi + ;; + esac + + +enable_dlopen=no +enable_win32_dll=no + +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + +fi; +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + + +# Check whether --with-pic or --without-pic was given. +if test "${with_pic+set}" = set; then + withval="$with_pic" + pic_mode="$withval" +else + pic_mode=default +fi; +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +lt_save_CC="$CC" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm -r conftest* + + + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag=' -fno-builtin' + + +echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6889: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:6893: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic='-qnocommon' + lt_prog_compiler_wl='-Wl,' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + linux* | k*bsd*-gnu) + case $cc_basename in + icc* | ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + esac + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_pic_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:7179: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:7183: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_pic_works" >&6 + +if test x"$lt_cv_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_static_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $rm -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_static_works" >&6 + +if test x"$lt_cv_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:7283: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:7287: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag= + enable_shared_with_static_runtimes=no + archive_cmds= + archive_expsym_cmds= + old_archive_From_new_cmds= + old_archive_from_expsyms_cmds= + export_dynamic_flag_spec= + whole_archive_flag_spec= + thread_safe_flag_spec= + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld= + hardcode_libdir_separator= + hardcode_direct=no + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + link_all_deplibs=unknown + hardcode_automatic=no + module_cmds= + module_expsym_cmds= + always_export_symbols=no + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | k*bsd*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + *) + tmp_sharedflag='-shared' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes=yes + ;; + + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[012]) + allow_undefined_flag='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='' + link_all_deplibs=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' + module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs=no + ;; + esac + fi + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + hardcode_direct=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_libdir_flag_spec_ld='+b $libdir' + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld='-rpath $libdir' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='${wl}-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='${wl}-z,text' + allow_undefined_flag='${wl}-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $ld_shlibs" >&5 +echo "${ECHO_T}$ld_shlibs" >&6 +test "$ld_shlibs" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc=no + else + archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 +echo "${ECHO_T}$archive_cmds_need_lc" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" + +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'` + else + lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + sys_lib_search_path_spec=`echo $lt_search_path_spec` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[3-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec" +fi + +sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec" +fi + +sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var" || \ + test "X$hardcode_automatic" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6 + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_shl_load) || defined (__stub___shl_load) +choke me +#else +char (*f) () = shl_load; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != shl_load; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_dlopen) || defined (__stub___dlopen) +choke me +#else +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != dlopen; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_svld_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dld_link (); +int +main () +{ +dld_link (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_dld_link=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + exit (status); +} +EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + exit (status); +} +EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +# Report which library types will actually be built +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case $host_os in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix[4-9]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler \ + CC \ + LD \ + lt_prog_compiler_wl \ + lt_prog_compiler_pic \ + lt_prog_compiler_static \ + lt_prog_compiler_no_builtin_flag \ + export_dynamic_flag_spec \ + thread_safe_flag_spec \ + whole_archive_flag_spec \ + enable_shared_with_static_runtimes \ + old_archive_cmds \ + old_archive_from_new_cmds \ + predep_objects \ + postdep_objects \ + predeps \ + postdeps \ + compiler_lib_search_path \ + compiler_lib_search_dirs \ + archive_cmds \ + archive_expsym_cmds \ + postinstall_cmds \ + postuninstall_cmds \ + old_archive_from_expsyms_cmds \ + allow_undefined_flag \ + no_undefined_flag \ + export_symbols_cmds \ + hardcode_libdir_flag_spec \ + hardcode_libdir_flag_spec_ld \ + hardcode_libdir_separator \ + hardcode_automatic \ + module_cmds \ + module_expsym_cmds \ + lt_cv_prog_compiler_c_o \ + fix_srcfile_path \ + exclude_expsyms \ + include_expsyms; do + + case $var in + old_archive_cmds | \ + old_archive_from_new_cmds | \ + archive_cmds | \ + archive_expsym_cmds | \ + module_cmds | \ + module_expsym_cmds | \ + old_archive_from_expsyms_cmds | \ + export_symbols_cmds | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + { echo "$as_me:$LINENO: creating $ofile" >&5 +echo "$as_me: creating $ofile" >&6;} + + cat <<__EOF__ >> "$cfgfile" +#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit , 1996 +# +# 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="$SED -e 1s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU C compiler? +with_gcc=$GCC + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps + +# The directories searched by this compiler when creating a shared +# library +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# ### END LIBTOOL CONFIG + +__EOF__ + + + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + +# Check whether --with-tags or --without-tags was given. +if test "${with_tags+set}" = set; then + withval="$with_tags" + tagnames="$withval" +fi; + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 +echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 +echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} + else + { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 +echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} + fi + fi + if test -z "$LTCFLAGS"; then + eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in + "") ;; + *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 +echo "$as_me: error: invalid tag name: $tagname" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 +echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} + { (exit 1); exit 1; }; } + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + + +archive_cmds_need_lc_CXX=no +allow_undefined_flag_CXX= +always_export_symbols_CXX=no +archive_expsym_cmds_CXX= +export_dynamic_flag_spec_CXX= +hardcode_direct_CXX=no +hardcode_libdir_flag_spec_CXX= +hardcode_libdir_flag_spec_ld_CXX= +hardcode_libdir_separator_CXX= +hardcode_minus_L_CXX=no +hardcode_shlibpath_var_CXX=unsupported +hardcode_automatic_CXX=no +module_cmds_CXX= +module_expsym_cmds_CXX= +link_all_deplibs_CXX=unknown +old_archive_cmds_CXX=$old_archive_cmds +no_undefined_flag_CXX= +whole_archive_flag_spec_CXX= +enable_shared_with_static_runtimes_CXX=no + +# Dependencies to place before and after the object being linked: +predep_objects_CXX= +postdep_objects_CXX= +predeps_CXX= +postdeps_CXX= +compiler_lib_search_path_CXX= +compiler_lib_search_dirs_CXX= + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +objext_CXX=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[]) { return(0); }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm -r conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + $as_unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + $as_unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +compiler_CXX=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' +else + lt_prog_compiler_no_builtin_flag_CXX= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi; +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo "$as_me:$LINENO: checking for ld used by $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 +else + echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 +fi +if test "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +echo "${ECHO_T}$LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 +if test "${lt_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_CXX= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 +ld_shlibs_CXX=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_CXX='' + hardcode_direct_CXX=yes + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct_CXX=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_CXX=yes + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_libdir_separator_CXX= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_CXX=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_CXX='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + + archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_CXX="-z nodefs" + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_CXX=' ${wl}-bernotok' + allow_undefined_flag_CXX=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_CXX='$convenience' + archive_cmds_need_lc_CXX=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_CXX=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_CXX=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_CXX='-L$libdir' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=no + enable_shared_with_static_runtimes_CXX=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs_CXX=no + fi + ;; + darwin* | rhapsody*) + archive_cmds_need_lc_CXX=no + hardcode_direct_CXX=no + hardcode_automatic_CXX=yes + hardcode_shlibpath_var_CXX=unsupported + whole_archive_flag_spec_CXX='' + link_all_deplibs_CXX=yes + allow_undefined_flag_CXX="$_lt_dar_allow_undefined" + if test "$GXX" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "$lt_cv_apple_cc_single_mod" != "yes"; then + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" + fi + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' + module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_CXX=no + ;; + esac + fi + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + freebsd[12]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + ld_shlibs_CXX=no + ;; + freebsd-elf*) + archive_cmds_need_lc_CXX=no + ;; + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + ld_shlibs_CXX=yes + ;; + gnu*) + ;; + hpux9*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + case $host_cpu in + hppa*64*|ia64*) ;; + *) + export_dynamic_flag_spec_CXX='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + ;; + *) + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + interix[3-9]*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + link_all_deplibs_CXX=yes + ;; + esac + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + ;; + linux* | k*bsd*-gnu) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc*) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + archive_cmds_need_lc_CXX=no + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + hardcode_libdir_flag_spec_CXX='-R$libdir' + whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + m88k*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + openbsd2*) + # C++ shared libraries are fairly broken + ld_shlibs_CXX=no + ;; + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + export_dynamic_flag_spec_CXX='${wl}-E' + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + else + ld_shlibs_CXX=no + fi + ;; + osf3*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx*) + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx*) + allow_undefined_flag_CXX=' -expect_unresolved \*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $rm $lib.exp' + + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + archive_cmds_need_lc_CXX=yes + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_shlibpath_var_CXX=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' + ;; + esac + link_all_deplibs_CXX=yes + + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + no_undefined_flag_CXX=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag_CXX='${wl}-z,text' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + # So that behaviour is only enabled if SCOABSPATH is set to a + # non-empty value in the environment. Most likely only useful for + # creating official distributions of packages. + # This is a hack until libtool officially supports absolute path + # names for shared libraries. + no_undefined_flag_CXX='${wl}-z,text' + allow_undefined_flag_CXX='${wl}-z,nodefs' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + export_dynamic_flag_spec_CXX='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; +esac +echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6 +test "$ld_shlibs_CXX" = no && can_build_shared=no + +GCC_CXX="$GXX" +LD_CXX="$LD" + +cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + # The `*' in the case matches for architectures that use `case' in + # $output_verbose_cmd can trigger glob expansion during the loop + # eval without this substitution. + output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"` + + for p in `eval $output_verbose_link_cmd`; do + case $p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" \ + || test $p = "-R"; then + prev=$p + continue + else + prev= + fi + + if test "$pre_test_object_deps_done" = no; then + case $p in + -L* | -R*) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$compiler_lib_search_path_CXX"; then + compiler_lib_search_path_CXX="${prev}${p}" + else + compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$postdeps_CXX"; then + postdeps_CXX="${prev}${p}" + else + postdeps_CXX="${postdeps_CXX} ${prev}${p}" + fi + fi + ;; + + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$predep_objects_CXX"; then + predep_objects_CXX="$p" + else + predep_objects_CXX="$predep_objects_CXX $p" + fi + else + if test -z "$postdep_objects_CXX"; then + postdep_objects_CXX="$p" + else + postdep_objects_CXX="$postdep_objects_CXX $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling CXX test program" +fi + +$rm -f confest.$objext + +compiler_lib_search_dirs_CXX= +if test -n "$compiler_lib_search_path_CXX"; then + compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` +fi + +# PORTME: override above test on systems where it is broken +case $host_os in +interix[3-9]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + predep_objects_CXX= + postdep_objects_CXX= + postdeps_CXX= + ;; + +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + # + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + if test "$solaris_use_stlport4" != yes; then + postdeps_CXX='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + +solaris*) + case $cc_basename in + CC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + if test "$solaris_use_stlport4" != yes; then + postdeps_CXX='-library=Cstd -library=Crun' + fi + ;; + esac + ;; +esac + +case " $postdeps_CXX " in +*" -lc "*) archive_cmds_need_lc_CXX=no ;; +esac + +lt_prog_compiler_wl_CXX= +lt_prog_compiler_pic_CXX= +lt_prog_compiler_static_CXX= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_CXX='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + lt_prog_compiler_pic_CXX= + ;; + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_CXX=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + else + case $host_os in + aix[4-9]*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + else + lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic_CXX='-qnocommon' + lt_prog_compiler_wl_CXX='-Wl,' + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++*) + lt_prog_compiler_pic_CXX='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + lt_prog_compiler_pic_CXX='+Z' + fi + ;; + aCC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_CXX='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu) + case $cc_basename in + KCC*) + # KAI C++ Compiler + lt_prog_compiler_wl_CXX='--backend -Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + ;; + icpc* | ecpc*) + # Intel C++ + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fpic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + lt_prog_compiler_pic_CXX='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + lt_prog_compiler_wl_CXX='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + lt_prog_compiler_pic_CXX='-pic' + ;; + cxx*) + # Digital/Compaq C++ + lt_prog_compiler_wl_CXX='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + lt_prog_compiler_pic_CXX='-pic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + lcc*) + # Lucid + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + lt_prog_compiler_pic_CXX='-KPIC' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + esac + ;; + vxworks*) + ;; + *) + lt_prog_compiler_can_build_shared_CXX=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_CXX"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_pic_works_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_pic_works_CXX=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:12191: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:12195: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works_CXX=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_pic_works_CXX" >&6 + +if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then + case $lt_prog_compiler_pic_CXX in + "" | " "*) ;; + *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; + esac +else + lt_prog_compiler_pic_CXX= + lt_prog_compiler_can_build_shared_CXX=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_CXX= + ;; + *) + lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" + ;; +esac + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" +echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_static_works_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_static_works_CXX=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works_CXX=yes + fi + else + lt_cv_prog_compiler_static_works_CXX=yes + fi + fi + $rm -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_CXX" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_static_works_CXX" >&6 + +if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then + : +else + lt_prog_compiler_static_CXX= +fi + + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_CXX=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:12295: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:12299: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . 2>&5 + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix[4-9]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + export_symbols_cmds_CXX="$ltdll_cmds" + ;; + cygwin* | mingw*) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + +echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6 +test "$ld_shlibs_CXX" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_CXX" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_CXX=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_CXX in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_CXX + pic_flag=$lt_prog_compiler_pic_CXX + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_CXX + allow_undefined_flag_CXX= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_CXX=no + else + archive_cmds_need_lc_CXX=yes + fi + allow_undefined_flag_CXX=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" + +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[3-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec" +fi + +sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec" +fi + +sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_CXX= +if test -n "$hardcode_libdir_flag_spec_CXX" || \ + test -n "$runpath_var_CXX" || \ + test "X$hardcode_automatic_CXX" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_CXX" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && + test "$hardcode_minus_L_CXX" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_CXX=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_CXX=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_CXX=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 +echo "${ECHO_T}$hardcode_action_CXX" >&6 + +if test "$hardcode_action_CXX" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_CXX \ + CC_CXX \ + LD_CXX \ + lt_prog_compiler_wl_CXX \ + lt_prog_compiler_pic_CXX \ + lt_prog_compiler_static_CXX \ + lt_prog_compiler_no_builtin_flag_CXX \ + export_dynamic_flag_spec_CXX \ + thread_safe_flag_spec_CXX \ + whole_archive_flag_spec_CXX \ + enable_shared_with_static_runtimes_CXX \ + old_archive_cmds_CXX \ + old_archive_from_new_cmds_CXX \ + predep_objects_CXX \ + postdep_objects_CXX \ + predeps_CXX \ + postdeps_CXX \ + compiler_lib_search_path_CXX \ + compiler_lib_search_dirs_CXX \ + archive_cmds_CXX \ + archive_expsym_cmds_CXX \ + postinstall_cmds_CXX \ + postuninstall_cmds_CXX \ + old_archive_from_expsyms_cmds_CXX \ + allow_undefined_flag_CXX \ + no_undefined_flag_CXX \ + export_symbols_cmds_CXX \ + hardcode_libdir_flag_spec_CXX \ + hardcode_libdir_flag_spec_ld_CXX \ + hardcode_libdir_separator_CXX \ + hardcode_automatic_CXX \ + module_cmds_CXX \ + module_expsym_cmds_CXX \ + lt_cv_prog_compiler_c_o_CXX \ + fix_srcfile_path_CXX \ + exclude_expsyms_CXX \ + include_expsyms_CXX; do + + case $var in + old_archive_cmds_CXX | \ + old_archive_from_new_cmds_CXX | \ + archive_cmds_CXX | \ + archive_expsym_cmds_CXX | \ + module_cmds_CXX | \ + module_expsym_cmds_CXX | \ + old_archive_from_expsyms_cmds_CXX | \ + export_symbols_cmds_CXX | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_CXX + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_CXX +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_CXX + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_CXX + +# The directories searched by this compiler when creating a shared +# library +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_CXX + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld + + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu + + +archive_cmds_need_lc_F77=no +allow_undefined_flag_F77= +always_export_symbols_F77=no +archive_expsym_cmds_F77= +export_dynamic_flag_spec_F77= +hardcode_direct_F77=no +hardcode_libdir_flag_spec_F77= +hardcode_libdir_flag_spec_ld_F77= +hardcode_libdir_separator_F77= +hardcode_minus_L_F77=no +hardcode_automatic_F77=no +module_cmds_F77= +module_expsym_cmds_F77= +link_all_deplibs_F77=unknown +old_archive_cmds_F77=$old_archive_cmds +no_undefined_flag_F77= +whole_archive_flag_spec_F77= +enable_shared_with_static_runtimes_F77=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +objext_F77=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="\ + subroutine t + return + end +" + +# Code to be used in simple link tests +lt_simple_link_test_code="\ + program t + end +" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm -r conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${F77-"f77"} +compiler=$CC +compiler_F77=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case $host_os in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; +aix[4-9]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 + +GCC_F77="$G77" +LD_F77="$LD" + +lt_prog_compiler_wl_F77= +lt_prog_compiler_pic_F77= +lt_prog_compiler_static_F77= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + if test "$GCC" = yes; then + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_static_F77='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_F77='-fno-common' + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared_F77=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_F77=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_F77='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + else + lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic_F77='-qnocommon' + lt_prog_compiler_wl_F77='-Wl,' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_F77='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_F77='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + linux* | k*bsd*-gnu) + case $cc_basename in + icc* | ecc*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-fpic' + lt_prog_compiler_static_F77='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl_F77='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + lt_prog_compiler_wl_F77='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + lt_prog_compiler_wl_F77='' + ;; + esac + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_F77='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static_F77='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_F77='-Qoption ld ';; + *) + lt_prog_compiler_wl_F77='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl_F77='-Qoption ld ' + lt_prog_compiler_pic_F77='-PIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_F77='-Kconform_pic' + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_can_build_shared_F77=no + ;; + + uts4*) + lt_prog_compiler_pic_F77='-pic' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_F77=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_F77"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_pic_works_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_pic_works_F77=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_F77" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:13880: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:13884: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works_F77=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_F77" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_pic_works_F77" >&6 + +if test x"$lt_cv_prog_compiler_pic_works_F77" = xyes; then + case $lt_prog_compiler_pic_F77 in + "" | " "*) ;; + *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; + esac +else + lt_prog_compiler_pic_F77= + lt_prog_compiler_can_build_shared_F77=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_F77= + ;; + *) + lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" + ;; +esac + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\" +echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_static_works_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_static_works_F77=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works_F77=yes + fi + else + lt_cv_prog_compiler_static_works_F77=yes + fi + fi + $rm -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_F77" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_static_works_F77" >&6 + +if test x"$lt_cv_prog_compiler_static_works_F77" = xyes; then + : +else + lt_prog_compiler_static_F77= +fi + + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_F77=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:13984: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:13988: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_F77=yes + fi + fi + chmod u+w . 2>&5 + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag_F77= + enable_shared_with_static_runtimes_F77=no + archive_cmds_F77= + archive_expsym_cmds_F77= + old_archive_From_new_cmds_F77= + old_archive_from_expsyms_cmds_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= + thread_safe_flag_spec_F77= + hardcode_libdir_flag_spec_F77= + hardcode_libdir_flag_spec_ld_F77= + hardcode_libdir_separator_F77= + hardcode_direct_F77=no + hardcode_minus_L_F77=no + hardcode_shlibpath_var_F77=unsupported + link_all_deplibs_F77=unknown + hardcode_automatic_F77=no + module_cmds_F77= + module_expsym_cmds_F77= + always_export_symbols_F77=no + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_F77= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms_F77='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs_F77=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_F77=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_F77=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_F77=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_F77='-L$libdir' + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=no + enable_shared_with_static_runtimes_F77=yes + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs_F77=no + fi + ;; + + interix[3-9]*) + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + export_dynamic_flag_spec_F77='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | k*bsd*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec_F77='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + *) + tmp_sharedflag='-shared' ;; + esac + archive_cmds_F77='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs_F77=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs_F77=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs_F77=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + esac + + if test "$ld_shlibs_F77" = no; then + runpath_var= + hardcode_libdir_flag_spec_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=yes + archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L_F77=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_F77=unsupported + fi + ;; + + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_F77='' + hardcode_direct_F77=yes + hardcode_libdir_separator_F77=':' + link_all_deplibs_F77=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct_F77=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_F77=yes + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_libdir_separator_F77= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_F77=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_F77='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_F77="-z nodefs" + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_F77=' ${wl}-bernotok' + allow_undefined_flag_F77=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_F77='$convenience' + archive_cmds_need_lc_F77=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_F77=no + ;; + + bsdi[45]*) + export_dynamic_flag_spec_F77=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_F77=' ' + allow_undefined_flag_F77=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_F77='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_F77='lib -OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path_F77='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_F77=yes + ;; + + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[012]) + allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc_F77=no + hardcode_direct_F77=no + hardcode_automatic_F77=yes + hardcode_shlibpath_var_F77=unsupported + whole_archive_flag_spec_F77='' + link_all_deplibs_F77=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds_F77="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds_F77="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_F77="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_F77="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' + module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_F77=no + ;; + esac + fi + ;; + + dgux*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + freebsd1*) + ld_shlibs_F77=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + + hardcode_direct_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_libdir_flag_spec_ld_F77='+b $libdir' + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + ;; + *) + hardcode_direct_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + link_all_deplibs_F77=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + newsos6) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_shlibpath_var_F77=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + export_dynamic_flag_spec_F77='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + ;; + *) + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs_F77=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + allow_undefined_flag_F77=unsupported + archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec_F77='-rpath $libdir' + fi + hardcode_libdir_separator_F77=: + ;; + + solaris*) + no_undefined_flag_F77=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_shlibpath_var_F77=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs_F77=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_F77='$CC -r -o $output$reload_objs' + hardcode_direct_F77=no + ;; + motorola) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_F77=no + ;; + + sysv4.3*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + export_dynamic_flag_spec_F77='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_F77=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag_F77='${wl}-z,text' + archive_cmds_need_lc_F77=no + hardcode_shlibpath_var_F77=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag_F77='${wl}-z,text' + allow_undefined_flag_F77='${wl}-z,nodefs' + archive_cmds_need_lc_F77=no + hardcode_shlibpath_var_F77=no + hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator_F77=':' + link_all_deplibs_F77=yes + export_dynamic_flag_spec_F77='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + *) + ld_shlibs_F77=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 +echo "${ECHO_T}$ld_shlibs_F77" >&6 +test "$ld_shlibs_F77" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_F77" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_F77=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_F77 in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_F77 + pic_flag=$lt_prog_compiler_pic_F77 + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_F77 + allow_undefined_flag_F77= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_F77=no + else + archive_cmds_need_lc_F77=yes + fi + allow_undefined_flag_F77=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" + +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[3-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec" +fi + +sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec" +fi + +sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_F77= +if test -n "$hardcode_libdir_flag_spec_F77" || \ + test -n "$runpath_var_F77" || \ + test "X$hardcode_automatic_F77" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_F77" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && + test "$hardcode_minus_L_F77" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_F77=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_F77=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_F77=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 +echo "${ECHO_T}$hardcode_action_F77" >&6 + +if test "$hardcode_action_F77" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_F77 \ + CC_F77 \ + LD_F77 \ + lt_prog_compiler_wl_F77 \ + lt_prog_compiler_pic_F77 \ + lt_prog_compiler_static_F77 \ + lt_prog_compiler_no_builtin_flag_F77 \ + export_dynamic_flag_spec_F77 \ + thread_safe_flag_spec_F77 \ + whole_archive_flag_spec_F77 \ + enable_shared_with_static_runtimes_F77 \ + old_archive_cmds_F77 \ + old_archive_from_new_cmds_F77 \ + predep_objects_F77 \ + postdep_objects_F77 \ + predeps_F77 \ + postdeps_F77 \ + compiler_lib_search_path_F77 \ + compiler_lib_search_dirs_F77 \ + archive_cmds_F77 \ + archive_expsym_cmds_F77 \ + postinstall_cmds_F77 \ + postuninstall_cmds_F77 \ + old_archive_from_expsyms_cmds_F77 \ + allow_undefined_flag_F77 \ + no_undefined_flag_F77 \ + export_symbols_cmds_F77 \ + hardcode_libdir_flag_spec_F77 \ + hardcode_libdir_flag_spec_ld_F77 \ + hardcode_libdir_separator_F77 \ + hardcode_automatic_F77 \ + module_cmds_F77 \ + module_expsym_cmds_F77 \ + lt_cv_prog_compiler_c_o_F77 \ + fix_srcfile_path_F77 \ + exclude_expsyms_F77 \ + include_expsyms_F77; do + + case $var in + old_archive_cmds_F77 | \ + old_archive_from_new_cmds_F77 | \ + archive_cmds_F77 | \ + archive_expsym_cmds_F77 | \ + module_cmds_F77 | \ + module_expsym_cmds_F77 | \ + old_archive_from_expsyms_cmds_F77 | \ + export_symbols_cmds_F77 | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_F77 + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_compiler_F77 + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_F77 + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_F77 + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_F77 + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_F77 +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_F77 + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_F77 +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_F77 +archive_expsym_cmds=$lt_archive_expsym_cmds_F77 +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_F77 +module_expsym_cmds=$lt_module_expsym_cmds_F77 + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_F77 + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_F77 + +# The directories searched by this compiler when creating a shared +# library +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_F77 + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_F77 + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_F77 + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_F77 + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_F77 + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_F77 + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_F77 + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_F77 + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_F77 + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_F77 + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_F77 + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_F77 + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_F77 + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + + + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +objext_GCJ=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm -r conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${GCJ-"gcj"} +compiler=$CC +compiler_GCJ=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +archive_cmds_need_lc_GCJ=no + +old_archive_cmds_GCJ=$old_archive_cmds + + +lt_prog_compiler_no_builtin_flag_GCJ= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' + + +echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:16198: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:16202: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl_GCJ= +lt_prog_compiler_pic_GCJ= +lt_prog_compiler_static_GCJ= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + if test "$GCC" = yes; then + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_static_GCJ='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_GCJ='-fno-common' + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared_GCJ=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_GCJ=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_GCJ='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + else + lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic_GCJ='-qnocommon' + lt_prog_compiler_wl_GCJ='-Wl,' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + linux* | k*bsd*-gnu) + case $cc_basename in + icc* | ecc*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-fpic' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + lt_prog_compiler_wl_GCJ='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + lt_prog_compiler_wl_GCJ='' + ;; + esac + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_GCJ='-Qoption ld ';; + *) + lt_prog_compiler_wl_GCJ='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl_GCJ='-Qoption ld ' + lt_prog_compiler_pic_GCJ='-PIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_GCJ='-Kconform_pic' + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_can_build_shared_GCJ=no + ;; + + uts4*) + lt_prog_compiler_pic_GCJ='-pic' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_GCJ=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_GCJ"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_pic_works_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_pic_works_GCJ=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_GCJ" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:16488: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:16492: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works_GCJ=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_GCJ" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_pic_works_GCJ" >&6 + +if test x"$lt_cv_prog_compiler_pic_works_GCJ" = xyes; then + case $lt_prog_compiler_pic_GCJ in + "" | " "*) ;; + *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; + esac +else + lt_prog_compiler_pic_GCJ= + lt_prog_compiler_can_build_shared_GCJ=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_GCJ= + ;; + *) + lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" + ;; +esac + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\" +echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_static_works_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_static_works_GCJ=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works_GCJ=yes + fi + else + lt_cv_prog_compiler_static_works_GCJ=yes + fi + fi + $rm -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_GCJ" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_static_works_GCJ" >&6 + +if test x"$lt_cv_prog_compiler_static_works_GCJ" = xyes; then + : +else + lt_prog_compiler_static_GCJ= +fi + + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_GCJ=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:16592: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:16596: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_GCJ=yes + fi + fi + chmod u+w . 2>&5 + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag_GCJ= + enable_shared_with_static_runtimes_GCJ=no + archive_cmds_GCJ= + archive_expsym_cmds_GCJ= + old_archive_From_new_cmds_GCJ= + old_archive_from_expsyms_cmds_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= + thread_safe_flag_spec_GCJ= + hardcode_libdir_flag_spec_GCJ= + hardcode_libdir_flag_spec_ld_GCJ= + hardcode_libdir_separator_GCJ= + hardcode_direct_GCJ=no + hardcode_minus_L_GCJ=no + hardcode_shlibpath_var_GCJ=unsupported + link_all_deplibs_GCJ=unknown + hardcode_automatic_GCJ=no + module_cmds_GCJ= + module_expsym_cmds_GCJ= + always_export_symbols_GCJ=no + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_GCJ= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms_GCJ='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs_GCJ=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_GCJ=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_GCJ=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_GCJ=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_GCJ='-L$libdir' + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=no + enable_shared_with_static_runtimes_GCJ=yes + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + interix[3-9]*) + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + export_dynamic_flag_spec_GCJ='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | k*bsd*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec_GCJ='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + *) + tmp_sharedflag='-shared' ;; + esac + archive_cmds_GCJ='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs_GCJ=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs_GCJ=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs_GCJ=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + esac + + if test "$ld_shlibs_GCJ" = no; then + runpath_var= + hardcode_libdir_flag_spec_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=yes + archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L_GCJ=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_GCJ=unsupported + fi + ;; + + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_GCJ='' + hardcode_direct_GCJ=yes + hardcode_libdir_separator_GCJ=':' + link_all_deplibs_GCJ=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct_GCJ=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_GCJ=yes + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_libdir_separator_GCJ= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_GCJ=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_GCJ='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_GCJ="-z nodefs" + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_GCJ=' ${wl}-bernotok' + allow_undefined_flag_GCJ=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_GCJ='$convenience' + archive_cmds_need_lc_GCJ=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_GCJ=no + ;; + + bsdi[45]*) + export_dynamic_flag_spec_GCJ=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_GCJ=' ' + allow_undefined_flag_GCJ=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_GCJ='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_GCJ='lib -OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_GCJ=yes + ;; + + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[012]) + allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc_GCJ=no + hardcode_direct_GCJ=no + hardcode_automatic_GCJ=yes + hardcode_shlibpath_var_GCJ=unsupported + whole_archive_flag_spec_GCJ='' + link_all_deplibs_GCJ=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds_GCJ="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds_GCJ="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_GCJ="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_GCJ="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' + module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_GCJ=no + ;; + esac + fi + ;; + + dgux*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + freebsd1*) + ld_shlibs_GCJ=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + + hardcode_direct_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + ;; + *) + hardcode_direct_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + link_all_deplibs_GCJ=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + newsos6) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_shlibpath_var_GCJ=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + export_dynamic_flag_spec_GCJ='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + ;; + *) + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs_GCJ=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + allow_undefined_flag_GCJ=unsupported + archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec_GCJ='-rpath $libdir' + fi + hardcode_libdir_separator_GCJ=: + ;; + + solaris*) + no_undefined_flag_GCJ=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_shlibpath_var_GCJ=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs_GCJ=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_GCJ='$CC -r -o $output$reload_objs' + hardcode_direct_GCJ=no + ;; + motorola) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4.3*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + export_dynamic_flag_spec_GCJ='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_GCJ=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag_GCJ='${wl}-z,text' + archive_cmds_need_lc_GCJ=no + hardcode_shlibpath_var_GCJ=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag_GCJ='${wl}-z,text' + allow_undefined_flag_GCJ='${wl}-z,nodefs' + archive_cmds_need_lc_GCJ=no + hardcode_shlibpath_var_GCJ=no + hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator_GCJ=':' + link_all_deplibs_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + *) + ld_shlibs_GCJ=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 +echo "${ECHO_T}$ld_shlibs_GCJ" >&6 +test "$ld_shlibs_GCJ" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_GCJ" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_GCJ=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_GCJ in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_GCJ + pic_flag=$lt_prog_compiler_pic_GCJ + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ + allow_undefined_flag_GCJ= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_GCJ=no + else + archive_cmds_need_lc_GCJ=yes + fi + allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" + +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[3-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec" +fi + +sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec" +fi + +sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_GCJ= +if test -n "$hardcode_libdir_flag_spec_GCJ" || \ + test -n "$runpath_var_GCJ" || \ + test "X$hardcode_automatic_GCJ" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_GCJ" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && + test "$hardcode_minus_L_GCJ" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_GCJ=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_GCJ=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_GCJ=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 +echo "${ECHO_T}$hardcode_action_GCJ" >&6 + +if test "$hardcode_action_GCJ" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_GCJ \ + CC_GCJ \ + LD_GCJ \ + lt_prog_compiler_wl_GCJ \ + lt_prog_compiler_pic_GCJ \ + lt_prog_compiler_static_GCJ \ + lt_prog_compiler_no_builtin_flag_GCJ \ + export_dynamic_flag_spec_GCJ \ + thread_safe_flag_spec_GCJ \ + whole_archive_flag_spec_GCJ \ + enable_shared_with_static_runtimes_GCJ \ + old_archive_cmds_GCJ \ + old_archive_from_new_cmds_GCJ \ + predep_objects_GCJ \ + postdep_objects_GCJ \ + predeps_GCJ \ + postdeps_GCJ \ + compiler_lib_search_path_GCJ \ + compiler_lib_search_dirs_GCJ \ + archive_cmds_GCJ \ + archive_expsym_cmds_GCJ \ + postinstall_cmds_GCJ \ + postuninstall_cmds_GCJ \ + old_archive_from_expsyms_cmds_GCJ \ + allow_undefined_flag_GCJ \ + no_undefined_flag_GCJ \ + export_symbols_cmds_GCJ \ + hardcode_libdir_flag_spec_GCJ \ + hardcode_libdir_flag_spec_ld_GCJ \ + hardcode_libdir_separator_GCJ \ + hardcode_automatic_GCJ \ + module_cmds_GCJ \ + module_expsym_cmds_GCJ \ + lt_cv_prog_compiler_c_o_GCJ \ + fix_srcfile_path_GCJ \ + exclude_expsyms_GCJ \ + include_expsyms_GCJ; do + + case $var in + old_archive_cmds_GCJ | \ + old_archive_from_new_cmds_GCJ | \ + archive_cmds_GCJ | \ + archive_expsym_cmds_GCJ | \ + module_cmds_GCJ | \ + module_expsym_cmds_GCJ | \ + old_archive_from_expsyms_cmds_GCJ | \ + export_symbols_cmds_GCJ | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_GCJ + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_compiler_GCJ + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_GCJ + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_GCJ + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_GCJ + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_GCJ +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_GCJ + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_GCJ +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_GCJ +archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_GCJ +module_expsym_cmds=$lt_module_expsym_cmds_GCJ + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_GCJ + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_GCJ + +# The directories searched by this compiler when creating a shared +# library +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_GCJ + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_GCJ + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_GCJ + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_GCJ + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_GCJ + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_GCJ + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_GCJ + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_GCJ + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_GCJ + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_GCJ + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_GCJ + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_GCJ + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + else + tagname="" + fi + ;; + + RC) + + + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +objext_RC=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm -r conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${RC-"windres"} +compiler=$CC +compiler_RC=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + +lt_cv_prog_compiler_c_o_RC=yes + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_RC \ + CC_RC \ + LD_RC \ + lt_prog_compiler_wl_RC \ + lt_prog_compiler_pic_RC \ + lt_prog_compiler_static_RC \ + lt_prog_compiler_no_builtin_flag_RC \ + export_dynamic_flag_spec_RC \ + thread_safe_flag_spec_RC \ + whole_archive_flag_spec_RC \ + enable_shared_with_static_runtimes_RC \ + old_archive_cmds_RC \ + old_archive_from_new_cmds_RC \ + predep_objects_RC \ + postdep_objects_RC \ + predeps_RC \ + postdeps_RC \ + compiler_lib_search_path_RC \ + compiler_lib_search_dirs_RC \ + archive_cmds_RC \ + archive_expsym_cmds_RC \ + postinstall_cmds_RC \ + postuninstall_cmds_RC \ + old_archive_from_expsyms_cmds_RC \ + allow_undefined_flag_RC \ + no_undefined_flag_RC \ + export_symbols_cmds_RC \ + hardcode_libdir_flag_spec_RC \ + hardcode_libdir_flag_spec_ld_RC \ + hardcode_libdir_separator_RC \ + hardcode_automatic_RC \ + module_cmds_RC \ + module_expsym_cmds_RC \ + lt_cv_prog_compiler_c_o_RC \ + fix_srcfile_path_RC \ + exclude_expsyms_RC \ + include_expsyms_RC; do + + case $var in + old_archive_cmds_RC | \ + old_archive_from_new_cmds_RC | \ + archive_cmds_RC | \ + archive_expsym_cmds_RC | \ + module_cmds_RC | \ + module_expsym_cmds_RC | \ + old_archive_from_expsyms_cmds_RC | \ + export_symbols_cmds_RC | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_RC + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_compiler_RC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_RC + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_RC + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_RC + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_RC +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_RC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_RC +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_RC +archive_expsym_cmds=$lt_archive_expsym_cmds_RC +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_RC +module_expsym_cmds=$lt_module_expsym_cmds_RC + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_RC + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_RC + +# The directories searched by this compiler when creating a shared +# library +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_RC + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_RC + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_RC + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_RC + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_RC + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_RC + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_RC + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_RC + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_RC + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_RC + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_RC + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_RC + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_RC + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_RC + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + ;; + + *) + { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 +echo "$as_me: error: Unsupported tag name: $tagname" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 +echo "$as_me: error: unable to update list of available tagged configurations." >&2;} + { (exit 1); exit 1; }; } + fi +fi + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +# Prevent multiple expansion + + + + + + + + + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for C compiler vendor" >&5 +echo $ECHO_N "checking for C compiler vendor... $ECHO_C" >&6 +if test "${ax_cv_c_compiler_vendor+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ax_cv_c_compiler_vendor=unknown + # note: don't check for gcc first since some other compilers define __GNUC__ + for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ pathscale:__PATHCC__,__PATHSCALE__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do + vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + +#if !($vencpp) + thisisanerror; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ax_cv_c_compiler_vendor=`echo $ventest | cut -d: -f1`; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done + +fi +echo "$as_me:$LINENO: result: $ax_cv_c_compiler_vendor" >&5 +echo "${ECHO_T}$ax_cv_c_compiler_vendor" >&6 + + +if test "${build}" != "${host}" +then + # If we are doing a Canadian Cross, in which the host and build systems + # are not the same, we set reasonable default values for the tools. + + CC_FOR_BUILD=${CC_FOR_BUILD-gcc} + CPPFLAGS_FOR_BUILD="\$(CPPFLAGS)" + CC=${CC-${host_alias}-gcc} + CFLAGS=${CFLAGS-"-g -O2"} + CXX=${CXX-${host_alias}-c++} + CXXFLAGS=${CXXFLAGS-"-g -O2"} +else + # Set reasonable default values for some tools even if not Canadian. + # Of course, these are different reasonable default values, originally + # specified directly in the Makefile. + # We don't export, so that autoconf can do its job. + # Note that all these settings are above the fragment inclusion point + # in Makefile.in, so can still be overridden by fragments. + # This is all going to change when we autoconfiscate... + CC_FOR_BUILD="\$(CC)" + CPPFLAGS_FOR_BUILD="\$(CPPFLAGS)" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + + # We must set the default linker to the linker used by gcc for the correct + # operation of libtool. If LD is not defined and we are using gcc, try to + # set the LD default to the ld used by gcc. + if test -z "$LD" + then + if test "$GCC" = yes + then + case $build in + *-*-mingw*) + gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;; + *) + gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;; + esac + case $gcc_prog_ld in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + LD="$gcc_prog_ld" ;; + esac + fi + fi + + CXX=${CXX-"c++"} + CFLAGS=${CFLAGS-"-g -O2"} + CXXFLAGS=${CXXFLAGS-"-g -O2"} +fi + + + +echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_const=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_const=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 +if test $ac_cv_c_const = no; then + +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for inline" >&5 +echo $ECHO_N "checking for inline... $ECHO_C" >&6 +if test "${ac_cv_c_inline+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_inline=$ac_kw; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 +echo "${ECHO_T}$ac_cv_c_inline" >&6 + + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + +echo "$as_me:$LINENO: checking for working volatile" >&5 +echo $ECHO_N "checking for working volatile... $ECHO_C" >&6 +if test "${ac_cv_c_volatile+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + +volatile int x; +int * volatile y; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_volatile=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_volatile=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_volatile" >&5 +echo "${ECHO_T}$ac_cv_c_volatile" >&6 +if test $ac_cv_c_volatile = no; then + +cat >>confdefs.h <<\_ACEOF +#define volatile +_ACEOF + +fi + + +echo "$as_me:$LINENO: checking for long long" >&5 +echo $ECHO_N "checking for long long... $ECHO_C" >&6 +if test "${ac_cv_type_long_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((long long *) 0) + return 0; +if (sizeof (long long)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_long_long=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_long_long=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 +echo "${ECHO_T}$ac_cv_type_long_long" >&6 +if test $ac_cv_type_long_long = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_LONG_LONG 1 +_ACEOF + + +fi + +echo "$as_me:$LINENO: checking for long double" >&5 +echo $ECHO_N "checking for long double... $ECHO_C" >&6 +if test "${ac_cv_type_long_double+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((long double *) 0) + return 0; +if (sizeof (long double)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_long_double=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_long_double=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_long_double" >&5 +echo "${ECHO_T}$ac_cv_type_long_double" >&6 +if test $ac_cv_type_long_double = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_LONG_DOUBLE 1 +_ACEOF + + +fi + + +echo "$as_me:$LINENO: checking return type of signal handlers" >&5 +echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 +if test "${ac_cv_type_signal+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#ifdef signal +# undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int +main () +{ +int i; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_signal=void +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_signal=int +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 +echo "${ECHO_T}$ac_cv_type_signal" >&6 + +cat >>confdefs.h <<_ACEOF +#define RETSIGTYPE $ac_cv_type_signal +_ACEOF + + + +# Check whether --enable-doc or --disable-doc was given. +if test "${enable_doc+set}" = set; then + enableval="$enable_doc" + +fi; +# Check whether --enable-tests or --disable-tests was given. +if test "${enable_tests+set}" = set; then + enableval="$enable_tests" + +fi; +# Check whether --enable-test_data or --disable-test_data was given. +if test "${enable_test_data+set}" = set; then + enableval="$enable_test_data" + +fi; +# Check whether --enable-mmx or --disable-mmx was given. +if test "${enable_mmx+set}" = set; then + enableval="$enable_mmx" + +fi; +# Check whether --enable-sse or --disable-sse was given. +if test "${enable_sse+set}" = set; then + enableval="$enable_sse" + +fi; +# Check whether --enable-sse2 or --disable-sse2 was given. +if test "${enable_sse2+set}" = set; then + enableval="$enable_sse2" + +fi; +# Check whether --enable-sse3 or --disable-sse3 was given. +if test "${enable_sse3+set}" = set; then + enableval="$enable_sse3" + +fi; +# Check whether --enable-ssse3 or --disable-ssse3 was given. +if test "${enable_ssse3+set}" = set; then + enableval="$enable_ssse3" + +fi; +# Check whether --enable-sse4_1 or --disable-sse4_1 was given. +if test "${enable_sse4_1+set}" = set; then + enableval="$enable_sse4_1" + +fi; +# Check whether --enable-sse4_2 or --disable-sse4_2 was given. +if test "${enable_sse4_2+set}" = set; then + enableval="$enable_sse4_2" + +fi; +# Check whether --enable-sse4a or --disable-sse4a was given. +if test "${enable_sse4a+set}" = set; then + enableval="$enable_sse4a" + +fi; +# Check whether --enable-sse5 or --disable-sse5 was given. +if test "${enable_sse5+set}" = set; then + enableval="$enable_sse5" + +fi; +# Check whether --enable-fixed_point or --disable-fixed_point was given. +if test "${enable_fixed_point+set}" = set; then + enableval="$enable_fixed_point" + +fi; +# The following is for MSVC, where we may be using a local copy of libtiff, built alongside spandsp +# Check whether --enable-builtin_tiff or --disable-builtin_tiff was given. +if test "${enable_builtin_tiff+set}" = set; then + enableval="$enable_builtin_tiff" + enable_builtin_tiff="$enableval" +else + enable_builtin_tiff="no" +fi; + +echo "$as_me:$LINENO: checking for error_at_line" >&5 +echo $ECHO_N "checking for error_at_line... $ECHO_C" >&6 +if test "${ac_cv_lib_error_at_line+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +error_at_line (0, 0, "", 0, ""); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_error_at_line=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_error_at_line=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_error_at_line" >&5 +echo "${ECHO_T}$ac_cv_lib_error_at_line" >&6 +if test $ac_cv_lib_error_at_line = no; then + case $LIBOBJS in + "error.$ac_objext" | \ + *" error.$ac_objext" | \ + "error.$ac_objext "* | \ + *" error.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS error.$ac_objext" ;; +esac + +fi + + +for ac_func in vprintf +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +echo "$as_me:$LINENO: checking for _doprnt" >&5 +echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6 +if test "${ac_cv_func__doprnt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define _doprnt to an innocuous variant, in case declares _doprnt. + For example, HP-UX 11i declares gettimeofday. */ +#define _doprnt innocuous__doprnt + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char _doprnt (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef _doprnt + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char _doprnt (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub__doprnt) || defined (__stub____doprnt) +choke me +#else +char (*f) () = _doprnt; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != _doprnt; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func__doprnt=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func__doprnt=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 +echo "${ECHO_T}$ac_cv_func__doprnt" >&6 +if test $ac_cv_func__doprnt = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DOPRNT 1 +_ACEOF + +fi + +fi +done + + + +for ac_header in stdlib.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5 +echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6 +if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_malloc_0_nonnull=no +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#if STDC_HEADERS || HAVE_STDLIB_H +# include +#else +char *malloc (); +#endif + +int +main () +{ +exit (malloc (0) ? 0 : 1); + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_malloc_0_nonnull=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_malloc_0_nonnull=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5 +echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6 +if test $ac_cv_func_malloc_0_nonnull = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MALLOC 1 +_ACEOF + +else + cat >>confdefs.h <<\_ACEOF +#define HAVE_MALLOC 0 +_ACEOF + + case $LIBOBJS in + "malloc.$ac_objext" | \ + *" malloc.$ac_objext" | \ + "malloc.$ac_objext "* | \ + *" malloc.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; +esac + + +cat >>confdefs.h <<\_ACEOF +#define malloc rpl_malloc +_ACEOF + +fi + + + +echo "$as_me:$LINENO: checking for working memcmp" >&5 +echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6 +if test "${ac_cv_func_memcmp_working+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_memcmp_working=no +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + /* Some versions of memcmp are not 8-bit clean. */ + char c0 = 0x40, c1 = 0x80, c2 = 0x81; + if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) + exit (1); + + /* The Next x86 OpenStep bug shows up only when comparing 16 bytes + or more and with at least one buffer not starting on a 4-byte boundary. + William Lewis provided this test program. */ + { + char foo[21]; + char bar[21]; + int i; + for (i = 0; i < 4; i++) + { + char *a = foo + i; + char *b = bar + i; + strcpy (a, "--------01111111"); + strcpy (b, "--------10000000"); + if (memcmp (a, b, 16) >= 0) + exit (1); + } + exit (0); + } + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_memcmp_working=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_memcmp_working=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5 +echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6 +test $ac_cv_func_memcmp_working = no && case $LIBOBJS in + "memcmp.$ac_objext" | \ + *" memcmp.$ac_objext" | \ + "memcmp.$ac_objext "* | \ + *" memcmp.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; +esac + + + +for ac_header in stdlib.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +echo "$as_me:$LINENO: checking for GNU libc compatible realloc" >&5 +echo $ECHO_N "checking for GNU libc compatible realloc... $ECHO_C" >&6 +if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_realloc_0_nonnull=no +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#if STDC_HEADERS || HAVE_STDLIB_H +# include +#else +char *realloc (); +#endif + +int +main () +{ +exit (realloc (0, 0) ? 0 : 1); + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_realloc_0_nonnull=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_realloc_0_nonnull=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_realloc_0_nonnull" >&5 +echo "${ECHO_T}$ac_cv_func_realloc_0_nonnull" >&6 +if test $ac_cv_func_realloc_0_nonnull = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_REALLOC 1 +_ACEOF + +else + cat >>confdefs.h <<\_ACEOF +#define HAVE_REALLOC 0 +_ACEOF + + case $LIBOBJS in + "realloc.$ac_objext" | \ + *" realloc.$ac_objext" | \ + "realloc.$ac_objext "* | \ + *" realloc.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS realloc.$ac_objext" ;; +esac + + +cat >>confdefs.h <<\_ACEOF +#define realloc rpl_realloc +_ACEOF + +fi + + + + + +for ac_header in sys/select.h sys/socket.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +echo "$as_me:$LINENO: checking types of arguments for select" >&5 +echo $ECHO_N "checking types of arguments for select... $ECHO_C" >&6 +if test "${ac_cv_func_select_args+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + for ac_arg234 in 'fd_set *' 'int *' 'void *'; do + for ac_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do + for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#if HAVE_SYS_SELECT_H +# include +#endif +#if HAVE_SYS_SOCKET_H +# include +#endif + +int +main () +{ +extern int select ($ac_arg1, + $ac_arg234, $ac_arg234, $ac_arg234, + $ac_arg5); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3 +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done + done +done +# Provide a safe default value. +: ${ac_cv_func_select_args='int,int *,struct timeval *'} + +fi +echo "$as_me:$LINENO: result: $ac_cv_func_select_args" >&5 +echo "${ECHO_T}$ac_cv_func_select_args" >&6 +ac_save_IFS=$IFS; IFS=',' +set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'` +IFS=$ac_save_IFS +shift + +cat >>confdefs.h <<_ACEOF +#define SELECT_TYPE_ARG1 $1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define SELECT_TYPE_ARG234 ($2) +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define SELECT_TYPE_ARG5 ($3) +_ACEOF + +rm -f conftest* + + +echo "$as_me:$LINENO: checking for lrint" >&5 +echo $ECHO_N "checking for lrint... $ECHO_C" >&6 +if test "${ac_cv_c99_lrint+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +lrint_save_CFLAGS=$CFLAGS +CFLAGS="-lm" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _ISOC9X_SOURCE 1 +#define _ISOC99_SOURCE 1 +#define __USE_ISOC99 1 +#define __USE_ISOC9X 1 + +#include + +int +main () +{ +if (!lrint(3.14159)) lrint(2.7183); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c99_lrint=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c99_lrint=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +CFLAGS=$lrint_save_CFLAGS + + +fi +echo "$as_me:$LINENO: result: $ac_cv_c99_lrint" >&5 +echo "${ECHO_T}$ac_cv_c99_lrint" >&6 + +if test "$ac_cv_c99_lrint" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LRINT 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for lrintf" >&5 +echo $ECHO_N "checking for lrintf... $ECHO_C" >&6 +if test "${ac_cv_c99_lrintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +lrintf_save_CFLAGS=$CFLAGS +CFLAGS="-lm" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _ISOC9X_SOURCE 1 +#define _ISOC99_SOURCE 1 +#define __USE_ISOC99 1 +#define __USE_ISOC9X 1 + +#include + +int +main () +{ +if (!lrintf(3.14159)) lrintf(2.7183); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c99_lrintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c99_lrintf=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +CFLAGS=$lrintf_save_CFLAGS + + +fi +echo "$as_me:$LINENO: result: $ac_cv_c99_lrintf" >&5 +echo "${ECHO_T}$ac_cv_c99_lrintf" >&6 + +if test "$ac_cv_c99_lrintf" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LRINTF 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for llrint" >&5 +echo $ECHO_N "checking for llrint... $ECHO_C" >&6 +if test "${ac_cv_c99_llrint+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +llrint_save_CFLAGS=$CFLAGS +CFLAGS="-lm" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define ISOC9X_SOURCE 1 +#define _ISOC99_SOURCE 1 +#define __USE_ISOC99 1 +#define __USE_ISOC9X 1 + +#include + +int +main () +{ +long long int x ; x = llrint(3.14159) ; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c99_llrint=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c99_llrint=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +CFLAGS=$llrint_save_CFLAGS + + +fi +echo "$as_me:$LINENO: result: $ac_cv_c99_llrint" >&5 +echo "${ECHO_T}$ac_cv_c99_llrint" >&6 + +if test "$ac_cv_c99_llrint" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LLRINT 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for llrintf" >&5 +echo $ECHO_N "checking for llrintf... $ECHO_C" >&6 +if test "${ac_cv_c99_llrintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +llrintf_save_CFLAGS=$CFLAGS +CFLAGS="-lm" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _ISOC9X_SOURCE 1 +#define _ISOC99_SOURCE 1 +#define __USE_ISOC99 1 +#define __USE_ISOC9X 1 + +#include + +int +main () +{ +long long int x ; x = llrintf(3.14159) ; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c99_llrintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c99_llrintf=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +CFLAGS=$llrintf_save_CFLAGS + + +fi +echo "$as_me:$LINENO: result: $ac_cv_c99_llrintf" >&5 +echo "${ECHO_T}$ac_cv_c99_llrintf" >&6 + +if test "$ac_cv_c99_llrintf" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LLRINTF 1 +_ACEOF + +fi + + +if test "x$ac_cv_c99_lrint" = "xno" ; then + if test "x$ac_cv_c99_lrintf" = "xno" ; then + { echo "$as_me:$LINENO: WARNING: *** Missing C99 standard functions lrint() and lrintf()." >&5 +echo "$as_me: WARNING: *** Missing C99 standard functions lrint() and lrintf()." >&2;} + { echo "$as_me:$LINENO: WARNING: *** This may cause benign compiler warnings on some systems (ie Solaris)." >&5 +echo "$as_me: WARNING: *** This may cause benign compiler warnings on some systems (ie Solaris)." >&2;} + fi +fi + +echo "$as_me:$LINENO: checking if have C99 struct flexible array support" >&5 +echo $ECHO_N "checking if have C99 struct flexible array support... $ECHO_C" >&6 +if test "${ac_cv_c99_flexible_array+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Initialize to unknown +ac_cv_c99_flexible_array=no + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include + + typedef struct { + int k; + char buffer [] ; + } MY_STRUCT ; + +int +main () +{ + MY_STRUCT *p = calloc (1, sizeof (MY_STRUCT) + 42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c99_flexible_array=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c99_flexible_array=no + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c99_flexible_array" >&5 +echo "${ECHO_T}$ac_cv_c99_flexible_array" >&6 + + + +for ac_func in memmove +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_func in memset +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_func in select +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_func in strcasecmp +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_func in strchr +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_func in strdup +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_func in strerror +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_func in strstr +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_func in strtol +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_func in gettimeofday +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_func in drand48 +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6 +if test "${ac_cv_header_sys_wait_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#ifndef WEXITSTATUS +# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +#endif +#ifndef WIFEXITED +# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif + +int +main () +{ + int s; + wait (&s); + s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_sys_wait_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_sys_wait_h=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 +if test $ac_cv_header_sys_wait_h = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SYS_WAIT_H 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 +echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 +if test "${ac_cv_header_time+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include + +int +main () +{ +if ((struct tm *) 0) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_time=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_time=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 +echo "${ECHO_T}$ac_cv_header_time" >&6 +if test $ac_cv_header_time = yes; then + +cat >>confdefs.h <<\_ACEOF +#define TIME_WITH_SYS_TIME 1 +_ACEOF + +fi + + +# Check for header files. + +for ac_header in socket.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in inttypes.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + INSERT_INTTYPES_HEADER="#include " +fi + +done + + +for ac_header in stdint.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + INSERT_STDINT_HEADER="#include " +fi + +done + + +for ac_header in unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in stdlib.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in string.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in strings.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in malloc.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in tgmath.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + INSERT_TGMATH_HEADER="#include " +fi + +done + + +for ac_header in math.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + INSERT_MATH_HEADER="#include " +fi + +done + + +for ac_header in float.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in fcntl.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in sys/time.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in sys/select.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in sys/ioctl.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in sys/fcntl.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in sndfile.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in fftw3.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + +for ac_header in fftw.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +fi + +done + + +for ac_header in pthread.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +if test "${build}" == "${host}" +then + +for ac_header in X11/X.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +fi + +# Determine XML2 include path +echo "$as_me:$LINENO: checking for libxml/xmlmemory.h" >&5 +echo $ECHO_N "checking for libxml/xmlmemory.h... $ECHO_C" >&6 + +# Can we include headers using system include dirs? +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +int a = 1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + XML2_INCLUDE=" " +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +XML2_INCLUDE= + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +# Hunt through several possible directories to find the includes for libxml2 +if test "x$XML2_INCLUDE" = "x"; then + old_CPPFLAGS="$CPPFLAGS" + for i in $xml2_include_dir /usr/include /usr/local/include /usr/include/libxml2 /usr/local/include/libxml2 ; do + CPPFLAGS="$old_CPPFLAGS -I$i" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +int a = 1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + XML2_INCLUDE="-I$i" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +XML2_INCLUDE= + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + if test "x$XML2_INCLUDE" != "x"; then + break; + fi + done + CPPFLAGS="$old_CPPFLAGS $XML2_INCLUDE" +fi + + +for ac_header in libxml/xmlmemory.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in libxml/parser.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in libxml/xinclude.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + +for ac_header in FL/Fl.H +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in FL/Fl_Overlay_Window.H +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in FL/Fl_Light_Button.H +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in FL/fl_draw.H +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in FL/Fl_Cartesian.H +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in FL/Fl_Audio_Meter.H +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +if test "${build}" == "${host}" +then + case "${host}" in + x86_64-*) + # X86_64 Linux machines may have both 64 bit and 32 bit libraries. We need to choose the right set + as_ac_RealFile=`echo "ac_cv_real_file_${prefix}/lib64" | $as_tr_sh` +echo "$as_me:$LINENO: checking for ${prefix}/lib64" >&5 +echo $ECHO_N "checking for ${prefix}/lib64... $ECHO_C" >&6 +if eval "test \"\${$as_ac_RealFile+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + test "$cross_compiling" = yes && + { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 +echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} + { (exit 1); exit 1; }; } +if test -r "${prefix}/lib64" +then + if test -h "${prefix}/lib64" + then + eval "$as_ac_RealFile=no" + else + eval "$as_ac_RealFile=yes" + fi +else + eval "$as_ac_RealFile=no" +fi +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_RealFile'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_RealFile'}'`" >&6 +if test `eval echo '${'$as_ac_RealFile'}'` = yes; then + libdir='$(exec_prefix)/lib64' +fi + + echo "$as_me:$LINENO: checking for /usr/X11R6/lib64" >&5 +echo $ECHO_N "checking for /usr/X11R6/lib64... $ECHO_C" >&6 +if test "${ac_cv_real_file__usr_X11R6_lib64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + test "$cross_compiling" = yes && + { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 +echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} + { (exit 1); exit 1; }; } +if test -r "/usr/X11R6/lib64" +then + if test -h "/usr/X11R6/lib64" + then + ac_cv_real_file__usr_X11R6_lib64=no + else + ac_cv_real_file__usr_X11R6_lib64=yes + fi +else + ac_cv_real_file__usr_X11R6_lib64=no +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_real_file__usr_X11R6_lib64" >&5 +echo "${ECHO_T}$ac_cv_real_file__usr_X11R6_lib64" >&6 +if test $ac_cv_real_file__usr_X11R6_lib64 = yes; then + TESTLIBS="$TESTLIBS -L/usr/X11R6/lib64" +else + echo "$as_me:$LINENO: checking for /usr/X11R6/lib" >&5 +echo $ECHO_N "checking for /usr/X11R6/lib... $ECHO_C" >&6 +if test "${ac_cv_file__usr_X11R6_lib+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + test "$cross_compiling" = yes && + { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 +echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} + { (exit 1); exit 1; }; } +if test -r "/usr/X11R6/lib"; then + ac_cv_file__usr_X11R6_lib=yes +else + ac_cv_file__usr_X11R6_lib=no +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_file__usr_X11R6_lib" >&5 +echo "${ECHO_T}$ac_cv_file__usr_X11R6_lib" >&6 +if test $ac_cv_file__usr_X11R6_lib = yes; then + TESTLIBS="$TESTLIBS -L/usr/X11R6/lib" +fi + +fi + + # The very oldest AMD 64 bit chips support SSE2, SSE and MMX + enable_sse2="yes" + ;; + esac +fi + + +echo "$as_me:$LINENO: checking for cos in -lm" >&5 +echo $ECHO_N "checking for cos in -lm... $ECHO_C" >&6 +if test "${ac_cv_lib_m_cos+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char cos (); +int +main () +{ +cos (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_m_cos=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_m_cos=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_m_cos" >&5 +echo "${ECHO_T}$ac_cv_lib_m_cos" >&6 +if test $ac_cv_lib_m_cos = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBM 1 +_ACEOF + + LIBS="-lm $LIBS" + +fi + +# Some platforms still seem to lack the basic single precision trig and power related function. +echo "$as_me:$LINENO: checking for library containing sinf" >&5 +echo $ECHO_N "checking for library containing sinf... $ECHO_C" >&6 +if test "${ac_cv_search_sinf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_sinf=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char sinf (); +int +main () +{ +sinf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_sinf="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_sinf" = no; then + for ac_lib in m; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char sinf (); +int +main () +{ +sinf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_sinf="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_sinf" >&5 +echo "${ECHO_T}$ac_cv_search_sinf" >&6 +if test "$ac_cv_search_sinf" != no; then + test "$ac_cv_search_sinf" = "none required" || LIBS="$ac_cv_search_sinf $LIBS" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SINF 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for library containing cosf" >&5 +echo $ECHO_N "checking for library containing cosf... $ECHO_C" >&6 +if test "${ac_cv_search_cosf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_cosf=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char cosf (); +int +main () +{ +cosf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_cosf="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_cosf" = no; then + for ac_lib in m; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char cosf (); +int +main () +{ +cosf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_cosf="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_cosf" >&5 +echo "${ECHO_T}$ac_cv_search_cosf" >&6 +if test "$ac_cv_search_cosf" != no; then + test "$ac_cv_search_cosf" = "none required" || LIBS="$ac_cv_search_cosf $LIBS" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_COSF 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for library containing tanf" >&5 +echo $ECHO_N "checking for library containing tanf... $ECHO_C" >&6 +if test "${ac_cv_search_tanf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_tanf=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char tanf (); +int +main () +{ +tanf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_tanf="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_tanf" = no; then + for ac_lib in m; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char tanf (); +int +main () +{ +tanf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_tanf="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_tanf" >&5 +echo "${ECHO_T}$ac_cv_search_tanf" >&6 +if test "$ac_cv_search_tanf" != no; then + test "$ac_cv_search_tanf" = "none required" || LIBS="$ac_cv_search_tanf $LIBS" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_TANF 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for library containing asinf" >&5 +echo $ECHO_N "checking for library containing asinf... $ECHO_C" >&6 +if test "${ac_cv_search_asinf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_asinf=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char asinf (); +int +main () +{ +asinf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_asinf="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_asinf" = no; then + for ac_lib in m; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char asinf (); +int +main () +{ +asinf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_asinf="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_asinf" >&5 +echo "${ECHO_T}$ac_cv_search_asinf" >&6 +if test "$ac_cv_search_asinf" != no; then + test "$ac_cv_search_asinf" = "none required" || LIBS="$ac_cv_search_asinf $LIBS" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ASINF 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for library containing acosf" >&5 +echo $ECHO_N "checking for library containing acosf... $ECHO_C" >&6 +if test "${ac_cv_search_acosf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_acosf=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char acosf (); +int +main () +{ +acosf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_acosf="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_acosf" = no; then + for ac_lib in m; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char acosf (); +int +main () +{ +acosf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_acosf="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_acosf" >&5 +echo "${ECHO_T}$ac_cv_search_acosf" >&6 +if test "$ac_cv_search_acosf" != no; then + test "$ac_cv_search_acosf" = "none required" || LIBS="$ac_cv_search_acosf $LIBS" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ACOSF 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for library containing atanf" >&5 +echo $ECHO_N "checking for library containing atanf... $ECHO_C" >&6 +if test "${ac_cv_search_atanf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_atanf=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char atanf (); +int +main () +{ +atanf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_atanf="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_atanf" = no; then + for ac_lib in m; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char atanf (); +int +main () +{ +atanf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_atanf="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_atanf" >&5 +echo "${ECHO_T}$ac_cv_search_atanf" >&6 +if test "$ac_cv_search_atanf" != no; then + test "$ac_cv_search_atanf" = "none required" || LIBS="$ac_cv_search_atanf $LIBS" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ATANF 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for library containing atan2f" >&5 +echo $ECHO_N "checking for library containing atan2f... $ECHO_C" >&6 +if test "${ac_cv_search_atan2f+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_atan2f=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char atan2f (); +int +main () +{ +atan2f (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_atan2f="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_atan2f" = no; then + for ac_lib in m; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char atan2f (); +int +main () +{ +atan2f (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_atan2f="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_atan2f" >&5 +echo "${ECHO_T}$ac_cv_search_atan2f" >&6 +if test "$ac_cv_search_atan2f" != no; then + test "$ac_cv_search_atan2f" = "none required" || LIBS="$ac_cv_search_atan2f $LIBS" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ATAN2F 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for library containing ceilf" >&5 +echo $ECHO_N "checking for library containing ceilf... $ECHO_C" >&6 +if test "${ac_cv_search_ceilf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_ceilf=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char ceilf (); +int +main () +{ +ceilf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_ceilf="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_ceilf" = no; then + for ac_lib in m; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char ceilf (); +int +main () +{ +ceilf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_ceilf="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_ceilf" >&5 +echo "${ECHO_T}$ac_cv_search_ceilf" >&6 +if test "$ac_cv_search_ceilf" != no; then + test "$ac_cv_search_ceilf" = "none required" || LIBS="$ac_cv_search_ceilf $LIBS" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_CEILF 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for library containing floorf" >&5 +echo $ECHO_N "checking for library containing floorf... $ECHO_C" >&6 +if test "${ac_cv_search_floorf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_floorf=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char floorf (); +int +main () +{ +floorf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_floorf="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_floorf" = no; then + for ac_lib in m; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char floorf (); +int +main () +{ +floorf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_floorf="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_floorf" >&5 +echo "${ECHO_T}$ac_cv_search_floorf" >&6 +if test "$ac_cv_search_floorf" != no; then + test "$ac_cv_search_floorf" = "none required" || LIBS="$ac_cv_search_floorf $LIBS" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_FLOORF 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for library containing powf" >&5 +echo $ECHO_N "checking for library containing powf... $ECHO_C" >&6 +if test "${ac_cv_search_powf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_powf=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char powf (); +int +main () +{ +powf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_powf="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_powf" = no; then + for ac_lib in m; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char powf (); +int +main () +{ +powf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_powf="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_powf" >&5 +echo "${ECHO_T}$ac_cv_search_powf" >&6 +if test "$ac_cv_search_powf" != no; then + test "$ac_cv_search_powf" = "none required" || LIBS="$ac_cv_search_powf $LIBS" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_POWF 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for library containing expf" >&5 +echo $ECHO_N "checking for library containing expf... $ECHO_C" >&6 +if test "${ac_cv_search_expf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_expf=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char expf (); +int +main () +{ +expf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_expf="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_expf" = no; then + for ac_lib in m; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char expf (); +int +main () +{ +expf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_expf="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_expf" >&5 +echo "${ECHO_T}$ac_cv_search_expf" >&6 +if test "$ac_cv_search_expf" != no; then + test "$ac_cv_search_expf" = "none required" || LIBS="$ac_cv_search_expf $LIBS" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_EXPF 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for library containing logf" >&5 +echo $ECHO_N "checking for library containing logf... $ECHO_C" >&6 +if test "${ac_cv_search_logf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_logf=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char logf (); +int +main () +{ +logf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_logf="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_logf" = no; then + for ac_lib in m; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char logf (); +int +main () +{ +logf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_logf="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_logf" >&5 +echo "${ECHO_T}$ac_cv_search_logf" >&6 +if test "$ac_cv_search_logf" != no; then + test "$ac_cv_search_logf" = "none required" || LIBS="$ac_cv_search_logf $LIBS" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LOGF 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for library containing log10f" >&5 +echo $ECHO_N "checking for library containing log10f... $ECHO_C" >&6 +if test "${ac_cv_search_log10f+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_log10f=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char log10f (); +int +main () +{ +log10f (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_log10f="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_log10f" = no; then + for ac_lib in m; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char log10f (); +int +main () +{ +log10f (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_log10f="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_log10f" >&5 +echo "${ECHO_T}$ac_cv_search_log10f" >&6 +if test "$ac_cv_search_log10f" != no; then + test "$ac_cv_search_log10f" = "none required" || LIBS="$ac_cv_search_log10f $LIBS" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LOG10F 1 +_ACEOF + +fi + + +# Checks for libraries. +echo "$as_me:$LINENO: checking for xmlParseFile in -lxml2" >&5 +echo $ECHO_N "checking for xmlParseFile in -lxml2... $ECHO_C" >&6 +if test "${ac_cv_lib_xml2_xmlParseFile+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lxml2 $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char xmlParseFile (); +int +main () +{ +xmlParseFile (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_xml2_xmlParseFile=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_xml2_xmlParseFile=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_xml2_xmlParseFile" >&5 +echo "${ECHO_T}$ac_cv_lib_xml2_xmlParseFile" >&6 +if test $ac_cv_lib_xml2_xmlParseFile = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBXML2 1 +_ACEOF + SIMLIBS="$SIMLIBS -lxml2" +fi + + +if test -n "$enable_tests" ; then + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + echo "$as_me:$LINENO: checking for sf_open in -lsndfile" >&5 +echo $ECHO_N "checking for sf_open in -lsndfile... $ECHO_C" >&6 +if test "${ac_cv_lib_sndfile_sf_open+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsndfile $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char sf_open (); +int +main () +{ +sf_open (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_sndfile_sf_open=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_sndfile_sf_open=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_sndfile_sf_open" >&5 +echo "${ECHO_T}$ac_cv_lib_sndfile_sf_open" >&6 +if test $ac_cv_lib_sndfile_sf_open = yes; then + SIMLIBS="$SIMLIBS -lsndfile" +else + { { echo "$as_me:$LINENO: error: \"Can't make tests without libsndfile (does your system require a libsndfile-devel package?)\"" >&5 +echo "$as_me: error: \"Can't make tests without libsndfile (does your system require a libsndfile-devel package?)\"" >&2;} + { (exit 1); exit 1; }; } +fi + + echo "$as_me:$LINENO: checking for fftw_plan_dft_1d in -lfftw3" >&5 +echo $ECHO_N "checking for fftw_plan_dft_1d in -lfftw3... $ECHO_C" >&6 +if test "${ac_cv_lib_fftw3_fftw_plan_dft_1d+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lfftw3 $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char fftw_plan_dft_1d (); +int +main () +{ +fftw_plan_dft_1d (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_fftw3_fftw_plan_dft_1d=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_fftw3_fftw_plan_dft_1d=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_fftw3_fftw_plan_dft_1d" >&5 +echo "${ECHO_T}$ac_cv_lib_fftw3_fftw_plan_dft_1d" >&6 +if test $ac_cv_lib_fftw3_fftw_plan_dft_1d = yes; then + SIMLIBS="$SIMLIBS -lfftw3" +else + echo "$as_me:$LINENO: checking for fftw_create_plan in -lfftw" >&5 +echo $ECHO_N "checking for fftw_create_plan in -lfftw... $ECHO_C" >&6 +if test "${ac_cv_lib_fftw_fftw_create_plan+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lfftw $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char fftw_create_plan (); +int +main () +{ +fftw_create_plan (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_fftw_fftw_create_plan=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_fftw_fftw_create_plan=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_fftw_fftw_create_plan" >&5 +echo "${ECHO_T}$ac_cv_lib_fftw_fftw_create_plan" >&6 +if test $ac_cv_lib_fftw_fftw_create_plan = yes; then + SIMLIBS="$SIMLIBS -lfftw" +else + { { echo "$as_me:$LINENO: error: \"Can't make tests without FFTW 2 or 3 (does your system require an fftw?-devel package?)\"" >&5 +echo "$as_me: error: \"Can't make tests without FFTW 2 or 3 (does your system require an fftw?-devel package?)\"" >&2;} + { (exit 1); exit 1; }; } +fi + +fi + + echo "$as_me:$LINENO: checking for pthread_attr_init in -lpthread" >&5 +echo $ECHO_N "checking for pthread_attr_init in -lpthread... $ECHO_C" >&6 +if test "${ac_cv_lib_pthread_pthread_attr_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_attr_init (); +int +main () +{ +pthread_attr_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pthread_pthread_attr_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthread_pthread_attr_init=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_attr_init" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread_pthread_attr_init" >&6 +if test $ac_cv_lib_pthread_pthread_attr_init = yes; then + TESTLIBS="$TESTLIBS -lpthread" +fi + + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + TESTLIBS="$TESTLIBS -ldl" +fi + + echo "$as_me:$LINENO: checking for XftFontOpen in -lXft" >&5 +echo $ECHO_N "checking for XftFontOpen in -lXft... $ECHO_C" >&6 +if test "${ac_cv_lib_Xft_XftFontOpen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXft $TESTLIBS $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XftFontOpen (); +int +main () +{ +XftFontOpen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_Xft_XftFontOpen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_Xft_XftFontOpen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_Xft_XftFontOpen" >&5 +echo "${ECHO_T}$ac_cv_lib_Xft_XftFontOpen" >&6 +if test $ac_cv_lib_Xft_XftFontOpen = yes; then + TESTLIBS="$TESTLIBS -lXft" +fi + + echo "$as_me:$LINENO: checking for XextCreateExtension in -lXext" >&5 +echo $ECHO_N "checking for XextCreateExtension in -lXext... $ECHO_C" >&6 +if test "${ac_cv_lib_Xext_XextCreateExtension+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXext $TESTLIBS $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XextCreateExtension (); +int +main () +{ +XextCreateExtension (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_Xext_XextCreateExtension=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_Xext_XextCreateExtension=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_Xext_XextCreateExtension" >&5 +echo "${ECHO_T}$ac_cv_lib_Xext_XextCreateExtension" >&6 +if test $ac_cv_lib_Xext_XextCreateExtension = yes; then + TESTLIBS="$TESTLIBS -lXext" +fi + + echo "$as_me:$LINENO: checking for XOpenDisplay in -lX11" >&5 +echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6 +if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lX11 $TESTLIBS $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XOpenDisplay (); +int +main () +{ +XOpenDisplay (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_X11_XOpenDisplay=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_X11_XOpenDisplay=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_X11_XOpenDisplay" >&5 +echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6 +if test $ac_cv_lib_X11_XOpenDisplay = yes; then + TESTLIBS="$TESTLIBS -lX11" +fi + + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + echo "$as_me:$LINENO: checking for main in -lfltk" >&5 +echo $ECHO_N "checking for main in -lfltk... $ECHO_C" >&6 +if test "${ac_cv_lib_fltk_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lfltk $TESTLIBS $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_fltk_main=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_fltk_main=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_fltk_main" >&5 +echo "${ECHO_T}$ac_cv_lib_fltk_main" >&6 +if test $ac_cv_lib_fltk_main = yes; then + TESTLIBS="$TESTLIBS -lfltk -lsupc++" +fi + + echo "$as_me:$LINENO: checking for main in -lfltk_cartesian" >&5 +echo $ECHO_N "checking for main in -lfltk_cartesian... $ECHO_C" >&6 +if test "${ac_cv_lib_fltk_cartesian_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lfltk_cartesian $TESTLIBS $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_fltk_cartesian_main=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_fltk_cartesian_main=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_fltk_cartesian_main" >&5 +echo "${ECHO_T}$ac_cv_lib_fltk_cartesian_main" >&6 +if test $ac_cv_lib_fltk_cartesian_main = yes; then + TESTLIBS="-lfltk_cartesian $TESTLIBS" +fi + + echo "$as_me:$LINENO: checking for main in -lfltk_audio_meter" >&5 +echo $ECHO_N "checking for main in -lfltk_audio_meter... $ECHO_C" >&6 +if test "${ac_cv_lib_fltk_audio_meter_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lfltk_audio_meter $TESTLIBS $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_fltk_audio_meter_main=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_fltk_audio_meter_main=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_fltk_audio_meter_main" >&5 +echo "${ECHO_T}$ac_cv_lib_fltk_audio_meter_main" >&6 +if test $ac_cv_lib_fltk_audio_meter_main = yes; then + TESTLIBS="-lfltk_audio_meter $TESTLIBS" +fi + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi + +echo "$as_me:$LINENO: checking if $host supports library symbol export" >&5 +echo $ECHO_N "checking if $host supports library symbol export... $ECHO_C" >&6 +if test "${ac_cv_symbol_export_capability+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Initialize to unknown +ac_cv_symbol_export_capability="no" + +case "${ax_cv_c_compiler_vendor}" in +gnu) + save_CFLAGS="${CFLAGS}" + CFLAGS="${CFLAGS} -fvisibility=hidden" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int foo __attribute__ ((visibility("default"))); +int +main () +{ +; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + COMP_VENDOR_CFLAGS="-fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 $COMP_VENDOR_CFLAGS" + COMP_VENDOR_CXXFLAGS="-fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 $COMP_VENDOR_CXXFLAGS" + ac_cv_symbol_export_capability="yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="${save_CFLAGS}" + ;; + +sun) + save_CFLAGS="${CFLAGS}" + CFLAGS="${CFLAGS} -xldscope=hidden" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int foo __attribute__ ((visibility("default"))); +int +main () +{ +; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + COMP_VENDOR_CFLAGS="-xldscope=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 $COMP_VENDOR_CFLAGS" + COMP_VENDOR_CXXFLAGS="-xldscope=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 $COMP_VENDOR_CXXFLAGS" + ac_cv_symbol_export_capability="yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="${save_CFLAGS}" + ;; + +esac +fi +echo "$as_me:$LINENO: result: $ac_cv_symbol_export_capability" >&5 +echo "${ECHO_T}$ac_cv_symbol_export_capability" >&6 +if test $ac_cv_symbol_export_capability = yes; then + +cat >>confdefs.h <<\_ACEOF +#define SPANDSP_USE_EXPORT_CAPABILITY 1 +_ACEOF + + SPANDSP_USE_EXPORT_CAPABILITY="#define SPANDSP_USE_EXPORT_CAPABILITY 1" +else + SPANDSP_USE_EXPORT_CAPABILITY="#undef SPANDSP_USE_EXPORT_CAPABILITY" +fi + + +case "${ax_cv_c_compiler_vendor}" in +gnu) + COMP_VENDOR_CFLAGS="-std=gnu99 -ffast-math -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS" + if test "$enable_sse5" = "yes" ; then + COMP_VENDOR_CFLAGS="-msse5 $COMP_VENDOR_CFLAGS" + fi + if test "$enable_sse4a" = "yes" ; then + COMP_VENDOR_CFLAGS="-msse4a $COMP_VENDOR_CFLAGS" + fi + if test "$enable_sse4_2" = "yes" ; then + COMP_VENDOR_CFLAGS="-msse42 $COMP_VENDOR_CFLAGS" + fi + if test "$enable_sse4_1" = "yes" ; then + COMP_VENDOR_CFLAGS="-msse41 $COMP_VENDOR_CFLAGS" + fi + if test "$enable_ssse3" = "yes" ; then + COMP_VENDOR_CFLAGS="-mssse3 $COMP_VENDOR_CFLAGS" + fi + if test "$enable_sse3" = "yes" ; then + COMP_VENDOR_CFLAGS="-msse3 $COMP_VENDOR_CFLAGS" + fi + if test "$enable_sse2" = "yes" ; then + COMP_VENDOR_CFLAGS="-msse2 $COMP_VENDOR_CFLAGS" + fi + if test "$enable_sse" = "yes" ; then + COMP_VENDOR_CFLAGS="-msse $COMP_VENDOR_CFLAGS" + fi + if test "$enable_mmx" = "yes" ; then + COMP_VENDOR_CFLAGS="-mmmx $COMP_VENDOR_CFLAGS" + fi + case $host_os in + mingw* | cygwin*) + COMP_VENDOR_LDFLAGS="-no-undefined" + ;; + *) + COMP_VENDOR_LDFLAGS= + ;; + esac + ;; +sun) + COMP_VENDOR_CFLAGS="-xc99=all -mt -xCC -errwarn=%all -xvpara $COMP_VENDOR_CFLAGS" + if test "$enable_sse3" = "yes" ; then + COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS" + fi + if test "$enable_sse2" = "yes" ; then + COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS" + fi + if test "$enable_sse" = "yes" ; then + COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS" + fi + if test "$enable_mmx" = "yes" ; then + COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS" + fi + COMP_VENDOR_LDFLAGS= + + new_val="" + removed=0 + for i in $CFLAGS; do + if test "x$i" != "x-Xc"; then + new_val="$new_val $i" + else + removed=1 + fi + done + if test $removed = "1"; then + echo " removed \"-Xc\" from CFLAGS" + CFLAGS=$new_val + fi + + ;; +*) + COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS" + COMP_VENDOR_LDFLAGS= + ;; +esac + +COMP_VENDOR_CFLAGS="-DNDEBUG $COMP_VENDOR_CFLAGS" + + + +if test "$enable_doc" = yes; then + COND_DOC_TRUE= + COND_DOC_FALSE='#' +else + COND_DOC_TRUE='#' + COND_DOC_FALSE= +fi + + + +if test "$enable_tests" = yes; then + COND_TESTS_TRUE= + COND_TESTS_FALSE='#' +else + COND_TESTS_TRUE='#' + COND_TESTS_FALSE= +fi + + + +if test "$enable_test_data" = yes; then + COND_TESTDATA_TRUE= + COND_TESTDATA_FALSE='#' +else + COND_TESTDATA_TRUE='#' + COND_TESTDATA_FALSE= +fi + + + +if test "$enable_mmx" = yes; then + COND_MMX_TRUE= + COND_MMX_FALSE='#' +else + COND_MMX_TRUE='#' + COND_MMX_FALSE= +fi + + + +if test "$enable_sse" = yes; then + COND_SSE_TRUE= + COND_SSE_FALSE='#' +else + COND_SSE_TRUE='#' + COND_SSE_FALSE= +fi + + + +if test "$enable_sse2" = yes; then + COND_SSE2_TRUE= + COND_SSE2_FALSE='#' +else + COND_SSE2_TRUE='#' + COND_SSE2_FALSE= +fi + + + +if test "$enable_sse3" = yes; then + COND_SSE3_TRUE= + COND_SSE3_FALSE='#' +else + COND_SSE3_TRUE='#' + COND_SSE3_FALSE= +fi + + + +if test "$enable_ssse3" = yes; then + COND_SSSE3_TRUE= + COND_SSSE3_FALSE='#' +else + COND_SSSE3_TRUE='#' + COND_SSSE3_FALSE= +fi + + + +if test "$enable_sse4_1" = yes; then + COND_SSE4_1_TRUE= + COND_SSE4_1_FALSE='#' +else + COND_SSE4_1_TRUE='#' + COND_SSE4_1_FALSE= +fi + + + +if test "$enable_sse4_2" = yes; then + COND_SSE4_2_TRUE= + COND_SSE4_2_FALSE='#' +else + COND_SSE4_2_TRUE='#' + COND_SSE4_2_FALSE= +fi + + + +if test "$enable_sse4a" = yes; then + COND_SSE4A_TRUE= + COND_SSE4A_FALSE='#' +else + COND_SSE4A_TRUE='#' + COND_SSE4A_FALSE= +fi + + + +if test "$enable_sse5" = yes; then + COND_SSE5_TRUE= + COND_SSE5_FALSE='#' +else + COND_SSE5_TRUE='#' + COND_SSE5_FALSE= +fi + +if test "$enable_fixed_point" = "yes" ; then + +cat >>confdefs.h <<\_ACEOF +#define SPANDSP_USE_FIXED_POINT 1 +_ACEOF + + SPANDSP_USE_FIXED_POINT="#define SPANDSP_USE_FIXED_POINT 1" +else + as_ac_FixedPoint=`echo "ac_cv_fixed_point_machine_$host" | $as_tr_sh` +echo "$as_me:$LINENO: checking if $host is fixed point only" >&5 +echo $ECHO_N "checking if $host is fixed point only... $ECHO_C" >&6 +if eval "test \"\${$as_ac_FixedPoint+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $host in + arc | arm | armble | armelb | armv2345 | armv345lb \ + | bfin \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | tic54x | c54x* | tic55x | c55x* | tic6x | c6x* \ + | xscale | xscaleebl \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | bfin-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | xscale-* | xscaleebl-* ) + eval "$as_ac_FixedPoint=yes" + ;; + *) + eval "$as_ac_FixedPoint=no" + ;; +esac +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_FixedPoint'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_FixedPoint'}'`" >&6 +if test `eval echo '${'$as_ac_FixedPoint'}'` = yes; then + +cat >>confdefs.h <<\_ACEOF +#define SPANDSP_USE_FIXED_POINT 1 +_ACEOF + + SPANDSP_USE_FIXED_POINT="#define SPANDSP_USE_FIXED_POINT 1" +else + SPANDSP_USE_FIXED_POINT="#undef SPANDSP_USE_FIXED_POINT" +fi + +fi +as_ac_MisalignedAccessFails=`echo "ac_cv_misaligned_access_fails_$host" | $as_tr_sh` +echo "$as_me:$LINENO: checking if $host fails on misaligned memory access" >&5 +echo $ECHO_N "checking if $host fails on misaligned memory access... $ECHO_C" >&6 +if eval "test \"\${$as_ac_MisalignedAccessFails+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $host in + arc | arm | armble | armelb | armv2345 | armv345lb \ + | bfin \ + | sparc \ + | xscale | xscaleebl \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | bfin-* \ + | sparc-* \ + | xscale-* | xscaleebl-* ) + eval "$as_ac_MisalignedAccessFails=yes" + ;; + *) + eval "$as_ac_MisalignedAccessFails=no" + ;; +esac +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_MisalignedAccessFails'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_MisalignedAccessFails'}'`" >&6 +if test `eval echo '${'$as_ac_MisalignedAccessFails'}'` = yes; then + +cat >>confdefs.h <<\_ACEOF +#define SPANDSP_MISALIGNED_ACCESS_FAILS 1 +_ACEOF + + SPANDSP_MISALIGNED_ACCESS_FAILS="#define SPANDSP_MISALIGNED_ACCESS_FAILS 1" +else + SPANDSP_MISALIGNED_ACCESS_FAILS="#undef SPANDSP_MISALIGNED_ACCESS_FAILS" +fi + + +if test "$enable_sse5" = "yes" ; then + +cat >>confdefs.h <<\_ACEOF +#define SPANDSP_USE_SSE5 1 +_ACEOF + + enable_sse4a="yes" +fi +if test "$enable_sse4a" = "yes" ; then + +cat >>confdefs.h <<\_ACEOF +#define SPANDSP_USE_SSE4A 1 +_ACEOF + + enable_sse4_2="yes" +fi +if test "$enable_sse4_2" = "yes" ; then + +cat >>confdefs.h <<\_ACEOF +#define SPANDSP_USE_SSE4_2 1 +_ACEOF + + enable_sse4_1="yes" +fi +if test "$enable_sse4_1" = "yes" ; then + +cat >>confdefs.h <<\_ACEOF +#define SPANDSP_USE_SSE4_1 1 +_ACEOF + + enable_ssse3="yes" +fi +if test "$enable_ssse3" = "yes" ; then + +cat >>confdefs.h <<\_ACEOF +#define SPANDSP_USE_SSSE3 1 +_ACEOF + + enable_sse3="yes" +fi +if test "$enable_sse3" = "yes" ; then + +cat >>confdefs.h <<\_ACEOF +#define SPANDSP_USE_SSE3 1 +_ACEOF + + enable_sse2="yes" +fi +if test "$enable_sse2" = "yes" ; then + +cat >>confdefs.h <<\_ACEOF +#define SPANDSP_USE_SSE2 1 +_ACEOF + + enable_sse="yes" +fi +if test "$enable_sse" = "yes" ; then + +cat >>confdefs.h <<\_ACEOF +#define SPANDSP_USE_SSE 1 +_ACEOF + + enable_mmx="yes" +fi +if test "$enable_mmx" = "yes" ; then + +cat >>confdefs.h <<\_ACEOF +#define SPANDSP_USE_MMX 1 +_ACEOF + +fi + +if test "$enable_builtin_tiff" = "yes" ; then + abs_tiffdir="`cd $srcdir/../tiff-3.8.2/ && pwd`" + save_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -I$abs_tiffdir/libtiff" + +for ac_header in tiffio.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + CFLAGS="$save_CFLAGS" + COMP_VENDOR_CFLAGS="-I$abs_tiffdir/libtiff $COMP_VENDOR_CFLAGS" + COMP_VENDOR_LDFLAGS="-L$abs_tiffdir/libtiff $COMP_VENDOR_LDFLAGS" + LIBS="$LIBS $abs_tiffdir/libtiff/libtiff.la" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBTIFF 1 +_ACEOF + +else + +for ac_header in tiffio.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +echo "$as_me:$LINENO: checking for TIFFOpen in -ltiff" >&5 +echo $ECHO_N "checking for TIFFOpen in -ltiff... $ECHO_C" >&6 +if test "${ac_cv_lib_tiff_TIFFOpen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ltiff -lm $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char TIFFOpen (); +int +main () +{ +TIFFOpen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_tiff_TIFFOpen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_tiff_TIFFOpen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_tiff_TIFFOpen" >&5 +echo "${ECHO_T}$ac_cv_lib_tiff_TIFFOpen" >&6 +if test $ac_cv_lib_tiff_TIFFOpen = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBTIFF 1 +_ACEOF + + LIBS="-ltiff $LIBS" + +else + { { echo "$as_me:$LINENO: error: \"Can't build without libtiff (does your system require a libtiff-devel package?)\"" >&5 +echo "$as_me: error: \"Can't build without libtiff (does your system require a libtiff-devel package?)\"" >&2;} + { (exit 1); exit 1; }; } +fi + +fi + +TESTLIBS="$SIMLIBS $TESTLIBS" + + + + + + + + + + + + + + + + ac_config_files="$ac_config_files Makefile doc/Makefile doc/doxygen src/Makefile src/spandsp.h spandsp-sim/Makefile test-data/Makefile test-data/etsi/Makefile test-data/etsi/fax/Makefile test-data/itu/Makefile test-data/itu/fax/Makefile test-data/local/Makefile tests/Makefile spandsp.pc spandsp.spec" + + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${COND_DOC_TRUE}" && test -z "${COND_DOC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"COND_DOC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"COND_DOC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${COND_TESTS_TRUE}" && test -z "${COND_TESTS_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"COND_TESTS\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"COND_TESTS\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${COND_TESTDATA_TRUE}" && test -z "${COND_TESTDATA_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"COND_TESTDATA\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"COND_TESTDATA\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${COND_MMX_TRUE}" && test -z "${COND_MMX_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"COND_MMX\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"COND_MMX\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${COND_SSE_TRUE}" && test -z "${COND_SSE_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"COND_SSE\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"COND_SSE\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${COND_SSE2_TRUE}" && test -z "${COND_SSE2_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"COND_SSE2\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"COND_SSE2\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${COND_SSE3_TRUE}" && test -z "${COND_SSE3_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"COND_SSE3\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"COND_SSE3\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${COND_SSSE3_TRUE}" && test -z "${COND_SSSE3_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"COND_SSSE3\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"COND_SSSE3\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${COND_SSE4_1_TRUE}" && test -z "${COND_SSE4_1_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"COND_SSE4_1\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"COND_SSE4_1\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${COND_SSE4_2_TRUE}" && test -z "${COND_SSE4_2_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"COND_SSE4_2\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"COND_SSE4_2\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${COND_SSE4A_TRUE}" && test -z "${COND_SSE4A_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"COND_SSE4A\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"COND_SSE4A\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${COND_SSE5_TRUE}" && test -z "${COND_SSE5_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"COND_SSE5\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"COND_SSE5\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS section. +# + +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "doc/doxygen" ) CONFIG_FILES="$CONFIG_FILES doc/doxygen" ;; + "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "src/spandsp.h" ) CONFIG_FILES="$CONFIG_FILES src/spandsp.h" ;; + "spandsp-sim/Makefile" ) CONFIG_FILES="$CONFIG_FILES spandsp-sim/Makefile" ;; + "test-data/Makefile" ) CONFIG_FILES="$CONFIG_FILES test-data/Makefile" ;; + "test-data/etsi/Makefile" ) CONFIG_FILES="$CONFIG_FILES test-data/etsi/Makefile" ;; + "test-data/etsi/fax/Makefile" ) CONFIG_FILES="$CONFIG_FILES test-data/etsi/fax/Makefile" ;; + "test-data/itu/Makefile" ) CONFIG_FILES="$CONFIG_FILES test-data/itu/Makefile" ;; + "test-data/itu/fax/Makefile" ) CONFIG_FILES="$CONFIG_FILES test-data/itu/fax/Makefile" ;; + "test-data/local/Makefile" ) CONFIG_FILES="$CONFIG_FILES test-data/local/Makefile" ;; + "tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; + "spandsp.pc" ) CONFIG_FILES="$CONFIG_FILES spandsp.pc" ;; + "spandsp.spec" ) CONFIG_FILES="$CONFIG_FILES spandsp.spec" ;; + "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "src/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/config.h:config-h.in" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@SPANDSP_LT_CURRENT@,$SPANDSP_LT_CURRENT,;t t +s,@SPANDSP_LT_REVISION@,$SPANDSP_LT_REVISION,;t t +s,@SPANDSP_LT_AGE@,$SPANDSP_LT_AGE,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@CYGPATH_W@,$CYGPATH_W,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@install_sh@,$install_sh,;t t +s,@STRIP@,$STRIP,;t t +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t +s,@mkdir_p@,$mkdir_p,;t t +s,@AWK@,$AWK,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@am__leading_dot@,$am__leading_dot,;t t +s,@AMTAR@,$AMTAR,;t t +s,@am__tar@,$am__tar,;t t +s,@am__untar@,$am__untar,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@DEPDIR@,$DEPDIR,;t t +s,@am__include@,$am__include,;t t +s,@am__quote@,$am__quote,;t t +s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t +s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t +s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t +s,@CCDEPMODE@,$CCDEPMODE,;t t +s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t +s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t +s,@CXX@,$CXX,;t t +s,@CXXFLAGS@,$CXXFLAGS,;t t +s,@ac_ct_CXX@,$ac_ct_CXX,;t t +s,@CXXDEPMODE@,$CXXDEPMODE,;t t +s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t +s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t +s,@SED@,$SED,;t t +s,@LN_S@,$LN_S,;t t +s,@ECHO@,$ECHO,;t t +s,@AR@,$AR,;t t +s,@ac_ct_AR@,$ac_ct_AR,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@DSYMUTIL@,$DSYMUTIL,;t t +s,@ac_ct_DSYMUTIL@,$ac_ct_DSYMUTIL,;t t +s,@NMEDIT@,$NMEDIT,;t t +s,@ac_ct_NMEDIT@,$ac_ct_NMEDIT,;t t +s,@CXXCPP@,$CXXCPP,;t t +s,@F77@,$F77,;t t +s,@FFLAGS@,$FFLAGS,;t t +s,@ac_ct_F77@,$ac_ct_F77,;t t +s,@LIBTOOL@,$LIBTOOL,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@COND_DOC_TRUE@,$COND_DOC_TRUE,;t t +s,@COND_DOC_FALSE@,$COND_DOC_FALSE,;t t +s,@COND_TESTS_TRUE@,$COND_TESTS_TRUE,;t t +s,@COND_TESTS_FALSE@,$COND_TESTS_FALSE,;t t +s,@COND_TESTDATA_TRUE@,$COND_TESTDATA_TRUE,;t t +s,@COND_TESTDATA_FALSE@,$COND_TESTDATA_FALSE,;t t +s,@COND_MMX_TRUE@,$COND_MMX_TRUE,;t t +s,@COND_MMX_FALSE@,$COND_MMX_FALSE,;t t +s,@COND_SSE_TRUE@,$COND_SSE_TRUE,;t t +s,@COND_SSE_FALSE@,$COND_SSE_FALSE,;t t +s,@COND_SSE2_TRUE@,$COND_SSE2_TRUE,;t t +s,@COND_SSE2_FALSE@,$COND_SSE2_FALSE,;t t +s,@COND_SSE3_TRUE@,$COND_SSE3_TRUE,;t t +s,@COND_SSE3_FALSE@,$COND_SSE3_FALSE,;t t +s,@COND_SSSE3_TRUE@,$COND_SSSE3_TRUE,;t t +s,@COND_SSSE3_FALSE@,$COND_SSSE3_FALSE,;t t +s,@COND_SSE4_1_TRUE@,$COND_SSE4_1_TRUE,;t t +s,@COND_SSE4_1_FALSE@,$COND_SSE4_1_FALSE,;t t +s,@COND_SSE4_2_TRUE@,$COND_SSE4_2_TRUE,;t t +s,@COND_SSE4_2_FALSE@,$COND_SSE4_2_FALSE,;t t +s,@COND_SSE4A_TRUE@,$COND_SSE4A_TRUE,;t t +s,@COND_SSE4A_FALSE@,$COND_SSE4A_FALSE,;t t +s,@COND_SSE5_TRUE@,$COND_SSE5_TRUE,;t t +s,@COND_SSE5_FALSE@,$COND_SSE5_FALSE,;t t +s,@CC_FOR_BUILD@,$CC_FOR_BUILD,;t t +s,@CPPFLAGS_FOR_BUILD@,$CPPFLAGS_FOR_BUILD,;t t +s,@COMP_VENDOR_CFLAGS@,$COMP_VENDOR_CFLAGS,;t t +s,@COMP_VENDOR_LDFLAGS@,$COMP_VENDOR_LDFLAGS,;t t +s,@SIMLIBS@,$SIMLIBS,;t t +s,@TESTLIBS@,$TESTLIBS,;t t +s,@SPANDSP_USE_FIXED_POINT@,$SPANDSP_USE_FIXED_POINT,;t t +s,@SPANDSP_MISALIGNED_ACCESS_FAILS@,$SPANDSP_MISALIGNED_ACCESS_FAILS,;t t +s,@SPANDSP_USE_EXPORT_CAPABILITY@,$SPANDSP_USE_EXPORT_CAPABILITY,;t t +s,@INSERT_INTTYPES_HEADER@,$INSERT_INTTYPES_HEADER,;t t +s,@INSERT_STDINT_HEADER@,$INSERT_STDINT_HEADER,;t t +s,@INSERT_TGMATH_HEADER@,$INSERT_TGMATH_HEADER,;t t +s,@INSERT_MATH_HEADER@,$INSERT_MATH_HEADER,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +_ACEOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # grep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +# Compute $ac_file's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $ac_file | $ac_file:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || +$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X$ac_file : 'X\(//\)[^/]' \| \ + X$ac_file : 'X\(//\)$' \| \ + X$ac_file : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X$ac_file | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'`/stamp-h$_am_stamp_count +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`(dirname "$mf") 2>/dev/null || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`(dirname "$file") 2>/dev/null || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p $dirpart/$fdir + else + as_dir=$dirpart/$fdir + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 +echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} + { (exit 1); exit 1; }; }; } + + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + esac +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + + +# @end 1 diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/configure.ac --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/configure.ac Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,484 @@ +# +# SpanDSP - a series of DSP components for telephony +# +# configure.ac - Process this file with autoconf to produce configure +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 2.1, +# as published by the Free Software Foundation. +# +# 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# $Id: configure.ac,v 1.73 2009/10/03 04:37:25 steveu Exp $ + +# @start 1 + +AC_INIT + +m4_include(config/ax_compiler_vendor.m4) +m4_include(config/ax_check_real_file.m4) +m4_include(config/ax_fixed_point_machine.m4) +m4_include(config/ax_misaligned_access_fails.m4) +m4_include(config/ax_c99_features.m4) +m4_include(config/ax_check_export_capability.m4) + +SPANDSP_MAJOR_VERSION=0 +SPANDSP_MINOR_VERSION=0 +SPANDSP_MICRO_VERSION=6 + +SPANDSP_LT_CURRENT=2 +SPANDSP_LT_REVISION=0 +SPANDSP_LT_AGE=0 + +VERSION=$SPANDSP_MAJOR_VERSION.$SPANDSP_MINOR_VERSION.$SPANDSP_MICRO_VERSION +PACKAGE=spandsp + +AC_SUBST(SPANDSP_LT_CURRENT) +AC_SUBST(SPANDSP_LT_REVISION) +AC_SUBST(SPANDSP_LT_AGE) + +AC_CONFIG_SRCDIR([src/tone_generate.c]) +AC_CONFIG_AUX_DIR(config) +AC_CONFIG_HEADERS([src/config.h:config-h.in]) +AM_INIT_AUTOMAKE($PACKAGE, $VERSION) + +AC_CANONICAL_HOST +#AC_CANONICAL_BUILD +AC_PROG_CC +AC_PROG_CXX +AC_PROG_GCC_TRADITIONAL +AC_PROG_LIBTOOL +AC_LANG([C]) + +AX_COMPILER_VENDOR + +if test "${build}" != "${host}" +then + # If we are doing a Canadian Cross, in which the host and build systems + # are not the same, we set reasonable default values for the tools. + + CC_FOR_BUILD=${CC_FOR_BUILD-gcc} + CPPFLAGS_FOR_BUILD="\$(CPPFLAGS)" + CC=${CC-${host_alias}-gcc} + CFLAGS=${CFLAGS-"-g -O2"} + CXX=${CXX-${host_alias}-c++} + CXXFLAGS=${CXXFLAGS-"-g -O2"} +else + # Set reasonable default values for some tools even if not Canadian. + # Of course, these are different reasonable default values, originally + # specified directly in the Makefile. + # We don't export, so that autoconf can do its job. + # Note that all these settings are above the fragment inclusion point + # in Makefile.in, so can still be overridden by fragments. + # This is all going to change when we autoconfiscate... + CC_FOR_BUILD="\$(CC)" + CPPFLAGS_FOR_BUILD="\$(CPPFLAGS)" + AC_PROG_CC + + # We must set the default linker to the linker used by gcc for the correct + # operation of libtool. If LD is not defined and we are using gcc, try to + # set the LD default to the ld used by gcc. + if test -z "$LD" + then + if test "$GCC" = yes + then + case $build in + *-*-mingw*) + gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;; + *) + gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;; + esac + case $gcc_prog_ld in + # Accept absolute paths. + [[\\/]* | [A-Za-z]:[\\/]*)] + LD="$gcc_prog_ld" ;; + esac + fi + fi + + CXX=${CXX-"c++"} + CFLAGS=${CFLAGS-"-g -O2"} + CXXFLAGS=${CXXFLAGS-"-g -O2"} +fi + +AC_DEFUN([REMOVE_FROM_VAR],[ + new_val="" + removed=0 + for i in $$1; do + if test "x$i" != "x$2"; then + new_val="$new_val $i" + else + removed=1 + fi + done + if test $removed = "1"; then + echo " removed \"$2\" from $1" + $1=$new_val + fi +]) + +AC_C_CONST +AC_C_INLINE +AC_C_VOLATILE + +AC_CHECK_TYPES(long long) +AC_CHECK_TYPES(long double) + +AC_TYPE_SIGNAL + +AC_ARG_ENABLE(doc, [ --enable-doc Build the documentation]) +AC_ARG_ENABLE(tests, [ --enable-tests Build the test programs]) +AC_ARG_ENABLE(test_data, [ --enable-test-data Build TIFF test files for some ITU test images]) +AC_ARG_ENABLE(mmx, [ --enable-mmx Enable MMX support]) +AC_ARG_ENABLE(sse, [ --enable-sse Enable SSE support]) +AC_ARG_ENABLE(sse2, [ --enable-sse2 Enable SSE2 support]) +AC_ARG_ENABLE(sse3, [ --enable-sse3 Enable SSE3 support]) +AC_ARG_ENABLE(ssse3, [ --enable-ssse3 Enable SSSE3 support]) +AC_ARG_ENABLE(sse4_1, [ --enable-sse4-1 Enable SSE4.1 support]) +AC_ARG_ENABLE(sse4_2, [ --enable-sse4-2 Enable SSE4.2 support]) +AC_ARG_ENABLE(sse4a, [ --enable-sse4a Enable SSE4A support]) +AC_ARG_ENABLE(sse5, [ --enable-sse5 Enable SSE5 support]) +AC_ARG_ENABLE(fixed_point, [ --enable-fixed-point Enable fixed point support]) +# The following is for MSVC, where we may be using a local copy of libtiff, built alongside spandsp +AC_ARG_ENABLE(builtin_tiff, + [AC_HELP_STRING([--enable-builtin-tiff],[build with builtin libtiff])],[enable_builtin_tiff="$enableval"],[enable_builtin_tiff="no"]) + +AC_FUNC_ERROR_AT_LINE +AC_FUNC_VPRINTF +AC_FUNC_MALLOC +AC_FUNC_MEMCMP +AC_FUNC_REALLOC +AC_FUNC_SELECT_ARGTYPES + +AX_C99_FUNC_LRINT +AX_C99_FUNC_LRINTF +AX_C99_FUNC_LLRINT +AX_C99_FUNC_LLRINTF + +if test "x$ac_cv_c99_lrint" = "xno" ; then + if test "x$ac_cv_c99_lrintf" = "xno" ; then + AC_MSG_WARN([[*** Missing C99 standard functions lrint() and lrintf().]]) + AC_MSG_WARN([[*** This may cause benign compiler warnings on some systems (ie Solaris).]]) + fi +fi + +AX_C99_FLEXIBLE_ARRAY + +AC_CHECK_FUNCS([memmove]) +AC_CHECK_FUNCS([memset]) +AC_CHECK_FUNCS([select]) +AC_CHECK_FUNCS([strcasecmp]) +AC_CHECK_FUNCS([strchr]) +AC_CHECK_FUNCS([strdup]) +AC_CHECK_FUNCS([strerror]) +AC_CHECK_FUNCS([strstr]) +AC_CHECK_FUNCS([strtol]) +AC_CHECK_FUNCS([gettimeofday]) +AC_CHECK_FUNCS([drand48]) + +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_HEADER_TIME + +# Check for header files. +AC_CHECK_HEADERS([socket.h]) +AC_CHECK_HEADERS([inttypes.h], [INSERT_INTTYPES_HEADER="#include "]) +AC_CHECK_HEADERS([stdint.h], [INSERT_STDINT_HEADER="#include "]) +AC_CHECK_HEADERS([unistd.h]) +AC_CHECK_HEADERS([stdlib.h]) +AC_CHECK_HEADERS([string.h]) +AC_CHECK_HEADERS([strings.h]) +AC_CHECK_HEADERS([malloc.h]) +AC_CHECK_HEADERS([tgmath.h], [INSERT_TGMATH_HEADER="#include "]) +AC_CHECK_HEADERS([math.h], [INSERT_MATH_HEADER="#include "]) +AC_CHECK_HEADERS([float.h]) +AC_CHECK_HEADERS([fcntl.h]) +AC_CHECK_HEADERS([sys/time.h]) +AC_CHECK_HEADERS([sys/select.h]) +AC_CHECK_HEADERS([sys/ioctl.h]) +AC_CHECK_HEADERS([sys/fcntl.h]) +AC_CHECK_HEADERS([sndfile.h]) +AC_CHECK_HEADERS([fftw3.h], , [AC_CHECK_HEADERS([fftw.h])]) +AC_CHECK_HEADERS([pthread.h]) +if test "${build}" == "${host}" +then + AC_CHECK_HEADERS([X11/X.h]) +fi + +# Determine XML2 include path +AC_MSG_CHECKING(for libxml/xmlmemory.h) + +# Can we include headers using system include dirs? +AC_TRY_COMPILE([#include ], [int a = 1;], + XML2_INCLUDE=" ", + XML2_INCLUDE= +) + +# Hunt through several possible directories to find the includes for libxml2 +if test "x$XML2_INCLUDE" = "x"; then + old_CPPFLAGS="$CPPFLAGS" + for i in $xml2_include_dir /usr/include /usr/local/include /usr/include/libxml2 /usr/local/include/libxml2 ; do + CPPFLAGS="$old_CPPFLAGS -I$i" + AC_TRY_COMPILE([#include ], [int a = 1;], + XML2_INCLUDE="-I$i", + XML2_INCLUDE= + ) + if test "x$XML2_INCLUDE" != "x"; then + break; + fi + done + CPPFLAGS="$old_CPPFLAGS $XML2_INCLUDE" +fi + +AC_CHECK_HEADERS([libxml/xmlmemory.h]) +AC_CHECK_HEADERS([libxml/parser.h]) +AC_CHECK_HEADERS([libxml/xinclude.h]) + +AC_LANG([C++]) +AC_CHECK_HEADERS([FL/Fl.H]) +AC_CHECK_HEADERS([FL/Fl_Overlay_Window.H]) +AC_CHECK_HEADERS([FL/Fl_Light_Button.H]) +AC_CHECK_HEADERS([FL/fl_draw.H]) +AC_CHECK_HEADERS([FL/Fl_Cartesian.H], [], [], [],[[#include +]]) +AC_CHECK_HEADERS([FL/Fl_Audio_Meter.H], [], [], [],[[#include +]]) + +AC_LANG([C]) + +if test "${build}" == "${host}" +then + case "${host}" in + x86_64-*) + # X86_64 Linux machines may have both 64 bit and 32 bit libraries. We need to choose the right set + AX_CHECK_REAL_FILE([${prefix}/lib64], libdir='$(exec_prefix)/lib64') + AX_CHECK_REAL_FILE([/usr/X11R6/lib64], [TESTLIBS="$TESTLIBS -L/usr/X11R6/lib64"], AC_CHECK_FILE([/usr/X11R6/lib], [TESTLIBS="$TESTLIBS -L/usr/X11R6/lib"])) + # The very oldest AMD 64 bit chips support SSE2, SSE and MMX + enable_sse2="yes" + ;; + esac +fi + +AC_CHECK_LIB([m], [cos]) +# Some platforms still seem to lack the basic single precision trig and power related function. +AC_SEARCH_LIBS([sinf], [m], AC_DEFINE([HAVE_SINF], [1], [Define to 1 if you have the sinf() function.])) +AC_SEARCH_LIBS([cosf], [m], AC_DEFINE([HAVE_COSF], [1], [Define to 1 if you have the cosf() function.])) +AC_SEARCH_LIBS([tanf], [m], AC_DEFINE([HAVE_TANF], [1], [Define to 1 if you have the tanf() function.])) +AC_SEARCH_LIBS([asinf], [m], AC_DEFINE([HAVE_ASINF], [1], [Define to 1 if you have the asinf() function.])) +AC_SEARCH_LIBS([acosf], [m], AC_DEFINE([HAVE_ACOSF], [1], [Define to 1 if you have the acosf() function.])) +AC_SEARCH_LIBS([atanf], [m], AC_DEFINE([HAVE_ATANF], [1], [Define to 1 if you have the atanf() function.])) +AC_SEARCH_LIBS([atan2f], [m], AC_DEFINE([HAVE_ATAN2F], [1], [Define to 1 if you have the atan2f() function.])) +AC_SEARCH_LIBS([ceilf], [m], AC_DEFINE([HAVE_CEILF], [1], [Define to 1 if you have the ceilf() function.])) +AC_SEARCH_LIBS([floorf], [m], AC_DEFINE([HAVE_FLOORF], [1], [Define to 1 if you have the floorf() function.])) +AC_SEARCH_LIBS([powf], [m], AC_DEFINE([HAVE_POWF], [1], [Define to 1 if you have the powf() function.])) +AC_SEARCH_LIBS([expf], [m], AC_DEFINE([HAVE_EXPF], [1], [Define to 1 if you have the expf() function.])) +AC_SEARCH_LIBS([logf], [m], AC_DEFINE([HAVE_LOGF], [1], [Define to 1 if you have the logf() function.])) +AC_SEARCH_LIBS([log10f], [m], AC_DEFINE([HAVE_LOG10F], [1], [Define to 1 if you have the log10f() function.])) + +# Checks for libraries. +AC_CHECK_LIB([xml2], [xmlParseFile], [AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have the 'libxml2' library (-lxml2).]) SIMLIBS="$SIMLIBS -lxml2"]) + +if test -n "$enable_tests" ; then + AC_LANG([C]) + AC_CHECK_LIB([sndfile], [sf_open], SIMLIBS="$SIMLIBS -lsndfile", AC_MSG_ERROR("Can't make tests without libsndfile (does your system require a libsndfile-devel package?)")) + AC_CHECK_LIB([fftw3], [fftw_plan_dft_1d], SIMLIBS="$SIMLIBS -lfftw3", [AC_CHECK_LIB([fftw], [fftw_create_plan], SIMLIBS="$SIMLIBS -lfftw", AC_MSG_ERROR("Can't make tests without FFTW 2 or 3 (does your system require an fftw?-devel package?)"))]) + AC_CHECK_LIB([pthread], [pthread_attr_init], TESTLIBS="$TESTLIBS -lpthread") + AC_CHECK_LIB([dl], [dlopen], TESTLIBS="$TESTLIBS -ldl") + AC_CHECK_LIB([Xft], [XftFontOpen], TESTLIBS="$TESTLIBS -lXft",, $TESTLIBS) + AC_CHECK_LIB([Xext], [XextCreateExtension], TESTLIBS="$TESTLIBS -lXext",, $TESTLIBS) + AC_CHECK_LIB([X11], [XOpenDisplay], TESTLIBS="$TESTLIBS -lX11",, $TESTLIBS) + AC_LANG([C++]) + AC_CHECK_LIB([fltk], [main], TESTLIBS="$TESTLIBS -lfltk -lsupc++",, $TESTLIBS) + AC_CHECK_LIB([fltk_cartesian], [main], TESTLIBS="-lfltk_cartesian $TESTLIBS",, $TESTLIBS) + AC_CHECK_LIB([fltk_audio_meter], [main], TESTLIBS="-lfltk_audio_meter $TESTLIBS",, $TESTLIBS) + AC_LANG([C]) +fi + +AX_CHECK_EXPORT_CAPABILITY([$host], + [AC_DEFINE([SPANDSP_USE_EXPORT_CAPABILITY], [1], [Use the library symbol export capability of the compiler]) + SPANDSP_USE_EXPORT_CAPABILITY="#define SPANDSP_USE_EXPORT_CAPABILITY 1"], + [SPANDSP_USE_EXPORT_CAPABILITY="#undef SPANDSP_USE_EXPORT_CAPABILITY"]) + +case "${ax_cv_c_compiler_vendor}" in +gnu) + COMP_VENDOR_CFLAGS="-std=gnu99 -ffast-math -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS" + if test "$enable_sse5" = "yes" ; then + COMP_VENDOR_CFLAGS="-msse5 $COMP_VENDOR_CFLAGS" + fi + if test "$enable_sse4a" = "yes" ; then + COMP_VENDOR_CFLAGS="-msse4a $COMP_VENDOR_CFLAGS" + fi + if test "$enable_sse4_2" = "yes" ; then + COMP_VENDOR_CFLAGS="-msse42 $COMP_VENDOR_CFLAGS" + fi + if test "$enable_sse4_1" = "yes" ; then + COMP_VENDOR_CFLAGS="-msse41 $COMP_VENDOR_CFLAGS" + fi + if test "$enable_ssse3" = "yes" ; then + COMP_VENDOR_CFLAGS="-mssse3 $COMP_VENDOR_CFLAGS" + fi + if test "$enable_sse3" = "yes" ; then + COMP_VENDOR_CFLAGS="-msse3 $COMP_VENDOR_CFLAGS" + fi + if test "$enable_sse2" = "yes" ; then + COMP_VENDOR_CFLAGS="-msse2 $COMP_VENDOR_CFLAGS" + fi + if test "$enable_sse" = "yes" ; then + COMP_VENDOR_CFLAGS="-msse $COMP_VENDOR_CFLAGS" + fi + if test "$enable_mmx" = "yes" ; then + COMP_VENDOR_CFLAGS="-mmmx $COMP_VENDOR_CFLAGS" + fi + case $host_os in + mingw* | cygwin*) + COMP_VENDOR_LDFLAGS="-no-undefined" + ;; + *) + COMP_VENDOR_LDFLAGS= + ;; + esac + ;; +sun) + COMP_VENDOR_CFLAGS="-xc99=all -mt -xCC -errwarn=%all -xvpara $COMP_VENDOR_CFLAGS" + if test "$enable_sse3" = "yes" ; then + COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS" + fi + if test "$enable_sse2" = "yes" ; then + COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS" + fi + if test "$enable_sse" = "yes" ; then + COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS" + fi + if test "$enable_mmx" = "yes" ; then + COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS" + fi + COMP_VENDOR_LDFLAGS= + REMOVE_FROM_VAR(CFLAGS, -Xc) + ;; +*) + COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS" + COMP_VENDOR_LDFLAGS= + ;; +esac + +COMP_VENDOR_CFLAGS="-DNDEBUG $COMP_VENDOR_CFLAGS" + +AM_CONDITIONAL([COND_DOC], [test "$enable_doc" = yes]) +AM_CONDITIONAL([COND_TESTS], [test "$enable_tests" = yes]) +AM_CONDITIONAL([COND_TESTDATA], [test "$enable_test_data" = yes]) +AM_CONDITIONAL([COND_MMX], [test "$enable_mmx" = yes]) +AM_CONDITIONAL([COND_SSE], [test "$enable_sse" = yes]) +AM_CONDITIONAL([COND_SSE2], [test "$enable_sse2" = yes]) +AM_CONDITIONAL([COND_SSE3], [test "$enable_sse3" = yes]) +AM_CONDITIONAL([COND_SSSE3], [test "$enable_ssse3" = yes]) +AM_CONDITIONAL([COND_SSE4_1], [test "$enable_sse4_1" = yes]) +AM_CONDITIONAL([COND_SSE4_2], [test "$enable_sse4_2" = yes]) +AM_CONDITIONAL([COND_SSE4A], [test "$enable_sse4a" = yes]) +AM_CONDITIONAL([COND_SSE5], [test "$enable_sse5" = yes]) +if test "$enable_fixed_point" = "yes" ; then + AC_DEFINE([SPANDSP_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point]) + SPANDSP_USE_FIXED_POINT="#define SPANDSP_USE_FIXED_POINT 1" +else + AX_FIXED_POINT_MACHINE([$host], + [AC_DEFINE([SPANDSP_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point]) + SPANDSP_USE_FIXED_POINT="#define SPANDSP_USE_FIXED_POINT 1"], + [SPANDSP_USE_FIXED_POINT="#undef SPANDSP_USE_FIXED_POINT"]) +fi +AX_MISALIGNED_ACCESS_FAILS([$host], + [AC_DEFINE([SPANDSP_MISALIGNED_ACCESS_FAILS], [1], [Do not expect a misaligned memory access to work correctly]) + SPANDSP_MISALIGNED_ACCESS_FAILS="#define SPANDSP_MISALIGNED_ACCESS_FAILS 1"], + [SPANDSP_MISALIGNED_ACCESS_FAILS="#undef SPANDSP_MISALIGNED_ACCESS_FAILS"]) + +if test "$enable_sse5" = "yes" ; then + AC_DEFINE([SPANDSP_USE_SSE5], [1], [Use the SSE5 instruction set (i386 and x86_64 only).]) + enable_sse4a="yes" +fi +if test "$enable_sse4a" = "yes" ; then + AC_DEFINE([SPANDSP_USE_SSE4A], [1], [Use the SSE4A instruction set (i386 and x86_64 only).]) + enable_sse4_2="yes" +fi +if test "$enable_sse4_2" = "yes" ; then + AC_DEFINE([SPANDSP_USE_SSE4_2], [1], [Use the SSE4.2 instruction set (i386 and x86_64 only).]) + enable_sse4_1="yes" +fi +if test "$enable_sse4_1" = "yes" ; then + AC_DEFINE([SPANDSP_USE_SSE4_1], [1], [Use the SSE4.1 instruction set (i386 and x86_64 only).]) + enable_ssse3="yes" +fi +if test "$enable_ssse3" = "yes" ; then + AC_DEFINE([SPANDSP_USE_SSSE3], [1], [Use the SSSE3 instruction set (i386 and x86_64 only).]) + enable_sse3="yes" +fi +if test "$enable_sse3" = "yes" ; then + AC_DEFINE([SPANDSP_USE_SSE3], [1], [Use the SSE3 instruction set (i386 and x86_64 only).]) + enable_sse2="yes" +fi +if test "$enable_sse2" = "yes" ; then + AC_DEFINE([SPANDSP_USE_SSE2], [1], [Use the SSE2 instruction set (i386 and x86_64 only).]) + enable_sse="yes" +fi +if test "$enable_sse" = "yes" ; then + AC_DEFINE([SPANDSP_USE_SSE], [1], [Use the SSE instruction set (i386 and x86_64 only).]) + enable_mmx="yes" +fi +if test "$enable_mmx" = "yes" ; then + AC_DEFINE([SPANDSP_USE_MMX], [1], [Use the MMX instruction set (i386 and x86_64 only).]) +fi + +if test "$enable_builtin_tiff" = "yes" ; then + abs_tiffdir="`cd $srcdir/../tiff-3.8.2/ && pwd`" + save_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -I$abs_tiffdir/libtiff" + AC_CHECK_HEADERS([tiffio.h]) + CFLAGS="$save_CFLAGS" + COMP_VENDOR_CFLAGS="-I$abs_tiffdir/libtiff $COMP_VENDOR_CFLAGS" + COMP_VENDOR_LDFLAGS="-L$abs_tiffdir/libtiff $COMP_VENDOR_LDFLAGS" + LIBS="$LIBS $abs_tiffdir/libtiff/libtiff.la" + AC_DEFINE([HAVE_LIBTIFF], [1], [Define to 1 if you have the `tiff' library (-ltiff).]) +else + AC_CHECK_HEADERS([tiffio.h]) + AC_CHECK_LIB([tiff], [TIFFOpen], , AC_MSG_ERROR("Can't build without libtiff (does your system require a libtiff-devel package?)"), -lm) +fi + +TESTLIBS="$SIMLIBS $TESTLIBS" + +AC_SUBST(CC_FOR_BUILD) +AC_SUBST(CPPFLAGS_FOR_BUILD) +AC_SUBST(COMP_VENDOR_CFLAGS) +AC_SUBST(COMP_VENDOR_LDFLAGS) +AC_SUBST(SIMLIBS) +AC_SUBST(TESTLIBS) +AC_SUBST(SPANDSP_USE_FIXED_POINT) +AC_SUBST(SPANDSP_MISALIGNED_ACCESS_FAILS) +AC_SUBST(SPANDSP_USE_EXPORT_CAPABILITY) +AC_SUBST(INSERT_INTTYPES_HEADER) +AC_SUBST(INSERT_STDINT_HEADER) +AC_SUBST(INSERT_TGMATH_HEADER) +AC_SUBST(INSERT_MATH_HEADER) + +AC_CONFIG_FILES([Makefile + doc/Makefile + doc/doxygen + src/Makefile + src/spandsp.h + spandsp-sim/Makefile + test-data/Makefile + test-data/etsi/Makefile + test-data/etsi/fax/Makefile + test-data/itu/Makefile + test-data/itu/fax/Makefile + test-data/local/Makefile + tests/Makefile + spandsp.pc + spandsp.spec]) + +AC_OUTPUT + +# @end 1 diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/debian/changelog --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/debian/changelog Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,119 @@ +spandsp (0.0.6~pre7-1) unstable; urgency=low + + [ Steve Underwood ] + * New upstream release. + * Fixed upstream file name for get-orig-source. + * Updates to 64bit archs support + * Removal of obsoleted files + + -- Steve Underwood Sat, 14 Mar 2009 09:23:36 +0100 + +spandsp (0.0.5~pre2-1) unstable; urgency=low + + [ Massimo Cetra ] + * New upstream release. + * Fixed upstream file name for get-orig-source. + * Updates to 64bit archs support + * Removal of obsoleted files + + -- Massimo Cetra Mon, 5 May 2008 09:23:36 +0100 + +spandsp (0.0.4~pre3-1) unstable; urgency=low + + [ Santiago Ruano Rincón ] + * Added Conflicts: libspandsp2 + * Fixed URL in debian/rules + + [ Tzafrir Cohen ] + * New upstream release. + * Fixed upstream file name for get-orig-source. + * standards version updated to 3.7.2 . + + -- Tzafrir Cohen Mon, 18 Jun 2007 09:53:06 +0300 + +spandsp (0.0.4~pre1-1) experimental; urgency=low + + * New upstream release. + + -- Santiago Ruano Rincón Fri, 11 May 2007 15:24:41 -0500 + +spandsp (0.0.3pre27-2) experimental; urgency=low + + * Conflict with libspandsp1 due to /usr/share/spandsp/global-tones.xml + + -- Kilian Krause Thu, 4 Jan 2007 00:29:10 +0100 + +spandsp (0.0.3pre27-1) experimental; urgency=low + + * New upstream release. + * Bump library name due to API incompatibility with 0.0.2 versions. + + -- Kilian Krause Wed, 3 Jan 2007 21:31:17 +0100 + +spandsp (0.0.3pre26-1) experimental; urgency=low + + * New upstream release + - New version of spandsp available (Closes: #339293) + - Remove src/spandsp/mmx.h is not GPL and has no license attached (Closes: + #357813) + * Lintian: outdated-autotools-helper-file - Build-Depends: autotools-dev + * Add debian/watch + + -- Mark Purcell Sat, 9 Dec 2006 14:00:57 +0000 + +spandsp (0.0.2pre26-1) unstable; urgency=low + + * New upstream release. + * Added get-orig-source target. + * Removed unneeded and buggy nommx.dpatch (Closes: #376249, #377374) + + -- Tzafrir Cohen Tue, 1 Aug 2006 06:27:47 +0100 + +spandsp (0.0.2pre25-1) unstable; urgency=low + + * New upstream version. + * debian/copyright: Source's URL in copyright file updated to the new author' site. + * Added -doc package, with the API documentation. + * Fixed package name to follow new upstream's version. + + -- Kilian Krause Sat, 18 Feb 2006 22:10:21 +0100 + +spandsp (0.0.2pre17-1) unstable; urgency=low + + * New upstream version. + + -- Kilian Krause Mon, 9 May 2005 21:56:53 +0200 + +spandsp (0.0.2pre10-3) unstable; urgency=low + + * debian/control: fixed overrides. again. (Back to the old optional) + + -- Kilian Krause Mon, 21 Mar 2005 10:39:30 +0100 + +spandsp (0.0.2pre10-2) unstable; urgency=low + + * debian/control: fixed overrides. + * debian/patches/mmx.dpatch: Added compilation on non-i386 and non-amd64. + + -- Kilian Krause Sun, 20 Mar 2005 23:32:48 +0100 + +spandsp (0.0.2pre10-1) unstable; urgency=low + + * New upstream release. + * Debian VoIP Team takes this package from Simon. Thanks! + * debian/rules: fixed how config.[sub,guess] files are linked from + autotools-dev and cleaned. + + -- Kilian Krause Sat, 22 Jan 2005 13:44:28 +0100 + +spandsp (0.0.2-2) unstable; urgency=low + + * Corrected build dependencies. + + -- Simon Richter Mon, 3 Jan 2005 13:33:33 +0100 + +spandsp (0.0.2-1) unstable; urgency=low + + * Initial Release (Closes: #262032). + + -- Simon Richter Sun, 2 Jan 2005 15:22:58 +0100 diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/debian/compat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/debian/compat Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1 @@ +4 diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/debian/control --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/debian/control Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,42 @@ +Source: spandsp +Section: libs +Priority: optional +Maintainer: Debian VoIP Team +Uploaders: Jose Carlos Garcia Sogo , Kilian Krause , Santiago Garcia Mantinan , Mark Purcell , Tzafrir Cohen , Santiago Ruano Rincón +Build-Depends: debhelper (>= 4.0.0), libtiff4-dev, libjpeg62-dev, dpatch, doxygen, autotools-dev, xsltproc +Standards-Version: 3.7.2 +XS-Vcs-Svn: svn://svn.debian.org/pkg-voip/ +XS-Vcs-Browser: http://svn.debian.org/wsvn/pkg-voip/ + +Package: libspandsp6 +Architecture: any +Depends: ${shlibs:Depends} +Conflicts: libspandsp0, libspandsp1, libspandsp2 +Description: Telephony signal processing library + This is a low-level signal processing library that modulate and demodulate + signals commonly used in telephony, such as the "noise" generated by a + fax modem or DTMF touchpad. + . + This package contains the shared library. + +Package: libspandsp-dev +Section: libdevel +Architecture: any +Depends: libspandsp6 (= ${Source-Version}), libtiff4-dev, libjpeg62-dev +Description: Telephony signal processing library + This is a low-level signal processing library that modulate and demodulate + signals commonly used in telephony, such as the "noise" generated by a + fax modem or DTMF touchpad. + . + This package contains the static library and development headers. + . + Homepage: http://www.soft-switch.org/ + +Package: libspandsp-doc +Section: doc +Architecture: all +Description: Documentation for the spandsp signal processing library + This package contains the online API in HTML for the libspandsp, a low + level signal processing library that modulate and demodulate siignals + commonly used in telephony, such as the "noise" generated by a fax + modem or DTMF touchpad. diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/debian/copyright --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/debian/copyright Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,25 @@ +This package was debianized by Simon Richter on +Sun, 2 Jan 2005 15:22:58 +0100. + +It was downloaded from http://soft-switch.org/downloads/spandsp/ + +Copyright: Steve Underwood + +License: + + This package 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; version 2 dated June, 1991. + + This package is distributed in the hope that 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 package; if not, write to the Free Software Foundation, Inc., + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/debian/libspandsp-dev.install --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/debian/libspandsp-dev.install Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,4 @@ +debian/tmp/usr/include +debian/tmp/usr/lib/libspandsp.so +debian/tmp/usr/lib/libspandsp.la +debian/tmp/usr/lib/libspandsp.a diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/debian/libspandsp-doc.install --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/debian/libspandsp-doc.install Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1 @@ +doc/api/html usr/share/doc/libspandsp-doc/api/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/debian/libspandsp6.install --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/debian/libspandsp6.install Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,2 @@ +debian/tmp/usr/lib*/libspandsp.so.2.* +debian/tmp/usr/lib*/libspandsp.so.2 diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/debian/rules --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/debian/rules Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,106 @@ +#!/usr/bin/make -f + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + +DEBVERSION:=$(shell head -n 1 debian/changelog \ + | sed -e 's/^[^(]*(\([^)]*\)).*/\1/') +ORIGTARVER:=$(shell echo $(DEBVERSION) | sed -e 's/^.*://' -e 's/-[0-9.]*$$//')# -e 's/.dfsg$$//' -e 's/~//') + +UPVERSION:=$(shell echo $(ORIGTARVER) | tr -d '~') + +FILENAME := spandsp_$(ORIGTARVER).orig.tar.gz +FULLNAME := spandsp-$(UPVERSION) +URL := http://soft-switch.org/downloads/spandsp/spandsp-$(UPVERSION).tgz + +CFLAGS = -Wall -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif + +include /usr/share/dpatch/dpatch.make + + +autotools: patch-stamp + ln -s /usr/share/misc/config.sub config.sub + ln -s /usr/share/misc/config.guess config.guess + touch autotools + +config.status: autotools configure + dh_testdir + CFLAGS="$(CFLAGS)" ./configure \ + --host=$(DEB_HOST_GNU_TYPE) \ + --build=$(DEB_BUILD_GNU_TYPE) \ + --prefix=/usr \ + --mandir=\$${prefix}/share/man \ + --infodir=\$${prefix}/share/info \ + --enable-doc + +build: build-stamp + +build-stamp: config.status + dh_testdir + $(MAKE) + touch build-stamp + +clean: clean-patched unpatch +clean-patched: + dh_testdir + dh_testroot + rm -f build-stamp autotools + -$(MAKE) distclean + + -$(RM) -f config.sub + -$(RM) -f config.guess + + dh_clean + +install: build-stamp + dh_testdir + dh_testroot + dh_clean -k + $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp + +binary-indep: build-stamp install + dh_testdir -i + dh_testroot -i + dh_installchangelogs -i ChangeLog + dh_installdocs -i DueDiligence + dh_install -i + dh_compress -i + dh_fixperms -i + dh_installdeb -i + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i + +binary-arch: build-stamp install + dh_testdir -a + dh_testroot -a + dh_installchangelogs -a ChangeLog + dh_installdocs -a DueDiligence + dh_install -a + dh_strip -a + dh_compress -a + dh_fixperms -a + dh_makeshlibs -a + dh_installdeb -a + dh_shlibdeps -a + dh_gencontrol -a + dh_md5sums -a + dh_builddeb -a + +get-orig-source: + -@@dh_testdir + @@[ -d ../tarballs/. ]||mkdir -p ../tarballs + @@echo Downloading $(FILENAME) from $(URL) ... + @@wget -N -nv -T10 -t3 -O ../tarballs/$(FILENAME) $(URL) + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install patch unpatch diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/debian/watch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/debian/watch Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,7 @@ +# See uscan(1) for format + +# Compulsory line, this is a version 3 file +version=3 + +# +http://soft-switch.org/downloads/spandsp/ spandsp-(.*)\.tgz debian svn-upgrade diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/doc/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/doc/Makefile.am Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,40 @@ +## +## SpanDSP - a series of DSP components for telephony +## +## Makefile.am - Process this file with automake to produce Makefile.in +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU Lesser General Public License version 2.1, +## as published by the Free Software Foundation. +## +## 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 Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this program; if not, write to the Free Software +## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +## +## $Id: Makefile.am,v 1.12 2008/09/20 15:44:40 steveu Exp $ + +MAINTAINERCLEANFILES = Makefile.in + +EXTRA_DIST = css.css \ + doxygen.in \ + t38-gateway.dia \ + t38-terminal.dia \ + t38_manual.xml \ + wrapper.xsl \ + t38_manual/css.css + +all: doxydocs t38_manual/index.html + +doxydocs: + doxygen doxygen + +t38_manual/index.html: t38_manual.xml + cd t38_manual ; xsltproc ../wrapper.xsl ../t38_manual.xml + +clean: + cd t38_manual ; rm *.html ; cd ../api ; rm -rf html diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/doc/Makefile.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/doc/Makefile.in Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,382 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = doc +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/doxygen.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/config/ax_compiler_vendor.m4 \ + $(top_srcdir)/config/ax_check_real_file.m4 \ + $(top_srcdir)/config/ax_fixed_point_machine.m4 \ + $(top_srcdir)/config/ax_misaligned_access_fails.m4 \ + $(top_srcdir)/config/ax_c99_features.m4 \ + $(top_srcdir)/config/ax_check_export_capability.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = doxygen +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_FOR_BUILD = @CC_FOR_BUILD@ +CFLAGS = @CFLAGS@ +COMP_VENDOR_CFLAGS = @COMP_VENDOR_CFLAGS@ +COMP_VENDOR_LDFLAGS = @COMP_VENDOR_LDFLAGS@ +COND_DOC_FALSE = @COND_DOC_FALSE@ +COND_DOC_TRUE = @COND_DOC_TRUE@ +COND_MMX_FALSE = @COND_MMX_FALSE@ +COND_MMX_TRUE = @COND_MMX_TRUE@ +COND_SSE2_FALSE = @COND_SSE2_FALSE@ +COND_SSE2_TRUE = @COND_SSE2_TRUE@ +COND_SSE3_FALSE = @COND_SSE3_FALSE@ +COND_SSE3_TRUE = @COND_SSE3_TRUE@ +COND_SSE4A_FALSE = @COND_SSE4A_FALSE@ +COND_SSE4A_TRUE = @COND_SSE4A_TRUE@ +COND_SSE4_1_FALSE = @COND_SSE4_1_FALSE@ +COND_SSE4_1_TRUE = @COND_SSE4_1_TRUE@ +COND_SSE4_2_FALSE = @COND_SSE4_2_FALSE@ +COND_SSE4_2_TRUE = @COND_SSE4_2_TRUE@ +COND_SSE5_FALSE = @COND_SSE5_FALSE@ +COND_SSE5_TRUE = @COND_SSE5_TRUE@ +COND_SSE_FALSE = @COND_SSE_FALSE@ +COND_SSE_TRUE = @COND_SSE_TRUE@ +COND_SSSE3_FALSE = @COND_SSSE3_FALSE@ +COND_SSSE3_TRUE = @COND_SSSE3_TRUE@ +COND_TESTDATA_FALSE = @COND_TESTDATA_FALSE@ +COND_TESTDATA_TRUE = @COND_TESTDATA_TRUE@ +COND_TESTS_FALSE = @COND_TESTS_FALSE@ +COND_TESTS_TRUE = @COND_TESTS_TRUE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSERT_INTTYPES_HEADER = @INSERT_INTTYPES_HEADER@ +INSERT_MATH_HEADER = @INSERT_MATH_HEADER@ +INSERT_STDINT_HEADER = @INSERT_STDINT_HEADER@ +INSERT_TGMATH_HEADER = @INSERT_TGMATH_HEADER@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIMLIBS = @SIMLIBS@ +SPANDSP_LT_AGE = @SPANDSP_LT_AGE@ +SPANDSP_LT_CURRENT = @SPANDSP_LT_CURRENT@ +SPANDSP_LT_REVISION = @SPANDSP_LT_REVISION@ +SPANDSP_MISALIGNED_ACCESS_FAILS = @SPANDSP_MISALIGNED_ACCESS_FAILS@ +SPANDSP_USE_EXPORT_CAPABILITY = @SPANDSP_USE_EXPORT_CAPABILITY@ +SPANDSP_USE_FIXED_POINT = @SPANDSP_USE_FIXED_POINT@ +STRIP = @STRIP@ +TESTLIBS = @TESTLIBS@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DSYMUTIL = @ac_ct_DSYMUTIL@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_NMEDIT = @ac_ct_NMEDIT@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +MAINTAINERCLEANFILES = Makefile.in +EXTRA_DIST = css.css \ + doxygen.in \ + t38-gateway.dia \ + t38-terminal.dia \ + t38_manual.xml \ + wrapper.xsl \ + t38_manual/css.css + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu doc/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +doxygen: $(top_builddir)/config.status $(srcdir)/doxygen.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + $(mkdir_p) $(distdir)/t38_manual + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-info-am + + +all: doxydocs t38_manual/index.html + +doxydocs: + doxygen doxygen + +t38_manual/index.html: t38_manual.xml + cd t38_manual ; xsltproc ../wrapper.xsl ../t38_manual.xml + +clean: + cd t38_manual ; rm *.html ; cd ../api ; rm -rf html +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/doc/css.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/doc/css.css Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,564 @@ +body { + background-image: url("../images/weave.jpg"); + font-family: Verdana, Arial, Helvetica, Sans-serif; + color: black; + margin-right: 20px; + margin-left: 20px; +} + +h1 { + text-align: center; +} + +h2 { + font-family: Verdana, Arial, Helvetica, Sans-serif; + border-color: #c00000; + color : black; + margin-top: 0.8em; + border-style: solid; + border-width: 0px 0px 3px 0.5em; + line-height : 130%; +} + +h3 { + font-family: Verdana, Arial, Helvetica, Sans-serif; + border-color: #f02020; + color : black; + border-width: 0px 0px 2px 0.5em; + border-style: solid; + margin-right: 20%; + line-height : 130%; +} +caption { + font-weight: bold +} +a.qindex {} +a.qindexRef {} +a.el { + text-decoration: none; + font-weight: bold +} +a.elRef { + font-weight: bold +} +a.code { + text-decoration: none; + font-weight: normal; + color: #4444ee +} +a.codeRef { + font-weight: normal; + color: #4444ee +} +a:hover { + text-decoration: none; + background-color: #f2f2ff +} +dl.el { + margin-left: -1cm +} +div.fragment { + width: 100%; + border: none; + background-color: #eeeeee +} +div.ah { + background-color: black; + font-weight: bold; + color: #ffffff; + margin-bottom: 3px; + margin-top: 3px +} + +td { + font-family: Verdana, Arial, Helvetica, Sans-serif; + font-weight: bold; +} + +.navheader { + font-family: Verdana, Arial, Helvetica, Sans-serif; + background-color: #B2B2ff; + font-weight: bold; +} + +.navfooter { + font-family: Verdana, Arial, Helvetica, Sans-serif; + background-color: #B2B2ff; + font-weight: bold; +} + +table.menu { + background-color: #000066; + font-weight: bold; + text-align: center; + width: 100%; +} + +tr.menu { + background-color: #ccffff; + font-weight: bold; + text-align: center; +} +td.menu { + background-color: #f2e0d0; + font-weight: bold; + text-align: center; +} + +td.md { + background-color: #f2f2ff; + font-weight: bold; +} +td.mdname1 { + background-color: #f2f2ff; + font-weight: bold; + color: #602020; +} +td.mdname { + background-color: #f2f2ff; + font-weight: bold; + color: #602020; + width: 600px; +} +div.groupHeader { + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold +} +div.groupText { + margin-left: 16px; + font-style: italic; + font-size: smaller +} +td.indexkey { + font-family: Verdana, Arial, Helvetica, Sans-serif; + background-color: #eeeeff; + font-weight: bold; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px +} +td.indexvalue { + font-family: Verdana, Arial, Helvetica, Sans-serif; + background-color: #eeeeff; + font-style: italic; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px +} +span.keyword { + color: #008000 +} +span.keywordtype { + color: #604020 +} +span.keywordflow { + color: #e08000 +} +span.comment { + color: #800000 +} +span.preprocessor { + color: #806020 +} +span.stringliteral { + color: #002080 +} +span.charliteral { + color: #008080 +} +em { + color: #990000; + background-color: transparent; +} +h1,h2,h3,h4,h5,h6,p,center,td,th,ul,dl,div { + font-family: Geneva, Arial, Helvetica, sans-serif; +} +body,td { + font-size: 90%; +} +h1 { + text-align: center; + font-size: 160%; +} +h2 { + font-size: 120%; +} +h3 { + font-size: 100%; +} +caption { + font-weight: bold +} +div.qindex { + width: 100%; + background-color: #eeeeff; + border: 1px solid #b0b0b0; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +div.nav { + width: 100%; + background-color: #eeeeff; + border: 1px solid #b0b0b0; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +div.navtab { + background-color: #eeeeff; + border: 1px solid #b0b0b0; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +td.navtab { + font-size: 70%; +} +a.qindex { + text-decoration: none; + font-weight: bold; + color: #1a419d; +} +a.qindex:visited { + text-decoration: none; + font-weight: bold; + color: #1a419d +} +a.qindex:hover { + text-decoration: none; + background-color: #ddddff; +} +a.qindexHL { + text-decoration: none; + font-weight: bold; + background-color: #6666cc; + color: #ffffff; + border: 1px double #9295C2; +} +a.qindexHL:hover { + text-decoration: none; + background-color: #6666cc; + color: #ffffff; +} +a.qindexHL:visited { + text-decoration: none; + background-color: #6666cc; + color: #ffffff +} +a.el { + text-decoration: none; + font-weight: bold +} +a.elRef { + font-weight: bold +} +a.code:link { + text-decoration: none; + font-weight: normal; + color: #0000FF +} +a.code:visited { + text-decoration: none; + font-weight: normal; + color: #0000FF +} +a.codeRef:link { + font-weight: normal; + color: #0000FF +} +a.codeRef:visited { + font-weight: normal; + color: #0000FF +} +a:hover { + text-decoration: none; + background-color: #f2f2ff +} +dl.el { + margin-left: -1cm +} +.fragment { + font-family: Fixed, monospace; + font-size: 95%; +} +pre.fragment { + border: 1px solid #CCCCCC; + background-color: #f5f5f5; + margin-top: 4px; + margin-bottom: 4px; + margin-left: 2px; + margin-right: 8px; + padding-left: 6px; + padding-right: 6px; + padding-top: 4px; + padding-bottom: 4px; +} +div.ah { + background-color: black; + font-weight: bold; + color: #ffffff; + margin-bottom: 3px; + margin-top: 3px +} +td.md { + background-color: #F4F4FB; + font-weight: bold; +} +td.mdPrefix { + background-color: #F4F4FB; + color: #606060; + font-size: 80%; +} +td.mdname1 { + background-color: #F4F4FB; + font-weight: bold; + color: #602020; +} +td.mdname { + background-color: #F4F4FB; + font-weight: bold; + color: #602020; + width: 600px; +} +div.groupHeader { + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold; +} +div.groupText { + margin-left: 16px; + font-style: italic; + font-size: 90% +} +td.indexkey { + background-color: #eeeeff; + font-weight: bold; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +td.indexvalue { + background-color: #eeeeff; + font-style: italic; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +tr.memlist { + background-color: #f0f0f0; +} +p.formulaDsp { + text-align: center; +} +img.formulaDsp { +} +img.formulaInl { + vertical-align: middle; +} +span.keyword { + color: #008000 +} +span.keywordtype { + color: #604020 +} +span.keywordflow { + color: #e08000 +} +span.comment { + color: #800000 +} +span.preprocessor { + color: #806020 +} +span.stringliteral { + color: #002080 +} +span.charliteral { + color: #008080 +} +.mdTable { + border: 1px solid #868686; + background-color: #F4F4FB; +} +.mdRow { + padding: 8px 10px; +} +.mdescLeft { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.mdescRight { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.memItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplParams { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + color: #606060; + background-color: #FAFAFA; + font-size: 80%; +} +.search { + color: #003399; + font-weight: bold; +} +form.search { + margin-bottom: 0px; + margin-top: 0px; +} +input.search { + font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #eeeeff; +} +td.tiny { + font-size: 75%; +} +a { + color: #252e78; +} +a:visited { + color: #3d2185; +} +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #b0b0b0; +} +th.dirtab { + background: #eeeeff; + font-weight: bold; +} +hr { + height: 1px; + border: none; + border-top: 1px solid black; +} diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/doc/doxygen.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/doc/doxygen.in Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1196 @@ +# Doxyfile 1.4.4 + +# 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 (" ") + +#--------------------------------------------------------------------------- +# Project related 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 = @PACKAGE@ + +# 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 = @VERSION@ + +# 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 = api + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# 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, Korean-en, Norwegian, +# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, +# Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# 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 + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# 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 = NO + +# 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. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# 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 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 +# explicit @brief command for a brief description. + +JAVADOC_AUTOBRIEF = NO + +# 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 INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_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 + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = 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 + +# 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 = + +# 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 = NO + +# 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 SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# 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 = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# 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 + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# 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 classes 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 + +# 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 +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# 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 SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = 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 the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# 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 + +# 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 consists 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 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 + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is YES. + +SHOW_DIRECTORIES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the progam writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# 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 + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# 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. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = + +# 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 *.cs *.php *.php3 *.inc *.m *.mm + +FILE_PATTERNS = *.c \ + *.h + +# 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. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# 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 , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# 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. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# 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 = NO + +# 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 = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = 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 + +#--------------------------------------------------------------------------- +# 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 = 2 + +# 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 = + +# 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. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = css.css + +# 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 directory. + +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, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = YES + +# 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 = NO + +# 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 = + +# 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 + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = 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 = + +# 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 assignments. 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 = + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = + +# 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. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML 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 `xml' will be used as the default path. + +XML_OUTPUT = xml + +# 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 = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# 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 = NO + +# 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. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = SPAN_DECLARE(x)=x + +# 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 = + +# 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::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +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 superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields 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 the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# 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 CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = NO + +# 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 + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = 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 in 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_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that a graph may be further truncated if the graph's +# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH +# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), +# the graph is not depth-constrained. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, which results in a white background. +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# 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 intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions 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 diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/doc/t38-gateway.dia Binary file spandsp-0.0.6pre17/doc/t38-gateway.dia has changed diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/doc/t38-terminal.dia Binary file spandsp-0.0.6pre17/doc/t38-terminal.dia has changed diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/doc/t38_manual.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/doc/t38_manual.xml Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,291 @@ + + + + + + 2007-11-14 + T.38 protocol (FoIP) support + User manual + documentation in progress + + + Steve + Underwood + + +
+ steveu@coppice.org +
+ + 2007 + Steve Underwood + + + + This document can be freely redistributed according to the + terms of the GNU General Public License. + + +
+ + + + +The T.38 real-time FAX over IP (FoIP) protocol + +There are two ITU recommendations which address sending FAXes over IP networks. T.37 specifies a method of encapsulating FAX images in e-mails, and transporting them to the recipient (an e-mail box, or another FAX machine) in a store-and-forward manner. T.38 specifies a protocol for transmitting a FAX across an IP network in real time. This document discusses the implementation of the T.38, real time, FAX over IP (FoIP) protocol. + +FAXing between two PSTN FAX machines provides the illusion of real-time communication, with confirmed delivery. This is, of course, no more than an illusion. The sender has no idea what is receiving the FAX. It might be a FAX mailbox, where the FAX might only be retrieved much later, or might never be retrieved at all. It might be a FAX machine which is out of paper, and is storing the FAX in memory. If nobody adds paper before the FAX machine is switched off, the FAX might never be printed. With increasing amounts of FAX spam, many people don't ever bother to collect FAXes from the FAX machine in their office. Still, with all these reasons why the real-time confirmed delivery nature of FAXing is an illusion, large numbers of people still insist on using direct FAXing. + +The FAX protocols - in particular T.30 - were designed for the PSTN. The PSTN is very different from a packet network like the Internet. It offers very strict timing; latency is rock steady throughout a call; and latency is seldom very high. The lack of these features in packet networks tends to spoil the quality of voice over IP, compared to voice over the PSTN. However, it can totally destroy modem data, like that used for FAX. Jitter and packet loss can cause modem reception to fail, and excessive delays can cause timers designed for a low latency environment to expire. T.38 tries to mitigate these factors, and can greatly improve the reliability of FAXing across the internet. It can also send FAXes using less bandwidth than using VoIP protocols. There are limits to what can be achieved on a congested network, though, and T.38 can never offer the reliability of a store and forward protocol, like T.37. Sadly, the average office worker's love affair with real-time FAX ensures a bright future for the T.38 protocol, even though the T.37 protocol makes far more sense. + +The T.38 protocol primarily operates between: + +Internet-aware FAX terminals, which connect directly to an IP network. +FAX gateways, which allow traditional PSTN FAX terminals to communicate via the Internet. +A combination of these. + +T.38 is the only standardised protocol which exists for real-time FoIP. Reliably transporting a FAX between PSTN FAX terminals, through an IP network, requires use of the T.38 protocol at FAX gateways. VoIP connections are not robust for modem use, including FAX modem use. Most use low bit rate codecs, which cannot convey the modem signals accurately. Even when high bit rate codecs, such as G.711, are used, VoIP connections suffer dropouts and timing adjustments, which modems cannot tolerate. In a LAN environment the dropout rate may be very low, but the timing adjustments which occur in VoIP connections still make modem operation unreliable. T.38 FAX gateways deal with the delays, timing jitter, and packet loss experienced in packet networks, and isolate the PSTN FAX terminals from these as far as possible. In addition, by sending FAXes as image data, rather than digitised audio, the required bandwidth of the IP network might be reduced. However, the redundant transmission needed to make T.38 work acceptably over an unreliable network tends to offset much of the potential bandwidth gain. + +The original T.38 specification provides for operation up to 14,400bps, using a V.17 modem. The latest version of the T.38 specification adds features for FAXing at up to 33,600bps, using a V.34 modem. However, it appears most current T.38 implementations only support operation up to 14,400bps. + + + +The basics of a T.38 entity + +The T.38 protocol may be used to build an Internet-aware FAX terminal, for direct connection to the Internet. It may also be used to build gateways. A T.38 FAX gateway might be a gateway between the PSTN and the Internet. It might just be an a ATA box acting as a gateway between a directly connected traditional FAX machine and the Internet. The T.38 protocol merely defines what passes between two T.38 entities. Creating a robust entity, able to tolerate the widest possible variation in network delays, jitter and packet loss, requires considerably more than just implementing what is contained in the T.38 spec. Also, the protocol definition is somewhat loose, resulting is considerable variability in the way the protocol is implemented. Considerable flexibility is required in a T.38 entity's design, to tolerate these variations. + +T.38 currently works over one of the following transports: + +TCP, with TPKT message framing - the use of TPKT was originally specified in a vague way, and implementations without TPKT framing apparently exist. +UDPTL - A UDP based protocol used nowhere else. This is the most common transport for T.38. +RTP - Added quite late to the T.38 specification, and still not widely supported. + +TCP is the ideal way to communicate between two entities on an IP network, which do not have real-time constraints. The entities can talk as fast as they and the medium between them permit, with full error control. Internet-aware FAX devices would, therefore, usually use TCP as the transport for T.38. Gateways have only limited control of the timing of the FAX data passing through them. They have to operate in real-time, at a rate outside their control. Gateways, therefore, usually use UDPTL. The RTP option was only added to the T.38 specification in 2004, and is not yet widely supported. Over time it may become the preferred replacement for UDPTL, since most entities handle more than just FAX, and need to implement RTP anyway. + +A TCP stream is fully corrected by the TCP protocol itself. However, in the UDPTL or RTP modes of operation, T.38 is subject to possible packet loss. A high level of missing data would defeat the protocol, so some measure of FEC (forward error correction) must be used. The UDPTL specification defines two optional forms of FEC. Both consist of adding information from previous packets to new packets. In one form this repeated data is send as a direct copy of the original. In the other it is sent as parity information, which requires encoding and decoding. The specifications for RTP include definitions of suitable FEC and redundancy protocols (RFC2198 and RFC2733). The T.38 specification says these should be used for T.38 over RTP. + +Interestingly, even the latest revision of the T.38 specification does not provide properly for security in FAX transmission. SRTP is a standard way to achieve secure multi-media communication, and can be applied to T.38 over RTP without any specific wording on the subject in the T.38 specification. UDPTL might be seen as obsolete in the long term, and not worthy of enhancements to encrypt the data. However, no secure option for T.38 over TCP is defined. TPKT could be sent over TLS/TCP. TLS also has message framing features which would allow IFP packets to be sent directly over a TLS protected connection. However, there is no specified way to do this. + +Although redundant information in future packets is an important part of a solid T.38 implementation, it is not a complete solution to problem of lost packets. Sometimes the next packet occurs after a considerable delay (e.g. when allowing time for a fast modem to train). If a "start training" message is only received through the redundant information in a following packet, it usually arrives too late to be useful (at least for a gateway). Most T.38 implementations now follow a practice of sending several exact copies of key packets - generally the ones which start or end the stages of the T.30 protocol. Typically up to 4 identical copies of these packets are sent down the wire. The may be sent in a burst, as fast as possible, or they may be spaced in time by 10ms or 20ms. IP network congestion, and the resulting packet loss, can be very bursty. If all copies are sent together, they might all be lost. Even a small amount of spreading in time may significantly increase the likelihood of at least one copy reaching its destination. The price is some delay in delivery of the message, which might be problematic. Multiple copies of these packets add little to the overall volume of data transmitted, as only a small percentage of packets fall in this "key packet" category. Some T.38 implementations follow a less effective practice of sending multiple key packets, which have separate sequence numbers and are separately bundled with redundant information for transmission. They may also be spaced in time. Although this seems a less effective strategy, a T.38 entity must expect to receive packets streams of this kind, and tolerate them. + +Between the high priority key packets, and the low priority packets for the image data (the loss of which might just cause a streak on an image, or be corrected by ECM FAXing), lies the V.21 HDLC control messages. Some T.38 implementations dynamically adjust the amount of redundant information in packets, so these control messages are repeated through several packets, but the large image data packets are repeated less, or not at all. Used with care, this dynamic redundancy strategy can nicely balance data volume and reliability. + +A T.38 terminal has a lot more flexibility in how it can deal with problem data than a T.38 gateway. The terminal has no tight timing constraints governing how it behaves with regard to received data. It can wait a considerable period for delayed packets to arrive. The gateway is a man-in-the-middle, and must live with the timing constraints that imposes. This means a T.38 gateway has a rather more difficult design than a terminal. + + + +The core elements of a T.38 implementation + +There are many differences between the behaviour of a T.38 terminal and a T.38 gateway. However, some functions are common to both types of T.38 entity, particular in the IP network interface. + + +The T.38 Internet Fascimile Protocol (IFP) packetiser + +The T.38 specification defines an ASN.1 schema for the messages which pass between T.38 entities. These messages are called IFP (Internet Fascimile Protocol) messages. Their format is independent of the transport used to carry them. However, there are currently two slightly different versions of the ASN.1 schema. This is due to a typo in the original version of the T.38 specification. The protocol negotiation which occurs just before T.38 communication resolves which version will be used. Although the typo was corrected several years ago, it is still very more common to find implementations which only support the original buggy version. + + + +The UDPTL, RTP, TPKT packetiser + +A second level packetiser bundles the IFP packets for transmission. This functions in different ways, depending on the type of transport in use. For the unreliable transports (UDPTL and RTP) the packetiser adds forward error correction (FEC) information to the packets. This can greatly inprove the reliability of the T.38 protocol, at the expense of higher bandwidth. The amount of error correction information added to the packets is implementation dependant. + +For UDPTL, two forms of FEC are defined. One simply repeats older T.38 packets as FEC information in the current UDPTL packet. The other generates parity packets over a series of T.38 packets, and includes that parity information in the current UDPTL packet. The type of FEC to be used is negotiated just before T.38 communication begins. + +The RTP specifications (RFC3550, RFC3551, RFC2198, RFC2733) define common redundancy and FEC formats, to be used for any payload. Where T.38 packets are carried by RTP, the standard RTP FEC mechanisms are used. + +TPKT (RFC1006, RFC2126) encapsulation works over a TCP transport. TCP provides full error correction, though retries may slow it considerably. TPKT encapsulation merely provides the ability to delineate the start and end of the IFP packets in the structureless TCP stream. + + + + + +The elements of a T.38 terminal + + + + + + +The elements of a T.38 gateway + + + + +The HDLC decoder +If the HDLC decoder in a T.38 gateway worked in whole frames, it would introduce unacceptable latency. Instead, the HDLC decoder must work progressively through the HDLC frames, outputing its results octet by octet. The T.38 message stream does not contain HDLC preamble, though it usually contains an indication that preamble is in progress. It does not contain the CRC octets, but simply an indication of whether the CRC is good or bad. The HDLC decoder provides an indication when preamble is being received, and checks the CRC octets at the end of frames to provide the good or bad indication. The decoder makes the frames available, octet by octet, to the T.38 engine for status tracking and possible modification. Tracking and modification imposes a few octets delay, but the goal is to keep this to the minimum possible. Whether the frames are modified or unmodified, good or bad they are always passed on, to maintain the appropriate timing flow for the T.30 protocol. + +An interesting aspect of the timing flow of V.21 HDLC messages on the T.38 path relates to the size of the CRC. The usual practice for sending these frames is to send one octet in each message, with the messages spaced by the duration of one octet. They will normally be sent with the minimum possible delay. The CRC at the end of each frame is two octets long, and only an indication of good or bad is sent in the T.38 messages. It takes two octet times to know if the CRC is OK or not, typically causing the flow of T.38 messages to stutter by the duration of an octet. Since flow control within a frame is not possible when frames are replayed by a remote T.38 gateway, that gateway must allow for this inevitable stutter as it prepares to begin playout of the frame. + + + +T.30 message analysis and manipulation +The T.30 message analyser in a T.38 gateway performs the following functions: + +It passes NSS, NSF and NSC frames, but modifies their contents. A receiving FAX machine must be prevented from acting upon these messages in a manufacturer specific manner. The T.38 protocol is incapable of handling such manufacturer specific things. However, simply dropping these packets would upset the timing of the T.30 protocol. Instead, most T.38 implementations modify the country and manufacturer codes nesr the start of these messages, so the messages will be ignored by any receiver. They are typically set to 0x00, 0x55, 0xAA or 0xFF. Some implementations set them to the country and manufacturer code of the T.38 implementor. As long as they are set to something the receiver will not recognise, problems are avoided. To avoid removing useful information, the original country and manufacturer code bytes might be reinserted in a different part of the modified NSF message, provided space permits. +It tracks the contents of the DCS messages. During flow control of non-ECM data, the minimum row length must be preserved, so the current minimum must be found from the DCS messages. Similarly, the current encoding must be known to apply non-ECM flow control correctly. ECM data must be flow controlled in a completely different way than non-ECM data, so ECM mode information must be found from the DCS messages. +It may optionally modify the minimum row length in the DIS messages. Because flow control will be applied to non-ECM data, it can make sense to tell the sending FAX machine it has no need to impose a minimum row length, and let the emitting T.38 entity impose the minimum as part of its flow control operation. +It passes on the stripped and modified HDLC frames, with the minimum possible delay. This implies that is must analyse and modify the messages octet by octet. + + + + + +The HDLC rate adapting encoder +The HDLC data rate adapting encoder accepts a T.30 message stream as input. The V.21 HDLC messages generally arriving byte by byte, in separate T.38 messages. ECM HDLC messages usually arrive in larger chunks, but they are still generally fragmented. The rate adapter dynamically buffers the T.30 data, generates preamble, and adjusts its length if the incoming message data is falling behind. It may insert additional flag octets between frames, as a flow control mechanism. However, the HDLC protocol is synchronous, so the adapter cannot perform any flow control within a frame. It must, therefore, buffer enough octets of a frame to provide reasonable jitter tolerance, before it emits the first octet of that frame. If the arriving messages fall too far behind mid-frame, there will be corruption of the outgoing stream. In the case of ECM image data frames, the frames are fast enough, that buffering whole frames is quite proactical within the T.30 timing constraints. This ensures mid-frame underflow can never occur. + + + +TCF (training confirmation) and non-ECM image data rate adaption +Non-ECM image data rate adaption deals with exchanging TCF data, and non-ECM image data using T.4 1-D or 2-D compression. Non-ECM image data is typically padded with zero bits at the end of each pixel row. This is used to avoid rows arriving at the receiving FAX machine faster than the mechanical paper handling can process them. It is also used by sending FAX machines for flow control, when their paper handling falls behind. The minimum duration of a row is negotiated between the FAX machines, before image transfer commences. + +TCF data is a continuous stream of zero bits. It may, optionally, be preceeded by a continuous block of one bits. So, when transferring TCF data between the T.38 entities, flow control is simply a matter of repeating the last received bit when the late arrival of TCF data packets causes underflow at an emitting gateway. + +T.38 entities may negotiate to generate and check TCF data locally, and not exchange it. Generally, this is only used when TCP/TPKT is used as the transport for the T.38 messages. A TCF checker and a TCF generator are needed by a T.38 gateway supporting this option. + +Some T.38 entities are capable of negotiating the removal of end of row padding bits in the data passing between the T.38 entities. This may reduce the amount of data significantly, for some types of image. If negotiated, most or all surplus zero bits are stripped from the image bit stream, at the sending T.38 entity. If a T.38 gateway is receiving such stripped data, it may need to reimpose a minimum row time, by inserting zeros, as part of its non-ECM rate adaption process. By checking the contents of the DCS messages, it can determine what this minimum should be. + +Only two types of image compression are used for non-ECM transmission - T.4 1-D and 2-D. The end of line (EOL) marker for both these is 11 zero bits, followed by a one bit. In 2-D mode, an additional one or zero bit follows, which defines the mode of the next row. It turns out that the maximum number of valid consecutive zeros which could preceed the 11 zeros of an EOL is 3. In a valid image there are no longer runs of zeros than at an EOL, and the maximum there is 14. Therefore, if the padding stripper reduces all runs of zeros longer than 14 to just 14, it will strip most of the padding with very simple logic. Simple logic is a good thing in this case. It not only avoids the need to fully analyse the image data, it also minimises problems when there are bit errors in the image data stream. + +For image data sent without error correction (T.4 1-D or 2-D) there may be underflow at the outgoing gateway, if image data packets arrive too late. To deal with slow mechanical paper handling in FAX machines, the T.30 specification includes an end of pixel row padding scheme for non-error corrected image data. The receiving machine may request a minimum row duration. The sending machine is required to impose that minimum, but can arbitrarily make it much longer to meet its own paper handling needs, sending padding bits as appropriate. This mechanism provides a robust basis for flow control in a T.38 gateway. If the outgoing gateway only starts sending a pixel row when it has the entire row in its buffer, it can safely idle, sending padding bits, at any row end it needs to. Only the 6 EOL markers, which terminate an image, must be protected from this kind of flow control. Those markers are defined as being consecutive, with no zero bit padding separating them. + +When ECM is used (usually with T.6 image data) the image is packetised in HDLC frames. In this case rate adaption is handled in a similar manner to the V.21 HDLC packets. + + + + + +Testing an implementation of T.38 +The T.38 specification does not define any specific compliance tests which an implementation must pass. It is not supplied with any test vectors. Commetrex is a supplier of T.38 implementations, who have taken it upon themselves to define a set of tests, and create a lab for T.38 interoperability testing. This seems the closest thing to an industry standard for T.38 testing which exists at this time, and is much to their credit. + +Commetrex have defined 16 tests which an implementation T.38 undergoes in their lab. These are described on the Commetrex web site as: + + +Commetrex T.38 tests + + + + + + + + + + + +Test # +Direction +Transport +Image file +Error correction +Data rate mgt +Image encoding +Polling + + + + +1originateUDPccitt2p.tifredundancy 0method 2MRno + + +2originateUDP100page.tifredundancy 0method 2MRno + + +3originateTCPccitt2p.tifredundancy 0method 1MRno + + +4originateUDPccitt2p.tifredundancy 3method 2MRno + + +5originateTCPccitt2p.tifFEC 2 from 3 spanmethod 2MRno + + +6originateUDPdither1d.tifredundancy 3method 2MRno + + +7originateUDPccitt2p.tifredundancy 3method 2ECMno + + +8originate & poll to rxUDPccitt2p.tifredundancy 3method 2MRpolled rx + + +9answerUDPccitt2p.tifredundancy 0method 2MRno + + +10answerUDP100page.tifredundancy 0method 2MRno + + +11answerTCPccitt2p.tifredundancy 0method 1MRno + + +12answerUDPccitt2p.tifredundancy 3method 2MRno + + +13answerTCPccitt2p.tifFEC 2 from 3 spanmethod 2MRno + + +14answerUDPdither1d.tifredundancy 3method 2MRno + + +15answerUDPccitt2p.tifredundancy 3method 2ECMno + + +16answer & polled to txUDPccitt2p.tifredundancy 3method 2MRpolled tx + + + +
+The file dither1d.tif is a whole page of dense checkerboard pattern, which does not compress, and produces a kind of torture test page. It is about 2M bytes. 100page.tif is exactly what it says - a file with 100 pages of FAX images. The content of the pages does not seem to be specified by Commetrex. The ITU T.30 test images, repeated sufficiently, seems a good basis for this test. ccitt2p.tif appears to be page 2 of the ITU test images. The tests are heavily biased towards non-ECM operation with MR coding. No other coding appears to be used, and only 2 tests use error corrected (ECM) FAXing. +
+ +Some of the Commetrex tests seem strange. Why is TCP transmission tested with FEC or redundancy? These things are only needed to overcome to lack of reliability in a UDP path. +
+ + +Living with real world T.38 entities. + The T.38 specification leaves a number of grey areas, and many things can be implemented in several ways. It might, therefore, be expected that interoperability will not always run smoothly. Whilst some design decisions are reasonable subjects for discussion, it is quite common to find T.38 implementations doing things which are simply wrong. + + +Non-ECM data ending immediately after the six EOLs denoting the end of a page causes corruption +From the T.38 specification, a T.38 entity sending non-ECM image data should be able to end the image data, with t4-non-ecm-sig-end, at the last bit of the six consecutive EOLs which denote the end of a page. However, this offers poor compatibility with some implementations of T.38. They will drop their carrier signal prematurely, and the last few rows of the image will be corrupted at the receiver. This can happen regardless of whether the t4-non-ecm-sig-end is followed by a no-signal message, and regardless of the timing of that no-signal message. Padding with zero bytes for 40ms or more after the six EOLs seems to prevent this, and results in an image which exactly matches the one at the source. + + + +Expect mixups between non-ECM and ECM image modes. +The TCF data should always be sent as non-ECM image data, whether the images which follow it are sent as non-ECM or ECM data. However, some broken implementations of T.38 (e.g. Mediatrix) may send an hdlc-sig-end message to terminate the TCF data. To be as tolerant as possible, it is probably wise to accept hdlc-sig-end or t4-non-ecm-sig-end, regardless of which kind of data it is really terminating. + + + +Expect some very poor timing decisions in various designs. +The preamble for V.21 HDLC data is specified as being 1s ±15%. This should mean 850ms of preamble is within spec, and many modern FAX machines only send that much. A number of T.38 implementations choke on this. They require at least 1s between the v21-preamble message and the first HDLC data, for reliable operation. This is very poor design. Even if there is 1s between these events at the source, jitter on the network can make them arrive less than 1s apart. It appears the best a tolerant implementation can really do is impose a 1s minimum between sending these T.38 messages, and accept that things might still go wrong when there is some jitter. + +There is similar intolerance with the timing of the start of training messages for the fast image data modems. Most implementations do not impose a minimum which is above that permitted by the T.30 specification. Some do, however, make no allowance for network jitter reducing the interval at the receiver. You should expect the far end to be using TEP, when sizing the required delay between the start of training, and the first data. Also, for ECM data, make sure the delay allows for the specified minimum 200ms of preamble. + + + +Which kinds of error correction to use. +T.38 defines two kinds of error correction for UDPTL streams. One inserts redundant copies of older IFP packets in each UDPTL packet. The other uses a more complex parity FEC scheme, based on XOR'ed data inserted in each UDPTL packet. Although each UDPTL packet identifies the type of error correction it contains, the original T.38 spec. did not offer any form of negotiation about the type to be used. The SIP and MGCP SDP for T.38 now includes preferred error correction type information, so some measure of negotiation is possible before the flow of UDPTL packets begins. + +It appears all T.38 implementations are happy to receive packets with redundant secondary content. However, it seems not all implementations will actually recover anything when there are missing UDPTL packets. It appears not all T.38 implementations are happy to receive packets with parity FEC data. Unless the SDP data from the far end explicitly says they support the parity FEC scheme, it is better to send only redundant information. A good implementation should be prepared to accept either kind of data, even intermixed, regardless of anything in the SDP negotiation. In the real world, whatever you ask for in your SDP data, you will probably receive secondary IFP packet redundancy from the far end. It is the only thing most implementations support, and with real world packet loss it may perform just as well as the more complex parity FEC scheme. + +When the first few UDPTL packets are sent, there will be no historical information to send as redundant secondary IFP packets, or parity FEC data. When using the redundant secondary packet scheme this is handled transparently. Each UDPTL packet says the number of redundant secondary IFP packets it contains. This can simply be set to zero for the first UDPTL packet, one for the second, up to the amount of redundancy which has been configured. All implementations seem to work in this way. When parity FEC is being used, the startup arrangement is less clear. While some implementations simply insert zeros for the non-existant packets before the start, others send a few packets with redundant secondary IFP packets, until they are able to insert the required amount of FEC data. Dealing with intermixed types of error correction makes a receiving implementation of UDPTL messier and slower, but is necessary for compatibility. + + + +What really ends the data? +It should be correct to send some image data, and end with the image data signal end message. However, some T.38 implementations misbehave when this is all that is sent. Immediately following the signal end message with a no-signal indicator message seems to greatly improve compatibility with some T.38 implementations. + +T.38 defines hdlc-fcs-OK, hdlc-fcs-OK-sig-end, hdlc-sig-end, and no-signal messages. Always end periods of HDLC transmission with either a hdlc-fcs-OK, hdlc-sig-end, no-signal sequence or a hdlc-fcs-OK-sig-end, no-signal sequence. Do not send hdlc-sig-end after hdlc-fcs-OK-sig-end. A number of T.38 implementations choke on this sequence, even though it looks fairly harmless. + + + + +Normal use versus testing +The design of some T.38 implementations precludes some reasonable tests from succeeding, due to design features which may have been implemented for sane reasons. This means each test failure needs to be investigated in detail, to see if it represents something genuinely bad in an implementation of T.38. For example, the 2M byte torture test page in the Commetrex test suite will not successfully pass through some T.38 implementations, because of a timeout they impose. For example, some ATAs based on Audiocodes silicon have been seen to stop any continuous period of modem transmission after about 90s. This appears to be a backstop timeout, to prevent troublesome implementations jamming the gateway. Legitimate pages just don't take that long, and the timeout is reasonable. However, the 2M byte test page takes up to 20 minutes to transmit, and will always fail on these boxes. + + + + + +
diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/doc/t38_manual/css.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/doc/t38_manual/css.css Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,564 @@ +body { + background-image: url("../images/weave.jpg"); + font-family: Verdana, Arial, Helvetica, Sans-serif; + color: black; + margin-right: 20px; + margin-left: 20px; +} + +h1 { + text-align: center; +} + +h2 { + font-family: Verdana, Arial, Helvetica, Sans-serif; + border-color: #c00000; + color : black; + margin-top: 0.8em; + border-style: solid; + border-width: 0px 0px 3px 0.5em; + line-height : 130%; +} + +h3 { + font-family: Verdana, Arial, Helvetica, Sans-serif; + border-color: #f02020; + color : black; + border-width: 0px 0px 2px 0.5em; + border-style: solid; + margin-right: 20%; + line-height : 130%; +} +caption { + font-weight: bold +} +a.qindex {} +a.qindexRef {} +a.el { + text-decoration: none; + font-weight: bold +} +a.elRef { + font-weight: bold +} +a.code { + text-decoration: none; + font-weight: normal; + color: #4444ee +} +a.codeRef { + font-weight: normal; + color: #4444ee +} +a:hover { + text-decoration: none; + background-color: #f2f2ff +} +dl.el { + margin-left: -1cm +} +div.fragment { + width: 100%; + border: none; + background-color: #eeeeee +} +div.ah { + background-color: black; + font-weight: bold; + color: #ffffff; + margin-bottom: 3px; + margin-top: 3px +} + +td { + font-family: Verdana, Arial, Helvetica, Sans-serif; + font-weight: bold; +} + +.navheader { + font-family: Verdana, Arial, Helvetica, Sans-serif; + background-color: #B2B2ff; + font-weight: bold; +} + +.navfooter { + font-family: Verdana, Arial, Helvetica, Sans-serif; + background-color: #B2B2ff; + font-weight: bold; +} + +table.menu { + background-color: #000066; + font-weight: bold; + text-align: center; + width: 100%; +} + +tr.menu { + background-color: #ccffff; + font-weight: bold; + text-align: center; +} +td.menu { + background-color: #f2e0d0; + font-weight: bold; + text-align: center; +} + +td.md { + background-color: #f2f2ff; + font-weight: bold; +} +td.mdname1 { + background-color: #f2f2ff; + font-weight: bold; + color: #602020; +} +td.mdname { + background-color: #f2f2ff; + font-weight: bold; + color: #602020; + width: 600px; +} +div.groupHeader { + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold +} +div.groupText { + margin-left: 16px; + font-style: italic; + font-size: smaller +} +td.indexkey { + font-family: Verdana, Arial, Helvetica, Sans-serif; + background-color: #eeeeff; + font-weight: bold; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px +} +td.indexvalue { + font-family: Verdana, Arial, Helvetica, Sans-serif; + background-color: #eeeeff; + font-style: italic; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px +} +span.keyword { + color: #008000 +} +span.keywordtype { + color: #604020 +} +span.keywordflow { + color: #e08000 +} +span.comment { + color: #800000 +} +span.preprocessor { + color: #806020 +} +span.stringliteral { + color: #002080 +} +span.charliteral { + color: #008080 +} +em { + color: #990000; + background-color: transparent; +} +h1,h2,h3,h4,h5,h6,p,center,td,th,ul,dl,div { + font-family: Geneva, Arial, Helvetica, sans-serif; +} +body,td { + font-size: 90%; +} +h1 { + text-align: center; + font-size: 160%; +} +h2 { + font-size: 120%; +} +h3 { + font-size: 100%; +} +caption { + font-weight: bold +} +div.qindex { + width: 100%; + background-color: #eeeeff; + border: 1px solid #b0b0b0; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +div.nav { + width: 100%; + background-color: #eeeeff; + border: 1px solid #b0b0b0; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +div.navtab { + background-color: #eeeeff; + border: 1px solid #b0b0b0; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +td.navtab { + font-size: 70%; +} +a.qindex { + text-decoration: none; + font-weight: bold; + color: #1a419d; +} +a.qindex:visited { + text-decoration: none; + font-weight: bold; + color: #1a419d +} +a.qindex:hover { + text-decoration: none; + background-color: #ddddff; +} +a.qindexHL { + text-decoration: none; + font-weight: bold; + background-color: #6666cc; + color: #ffffff; + border: 1px double #9295C2; +} +a.qindexHL:hover { + text-decoration: none; + background-color: #6666cc; + color: #ffffff; +} +a.qindexHL:visited { + text-decoration: none; + background-color: #6666cc; + color: #ffffff +} +a.el { + text-decoration: none; + font-weight: bold +} +a.elRef { + font-weight: bold +} +a.code:link { + text-decoration: none; + font-weight: normal; + color: #0000FF +} +a.code:visited { + text-decoration: none; + font-weight: normal; + color: #0000FF +} +a.codeRef:link { + font-weight: normal; + color: #0000FF +} +a.codeRef:visited { + font-weight: normal; + color: #0000FF +} +a:hover { + text-decoration: none; + background-color: #f2f2ff +} +dl.el { + margin-left: -1cm +} +.fragment { + font-family: Fixed, monospace; + font-size: 95%; +} +pre.fragment { + border: 1px solid #CCCCCC; + background-color: #f5f5f5; + margin-top: 4px; + margin-bottom: 4px; + margin-left: 2px; + margin-right: 8px; + padding-left: 6px; + padding-right: 6px; + padding-top: 4px; + padding-bottom: 4px; +} +div.ah { + background-color: black; + font-weight: bold; + color: #ffffff; + margin-bottom: 3px; + margin-top: 3px +} +td.md { + background-color: #F4F4FB; + font-weight: bold; +} +td.mdPrefix { + background-color: #F4F4FB; + color: #606060; + font-size: 80%; +} +td.mdname1 { + background-color: #F4F4FB; + font-weight: bold; + color: #602020; +} +td.mdname { + background-color: #F4F4FB; + font-weight: bold; + color: #602020; + width: 600px; +} +div.groupHeader { + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold; +} +div.groupText { + margin-left: 16px; + font-style: italic; + font-size: 90% +} +td.indexkey { + background-color: #eeeeff; + font-weight: bold; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +td.indexvalue { + background-color: #eeeeff; + font-style: italic; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +tr.memlist { + background-color: #f0f0f0; +} +p.formulaDsp { + text-align: center; +} +img.formulaDsp { +} +img.formulaInl { + vertical-align: middle; +} +span.keyword { + color: #008000 +} +span.keywordtype { + color: #604020 +} +span.keywordflow { + color: #e08000 +} +span.comment { + color: #800000 +} +span.preprocessor { + color: #806020 +} +span.stringliteral { + color: #002080 +} +span.charliteral { + color: #008080 +} +.mdTable { + border: 1px solid #868686; + background-color: #F4F4FB; +} +.mdRow { + padding: 8px 10px; +} +.mdescLeft { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.mdescRight { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.memItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplParams { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + color: #606060; + background-color: #FAFAFA; + font-size: 80%; +} +.search { + color: #003399; + font-weight: bold; +} +form.search { + margin-bottom: 0px; + margin-top: 0px; +} +input.search { + font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #eeeeff; +} +td.tiny { + font-size: 75%; +} +a { + color: #252e78; +} +a:visited { + color: #3d2185; +} +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #b0b0b0; +} +th.dirtab { + background: #eeeeff; + font-weight: bold; +} +hr { + height: 1px; + border: none; + border-top: 1px solid black; +} diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/doc/wrapper.xsl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/doc/wrapper.xsl Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,5 @@ + + + css.css + \ No newline at end of file diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/Makefile.am Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,128 @@ +## +## SpanDSP - a series of DSP components for telephony +## +## Makefile.am - Process this file with automake to produce Makefile.in +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License version 2, as +## published by the Free Software Foundation. +## +## 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., 675 Mass Ave, Cambridge, MA 02139, USA. +## +## $Id: Makefile.am,v 1.10 2009/06/02 16:03:55 steveu Exp $ + +AM_CFLAGS = $(COMP_VENDOR_CFLAGS) +AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) + +LIBS += -L$(top_builddir)/src -lspandsp $(SIMLIBS) + +MAINTAINERCLEANFILES = Makefile.in + +EXTRA_DIST = libspandsp_sim.dsp \ + libspandsp_sim.2005.vcproj \ + libspandsp_sim.2008.vcproj \ + msvc/make_line_models.2008.vcproj \ + msvc/msvcproj.head \ + msvc/msvcproj.foot \ + msvc/vc8proj.head \ + msvc/vc8proj.foot \ + msvc/vc9proj.head \ + msvc/vc9proj.foot + +INCLUDES = -I$(top_builddir) -I$(top_builddir)/src -DDATADIR="\"$(pkgdatadir)\"" + +noinst_PROGRAMS = make_line_models + +lib_LTLIBRARIES = libspandsp-sim.la + +libspandsp_sim_la_SOURCES = g1050.c \ + line_model.c \ + rfc2198_sim.c \ + test_utils.c + +nodist_libspandsp_sim_la_SOURCES = line_models.c + +libspandsp_sim_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@:@SPANDSP_LT_AGE@ $(COMP_VENDOR_LDFLAGS) + +nobase_include_HEADERS = spandsp/g1050.h \ + spandsp/line_model.h \ + spandsp/line_models.h \ + spandsp/rfc2198_sim.h \ + spandsp/test_utils.h \ + spandsp-sim.h + +make_line_models_SOURCES = make_line_models.c +make_line_models_LDADD = -L$(top_builddir)/src -lspandsp + +# We need to run make_line_models, so it generates the line_models.h file +# used by several of the test programs. + +line_models.lo: make_line_models$(EXEEXT) line_models.c + +line_models.$(OBJEXT): make_line_models$(EXEEXT) line_models.c + +line_models.c: make_line_models$(EXEEXT) + ./make_line_models$(EXEEXT) + +DSP = libspandsp_sim.dsp +VCPROJ8 = libspandsp_sim.2005.vcproj +VCPROJ9 = libspandsp_sim.2008.vcproj + +WIN32SOURCES = $(libspandsp_sim_la_SOURCES) +WIN32HEADERS = $(nobase_include_HEADERS) + +DSPOUT = | awk '{printf("%s\r\n", $$0)}' >> $(DSP) +VCPROJOUT8 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ8) +VCPROJOUT9 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ9) + +$(DSP): msvc/msvcproj.head msvc/msvcproj.foot Makefile.am + echo "creating $(DSP)" + @(cp $(srcdir)/msvc/msvcproj.head $(DSP); \ + echo "# Begin Group \"Source Files\"" $(DSPOUT); \ + for file in $(WIN32SOURCES); do \ + echo "# Begin Source File" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "SOURCE=.\\"$$file $(DSPOUT); \ + echo "# End Source File" $(DSPOUT); \ + done; \ + echo "# End Group" $(DSPOUT); \ + echo "# Begin Group \"Header Files\"" $(DSPOUT); \ + for file in $(WIN32HEADERS); do \ + echo "# Begin Source File" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "SOURCE=.\\"$$file $(DSPOUT); \ + echo "# End Source File" $(DSPOUT); \ + done; \ + echo "# End Group" $(DSPOUT); \ + cat $(srcdir)/msvc/msvcproj.foot $(DSPOUT) ) + +$(VCPROJ8): msvc/vc8proj.head msvc/vc8proj.foot Makefile.am + echo "creating $(VCPROJ8)" + @(cp $(srcdir)/msvc/vc8proj.head $(VCPROJ8); \ + for file in $(WIN32SOURCES); do \ + echo "" $(VCPROJOUT8); \ + done; \ + echo "
" $(VCPROJOUT8); \ + for file in $(WIN32HEADERS); do \ + echo "" $(VCPROJOUT8); \ + done; \ + cat $(srcdir)/msvc/vc8proj.foot $(VCPROJOUT8) ) + +$(VCPROJ9): msvc/vc9proj.head msvc/vc9proj.foot Makefile.am + echo "creating $(VCPROJ9)" + @(cp $(srcdir)/msvc/vc9proj.head $(VCPROJ9); \ + for file in $(WIN32SOURCES); do \ + echo "" $(VCPROJOUT9); \ + done; \ + echo "" $(VCPROJOUT9); \ + for file in $(WIN32HEADERS); do \ + echo "" $(VCPROJOUT9); \ + done; \ + cat $(srcdir)/msvc/vc9proj.foot $(VCPROJOUT9) ) diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/Makefile.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/Makefile.in Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,646 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +noinst_PROGRAMS = make_line_models$(EXEEXT) +subdir = spandsp-sim +DIST_COMMON = $(nobase_include_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/config/ax_compiler_vendor.m4 \ + $(top_srcdir)/config/ax_check_real_file.m4 \ + $(top_srcdir)/config/ax_fixed_point_machine.m4 \ + $(top_srcdir)/config/ax_misaligned_access_fails.m4 \ + $(top_srcdir)/config/ax_c99_features.m4 \ + $(top_srcdir)/config/ax_check_export_capability.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +libspandsp_sim_la_LIBADD = +am_libspandsp_sim_la_OBJECTS = g1050.lo line_model.lo rfc2198_sim.lo \ + test_utils.lo +nodist_libspandsp_sim_la_OBJECTS = line_models.lo +libspandsp_sim_la_OBJECTS = $(am_libspandsp_sim_la_OBJECTS) \ + $(nodist_libspandsp_sim_la_OBJECTS) +PROGRAMS = $(noinst_PROGRAMS) +am_make_line_models_OBJECTS = make_line_models.$(OBJEXT) +make_line_models_OBJECTS = $(am_make_line_models_OBJECTS) +make_line_models_DEPENDENCIES = +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libspandsp_sim_la_SOURCES) \ + $(nodist_libspandsp_sim_la_SOURCES) \ + $(make_line_models_SOURCES) +DIST_SOURCES = $(libspandsp_sim_la_SOURCES) \ + $(make_line_models_SOURCES) +nobase_includeHEADERS_INSTALL = $(install_sh_DATA) +HEADERS = $(nobase_include_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_FOR_BUILD = @CC_FOR_BUILD@ +CFLAGS = @CFLAGS@ +COMP_VENDOR_CFLAGS = @COMP_VENDOR_CFLAGS@ +COMP_VENDOR_LDFLAGS = @COMP_VENDOR_LDFLAGS@ +COND_DOC_FALSE = @COND_DOC_FALSE@ +COND_DOC_TRUE = @COND_DOC_TRUE@ +COND_MMX_FALSE = @COND_MMX_FALSE@ +COND_MMX_TRUE = @COND_MMX_TRUE@ +COND_SSE2_FALSE = @COND_SSE2_FALSE@ +COND_SSE2_TRUE = @COND_SSE2_TRUE@ +COND_SSE3_FALSE = @COND_SSE3_FALSE@ +COND_SSE3_TRUE = @COND_SSE3_TRUE@ +COND_SSE4A_FALSE = @COND_SSE4A_FALSE@ +COND_SSE4A_TRUE = @COND_SSE4A_TRUE@ +COND_SSE4_1_FALSE = @COND_SSE4_1_FALSE@ +COND_SSE4_1_TRUE = @COND_SSE4_1_TRUE@ +COND_SSE4_2_FALSE = @COND_SSE4_2_FALSE@ +COND_SSE4_2_TRUE = @COND_SSE4_2_TRUE@ +COND_SSE5_FALSE = @COND_SSE5_FALSE@ +COND_SSE5_TRUE = @COND_SSE5_TRUE@ +COND_SSE_FALSE = @COND_SSE_FALSE@ +COND_SSE_TRUE = @COND_SSE_TRUE@ +COND_SSSE3_FALSE = @COND_SSSE3_FALSE@ +COND_SSSE3_TRUE = @COND_SSSE3_TRUE@ +COND_TESTDATA_FALSE = @COND_TESTDATA_FALSE@ +COND_TESTDATA_TRUE = @COND_TESTDATA_TRUE@ +COND_TESTS_FALSE = @COND_TESTS_FALSE@ +COND_TESTS_TRUE = @COND_TESTS_TRUE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSERT_INTTYPES_HEADER = @INSERT_INTTYPES_HEADER@ +INSERT_MATH_HEADER = @INSERT_MATH_HEADER@ +INSERT_STDINT_HEADER = @INSERT_STDINT_HEADER@ +INSERT_TGMATH_HEADER = @INSERT_TGMATH_HEADER@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ -L$(top_builddir)/src -lspandsp $(SIMLIBS) +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIMLIBS = @SIMLIBS@ +SPANDSP_LT_AGE = @SPANDSP_LT_AGE@ +SPANDSP_LT_CURRENT = @SPANDSP_LT_CURRENT@ +SPANDSP_LT_REVISION = @SPANDSP_LT_REVISION@ +SPANDSP_MISALIGNED_ACCESS_FAILS = @SPANDSP_MISALIGNED_ACCESS_FAILS@ +SPANDSP_USE_EXPORT_CAPABILITY = @SPANDSP_USE_EXPORT_CAPABILITY@ +SPANDSP_USE_FIXED_POINT = @SPANDSP_USE_FIXED_POINT@ +STRIP = @STRIP@ +TESTLIBS = @TESTLIBS@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DSYMUTIL = @ac_ct_DSYMUTIL@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_NMEDIT = @ac_ct_NMEDIT@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AM_CFLAGS = $(COMP_VENDOR_CFLAGS) +AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) +MAINTAINERCLEANFILES = Makefile.in +EXTRA_DIST = libspandsp_sim.dsp \ + libspandsp_sim.2005.vcproj \ + libspandsp_sim.2008.vcproj \ + msvc/make_line_models.2008.vcproj \ + msvc/msvcproj.head \ + msvc/msvcproj.foot \ + msvc/vc8proj.head \ + msvc/vc8proj.foot \ + msvc/vc9proj.head \ + msvc/vc9proj.foot + +INCLUDES = -I$(top_builddir) -I$(top_builddir)/src -DDATADIR="\"$(pkgdatadir)\"" +lib_LTLIBRARIES = libspandsp-sim.la +libspandsp_sim_la_SOURCES = g1050.c \ + line_model.c \ + rfc2198_sim.c \ + test_utils.c + +nodist_libspandsp_sim_la_SOURCES = line_models.c +libspandsp_sim_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@:@SPANDSP_LT_AGE@ $(COMP_VENDOR_LDFLAGS) +nobase_include_HEADERS = spandsp/g1050.h \ + spandsp/line_model.h \ + spandsp/line_models.h \ + spandsp/rfc2198_sim.h \ + spandsp/test_utils.h \ + spandsp-sim.h + +make_line_models_SOURCES = make_line_models.c +make_line_models_LDADD = -L$(top_builddir)/src -lspandsp +DSP = libspandsp_sim.dsp +VCPROJ8 = libspandsp_sim.2005.vcproj +VCPROJ9 = libspandsp_sim.2008.vcproj +WIN32SOURCES = $(libspandsp_sim_la_SOURCES) +WIN32HEADERS = $(nobase_include_HEADERS) +DSPOUT = | awk '{printf("%s\r\n", $$0)}' >> $(DSP) +VCPROJOUT8 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ8) +VCPROJOUT9 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ9) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu spandsp-sim/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu spandsp-sim/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libspandsp-sim.la: $(libspandsp_sim_la_OBJECTS) $(libspandsp_sim_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libspandsp_sim_la_LDFLAGS) $(libspandsp_sim_la_OBJECTS) $(libspandsp_sim_la_LIBADD) $(LIBS) + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +make_line_models$(EXEEXT): $(make_line_models_OBJECTS) $(make_line_models_DEPENDENCIES) + @rm -f make_line_models$(EXEEXT) + $(LINK) $(make_line_models_LDFLAGS) $(make_line_models_OBJECTS) $(make_line_models_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g1050.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/line_model.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/line_models.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/make_line_models.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfc2198_sim.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_utils.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-nobase_includeHEADERS: $(nobase_include_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)" + @$(am__vpath_adj_setup) \ + list='$(nobase_include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + $(am__vpath_adj) \ + echo " $(nobase_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ + $(nobase_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ + done + +uninstall-nobase_includeHEADERS: + @$(NORMAL_UNINSTALL) + @$(am__vpath_adj_setup) \ + list='$(nobase_include_HEADERS)'; for p in $$list; do \ + $(am__vpath_adj) \ + echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ + rm -f "$(DESTDIR)$(includedir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(mkdir_p) $(distdir)/msvc $(distdir)/spandsp + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-nobase_includeHEADERS + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES \ + uninstall-nobase_includeHEADERS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool clean-noinstPROGRAMS ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-libLTLIBRARIES install-man \ + install-nobase_includeHEADERS install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-libLTLIBRARIES uninstall-nobase_includeHEADERS + + +# We need to run make_line_models, so it generates the line_models.h file +# used by several of the test programs. + +line_models.lo: make_line_models$(EXEEXT) line_models.c + +line_models.$(OBJEXT): make_line_models$(EXEEXT) line_models.c + +line_models.c: make_line_models$(EXEEXT) + ./make_line_models$(EXEEXT) + +$(DSP): msvc/msvcproj.head msvc/msvcproj.foot Makefile.am + echo "creating $(DSP)" + @(cp $(srcdir)/msvc/msvcproj.head $(DSP); \ + echo "# Begin Group \"Source Files\"" $(DSPOUT); \ + for file in $(WIN32SOURCES); do \ + echo "# Begin Source File" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "SOURCE=.\\"$$file $(DSPOUT); \ + echo "# End Source File" $(DSPOUT); \ + done; \ + echo "# End Group" $(DSPOUT); \ + echo "# Begin Group \"Header Files\"" $(DSPOUT); \ + for file in $(WIN32HEADERS); do \ + echo "# Begin Source File" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "SOURCE=.\\"$$file $(DSPOUT); \ + echo "# End Source File" $(DSPOUT); \ + done; \ + echo "# End Group" $(DSPOUT); \ + cat $(srcdir)/msvc/msvcproj.foot $(DSPOUT) ) + +$(VCPROJ8): msvc/vc8proj.head msvc/vc8proj.foot Makefile.am + echo "creating $(VCPROJ8)" + @(cp $(srcdir)/msvc/vc8proj.head $(VCPROJ8); \ + for file in $(WIN32SOURCES); do \ + echo "" $(VCPROJOUT8); \ + done; \ + echo "" $(VCPROJOUT8); \ + for file in $(WIN32HEADERS); do \ + echo "" $(VCPROJOUT8); \ + done; \ + cat $(srcdir)/msvc/vc8proj.foot $(VCPROJOUT8) ) + +$(VCPROJ9): msvc/vc9proj.head msvc/vc9proj.foot Makefile.am + echo "creating $(VCPROJ9)" + @(cp $(srcdir)/msvc/vc9proj.head $(VCPROJ9); \ + for file in $(WIN32SOURCES); do \ + echo "" $(VCPROJOUT9); \ + done; \ + echo "" $(VCPROJOUT9); \ + for file in $(WIN32HEADERS); do \ + echo "" $(VCPROJOUT9); \ + done; \ + cat $(srcdir)/msvc/vc9proj.foot $(VCPROJOUT9) ) +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/g1050.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/g1050.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1329 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * g1050.c - IP network modeling, as per G.1050/TIA-921. + * + * Written by Steve Underwood + * + * Copyright (C) 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: g1050.c,v 1.17 2009/06/02 14:55:36 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#define GEN_CONST +#include +#endif +#include "floating_fudge.h" + +#include "spandsp.h" +#include "spandsp/g1050.h" + +#define PACKET_LOSS_TIME -1 + +#define FALSE 0 +#define TRUE (!FALSE) + +g1050_constants_t g1050_constants[1] = +{ + { + { + { /* Side A LAN */ + { + 0.004, /*! Probability of loss rate change low->high */ + 0.1 /*! Probability of loss rate change high->low */ + }, + { + { + 0.0, /*! Probability of an impulse */ + 0.0, + }, + { + 0.5, + 0.0 + } + }, + 1.0, /*! Impulse height, based on MTU and bit rate */ + 0.0, /*! Impulse decay coefficient */ + 0.001, /*! Probability of packet loss due to occupancy. */ + 0.15 /*! Probability of packet loss due to a multiple access collision. */ + }, + { /* Side A access link */ + { + 0.0002, /*! Probability of loss rate change low->high */ + 0.2 /*! Probability of loss rate change high->low */ + }, + { + { + 0.001, /*! Probability of an impulse */ + 0.0, + }, + { + 0.3, + 0.4 + } + }, + 40.0, /*! Impulse height, based on MTU and bit rate */ + 0.75, /*! Impulse decay coefficient */ + 0.0005, /*! Probability of packet loss due to occupancy. */ + 0.0 /*! Probability of packet loss due to a multiple access collision. */ + }, + { /* Side B access link */ + { + 0.0002, /*! Probability of loss rate change low->high */ + 0.2 /*! Probability of loss rate change high->low */ + }, + { + { + 0.001, /*! Probability of an impulse */ + 0.0, + }, + { + 0.3, + 0.4 + } + }, + 40.0, /*! Impulse height, based on MTU and bit rate */ + 0.75, /*! Impulse decay coefficient */ + 0.0005, /*! Probability of packet loss due to occupancy. */ + 0.0 /*! Probability of packet loss due to a multiple access collision. */ + }, + { /* Side B LAN */ + { + 0.004, /*! Probability of loss rate change low->high */ + 0.1 /*! Probability of loss rate change high->low */ + }, + { + { + 0.0, /*! Probability of an impulse */ + 0.0, + }, + { + 0.5, + 0.0 + } + }, + 1.0, /*! Impulse height, based on MTU and bit rate */ + 0.0, /*! Impulse decay coefficient */ + 0.001, /*! Probability of packet loss due to occupancy. */ + 0.15 /*! Probability of packet loss due to a multiple access collision. */ + } + } + } +}; + +g1050_channel_speeds_t g1050_speed_patterns[168] = +{ + { 4000000, 0, 128000, 768000, 0, 4000000, 0, 128000, 768000, 0, 0.360}, + { 4000000, 0, 128000, 768000, 0, 20000000, 0, 128000, 768000, 0, 0.720}, + { 4000000, 0, 128000, 768000, 0, 100000000, 0, 128000, 768000, 0, 0.360}, + { 20000000, 0, 128000, 768000, 0, 20000000, 0, 128000, 768000, 0, 0.360}, + { 20000000, 0, 128000, 768000, 0, 100000000, 0, 128000, 768000, 0, 0.360}, + {100000000, 0, 128000, 768000, 0, 100000000, 0, 128000, 768000, 0, 0.090}, + { 4000000, 0, 128000, 1536000, 0, 4000000, 0, 384000, 768000, 0, 0.720}, + { 4000000, 0, 128000, 1536000, 0, 20000000, 0, 384000, 768000, 0, 1.470}, + { 4000000, 0, 128000, 1536000, 0, 100000000, 0, 384000, 768000, 0, 0.840}, + { 20000000, 0, 128000, 1536000, 0, 20000000, 0, 384000, 768000, 0, 0.750}, + { 20000000, 0, 128000, 1536000, 0, 100000000, 0, 384000, 768000, 0, 0.855}, + {100000000, 0, 128000, 1536000, 0, 100000000, 0, 384000, 768000, 0, 0.240}, + { 4000000, 0, 128000, 3000000, 0, 4000000, 0, 384000, 768000, 0, 0.120}, + { 4000000, 0, 128000, 3000000, 0, 20000000, 0, 384000, 768000, 0, 0.420}, + { 4000000, 0, 128000, 3000000, 0, 100000000, 0, 384000, 768000, 0, 0.840}, + { 20000000, 0, 128000, 3000000, 0, 20000000, 0, 384000, 768000, 0, 0.300}, + { 20000000, 0, 128000, 3000000, 0, 100000000, 0, 384000, 768000, 0, 0.930}, + {100000000, 0, 128000, 3000000, 0, 100000000, 0, 384000, 768000, 0, 0.390}, + { 4000000, 0, 384000, 768000, 0, 4000000, 0, 128000, 1536000, 0, 0.720}, + { 4000000, 0, 384000, 768000, 0, 20000000, 0, 128000, 1536000, 0, 1.470}, + { 4000000, 0, 384000, 768000, 0, 100000000, 0, 128000, 1536000, 0, 0.840}, + { 20000000, 0, 384000, 768000, 0, 20000000, 0, 128000, 1536000, 0, 0.750}, + { 20000000, 0, 384000, 768000, 0, 100000000, 0, 128000, 1536000, 0, 0.855}, + {100000000, 0, 384000, 768000, 0, 100000000, 0, 128000, 1536000, 0, 0.240}, + { 4000000, 0, 384000, 1536000, 0, 4000000, 0, 384000, 1536000, 0, 1.440}, + { 4000000, 0, 384000, 1536000, 0, 20000000, 0, 384000, 1536000, 0, 3.000}, + { 4000000, 0, 384000, 1536000, 0, 100000000, 0, 384000, 1536000, 0, 1.920}, + { 20000000, 0, 384000, 1536000, 0, 20000000, 0, 384000, 1536000, 0, 1.563}, + { 20000000, 0, 384000, 1536000, 0, 100000000, 0, 384000, 1536000, 0, 2.000}, + {100000000, 0, 384000, 1536000, 0, 100000000, 0, 384000, 1536000, 0, 0.640}, + { 4000000, 0, 384000, 3000000, 0, 4000000, 0, 384000, 1536000, 0, 0.240}, + { 4000000, 0, 384000, 3000000, 0, 20000000, 0, 384000, 1536000, 0, 0.850}, + { 4000000, 0, 384000, 3000000, 0, 100000000, 0, 384000, 1536000, 0, 1.720}, + { 20000000, 0, 384000, 3000000, 0, 20000000, 0, 384000, 1536000, 0, 0.625}, + { 20000000, 0, 384000, 3000000, 0, 100000000, 0, 384000, 1536000, 0, 2.025}, + {100000000, 0, 384000, 3000000, 0, 100000000, 0, 384000, 1536000, 0, 1.040}, + { 4000000, 0, 384000, 768000, 0, 4000000, 0, 128000, 3000000, 0, 0.120}, + { 4000000, 0, 384000, 768000, 0, 20000000, 0, 128000, 3000000, 0, 0.420}, + { 4000000, 0, 384000, 768000, 0, 100000000, 0, 128000, 3000000, 0, 0.840}, + { 20000000, 0, 384000, 768000, 0, 20000000, 0, 128000, 3000000, 0, 0.300}, + { 20000000, 0, 384000, 768000, 0, 100000000, 0, 128000, 3000000, 0, 0.930}, + {100000000, 0, 384000, 768000, 0, 100000000, 0, 128000, 3000000, 0, 0.390}, + { 4000000, 0, 384000, 1536000, 0, 4000000, 0, 384000, 3000000, 0, 0.240}, + { 4000000, 0, 384000, 1536000, 0, 20000000, 0, 384000, 3000000, 0, 0.850}, + { 4000000, 0, 384000, 1536000, 0, 100000000, 0, 384000, 3000000, 0, 1.720}, + { 20000000, 0, 384000, 1536000, 0, 20000000, 0, 384000, 3000000, 0, 0.625}, + { 20000000, 0, 384000, 1536000, 0, 100000000, 0, 384000, 3000000, 0, 2.025}, + {100000000, 0, 384000, 1536000, 0, 100000000, 0, 384000, 3000000, 0, 1.040}, + { 4000000, 0, 384000, 3000000, 0, 4000000, 0, 384000, 3000000, 0, 0.040}, + { 4000000, 0, 384000, 3000000, 0, 20000000, 0, 384000, 3000000, 0, 0.200}, + { 4000000, 0, 384000, 3000000, 0, 100000000, 0, 384000, 3000000, 0, 0.520}, + { 20000000, 0, 384000, 3000000, 0, 20000000, 0, 384000, 3000000, 0, 0.250}, + { 20000000, 0, 384000, 3000000, 0, 100000000, 0, 384000, 3000000, 0, 1.300}, + {100000000, 0, 384000, 3000000, 0, 100000000, 0, 384000, 3000000, 0, 1.690}, + { 4000000, 0, 128000, 1536000, 0, 20000000, 0, 768000, 1536000, 0, 0.090}, + { 4000000, 0, 128000, 1536000, 0, 100000000, 0, 768000, 1536000, 0, 0.360}, + { 20000000, 0, 128000, 1536000, 0, 20000000, 0, 768000, 1536000, 0, 0.090}, + { 20000000, 0, 128000, 1536000, 0, 100000000, 0, 768000, 1536000, 0, 0.405}, + {100000000, 0, 128000, 1536000, 0, 100000000, 0, 768000, 1536000, 0, 0.180}, + { 4000000, 0, 128000, 7000000, 0, 20000000, 0, 768000, 768000, 0, 0.270}, + { 4000000, 0, 128000, 7000000, 0, 100000000, 0, 768000, 768000, 0, 1.080}, + { 20000000, 0, 128000, 7000000, 0, 20000000, 0, 768000, 768000, 0, 0.270}, + { 20000000, 0, 128000, 7000000, 0, 100000000, 0, 768000, 768000, 0, 1.215}, + {100000000, 0, 128000, 7000000, 0, 100000000, 0, 768000, 768000, 0, 0.540}, + { 4000000, 0, 128000, 13000000, 0, 20000000, 0, 768000, 13000000, 0, 0.030}, + { 4000000, 0, 128000, 13000000, 0, 100000000, 0, 768000, 13000000, 0, 0.120}, + { 20000000, 0, 128000, 13000000, 0, 20000000, 0, 768000, 13000000, 0, 0.030}, + { 20000000, 0, 128000, 13000000, 0, 100000000, 0, 768000, 13000000, 0, 0.135}, + {100000000, 0, 128000, 13000000, 0, 100000000, 0, 768000, 13000000, 0, 0.060}, + { 4000000, 0, 384000, 1536000, 0, 20000000, 0, 1536000, 1536000, 0, 0.180}, + { 4000000, 0, 384000, 1536000, 0, 100000000, 0, 1536000, 1536000, 0, 0.720}, + { 20000000, 0, 384000, 1536000, 0, 20000000, 0, 1536000, 1536000, 0, 0.188}, + { 20000000, 0, 384000, 1536000, 0, 100000000, 0, 1536000, 1536000, 0, 0.870}, + {100000000, 0, 384000, 1536000, 0, 100000000, 0, 1536000, 1536000, 0, 0.480}, + { 4000000, 0, 384000, 7000000, 0, 20000000, 0, 768000, 1536000, 0, 0.540}, + { 4000000, 0, 384000, 7000000, 0, 100000000, 0, 768000, 1536000, 0, 2.160}, + { 20000000, 0, 384000, 7000000, 0, 20000000, 0, 768000, 1536000, 0, 0.563}, + { 20000000, 0, 384000, 7000000, 0, 100000000, 0, 768000, 1536000, 0, 2.610}, + {100000000, 0, 384000, 7000000, 0, 100000000, 0, 768000, 1536000, 0, 1.440}, + { 4000000, 0, 384000, 13000000, 0, 20000000, 0, 1536000, 13000000, 0, 0.060}, + { 4000000, 0, 384000, 13000000, 0, 100000000, 0, 1536000, 13000000, 0, 0.240}, + { 20000000, 0, 384000, 13000000, 0, 20000000, 0, 1536000, 13000000, 0, 0.063}, + { 20000000, 0, 384000, 13000000, 0, 100000000, 0, 1536000, 13000000, 0, 0.290}, + {100000000, 0, 384000, 13000000, 0, 100000000, 0, 1536000, 13000000, 0, 0.160}, + { 4000000, 0, 384000, 1536000, 0, 20000000, 0, 1536000, 3000000, 0, 0.030}, + { 4000000, 0, 384000, 1536000, 0, 100000000, 0, 1536000, 3000000, 0, 0.120}, + { 20000000, 0, 384000, 1536000, 0, 20000000, 0, 1536000, 3000000, 0, 0.075}, + { 20000000, 0, 384000, 1536000, 0, 100000000, 0, 1536000, 3000000, 0, 0.495}, + {100000000, 0, 384000, 1536000, 0, 100000000, 0, 1536000, 3000000, 0, 0.780}, + { 4000000, 0, 384000, 7000000, 0, 20000000, 0, 768000, 3000000, 0, 0.090}, + { 4000000, 0, 384000, 7000000, 0, 100000000, 0, 768000, 3000000, 0, 0.360}, + { 20000000, 0, 384000, 7000000, 0, 20000000, 0, 768000, 3000000, 0, 0.225}, + { 20000000, 0, 384000, 7000000, 0, 100000000, 0, 768000, 3000000, 0, 1.485}, + {100000000, 0, 384000, 7000000, 0, 100000000, 0, 768000, 3000000, 0, 2.340}, + { 4000000, 0, 384000, 13000000, 0, 20000000, 0, 3000000, 13000000, 0, 0.010}, + { 4000000, 0, 384000, 13000000, 0, 100000000, 0, 3000000, 13000000, 0, 0.040}, + { 20000000, 0, 384000, 13000000, 0, 20000000, 0, 3000000, 13000000, 0, 0.025}, + { 20000000, 0, 384000, 13000000, 0, 100000000, 0, 3000000, 13000000, 0, 0.165}, + {100000000, 0, 384000, 13000000, 0, 100000000, 0, 3000000, 13000000, 0, 0.260}, + { 4000000, 0, 768000, 1536000, 0, 20000000, 0, 128000, 1536000, 0, 0.090}, + { 20000000, 0, 768000, 1536000, 0, 20000000, 0, 128000, 1536000, 0, 0.090}, + { 20000000, 0, 768000, 1536000, 0, 100000000, 0, 128000, 1536000, 0, 0.405}, + { 4000000, 0, 768000, 1536000, 0, 100000000, 0, 128000, 1536000, 0, 0.360}, + {100000000, 0, 768000, 1536000, 0, 100000000, 0, 128000, 1536000, 0, 0.180}, + { 4000000, 0, 1536000, 1536000, 0, 20000000, 0, 384000, 1536000, 0, 0.180}, + { 20000000, 0, 1536000, 1536000, 0, 20000000, 0, 384000, 1536000, 0, 0.188}, + { 20000000, 0, 1536000, 1536000, 0, 100000000, 0, 384000, 1536000, 0, 0.870}, + { 4000000, 0, 1536000, 1536000, 0, 100000000, 0, 384000, 1536000, 0, 0.720}, + {100000000, 0, 1536000, 1536000, 0, 100000000, 0, 384000, 1536000, 0, 0.480}, + { 4000000, 0, 1536000, 3000000, 0, 20000000, 0, 384000, 1536000, 0, 0.030}, + { 20000000, 0, 1536000, 3000000, 0, 20000000, 0, 384000, 1536000, 0, 0.075}, + { 20000000, 0, 1536000, 3000000, 0, 100000000, 0, 384000, 1536000, 0, 0.495}, + { 4000000, 0, 1536000, 3000000, 0, 100000000, 0, 384000, 1536000, 0, 0.120}, + {100000000, 0, 1536000, 3000000, 0, 100000000, 0, 384000, 1536000, 0, 0.780}, + { 4000000, 0, 768000, 768000, 0, 20000000, 0, 128000, 7000000, 0, 0.270}, + { 20000000, 0, 768000, 768000, 0, 20000000, 0, 128000, 7000000, 0, 0.270}, + { 20000000, 0, 768000, 768000, 0, 100000000, 0, 128000, 7000000, 0, 1.215}, + { 4000000, 0, 768000, 768000, 0, 100000000, 0, 128000, 7000000, 0, 1.080}, + {100000000, 0, 768000, 768000, 0, 100000000, 0, 128000, 7000000, 0, 0.540}, + { 4000000, 0, 768000, 1536000, 0, 20000000, 0, 384000, 7000000, 0, 0.540}, + { 20000000, 0, 768000, 1536000, 0, 20000000, 0, 384000, 7000000, 0, 0.563}, + { 20000000, 0, 768000, 1536000, 0, 100000000, 0, 384000, 7000000, 0, 2.610}, + { 4000000, 0, 768000, 1536000, 0, 100000000, 0, 384000, 7000000, 0, 2.160}, + {100000000, 0, 768000, 1536000, 0, 100000000, 0, 384000, 7000000, 0, 1.440}, + { 4000000, 0, 768000, 3000000, 0, 20000000, 0, 384000, 7000000, 0, 0.090}, + { 20000000, 0, 768000, 3000000, 0, 20000000, 0, 384000, 7000000, 0, 0.225}, + { 20000000, 0, 768000, 3000000, 0, 100000000, 0, 384000, 7000000, 0, 1.485}, + { 4000000, 0, 768000, 3000000, 0, 100000000, 0, 384000, 7000000, 0, 0.360}, + {100000000, 0, 768000, 3000000, 0, 100000000, 0, 384000, 7000000, 0, 2.340}, + { 4000000, 0, 768000, 13000000, 0, 20000000, 0, 128000, 13000000, 0, 0.030}, + { 20000000, 0, 768000, 13000000, 0, 20000000, 0, 128000, 13000000, 0, 0.030}, + { 20000000, 0, 768000, 13000000, 0, 100000000, 0, 128000, 13000000, 0, 0.135}, + { 4000000, 0, 768000, 13000000, 0, 100000000, 0, 128000, 13000000, 0, 0.120}, + {100000000, 0, 768000, 13000000, 0, 100000000, 0, 128000, 13000000, 0, 0.060}, + { 4000000, 0, 1536000, 13000000, 0, 20000000, 0, 384000, 13000000, 0, 0.060}, + { 20000000, 0, 1536000, 13000000, 0, 20000000, 0, 384000, 13000000, 0, 0.063}, + { 20000000, 0, 1536000, 13000000, 0, 100000000, 0, 384000, 13000000, 0, 0.290}, + { 4000000, 0, 1536000, 13000000, 0, 100000000, 0, 384000, 13000000, 0, 0.240}, + {100000000, 0, 1536000, 13000000, 0, 100000000, 0, 384000, 13000000, 0, 0.160}, + { 4000000, 0, 3000000, 13000000, 0, 20000000, 0, 384000, 13000000, 0, 0.010}, + { 20000000, 0, 3000000, 13000000, 0, 20000000, 0, 384000, 13000000, 0, 0.025}, + { 20000000, 0, 3000000, 13000000, 0, 100000000, 0, 384000, 13000000, 0, 0.165}, + { 4000000, 0, 3000000, 13000000, 0, 100000000, 0, 384000, 13000000, 0, 0.040}, + {100000000, 0, 3000000, 13000000, 0, 100000000, 0, 384000, 13000000, 0, 0.260}, + { 20000000, 0, 1536000, 1536000, 0, 20000000, 0, 1536000, 1536000, 0, 0.023}, + { 20000000, 0, 1536000, 1536000, 0, 100000000, 0, 1536000, 1536000, 0, 0.180}, + {100000000, 0, 1536000, 1536000, 0, 100000000, 0, 1536000, 1536000, 0, 0.360}, + { 20000000, 0, 1536000, 7000000, 0, 20000000, 0, 768000, 1536000, 0, 0.068}, + { 20000000, 0, 1536000, 7000000, 0, 100000000, 0, 768000, 1536000, 0, 0.540}, + {100000000, 0, 1536000, 7000000, 0, 100000000, 0, 768000, 1536000, 0, 1.080}, + { 20000000, 0, 1536000, 13000000, 0, 20000000, 0, 1536000, 13000000, 0, 0.015}, + { 20000000, 0, 1536000, 13000000, 0, 100000000, 0, 1536000, 13000000, 0, 0.120}, + {100000000, 0, 1536000, 13000000, 0, 100000000, 0, 1536000, 13000000, 0, 0.240}, + { 20000000, 0, 768000, 1536000, 0, 20000000, 0, 1536000, 7000000, 0, 0.068}, + { 20000000, 0, 768000, 1536000, 0, 100000000, 0, 1536000, 7000000, 0, 0.540}, + {100000000, 0, 768000, 1536000, 0, 100000000, 0, 1536000, 7000000, 0, 1.080}, + { 20000000, 0, 768000, 7000000, 0, 20000000, 0, 768000, 7000000, 0, 0.203}, + { 20000000, 0, 768000, 7000000, 0, 100000000, 0, 768000, 7000000, 0, 1.620}, + {100000000, 0, 768000, 7000000, 0, 100000000, 0, 768000, 7000000, 0, 3.240}, + { 20000000, 0, 768000, 13000000, 0, 20000000, 0, 7000000, 13000000, 0, 0.023}, + { 20000000, 0, 768000, 13000000, 0, 100000000, 0, 7000000, 13000000, 0, 0.180}, + {100000000, 0, 768000, 13000000, 0, 100000000, 0, 7000000, 13000000, 0, 0.360}, + { 20000000, 0, 7000000, 13000000, 0, 20000000, 0, 768000, 13000000, 0, 0.023}, + { 20000000, 0, 7000000, 13000000, 0, 100000000, 0, 768000, 13000000, 0, 0.180}, + {100000000, 0, 7000000, 13000000, 0, 100000000, 0, 768000, 13000000, 0, 0.360}, + { 20000000, 0, 13000000, 13000000, 0, 20000000, 0, 13000000, 13000000, 0, 0.003}, + { 20000000, 0, 13000000, 13000000, 0, 100000000, 0, 13000000, 13000000, 0, 0.020}, + {100000000, 0, 13000000, 13000000, 0, 100000000, 0, 13000000, 13000000, 0, 0.040} +}; + +g1050_model_t g1050_standard_models[9] = +{ + { /* Severity 0 - no impairment */ + { + 0, /*! Percentage likelihood of occurance in scenario A */ + 0, /*! Percentage likelihood of occurance in scenario B */ + 0, /*! Percentage likelihood of occurance in scenario C */ + }, + { + 0.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0 /*! Peak jitter */ + }, + { + 0.0, /*! Percentage occupancy */ + 512, /*! MTU */ + 0.0 /*! Peak jitter */ + }, + { + 0.0, /*! Basic delay of the regional backbone, in seconds */ + 0.0, /*! Basic delay of the intercontinental backbone, in seconds */ + 0.0, /*! Percentage packet loss of the backbone */ + 0.0, /*! Maximum jitter of the backbone, in seconds */ + 0.0, /*! Interval between the backbone route flapping between two paths, in seconds */ + 0.0, /*! The difference in backbone delay between the two routes we flap between, in seconds */ + 0.0, /*! The interval between link failures, in seconds */ + 0.0, /*! The duration of link failures, in seconds */ + 0.0, /*! Probability of packet loss in the backbone, in percent */ + 0.0 /*! Probability of a packet going out of sequence in the backbone. */ + }, + { + 0.0, /*! Percentage occupancy */ + 512, /*! MTU */ + 0.0 /*! Peak jitter */ + }, + { + 0.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0 /*! Peak jitter */ + } + }, + { /* Severity A */ + { + 50, /*! Percentage likelihood of occurance in scenario A */ + 5, /*! Percentage likelihood of occurance in scenario B */ + 5, /*! Percentage likelihood of occurance in scenario C */ + }, + { + 1.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0015 /*! Peak jitter */ + }, + { + 0.0, /*! Percentage occupancy */ + 512, /*! MTU */ + 0.0 /*! Peak jitter */ + }, + { + 0.004, /*! Basic delay of the regional backbone, in seconds */ + 0.016, /*! Basic delay of the intercontinental backbone, in seconds */ + 0.0, /*! Percentage packet loss of the backbone */ + 0.005, /*! Maximum jitter of the backbone, in seconds */ + 0.0, /*! Interval between the backbone route flapping between two paths, in seconds */ + 0.0, /*! The difference in backbone delay between the two routes we flap between, in seconds */ + 0.0, /*! The interval between link failures, in seconds */ + 0.0, /*! The duration of link failures, in seconds */ + 0.0, /*! Probability of packet loss in the backbone, in percent */ + 0.0 /*! Probability of a packet going out of sequence in the backbone. */ + }, + { + 0.0, /*! Percentage occupancy */ + 512, /*! MTU */ + 0.0 /*! Peak jitter */ + }, + { + 1.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0015 /*! Peak jitter */ + } + }, + { /* Severity B */ + { + 30, /*! Percentage likelihood of occurance in scenario A */ + 25, /*! Percentage likelihood of occurance in scenario B */ + 5, /*! Percentage likelihood of occurance in scenario C */ + }, + { + 2.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0015 /*! Peak jitter */ + }, + { + 1.0, /*! Percentage occupancy */ + 512, /*! MTU */ + 0.0 /*! Peak jitter */ + }, + { + 0.008, /*! Basic delay of the regional backbone, in seconds */ + 0.032, /*! Basic delay of the intercontinental backbone, in seconds */ + 0.01, /*! Percentage packet loss of the backbone */ + 0.01, /*! Maximum jitter of the backbone, in seconds */ + 3600.0, /*! Interval between the backbone route flapping between two paths, in seconds */ + 0.002, /*! The difference in backbone delay between the two routes we flap between, in seconds */ + 3600.0, /*! The interval between link failures, in seconds */ + 0.064, /*! The duration of link failures, in seconds */ + 0.0, /*! Probability of packet loss in the backbone, in percent */ + 0.0 /*! Probability of a packet going out of sequence in the backbone. */ + }, + { + 1.0, /*! Percentage occupancy */ + 512, /*! MTU */ + 0.0 /*! Peak jitter */ + }, + { + 2.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0015 /*! Peak jitter */ + } + }, + { /* Severity C */ + { + 15, /*! Percentage likelihood of occurance in scenario A */ + 30, /*! Percentage likelihood of occurance in scenario B */ + 10, /*! Percentage likelihood of occurance in scenario C */ + }, + { + 3.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0015 /*! Peak jitter */ + }, + { + 2.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0 /*! Peak jitter */ + }, + { + 0.016, /*! Basic delay of the regional backbone, in seconds */ + 0.064, /*! Basic delay of the intercontinental backbone, in seconds */ + 0.02, /*! Percentage packet loss of the backbone */ + 0.016, /*! Maximum jitter of the backbone, in seconds */ + 1800.0, /*! Interval between the backbone route flapping between two paths, in seconds */ + 0.004, /*! The difference in backbone delay between the two routes we flap between, in seconds */ + 1800.0, /*! The interval between link failures, in seconds */ + 0.128, /*! The duration of link failures, in seconds */ + 0.0, /*! Probability of packet loss in the backbone, in percent */ + 0.0 /*! Probability of a packet going out of sequence in the backbone. */ + }, + { + 2.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0 /*! Peak jitter */ + }, + { + 3.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0015 /*! Peak jitter */ + } + }, + { /* Severity D */ + { + 5, /*! Percentage likelihood of occurance in scenario A */ + 25, /*! Percentage likelihood of occurance in scenario B */ + 15, /*! Percentage likelihood of occurance in scenario C */ + }, + { + 5.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0015 /*! Peak jitter */ + }, + { + 4.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0 /*! Peak jitter */ + }, + { + 0.032, /*! Basic delay of the regional backbone, in seconds */ + 0.128, /*! Basic delay of the intercontinental backbone, in seconds */ + 0.04, /*! Percentage packet loss of the backbone */ + 0.04, /*! Maximum jitter of the backbone, in seconds */ + 900.0, /*! Interval between the backbone route flapping between two paths, in seconds */ + 0.008, /*! The difference in backbone delay between the two routes we flap between, in seconds */ + 900.0, /*! The interval between link failures, in seconds */ + 0.256, /*! The duration of link failures, in seconds */ + 0.0, /*! Probability of packet loss in the backbone, in percent */ + 0.0 /*! Probability of a packet going out of sequence in the backbone. */ + }, + { + 4.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0 /*! Peak jitter */ + }, + { + 5.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0015 /*! Peak jitter */ + } + }, + { /* Severity E */ + { + 0, /*! Percentage likelihood of occurance in scenario A */ + 10, /*! Percentage likelihood of occurance in scenario B */ + 20, /*! Percentage likelihood of occurance in scenario C */ + }, + { + 8.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0015 /*! Peak jitter */ + }, + { + 8.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0 /*! Peak jitter */ + }, + { + 0.064, /*! Basic delay of the regional backbone, in seconds */ + 0.196, /*! Basic delay of the intercontinental backbone, in seconds */ + 0.1, /*! Percentage packet loss of the backbone */ + 0.07, /*! Maximum jitter of the backbone, in seconds */ + 480.0, /*! Interval between the backbone route flapping between two paths, in seconds */ + 0.016, /*! The difference in backbone delay between the two routes we flap between, in seconds */ + 480.0, /*! The interval between link failures, in seconds */ + 0.4, /*! The duration of link failures, in seconds */ + 0.0, /*! Probability of packet loss in the backbone, in percent */ + 0.0 /*! Probability of a packet going out of sequence in the backbone. */ + }, + { + 8.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0 /*! Peak jitter */ + }, + { + 8.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0015 /*! Peak jitter */ + } + }, + { /* Severity F */ + { + 0, /*! Percentage likelihood of occurance in scenario A */ + 0, /*! Percentage likelihood of occurance in scenario B */ + 25, /*! Percentage likelihood of occurance in scenario C */ + }, + { + 12.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0015 /*! Peak jitter */ + }, + { + 15.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0 /*! Peak jitter */ + }, + { + 0.128, /*! Basic delay of the regional backbone, in seconds */ + 0.256, /*! Basic delay of the intercontinental backbone, in seconds */ + 0.2, /*! Percentage packet loss of the backbone */ + 0.1, /*! Maximum jitter of the backbone, in seconds */ + 240.0, /*! Interval between the backbone route flapping between two paths, in seconds */ + 0.032, /*! The difference in backbone delay between the two routes we flap between, in seconds */ + 240.0, /*! The interval between link failures, in seconds */ + 0.8, /*! The duration of link failures, in seconds */ + 0.0, /*! Probability of packet loss in the backbone, in percent */ + 0.0 /*! Probability of a packet going out of sequence in the backbone. */ + }, + { + 15.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0 /*! Peak jitter */ + }, + { + 12.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0015 /*! Peak jitter */ + } + }, + { /* Severity G */ + { + 0, /*! Percentage likelihood of occurance in scenario A */ + 0, /*! Percentage likelihood of occurance in scenario B */ + 15, /*! Percentage likelihood of occurance in scenario C */ + }, + { + 16.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0015 /*! Peak jitter */ + }, + { + 30.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0 /*! Peak jitter */ + }, + { + 0.256, /*! Basic delay of the regional backbone, in seconds */ + 0.512, /*! Basic delay of the intercontinental backbone, in seconds */ + 0.5, /*! Percentage packet loss of the backbone */ + 0.15, /*! Maximum jitter of the backbone, in seconds */ + 120.0, /*! Interval between the backbone route flapping between two paths, in seconds */ + 0.064, /*! The difference in backbone delay between the two routes we flap between, in seconds */ + 120.0, /*! The interval between link failures, in seconds */ + 1.6, /*! The duration of link failures, in seconds */ + 0.0, /*! Probability of packet loss in the backbone, in percent */ + 0.0 /*! Probability of a packet going out of sequence in the backbone. */ + }, + { + 30.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0 /*! Peak jitter */ + }, + { + 16.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0015 /*! Peak jitter */ + } + }, + { /* Severity H */ + { + 0, /*! Percentage likelihood of occurance in scenario A */ + 0, /*! Percentage likelihood of occurance in scenario B */ + 5, /*! Percentage likelihood of occurance in scenario C */ + }, + { + 20.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0015 /*! Peak jitter */ + }, + { + 50.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0 /*! Peak jitter */ + }, + { + 0.512, /*! Basic delay of the regional backbone, in seconds */ + 0.768, /*! Basic delay of the intercontinental backbone, in seconds */ + 1.0, /*! Percentage packet loss of the backbone */ + 0.5, /*! Maximum jitter of the backbone, in seconds */ + 60.0, /*! Interval between the backbone route flapping between two paths, in seconds */ + 0.128, /*! The difference in backbone delay between the two routes we flap between, in seconds */ + 60.0, /*! The interval between link failures, in seconds */ + 3.0, /*! The duration of link failures, in seconds */ + 1.0, /*! Probability of packet loss in the backbone, in percent */ + 1.0 /*! Probability of a packet going out of sequence in the backbone. */ + }, + { + 50.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0 /*! Peak jitter */ + }, + { + 20.0, /*! Percentage occupancy */ + 1508, /*! MTU */ + 0.0015 /*! Peak jitter */ + } + } +}; + +#if defined(HAVE_DRAND48) +static __inline__ void q1050_rand_init(void) +{ + srand48(time(NULL)); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ double q1050_rand(void) +{ + return drand48(); +} +/*- End of function --------------------------------------------------------*/ +#else +static __inline__ void q1050_rand_init(void) +{ + srand(time(NULL)); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ double q1050_rand(void) +{ + return (double) rand()/(double) RAND_MAX; +} +/*- End of function --------------------------------------------------------*/ +#endif + +static __inline__ double scale_probability(double prob, double scale) +{ + /* Re-calculate probability based on a different time interval */ + return 1.0 - pow(1.0 - prob, scale); +} +/*- End of function --------------------------------------------------------*/ + +static void g1050_segment_init(g1050_segment_state_t *s, + int link_type, + g1050_segment_constants_t *constants, + g1050_segment_model_t *parms, + int bit_rate, + int multiple_access, + int qos_enabled, + int packet_size, + int packet_rate) +{ + double x; + double packet_interval; + + memset(s, 0, sizeof(*s)); + + packet_interval = 1000.0/packet_rate; + /* Some calculatons are common to both LAN and access links, and those that are not. */ + s->link_type = link_type; + s->prob_loss_rate_change[0] = scale_probability(constants->prob_loss_rate_change[0]*parms->percentage_occupancy, 1.0/packet_interval); + + s->serial_delay = packet_size*8.0/bit_rate; + if (link_type == G1050_LAN_LINK) + { + s->prob_loss_rate_change[1] = scale_probability(constants->prob_loss_rate_change[1], 1.0/packet_interval); + s->prob_impulse[0] = constants->prob_impulse[0][0]; + s->prob_impulse[1] = constants->prob_impulse[1][0]; + s->impulse_coeff = constants->impulse_coeff; + s->impulse_height = parms->mtu*(8.0/bit_rate)*(1.0 + parms->percentage_occupancy/constants->impulse_height); + } + else if (link_type == G1050_ACCESS_LINK) + { + s->prob_loss_rate_change[1] = scale_probability(constants->prob_loss_rate_change[1]/(1.0 + parms->percentage_occupancy), 1.0/packet_interval); + s->prob_impulse[0] = scale_probability(constants->prob_impulse[0][0] + (parms->percentage_occupancy/2000.0), 1.0/packet_interval); + s->prob_impulse[1] = scale_probability(constants->prob_impulse[1][0] + (constants->prob_impulse[1][1]*parms->percentage_occupancy/100.0), 1.0/packet_interval); + s->impulse_coeff = 1.0 - scale_probability(1.0 - constants->impulse_coeff, 1.0/packet_interval); + x = (1.0 - constants->impulse_coeff)/(1.0 - s->impulse_coeff); + s->impulse_height = x*parms->mtu*(8.0/bit_rate)*(1.0 + parms->percentage_occupancy/constants->impulse_height); + } + + /* The following are calculated the same way for LAN and access links */ + s->prob_packet_loss = constants->prob_packet_loss*parms->percentage_occupancy; + s->qos_enabled = qos_enabled; + s->multiple_access = multiple_access; + s->prob_packet_collision_loss = constants->prob_packet_collision_loss; + s->max_jitter = parms->max_jitter; + + /* The following is common state information to all links. */ + s->high_loss = FALSE; + s->congestion_delay = 0.0; + s->last_arrival_time = 0.0; + + /* Count of packets lost in this segment. */ + s->lost_packets = 0; + s->lost_packets_2 = 0; +} +/*- End of function --------------------------------------------------------*/ + +static void g1050_core_init(g1050_core_state_t *s, g1050_core_model_t *parms, int packet_rate) +{ + memset(s, 0, sizeof(*s)); + + /* Set up route flapping. */ + /* This is the length of the period of both the delayed duration and the non-delayed. */ + s->route_flap_interval = parms->route_flap_interval*G1050_TICKS_PER_SEC; + + /* How much additional delay is added or subtracted during route flaps. */ + s->route_flap_delta = parms->route_flap_delay; + + /* Current tick count. This is initialized so that we are part way into the first + CLEAN interval before the first change occurs. This is a random portion of the + period. When we reach the first flap, the flapping in both directions becomes + periodic. */ + s->route_flap_counter = s->route_flap_interval - 99 - floor(s->route_flap_interval*q1050_rand()); + s->link_failure_interval_ticks = parms->link_failure_interval*G1050_TICKS_PER_SEC; + + /* Link failures occur when the count reaches this number of ticks. */ + /* Duration of a failure. */ + s->link_failure_duration_ticks = floor((G1050_TICKS_PER_SEC*parms->link_failure_duration)); + /* How far into the first CLEAN interval we are. This is like the route flap initialzation. */ + s->link_failure_counter = s->link_failure_interval_ticks - 99 - floor(s->link_failure_interval_ticks*q1050_rand()); + s->link_recovery_counter = s->link_failure_duration_ticks; + + s->base_delay = parms->base_regional_delay; + s->max_jitter = parms->max_jitter; + s->prob_packet_loss = parms->prob_packet_loss/100.0; + s->prob_oos = parms->prob_oos/100.0; + s->last_arrival_time = 0.0; + s->delay_delta = 0; + + /* Count of packets lost in this segment. */ + s->lost_packets = 0; + s->lost_packets_2 = 0; +} +/*- End of function --------------------------------------------------------*/ + +static void g1050_segment_model(g1050_segment_state_t *s, double delays[], int len) +{ + int i; + int lose; + int was_high_loss; + double impulse; + double slice_delay; + + /* Compute delay and loss value for each time slice. */ + for (i = 0; i < len; i++) + { + lose = FALSE; + /* Initialize delay to the serial delay plus some jitter. */ + slice_delay = s->serial_delay + s->max_jitter*q1050_rand(); + /* If no QoS, do congestion delay and packet loss analysis. */ + if (!s->qos_enabled) + { + /* To match the logic in G.1050 we need to record the current loss state, before + checking if we should change. */ + was_high_loss = s->high_loss; + /* Toggle between the low-loss and high-loss states, based on the transition probability. */ + if (q1050_rand() < s->prob_loss_rate_change[was_high_loss]) + s->high_loss = !s->high_loss; + impulse = 0.0; + if (q1050_rand() < s->prob_impulse[was_high_loss]) + { + impulse = s->impulse_height; + if (!was_high_loss || s->link_type == G1050_LAN_LINK) + impulse *= q1050_rand(); + } + + if (was_high_loss && q1050_rand() < s->prob_packet_loss) + lose = TRUE; + /* Single pole LPF for the congestion delay impulses. */ + s->congestion_delay = s->congestion_delay*s->impulse_coeff + impulse*(1.0 - s->impulse_coeff); + slice_delay += s->congestion_delay; + } + /* If duplex mismatch on LAN, packet loss based on loss probability. */ + if (s->multiple_access && (q1050_rand() < s->prob_packet_collision_loss)) + lose = TRUE; + /* Put computed delay into time slice array. */ + if (lose) + { + delays[i] = PACKET_LOSS_TIME; + s->lost_packets++; + } + else + { + delays[i] = slice_delay; + } + } +} +/*- End of function --------------------------------------------------------*/ + +static void g1050_core_model(g1050_core_state_t *s, double delays[], int len) +{ + int32_t i; + int lose; + double jitter_delay; + + for (i = 0; i < len; i++) + { + lose = FALSE; + jitter_delay = s->base_delay + s->max_jitter*q1050_rand(); + /* Route flapping */ + if (--s->route_flap_counter <= 0) + { + /* Route changed */ + s->delay_delta = s->route_flap_delta - s->delay_delta; + s->route_flap_counter = s->route_flap_interval; + } + if (q1050_rand() < s->prob_packet_loss) + lose = TRUE; + /* Link failures */ + if (--s->link_failure_counter <= 0) + { + /* We are in a link failure */ + lose = TRUE; + if (--s->link_recovery_counter <= 0) + { + /* Leave failure state. */ + s->link_failure_counter = s->link_failure_interval_ticks; + s->link_recovery_counter = s->link_failure_duration_ticks; + lose = FALSE; + } + } + if (lose) + { + delays[i] = PACKET_LOSS_TIME; + s->lost_packets++; + } + else + { + delays[i] = jitter_delay + s->delay_delta; + } + } +} +/*- End of function --------------------------------------------------------*/ + +static int g1050_segment_delay(g1050_segment_state_t *s, + double base_time, + double arrival_times[], + double delays[], + int num_packets) +{ + int i; + int32_t departure_time; + int lost_packets; + + /* Add appropriate delays to the packets for the segments before the core. */ + lost_packets = 0; + for (i = 0; i < num_packets; i++) + { + /* Apply half a millisecond of rounding, as we working in millisecond steps. */ + departure_time = (arrival_times[i] + 0.0005 - base_time)*G1050_TICKS_PER_SEC; + if (arrival_times[i] == PACKET_LOSS_TIME) + { + /* Lost already */ + } + else if (delays[departure_time] == PACKET_LOSS_TIME) + { + arrival_times[i] = PACKET_LOSS_TIME; + lost_packets++; + } + else + { + arrival_times[i] += delays[departure_time]; + if (arrival_times[i] < s->last_arrival_time) + arrival_times[i] = s->last_arrival_time; + else + s->last_arrival_time = arrival_times[i]; + } + } + return lost_packets; +} +/*- End of function --------------------------------------------------------*/ + +static int g1050_segment_delay_preserve_order(g1050_segment_state_t *s, + double base_time, + double arrival_times_a[], + double arrival_times_b[], + double delays[], + int num_packets) +{ + int i; + int j; + int departure_time; + double last_arrival_time; + double last_arrival_time_temp; + int lost_packets; + + /* Add appropriate delays to the packets for the segments after the core. */ + last_arrival_time = 0.0; + last_arrival_time_temp = 0.0; + lost_packets = 0; + for (i = 0; i < num_packets; i++) + { + /* We need to preserve the order that came out of the core, so we + use an alternate array for the results. */ + /* Apply half a millisecond of rounding, as we working in millisecond steps. */ + departure_time = (arrival_times_a[i] + 0.0005 - base_time)*G1050_TICKS_PER_SEC; + if (arrival_times_a[i] == PACKET_LOSS_TIME) + { + /* Lost already */ + arrival_times_b[i] = PACKET_LOSS_TIME; + } + else if (delays[departure_time] == PACKET_LOSS_TIME) + { + arrival_times_b[i] = PACKET_LOSS_TIME; + lost_packets++; + } + else + { + arrival_times_b[i] = arrival_times_a[i] + delays[departure_time]; + if (arrival_times_a[i] < last_arrival_time) + { + /* If a legitimate out of sequence packet is detected, search + back a fixed amount of time to preserve order. */ + for (j = i - 1; j >= 0; j--) + { + if ((arrival_times_a[j] != PACKET_LOSS_TIME) + && + (arrival_times_b[j] != PACKET_LOSS_TIME)) + { + if ((arrival_times_a[i] - arrival_times_a[j]) > SEARCHBACK_PERIOD) + break; + if ((arrival_times_a[j] > arrival_times_a[i]) + && + (arrival_times_b[j] < arrival_times_b[i])) + { + arrival_times_b[j] = arrival_times_b[i]; + } + } + } + } + else + { + last_arrival_time = arrival_times_a[i]; + if (arrival_times_b[i] < last_arrival_time_temp) + arrival_times_b[i] = last_arrival_time_temp; + else + last_arrival_time_temp = arrival_times_b[i]; + } + } + } + return lost_packets; +} +/*- End of function --------------------------------------------------------*/ + +static int g1050_core_delay(g1050_core_state_t *s, + double base_time, + double arrival_times[], + double delays[], + int num_packets) +{ + int i; + int departure_time; + int lost_packets; + + /* This element does NOT preserve packet order. */ + lost_packets = 0; + for (i = 0; i < num_packets; i++) + { + /* Apply half a millisecond of rounding, as we working in millisecond steps. */ + departure_time = (arrival_times[i] + 0.0005 - base_time)*G1050_TICKS_PER_SEC; + if (arrival_times[i] == PACKET_LOSS_TIME) + { + /* Lost already */ + } + else if (delays[departure_time] == PACKET_LOSS_TIME) + { + arrival_times[i] = PACKET_LOSS_TIME; + lost_packets++; + } + else + { + /* Not lost. Compute arrival time. */ + arrival_times[i] += delays[departure_time]; + if (arrival_times[i] < s->last_arrival_time) + { + /* This packet is EARLIER than the last one. It is out of order! */ + /* Do we allow it to stay out of order? */ + if (q1050_rand() >= s->prob_oos) + arrival_times[i] = s->last_arrival_time; + } + else + { + /* Packet is in the correct order, relative to the last one. */ + s->last_arrival_time = arrival_times[i]; + } + } + } + return lost_packets; +} +/*- End of function --------------------------------------------------------*/ + +static void g1050_simulate_chunk(g1050_state_t *s) +{ + int i; + + s->base_time += 1.0; + + memcpy(&s->segment[0].delays[0], &s->segment[0].delays[G1050_TICKS_PER_SEC], 2*G1050_TICKS_PER_SEC*sizeof(s->segment[0].delays[0])); + g1050_segment_model(&s->segment[0], &s->segment[0].delays[2*G1050_TICKS_PER_SEC], G1050_TICKS_PER_SEC); + + memcpy(&s->segment[1].delays[0], &s->segment[1].delays[G1050_TICKS_PER_SEC], 2*G1050_TICKS_PER_SEC*sizeof(s->segment[1].delays[0])); + g1050_segment_model(&s->segment[1], &s->segment[1].delays[2*G1050_TICKS_PER_SEC], G1050_TICKS_PER_SEC); + + memcpy(&s->core.delays[0], &s->core.delays[G1050_TICKS_PER_SEC], 2*G1050_TICKS_PER_SEC*sizeof(s->core.delays[0])); + g1050_core_model(&s->core, &s->core.delays[2*G1050_TICKS_PER_SEC], G1050_TICKS_PER_SEC); + + memcpy(&s->segment[2].delays[0], &s->segment[2].delays[G1050_TICKS_PER_SEC], 2*G1050_TICKS_PER_SEC*sizeof(s->segment[2].delays[0])); + g1050_segment_model(&s->segment[2], &s->segment[2].delays[2*G1050_TICKS_PER_SEC], G1050_TICKS_PER_SEC); + + memcpy(&s->segment[3].delays[0], &s->segment[3].delays[G1050_TICKS_PER_SEC], 2*G1050_TICKS_PER_SEC*sizeof(s->segment[3].delays[0])); + g1050_segment_model(&s->segment[3], &s->segment[3].delays[2*G1050_TICKS_PER_SEC], G1050_TICKS_PER_SEC); + + memcpy(&s->arrival_times_1[0], &s->arrival_times_1[s->packet_rate], 2*s->packet_rate*sizeof(s->arrival_times_1[0])); + memcpy(&s->arrival_times_2[0], &s->arrival_times_2[s->packet_rate], 2*s->packet_rate*sizeof(s->arrival_times_2[0])); + for (i = 0; i < s->packet_rate; i++) + { + s->arrival_times_1[2*s->packet_rate + i] = s->base_time + 2.0 + (double) i/(double) s->packet_rate; + s->arrival_times_2[2*s->packet_rate + i] = 0.0; + } + + s->segment[0].lost_packets_2 += g1050_segment_delay(&s->segment[0], s->base_time, s->arrival_times_1, s->segment[0].delays, s->packet_rate); + s->segment[1].lost_packets_2 += g1050_segment_delay(&s->segment[1], s->base_time, s->arrival_times_1, s->segment[1].delays, s->packet_rate); + s->core.lost_packets_2 += g1050_core_delay(&s->core, s->base_time, s->arrival_times_1, s->core.delays, s->packet_rate); + s->segment[2].lost_packets_2 += g1050_segment_delay_preserve_order(&s->segment[2], s->base_time, s->arrival_times_1, s->arrival_times_2, s->segment[2].delays, s->packet_rate); + s->segment[3].lost_packets_2 += g1050_segment_delay_preserve_order(&s->segment[3], s->base_time, s->arrival_times_2, s->arrival_times_1, s->segment[3].delays, s->packet_rate); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(g1050_state_t *) g1050_init(int model, + int speed_pattern, + int packet_size, + int packet_rate) +{ + g1050_state_t *s; + g1050_constants_t *constants; + g1050_channel_speeds_t *sp; + g1050_model_t *mo; + int i; + + /* If the random generator has not been seeded it might give endless + zeroes - it depends on the platform. */ + for (i = 0; i < 10; i++) + { + if (q1050_rand() != 0.0) + break; + } + if (i >= 10) + q1050_rand_init(); + if ((s = (g1050_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + memset(s, 0, sizeof(*s)); + + constants = &g1050_constants[0]; + sp = &g1050_speed_patterns[speed_pattern - 1]; + mo = &g1050_standard_models[model]; + + memset(s, 0, sizeof(*s)); + + s->packet_rate = packet_rate; + s->packet_size = packet_size; + + g1050_segment_init(&s->segment[0], + G1050_LAN_LINK, + &constants->segment[0], + &mo->sidea_lan, + sp->sidea_lan_bit_rate, + sp->sidea_lan_multiple_access, + FALSE, + packet_size, + packet_rate); + g1050_segment_init(&s->segment[1], + G1050_ACCESS_LINK, + &constants->segment[1], + &mo->sidea_access_link, + sp->sidea_access_link_bit_rate_ab, + FALSE, + sp->sidea_access_link_qos_enabled, + packet_size, + packet_rate); + g1050_core_init(&s->core, &mo->core, packet_rate); + g1050_segment_init(&s->segment[2], + G1050_ACCESS_LINK, + &constants->segment[2], + &mo->sideb_access_link, + sp->sideb_access_link_bit_rate_ba, + FALSE, + sp->sideb_access_link_qos_enabled, + packet_size, + packet_rate); + g1050_segment_init(&s->segment[3], + G1050_LAN_LINK, + &constants->segment[3], + &mo->sideb_lan, + sp->sideb_lan_bit_rate, + sp->sideb_lan_multiple_access, + FALSE, + packet_size, + packet_rate); + + s->base_time = 0.0; + /* Start with enough of the future modelled to allow for the worst jitter. + After this we will always keep at least 2 seconds of the future modelled. */ + g1050_segment_model(&s->segment[0], s->segment[0].delays, 3*G1050_TICKS_PER_SEC); + g1050_segment_model(&s->segment[1], s->segment[1].delays, 3*G1050_TICKS_PER_SEC); + g1050_core_model(&s->core, s->core.delays, 3*G1050_TICKS_PER_SEC); + g1050_segment_model(&s->segment[2], s->segment[2].delays, 3*G1050_TICKS_PER_SEC); + g1050_segment_model(&s->segment[3], s->segment[3].delays, 3*G1050_TICKS_PER_SEC); + + /* Initialise the arrival times to the departure times */ + for (i = 0; i < 3*s->packet_rate; i++) + { + s->arrival_times_1[i] = s->base_time + (double) i/(double)s->packet_rate; + s->arrival_times_2[i] = 0.0; + } + + s->segment[0].lost_packets_2 += g1050_segment_delay(&s->segment[0], s->base_time, s->arrival_times_1, s->segment[0].delays, s->packet_rate); + s->segment[1].lost_packets_2 += g1050_segment_delay(&s->segment[1], s->base_time, s->arrival_times_1, s->segment[1].delays, s->packet_rate); + s->core.lost_packets_2 += g1050_core_delay(&s->core, s->base_time, s->arrival_times_1, s->core.delays, s->packet_rate); + s->segment[2].lost_packets_2 += g1050_segment_delay_preserve_order(&s->segment[2], s->base_time, s->arrival_times_1, s->arrival_times_2, s->segment[2].delays, s->packet_rate); + s->segment[3].lost_packets_2 += g1050_segment_delay_preserve_order(&s->segment[3], s->base_time, s->arrival_times_2, s->arrival_times_1, s->segment[3].delays, s->packet_rate); + + s->first = NULL; + s->last = NULL; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) g1050_dump_parms(int model, int speed_pattern) +{ + g1050_channel_speeds_t *sp; + g1050_model_t *mo; + + sp = &g1050_speed_patterns[speed_pattern - 1]; + mo = &g1050_standard_models[model]; + + printf("Model %d%c\n", speed_pattern, 'A' + model - 1); + printf("LOO %.6f%% %.6f%% %.6f%%\n", mo->loo[0]*sp->loo/100.0, mo->loo[1]*sp->loo/100.0, mo->loo[2]*sp->loo/100.0); + printf("Side A LAN %dbps, %.3f%% occupancy, MTU %d, %s MA\n", sp->sidea_lan_bit_rate, mo->sidea_lan.percentage_occupancy, mo->sidea_lan.mtu, (sp->sidea_lan_multiple_access) ? "" : "no"); + printf("Side A access %dbps, %.3f%% occupancy, MTU %d, %s QoS\n", sp->sidea_access_link_bit_rate_ab, mo->sidea_access_link.percentage_occupancy, mo->sidea_access_link.mtu, (sp->sidea_access_link_qos_enabled) ? "" : "no"); + printf("Core delay %.4fs (%.4fs), peak jitter %.4fs, prob loss %.4f%%, prob OOS %.4f%%\n", mo->core.base_regional_delay, mo->core.base_intercontinental_delay, mo->core.max_jitter, mo->core.prob_packet_loss, mo->core.prob_oos); + printf(" Route flap interval %.4fs, delay change %.4fs\n", mo->core.route_flap_interval, mo->core.route_flap_delay); + printf(" Link failure interval %.4fs, duration %.4fs\n", mo->core.link_failure_interval, mo->core.link_failure_duration); + printf("Side B access %dbps, %.3f%% occupancy, MTU %d, %s QoS\n", sp->sideb_access_link_bit_rate_ba, mo->sideb_access_link.percentage_occupancy, mo->sideb_access_link.mtu, (sp->sideb_access_link_qos_enabled) ? "" : "no"); + printf("Side B LAN %dbps, %.3f%% occupancy, MTU %d, %s MA\n", sp->sideb_lan_bit_rate, mo->sideb_lan.percentage_occupancy, mo->sideb_lan.mtu, (sp->sideb_lan_multiple_access) ? "" : "no"); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) g1050_put(g1050_state_t *s, const uint8_t buf[], int len, int seq_no, double departure_time) +{ + g1050_queue_element_t *element; + g1050_queue_element_t *e; + double arrival_time; + + while (departure_time >= s->base_time + 1.0) + g1050_simulate_chunk(s); + arrival_time = s->arrival_times_1[(int) ((departure_time - s->base_time)*(double) s->packet_rate + 0.5)]; + if (arrival_time < 0) + { + /* This packet is lost */ + return 0; + } + if ((element = (g1050_queue_element_t *) malloc(sizeof(*element) + len)) == NULL) + return -1; + element->next = NULL; + element->prev = NULL; + element->seq_no = seq_no; + element->departure_time = departure_time; + element->arrival_time = arrival_time; + element->len = len; + memcpy(element->pkt, buf, len); + /* Add it to the queue, in order */ + if (s->last == NULL) + { + /* The queue is empty */ + s->first = + s->last = element; + } + else + { + for (e = s->last; e; e = e->prev) + { + if (e->arrival_time <= arrival_time) + break; + } + if (e) + { + element->next = e->next; + element->prev = e; + e->next = element; + } + else + { + element->next = s->first; + s->first = element; + } + if (element->next) + element->next->prev = element; + else + s->last = element; + } + //printf(">> Seq %d, departs %f, arrives %f\n", seq_no, departure_time, arrival_time); + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) g1050_get(g1050_state_t *s, uint8_t buf[], int max_len, double current_time, int *seq_no, double *departure_time, double *arrival_time) +{ + int len; + g1050_queue_element_t *element; + + element = s->first; + if (element == NULL) + { + if (seq_no) + *seq_no = -1; + if (departure_time) + *departure_time = -1; + if (arrival_time) + *arrival_time = -1; + return -1; + } + if (element->arrival_time > current_time) + { + if (seq_no) + *seq_no = element->seq_no; + if (departure_time) + *departure_time = element->departure_time; + if (arrival_time) + *arrival_time = element->arrival_time; + return -1; + } + /* Return the first packet in the queue */ + len = element->len; + memcpy(buf, element->pkt, len); + if (seq_no) + *seq_no = element->seq_no; + if (departure_time) + *departure_time = element->departure_time; + if (arrival_time) + *arrival_time = element->arrival_time; + //printf("<< Seq %d, arrives %f (%f)\n", element->seq_no, element->arrival_time, current_time); + + /* Remove it from the queue */ + if (s->first == s->last) + s->last = NULL; + s->first = element->next; + if (element->next) + element->next->prev = NULL; + free(element); + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) g1050_queue_dump(g1050_state_t *s) +{ + g1050_queue_element_t *e; + + printf("Queue scanned forewards\n"); + for (e = s->first; e; e = e->next) + printf("Seq %5d, arrival %10.4f, len %3d\n", e->seq_no, e->arrival_time, e->len); + printf("Queue scanned backwards\n"); + for (e = s->last; e; e = e->prev) + printf("Seq %5d, arrival %10.4f, len %3d\n", e->seq_no, e->arrival_time, e->len); +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/libspandsp_sim.2005.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/libspandsp_sim.2005.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/libspandsp_sim.2008.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/libspandsp_sim.2008.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,270 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/libspandsp_sim.dsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/libspandsp_sim.dsp Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,143 @@ +# Microsoft Developer Studio Project File - Name="spandsp" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=spandsp - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "spandsp.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "spandsp.mak" CFG="spandsp - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "spandsp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "spandsp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "spandsp - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /D "_WINDLL" /FR /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /map /debug /machine:I386 /out:"Release/libspandsp.dll" + +!ELSEIF "$(CFG)" == "spandsp - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /FR /FD /GZ /c +# SUBTRACT CPP /WX /YX +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug/libspandsp.dll" /pdbtype:sept +# SUBTRACT LINK32 /nodefaultlib + +!ENDIF + +# Begin Target + +# Name "spandsp - Win32 Release" +# Name "spandsp - Win32 Debug" +# Begin Group "Source Files" +# Begin Source File + +SOURCE=.\g1050.c +# End Source File +# Begin Source File + +SOURCE=.\line_model.c +# End Source File +# Begin Source File + +SOURCE=.\rfc2198_sim.c +# End Source File +# Begin Source File + +SOURCE=.\test_utils.c +# End Source File +# End Group +# Begin Group "Header Files" +# Begin Source File + +SOURCE=.\spandsp/g1050.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/line_model.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/line_models.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/rfc2198_sim.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/test_utils.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp-sim.h +# End Source File +# End Group + +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/line_model.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/line_model.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,568 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * line_model.c - Model a telephone line. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: line_model.c,v 1.14 2009/09/23 16:02:59 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#define GEN_CONST +#include +#endif +#include "floating_fudge.h" + +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +#include "spandsp.h" +#include "spandsp-sim.h" +#include "spandsp/g168models.h" + +#if !defined(NULL) +#define NULL (void *) 0 +#endif + +static const float null_line_model[] = +{ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 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 +}; + +SPAN_DECLARE_DATA const float *line_models[] = +{ + null_line_model, /* 0 */ + proakis_line_model, + ad_1_edd_1_model, + ad_1_edd_2_model, + ad_1_edd_3_model, + ad_5_edd_1_model, /* 5 */ + ad_5_edd_2_model, + ad_5_edd_3_model, + ad_6_edd_1_model, + ad_6_edd_2_model, + ad_6_edd_3_model, /* 10 */ + ad_7_edd_1_model, + ad_7_edd_2_model, + ad_7_edd_3_model, + ad_8_edd_1_model, + ad_8_edd_2_model, /* 15 */ + ad_8_edd_3_model, + ad_9_edd_1_model, + ad_9_edd_2_model, + ad_9_edd_3_model +}; + +static float calc_near_line_filter(one_way_line_model_state_t *s, float v) +{ + float sum; + int j; + int p; + + /* Add the sample in the filter buffer */ + p = s->near_buf_ptr; + s->near_buf[p] = v; + if (++p == s->near_filter_len) + p = 0; + s->near_buf_ptr = p; + + /* Apply the filter */ + sum = 0.0f; + for (j = 0; j < s->near_filter_len; j++) + { + sum += s->near_filter[j]*s->near_buf[p]; + if (++p >= s->near_filter_len) + p = 0; + } + + /* Add noise */ + sum += awgn(&s->near_noise); + + return sum; +} +/*- End of function --------------------------------------------------------*/ + +static float calc_far_line_filter(one_way_line_model_state_t *s, float v) +{ + float sum; + int j; + int p; + + /* Add the sample in the filter buffer */ + p = s->far_buf_ptr; + s->far_buf[p] = v; + if (++p == s->far_filter_len) + p = 0; + s->far_buf_ptr = p; + + /* Apply the filter */ + sum = 0.0f; + for (j = 0; j < s->far_filter_len; j++) + { + sum += s->far_filter[j]*s->far_buf[p]; + if (++p >= s->far_filter_len) + p = 0; + } + + /* Add noise */ + sum += awgn(&s->far_noise); + + return sum; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) one_way_line_model(one_way_line_model_state_t *s, + int16_t output[], + const int16_t input[], + int samples) +{ + int i; + float in; + float out; + float out1; + int16_t amp[1]; + + /* The path being modelled is: + terminal + | < hybrid + | + | < noise and filtering + | + | < hybrid + CO + | + | < A-law distortion + bulk delay + | + CO + | < hybrid + | + | < noise and filtering + | + | < hybrid + terminal + */ + for (i = 0; i < samples; i++) + { + in = input[i]; + + /* Near end analogue section */ + + /* Line model filters & noise */ + out = calc_near_line_filter(s, in); + + /* Long distance digital section */ + + amp[0] = out; + codec_munge(s->munge, amp, 1); + out = amp[0]; + /* Introduce the bulk delay of the long distance link. */ + out1 = s->bulk_delay_buf[s->bulk_delay_ptr]; + s->bulk_delay_buf[s->bulk_delay_ptr] = out; + out = out1; + if (++s->bulk_delay_ptr >= s->bulk_delay) + s->bulk_delay_ptr = 0; + + /* Far end analogue section */ + + /* Line model filters & noise */ + out = calc_far_line_filter(s, out); + + if (s->mains_interference) + { + tone_gen(&s->mains_tone, amp, 1); + out += amp[0]; + } + output[i] = out + s->dc_offset; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) one_way_line_model_set_dc(one_way_line_model_state_t *s, float dc) +{ + s->dc_offset = dc; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) one_way_line_model_set_mains_pickup(one_way_line_model_state_t *s, int f, float level) +{ + tone_gen_descriptor_t mains_tone_desc; + + if (f) + { + make_tone_gen_descriptor(&mains_tone_desc, f, (int) (level - 10.0f), f*3, (int) level, 1, 0, 0, 0, TRUE); + tone_gen_init(&s->mains_tone, &mains_tone_desc); + } + s->mains_interference = f; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) both_ways_line_model(both_ways_line_model_state_t *s, + int16_t output1[], + const int16_t input1[], + int16_t output2[], + const int16_t input2[], + int samples) +{ + int i; + float in1; + float in2; + float out1; + float out2; + float tmp1; + float tmp2; + int16_t amp[1]; + + /* The path being modelled is: + terminal + | < hybrid echo + | + | < noise and filtering + | + | < hybrid echo + CO + | + | < A-law distortion + bulk delay + | + CO + | < hybrid echo + | + | < noise and filtering + | + | < hybrid echo + terminal + */ + for (i = 0; i < samples; i++) + { + in1 = input1[i]; + in2 = input2[i]; + + /* Near end analogue sections */ + /* Echo from each terminal's CO hybrid */ + tmp1 = in1 + s->fout2*s->line1.near_co_hybrid_echo; + tmp2 = in2 + s->fout1*s->line2.near_co_hybrid_echo; + + /* Line model filters & noise */ + s->fout1 = calc_near_line_filter(&s->line1, tmp1); + s->fout2 = calc_near_line_filter(&s->line2, tmp2); + + /* Long distance digital section */ + + /* Introduce distortion due to A-law or u-law munging. */ + amp[0] = s->fout1; + codec_munge(s->line1.munge, amp, 1); + s->fout1 = amp[0]; + + amp[0] = s->fout2; + codec_munge(s->line2.munge, amp, 1); + s->fout2 = amp[0]; + + /* Introduce the bulk delay of the long distance digital link. */ + out1 = s->line1.bulk_delay_buf[s->line1.bulk_delay_ptr]; + s->line1.bulk_delay_buf[s->line1.bulk_delay_ptr] = s->fout1; + s->fout1 = out1; + if (++s->line1.bulk_delay_ptr >= s->line1.bulk_delay) + s->line1.bulk_delay_ptr = 0; + + out2 = s->line2.bulk_delay_buf[s->line2.bulk_delay_ptr]; + s->line2.bulk_delay_buf[s->line2.bulk_delay_ptr] = s->fout2; + s->fout2 = out2; + if (++s->line2.bulk_delay_ptr >= s->line2.bulk_delay) + s->line2.bulk_delay_ptr = 0; + + /* Far end analogue sections */ + + /* Echo from each terminal's own hybrid */ + out1 += in2*s->line1.far_cpe_hybrid_echo; + out2 += in1*s->line2.far_cpe_hybrid_echo; + + /* Line model filters & noise */ + out1 = calc_far_line_filter(&s->line1, out1); + out2 = calc_far_line_filter(&s->line2, out2); + + output1[i] = fsaturate(out1 + s->line1.dc_offset); + output2[i] = fsaturate(out2 + s->line2.dc_offset); + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) both_ways_line_model_set_dc(both_ways_line_model_state_t *s, float dc1, float dc2) +{ + s->line1.dc_offset = dc1; + s->line2.dc_offset = dc2; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) both_ways_line_model_set_mains_pickup(both_ways_line_model_state_t *s, int f, float level1, float level2) +{ + tone_gen_descriptor_t mains_tone_desc; + + if (f) + { + make_tone_gen_descriptor(&mains_tone_desc, f, (int) (level1 - 10.0f), f*3, (int) level1, 1, 0, 0, 0, TRUE); + tone_gen_init(&s->line1.mains_tone, &mains_tone_desc); + make_tone_gen_descriptor(&mains_tone_desc, f, (int) (level2 - 10.0f), f*3, (int) level2, 1, 0, 0, 0, TRUE); + tone_gen_init(&s->line2.mains_tone, &mains_tone_desc); + } + s->line1.mains_interference = f; + s->line2.mains_interference = f; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(one_way_line_model_state_t *) one_way_line_model_init(int model, float noise, int codec, int rbs_pattern) +{ + one_way_line_model_state_t *s; + + if ((s = (one_way_line_model_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + memset(s, 0, sizeof(*s)); + + s->bulk_delay = 8; + s->bulk_delay_ptr = 0; + + s->munge = codec_munge_init(codec, rbs_pattern); + + s->near_filter = line_models[model]; + s->near_filter_len = 129; + + s->far_filter = line_models[model]; + s->far_filter_len = 129; + + /* Put half the noise in each analogue section */ + awgn_init_dbm0(&s->near_noise, 1234567, noise - 3.02f); + awgn_init_dbm0(&s->far_noise, 1234567, noise - 3.02f); + + s->dc_offset = 0.0f; + s->mains_interference = 0; + + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) one_way_line_model_release(one_way_line_model_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(both_ways_line_model_state_t *) both_ways_line_model_init(int model1, + float noise1, + int model2, + float noise2, + int codec, + int rbs_pattern) +{ + float echo_level; + both_ways_line_model_state_t *s; + + if ((s = (both_ways_line_model_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + memset(s, 0, sizeof(*s)); + + s->line1.munge = codec_munge_init(codec, rbs_pattern); + s->line2.munge = codec_munge_init(codec, rbs_pattern); + + s->line1.bulk_delay = 8; + s->line2.bulk_delay = 8; + + s->line1.bulk_delay_ptr = 0; + s->line2.bulk_delay_ptr = 0; + + s->line1.near_filter = line_models[model1]; + s->line1.near_filter_len = 129; + s->line2.near_filter = line_models[model2]; + s->line2.near_filter_len = 129; + + s->line1.far_filter = line_models[model1]; + s->line1.far_filter_len = 129; + s->line2.far_filter = line_models[model2]; + s->line2.far_filter_len = 129; + + /* Put half the noise in each analogue section */ + awgn_init_dbm0(&s->line1.near_noise, 1234567, noise1 - 3.02f); + awgn_init_dbm0(&s->line2.near_noise, 7654321, noise2 - 3.02f); + + awgn_init_dbm0(&s->line1.far_noise, 1234567, noise1 - 3.02f); + awgn_init_dbm0(&s->line2.far_noise, 7654321, noise2 - 3.02f); + + s->line1.dc_offset = 0.0f; + s->line2.dc_offset = 0.0f; + s->line1.mains_interference = 0; + s->line2.mains_interference = 0; + + /* Echos */ + echo_level = -15; /* in dB */ + s->line1.near_co_hybrid_echo = pow(10, echo_level/20.0f); + s->line2.near_co_hybrid_echo = pow(10, echo_level/20.0f); + s->line1.near_cpe_hybrid_echo = pow(10, echo_level/20.0f); + s->line2.near_cpe_hybrid_echo = pow(10, echo_level/20.0f); + + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) both_ways_line_model_release(both_ways_line_model_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/make_line_models.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/make_line_models.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1044 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * make_line_models.c + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: make_line_models.c,v 1.10 2009/09/23 16:02:59 steveu Exp $ + */ + +/*! \page make_line_models_page Telephony line model construction +\section make_line_models_page_sec_1 What does it do? +???. + +\section make_line_models_page_sec_2 How does it work? +???. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include "floating_fudge.h" +#if defined(HAVE_FFTW3_H) +#include +#else +#include +#endif +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif + +#include "spandsp.h" + +#if !defined(M_PI) +# define M_PI 3.14159265358979323846 /* pi */ +#endif + +#define LINE_MODEL_FILE_NAME "line_models.c" + +#define SAMPLE_RATE 8000 + +#define LINE_FILTER_SIZE 129 +#define FFT_SIZE 1024 + +/* Tabulated medium range telephone line response + (from p 537, Digital Communication, John G. Proakis */ +/* + amp 1.0 -> 2.15, freq = 3000 Hz -> 3.2, by 0.2 increments + delay = 4 ms -> 2.2 + */ + +struct +{ + int frequency; + float amp; + float delay; +} proakis[] = +{ + { 0, 0.00, 4.80}, + { 200, 0.90, 3.50}, + { 400, 1.40, 2.20}, + { 600, 1.80, 0.90}, + { 800, 2.00, 0.50}, + {1000, 2.10, 0.25}, + {1200, 2.30, 0.10}, + {1400, 2.30, 0.05}, + {1600, 2.20, 0.00}, + {1800, 2.10, 0.00}, + {2000, 2.00, 0.00}, + {2200, 1.85, 0.05}, + {2400, 1.75, 0.10}, + {2600, 1.55, 0.20}, + {2800, 1.30, 0.40}, + {3000, 1.10, 0.50}, + {3200, 0.80, 0.90}, + {3400, 0.55, 1.20}, + {3600, 0.25, 2.20}, + {3800, 0.05, 3.20}, + {4000, 0.05, 4.20}, + {4200, 0.05, 5.20} +}; + +#define CPE_TO_CO_ATTENUATION 0 /* In dB */ +#define CPE_TO_CO_DELAY 1 /* In us */ +#define CPE_TO_CO_IMPEDANCE 2 /* In ohms */ +#define CPE_TO_CO_PHASE 3 /* In degrees */ +#define CO_TO_CPE_IMPEDANCE 4 /* In ohms */ +#define CO_TO_CPE_PHASE 5 /* In degrees */ +#define CO_TO_CPE_ATTENUATION 6 /* In dB */ +#define CO_TO_CPE_DELAY 7 /* In us */ + +/* Terms used, for V.56bis: + AD = attenuation distortion + EDD = envelope delay distortion */ + +/* V.56bis EIA LL-1, non-loaded loop */ + +struct +{ + int freq; + float ad[8]; +} eia_ll1[] = +{ + { 200, {0.0, 0.4, 767, -1.4, 767, -1.4, 0.0, 0.4}}, + { 300, {0.0, 0.7, 766, -2.0, 766, -2.0, 0.0, 0.7}}, + { 400, {0.0, 0.5, 763, -2.8, 763, -2.8, 0.0, 0.5}}, + { 500, {0.0, 0.6, 765, -3.4, 765, -3.4, 0.0, 0.6}}, + { 600, {0.0, 0.2, 764, -4.1, 764, -4.1, 0.0, 0.2}}, + { 700, {0.0, 0.4, 764, -4.7, 764, -4.7, 0.0, 0.4}}, + { 800, {0.0, 0.4, 762, -5.4, 762, -5.4, 0.0, 0.4}}, + { 900, {0.0, 0.2, 762, -6.0, 762, -6.0, 0.0, 0.2}}, + {1000, {1.2, 0.5, 761, -6.7, 761, -6.7, 1.2, 0.5}}, + {1100, {0.0, 0.6, 759, -7.4, 759, -7.4, 0.0, 0.6}}, + {1200, {0.0, 0.4, 757, -8.1, 757, -8.1, 0.0, 0.4}}, + {1300, {0.0, 0.1, 757, -8.6, 757, -8.6, 0.0, 0.1}}, + {1400, {0.0, 0.3, 755, -9.3, 755, -9.3, 0.0, 0.3}}, + {1500, {0.0, 0.4, 753, -10.0, 753, -10.0, 0.0, 0.4}}, + {1600, {0.0, 0.3, 751, -10.7, 751, -10.7, 0.0, 0.3}}, + {1700, {0.0, 0.1, 748, -11.3, 748, -11.3, 0.0, 0.1}}, + {1800, {0.0, 11.0, 748, -11.9, 748, -11.9, 0.0, 11.0}}, + {1900, {0.1, 0.1, 745, -12.5, 745, -12.5, 0.1, 0.1}}, + {2000, {0.1, 0.3, 743, -13.9, 743, -13.9, 0.1, 0.3}}, + {2100, {0.1, 0.3, 740, -13.9, 740, -13.9, 0.1, 0.3}}, + {2200, {0.1, 0.3, 737, -14.5, 737, -14.5, 0.1, 0.3}}, + {2300, {0.1, 0.3, 734, -15.2, 734, -15.2, 0.1, 0.3}}, + {2400, {0.1, 0.2, 731, -15.8, 731, -15.8, 0.1, 0.2}}, + {2500, {0.1, 0.0, 728, -16.4, 728, -16.4, 0.1, 0.0}}, + {2600, {0.1, 0.0, 729, -16.8, 729, -16.8, 0.1, 0.0}}, + {2700, {0.2, 0.1, 726, -17.4, 726, -17.4, 0.2, 0.1}}, + {2800, {0.2, 0.2, 722, -18.0, 722, -18.0, 0.2, 0.2}}, + {2900, {0.2, 0.3, 719, -18.6, 719, -18.6, 0.2, 0.3}}, + {3000, {0.2, 0.4, 715, -19.3, 715, -19.3, 0.2, 0.4}}, + {3100, {0.2, 0.4, 712, -19.9, 712, -19.9, 0.2, 0.4}}, + {3200, {0.2, 0.5, 708, -20.5, 708, -20.5, 0.2, 0.5}}, + {3300, {0.2, 0.5, 704, -21.1, 704, -21.1, 0.2, 0.5}}, + {3400, {0.2, 0.5, 700, -21.7, 700, -21.7, 0.2, 0.5}}, + {3500, {0.2, 0.5, 696, -22.3, 696, -22.3, 0.2, 0.5}}, + {3600, {0.2, 0.4, 692, -22.9, 692, -22.9, 0.2, 0.4}}, + {3700, {0.2, 0.3, 688, -23.5, 688, -23.5, 0.2, 0.3}}, + {3800, {0.2, 0.2, 684, -24.1, 684, -24.1, 0.2, 0.2}}, + {3900, {0.2, 0.1, 680, -24.7, 680, -24.7, 0.2, 0.1}}, + {4000, {0.2, -0.1, 676, -25.2, 676, -25.2, 0.2, -0.1}} +}; + +/* V.56bis EIA LL-2, non-loaded loop */ + +struct +{ + int freq; + float ad[8]; +} eia_ll2[] = +{ + { 200, {-0.2, 6.6, 1086, -4.9, 1085, -5.6, -0.2, 6.6}}, + { 300, {-0.2, 7.7, 1079, -7.3, 1077, -8.3, -0.2, 7.7}}, + { 400, {-0.2, 6.7, 1062, -9.9, 1058, -11.2, -0.2, 6.7}}, + { 500, {-0.2, 7.1, 1059, -12.0, 1053, -13.6, -0.2, 7.1}}, + { 600, {-0.1, 5.2, 1041, -14.4, 1034, -16.3, -0.1, 5.2}}, + { 700, {-0.1, 5.8, 1030, -16.5, 1020, -18.6, -0.1, 5.8}}, + { 800, {-0.1, 5.4, 1010, -18.7, 998, -21.0, -0.1, 5.4}}, + { 900, { 0.0, 4.5, 997, -20.5, 982, -23.1, 0.0, 4.5}}, + {1000, { 3.2, 5.1, 976, -22.5, 959, -25.3, 3.2, 5.1}}, + {1100, { 0.1, 5.0, 954, -24.5, 934, -27.4, 0.1, 5.0}}, + {1200, { 0.1, 4.0, 931, -26.2, 909, -29.4, 0.1, 4.0}}, + {1300, { 0.2, 2.7, 918, -27.6, 894, -30.9, 0.2, 2.7}}, + {1400, { 0.2, 2.8, 897, -29.2, 871, -32.6, 0.2, 2.8}}, + {1500, { 0.3, 2.6, 874, -30.7, 847, -34.3, 0.3, 2.6}}, + {1600, { 0.3, 2.0, 852, -32.1, 823, -35.8, 0.3, 2.0}}, + {1700, { 0.4, 0.9, 831, -33.4, 800, -37.2, 0.4, 0.9}}, + {1800, { 0.5, 40.8, 816, -34.4, 783, -38.4, 0.5, 40.8}}, + {1900, { 0.6, 0.0, 796, -35.6, 762, -39.6, 0.6, 0.0}}, + {2000, { 0.6, -0.2, 776, -36.6, 741, -40.7, 0.6, -0.2}}, + {2100, { 0.7, -0.6, 756, -37.6, 720, -41.8, 0.7, -0.6}}, + {2200, { 0.8, -1.1, 737, -38.6, 700, -42.9, 0.8, -1.1}}, + {2300, { 0.9, -1.8, 719, -39.4, 681, -43.8, 0.9, -1.8}}, + {2400, { 1.0, -2.6, 701, -40.2, 663, -44.7, 1.0, -2.6}}, + {2500, { 1.0, -3.7, 684, -41.0, 646, -45.5, 1.0, -3.7}}, + {2600, { 1.1, -4.1, 678, -41.3, 639, -45.9, 1.1, -4.1}}, + {2700, { 1.2, -4.3, 663, -42.0, 623, -46.6, 1.2, -4.3}}, + {2800, { 1.3, -4.5, 647, -42.6, 607, -47.3, 1.3, -4.5}}, + {2900, { 1.4, -4.8, 632, -43.1, 591, -47.9, 1.4, -4.8}}, + {3000, { 1.5, -5.2, 617, -43.6, 576, -48.4, 1.5, -5.2}}, + {3100, { 1.6, -5.6, 603, -44.1, 562, -49.0, 1.6, -5.6}}, + {3200, { 1.7, -6.0, 589, -44.5, 548, -49.5, 1.7, -6.0}}, + {3300, { 1.8, -6.5, 576, -44.9, 535, -49.9, 1.8, -6.5}}, + {3400, { 1.9, -7.1, 563, -45.3, 522, -50.3, 1.9, -7.1}}, + {3500, { 2.0, -7.7, 551, -45.6, 509, -50.7, 2.0, -7.7}}, + {3600, { 2.1, -8.4, 539, -45.9, 498, -51.0, 2.1, -8.4}}, + {3700, { 2.2, -9.1, 528, -46.2, 486, -51.3, 2.2, -9.1}}, + {3800, { 2.3, -9.9, 518, -46.4, 476, -51.6, 2.3, -9.9}}, + {3900, { 2.4, -10.6, 507, -46.6, 466, -51.9, 2.4, -10.6}}, + {4000, { 2.5, -11.5, 498, -46.8, 456, -52.1, 2.5, -11.5}} +}; + +/* V.56bis EIA LL-3, non-loaded loop */ + +struct +{ + int freq; + float ad[8]; +} eia_ll3[] = +{ + { 200, {-0.3, 10.5, 1176, -5.9, 1173, -7.4, -0.3, 10.5}}, + { 300, {-0.3, 11.5, 1165, -8.8, 1159, -11.0, -0.3, 11.5}}, + { 400, {-0.3, 10.6, 1140, -11.8, 1130, -14.7, -0.3, 10.6}}, + { 500, {-0.3, 11.0, 1133, -14.3, 1117, -17.8, -0.3, 11.0}}, + { 600, {-0.2, 8.5, 1108, -17.1, 1086, -21.2, -0.2, 8.5}}, + { 700, {-0.2, 8.5, 1090, -19.4, 1062, -24.0, -0.2, 8.5}}, + { 800, {-0.1, 8.4, 1062, -21.9, 1029, -27.0, -0.1, 8.4}}, + { 900, { 0.0, 7.1, 1042, -23.9, 1003, -29.4, 0.0, 7.1}}, + {1000, { 3.8, 7.7, 1013, -23.0, 969, -31.9, 3.8, 7.7}}, + {1100, { 0.1, 7.4, 982, -28.1, 934, -34.3, 0.1, 7.4}}, + {1200, { 0.1, 6.0, 953, -29.9, 900, -36.5, 0.1, 6.0}}, + {1300, { 0.2, 4.2, 935, -31.3, 878, -38.1, 0.2, 4.2}}, + {1400, { 0.3, 4.2, 907, -32.8, 847, -40.0, 0.3, 4.2}}, + {1500, { 0.4, 3.7, 880, -34.3, 817, -41.7, 0.4, 3.7}}, + {1600, { 0.5, 2.7, 853, -35.6, 787, -43.2, 0.5, 2.7}}, + {1700, { 0.6, 1.2, 827, -36.8, 760, -44.6, 0.6, 1.2}}, + {1800, { 0.7, 48.7, 809, -37.8, 739, -45.8, 0.7, 48.7}}, + {1900, { 0.8, -0.2, 785, -38.8, 715, -47.0, 0.8, -0.2}}, + {2000, { 0.9, -0.7, 763, -39.7, 691, -48.0, 0.9, -0.7}}, + {2100, { 1.0, -1.3, 741, -40.5, 668, -49.1, 1.0, -1.3}}, + {2200, { 1.1, -2.1, 719, -41.3, 647, -50.0, 1.1, -2.1}}, + {2300, { 1.2, -2.1, 699, -42.0, 625, -50.8, 1.2, -2.1}}, + {2400, { 1.2, -4.3, 680, -42.6, 606, -51.6, 1.2, -4.3}}, + {2500, { 1.3, -5.6, 663, -43.2, 588, -52.3, 1.3, -5.6}}, + {2600, { 1.6, -6.2, 656, -43.4, 581, -52.7, 1.6, -6.2}}, + {2700, { 1.7, -6.6, 640, -43.9, 564, -53.3, 1.7, -6.6}}, + {2800, { 1.8, -7.0, 624, -44.3, 548, -53.9, 1.8, -7.0}}, + {2900, { 1.9, -7.5, 609, -44.7, 533, -54.4, 1.9, -7.5}}, + {3000, { 2.0, -8.0, 594, -45.0, 518, -54.8, 2.0, -8.0}}, + {3100, { 2.2, -8.6, 580, -45.3, 504, -55.3, 2.2, -8.6}}, + {3200, { 2.3, -9.2, 566, -45.6, 490, -55.7, 2.3, -9.2}}, + {3300, { 2.4, -9.9, 553, -45.8, 477, -56.0, 2.4, -9.9}}, + {3400, { 2.6, -10.7, 540, -46.0, 465, -56.3, 2.6, -10.7}}, + {3500, { 2.7, -11.4, 529, -46.2, 454, -56.6, 2.7, -11.4}}, + {3600, { 2.8, -12.3, 517, -46.3, 443, -56.9, 2.8, -12.3}}, + {3700, { 3.0, -13.1, 507, -46.4, 432, -57.1, 3.0, -13.1}}, + {3800, { 3.1, -14.0, 497, -46.5, 422, -57.3, 3.1, -14.0}}, + {3900, { 3.2, -14.9, 487, -46.6, 413, -57.5, 3.2, -14.9}}, + {4000, { 3.3, -15.9, 478, -46.6, 404, -57.7, 3.3, -15.9}} +}; + + +/* V.56bis EIA LL-4, non-loaded loop */ + +struct +{ + int freq; + float ad[8]; +} eia_ll4[] = +{ + { 200, {-0.8, 31.0, 1564, -10.7, 1564, -10.7, -0.8, 31.0}}, + { 300, {-0.8, 32.6, 1520, -15.6, 1520, -15.6, -0.8, 32.6}}, + { 400, {-0.8, 29.8, 1447, -20.5, 1447, -20.5, -0.8, 29.8}}, + { 500, {-0.6, 29.7, 1402, -24.3, 1402, -24.3, -0.6, 29.7}}, + { 600, {-0.5, 24.9, 1328, -28.1, 1328, -28.1, -0.5, 24.9}}, + { 700, {-0.4, 24.8, 1270, -31.2, 1270, -31.2, -0.4, 24.8}}, + { 800, {-0.3, 22.7, 1200, -34.0, 1200, -34.0, -0.3, 22.7}}, + { 900, {-0.1, 19.8, 1148, -36.2, 1148, -36.2, -0.1, 19.8}}, + {1000, { 6.1, 19.3, 1086, -38.3, 1086, -38.3, 6.1, 19.3}}, + {1100, { 0.1, 17.5, 1027, -40.1, 1027, -40.1, 0.1, 17.5}}, + {1200, { 0.3, 14.3, 974, -41.6, 974, -41.6, 0.3, 14.3}}, + {1300, { 0.5, 10.9, 941, -42.6, 941, -42.6, 0.5, 10.9}}, + {1400, { 0.7, 9.6, 897, -43.7, 897, -43.7, 0.7, 9.6}}, + {1500, { 0.9, 7.7, 856, -44.6, 856, -44.6, 0.9, 7.7}}, + {1600, { 1.1, 5.3, 818, -45.3, 818, -45.3, 1.1, 5.3}}, + {1700, { 1.3, 2.4, 784, -45.9, 784, -45.9, 1.3, 2.4}}, + {1800, { 1.4, 69.1, 761, -46.3, 761, -46.3, 1.4, 69.1}}, + {1900, { 1.7, -1.3, 732, -46.6, 732, -46.6, 1.7, -1.3}}, + {2000, { 1.9, -2.7, 706, -46.9, 706, -46.9, 1.9, -2.7}}, + {2100, { 2.1, -4.3, 682, -47.1, 682, -47.1, 2.1, -4.3}}, + {2200, { 2.3, -6.0, 659, -47.3, 659, -47.3, 2.3, -6.0}}, + {2300, { 2.5, -7.9, 638, -47.4, 638, -47.4, 2.5, -7.9}}, + {2400, { 2.7, -9.9, 619, -47.4, 619, -47.4, 2.7, -9.9}}, + {2500, { 2.9, -12.0, 602, -47.5, 602, -47.5, 2.9, -12.0}}, + {2600, { 3.1, -13.0, 596, -47.4, 596, -47.4, 3.1, -13.0}}, + {2700, { 3.3, -13.9, 580, -47.4, 580, -47.4, 3.3, -13.9}}, + {2800, { 3.5, -14.8, 566, -47.3, 566, -47.3, 3.5, -14.8}}, + {2900, { 3.7, -15.7, 552, -47.2, 552, -47.2, 3.7, -15.7}}, + {3000, { 3.9, -16.7, 539, -47.1, 539, -47.1, 3.9, -16.7}}, + {3100, { 4.1, -17.7, 526, -47.0, 526, -47.0, 4.1, -17.7}}, + {3200, { 4.3, -18.7, 515, -46.8, 515, -46.8, 4.3, -18.7}}, + {3300, { 4.5, -19.8, 504, -46.7, 504, -46.7, 4.5, -19.8}}, + {3400, { 4.7, -20.8, 493, -46.5, 493, -46.5, 4.7, -20.8}}, + {3500, { 4.9, -21.8, 484, -46.4, 484, -46.4, 4.9, -21.8}}, + {3600, { 5.1, -22.9, 475, -46.2, 475, -46.2, 5.1, -22.9}}, + {3700, { 5.3, -23.9, 466, -46.0, 466, -46.0, 5.3, -23.9}}, + {3800, { 5.5, -25.0, 458, -45.9, 458, -45.9, 5.5, -25.0}}, + {3900, { 5.6, -26.1, 451, -45.7, 451, -45.7, 5.6, -26.1}}, + {4000, { 5.8, -27.2, 444, -45.5, 444, -45.5, 5.8, -27.2}} +}; + + +/* V.56bis EIA LL-5, non-loaded loop */ + +struct +{ + int freq; + float ad[8]; +} eia_ll5[] = +{ + { 200, {-1.4, 55.8, 1607, -12.7, 1574, -17.4, -1.4, 55.8}}, + { 300, {-1.3, 57.2, 1541, -18.3, 1478, -24.8, -1.3, 57.2}}, + { 400, {-1.2, 52.2, 1443, -23.6, 1350, -31.5, -1.2, 52.2}}, + { 500, {-1.0, 51.0, 1379, -27.5, 1261, -36.4, -1.0, 51.0}}, + { 600, {-0.9, 43.2, 1287, -31.2, 1150, -40.7, -0.9, 43.2}}, + { 700, {-0.7, 41.8, 1216, -34.0, 1066, -44.0, -0.7, 41.8}}, + { 800, {-0.5, 37.4, 1137, -36.5, 979, -46.9, -0.5, 37.4}}, + { 900, {-0.2, 32.4, 1080, -38.3, 915, -48.9, -0.2, 32.4}}, + {1000, { 7.0, 30.5, 1015, -39.8, 848, -50.7, 7.0, 30.5}}, + {1100, { 0.3, 26.8, 956, -41.1, 788, -52.2, 0.3, 26.8}}, + {1200, { 0.5, 21.5, 904, -42.1, 736, -53.3, 0.5, 21.5}}, + {1300, { 0.8, 16.6, 873, -42.7, 703, -54.1, 0.8, 16.6}}, + {1400, { 1.0, 14.1, 832, -43.2, 663, -54.8, 1.0, 14.1}}, + {1500, { 1.3, 10.9, 795, -43.7, 627, -55.3, 1.3, 10.9}}, + {1600, { 1.6, 7.3, 762, -44.0, 595, -55.7, 1.6, 7.3}}, + {1700, { 1.9, 3.2, 733, -44.2, 567, -56.0, 1.9, 3.2}}, + {1800, { 2.2, 81.5, 713, -44.3, 547, -56.2, 2.2, 81.5}}, + {1900, { 2.4, -1.9, 689, -44.4, 524, -56.4, 2.4, -1.9}}, + {2000, { 2.7, -3.9, 667, -44.4, 503, -56.5, 2.7, -3.9}}, + {2100, { 3.0, -6.1, 646, -44.4, 485, -56.5, 3.0, -6.1}}, + {2200, { 3.3, -8.3, 628, -44.4, 466, -56.5, 3.3, -8.3}}, + {2300, { 3.6, -10.7, 610, -44.3, 450, -56.5, 3.6, -10.7}}, + {2400, { 3.8, -13.1, 595, -44.2, 436, -56.4, 3.8, -13.1}}, + {2500, { 4.1, -15.5, 581, -44.1, 422, -56.3, 4.1, -15.5}}, + {2600, { 4.3, -16.7, 577, -44.0, 417, -56.2, 4.3, -16.7}}, + {2700, { 4.6, -17.7, 565, -43.9, 406, -56.1, 4.6, -17.7}}, + {2800, { 4.8, -18.8, 553, -43.8, 395, -56.0, 4.8, -18.8}}, + {2900, { 5.1, -19.9, 542, -43.7, 395, -55.9, 5.1, -19.9}}, + {3000, { 5.4, -21.0, 531, -43.6, 375, -55.7, 5.4, -21.0}}, + {3100, { 5.6, -22.1, 521, -43.5, 366, -55.6, 5.6, -22.1}}, + {3200, { 5.9, -23.2, 511, -43.4, 357, -55.4, 5.9, -23.2}}, + {3300, { 6.1, -24.3, 502, -43.3, 349, -55.3, 6.1, -24.3}}, + {3400, { 6.4, -25.4, 494, -43.2, 341, -55.1, 6.4, -25.4}}, + {3500, { 6.6, -26.5, 486, -43.1, 334, -55.0, 6.6, -26.5}}, + {3600, { 6.9, -27.6, 478, -43.0, 327, -54.8, 6.9, -27.6}}, + {3700, { 7.1, -28.7, 471, -42.9, 321, -54.7, 7.1, -28.7}}, + {3800, { 7.3, -29.9, 464, -42.8, 315, -54.6, 7.3, -29.9}}, + {3900, { 7.5, -31.0, 458, -42.7, 310, -54.4, 7.5, -31.0}}, + {4000, { 7.8, -32.1, 452, -42.7, 304, -54.3, 7.8, -32.1}} +}; + + +/* V.56bis EIA LL-6, non-loaded loop */ + +struct +{ + int freq; + float ad[8]; +} eia_ll6[] = +{ + { 200, {-0.2, -39.3, 1756, -12.0, 1748, -19.8, -0.2, -39.3}}, + { 300, {-0.2, -31.7, 1642, -15.9, 1689, -26.9, -0.2, -31.7}}, + { 400, {-0.2, -37.5, 1506, -18.4, 1427, -33.4, -0.2, -37.5}}, + { 500, {-0.1, -34.7, 1442, -19.5, 1301, -37.7, -0.1, -34.7}}, + { 600, {-0.1, -46.0, 1363, -20.1, 1153, -40.7, -0.1, -46.0}}, + { 700, { 0.0, -40.8, 1320, -20.7, 1045, -42.2, 0.0, -40.8}}, + { 800, { 0.0, -40.1, 1269, -21.5, 943, -42.3, 0.0, -40.1}}, + { 900, { 0.0, -40.6, 1227, -22.5, 878, -41.3, 0.0, -40.6}}, + {1000, { 6.6, -28.0, 1161, -23.4, 825, -39.3, 6.6, -28.0}}, + {1100, { 0.0, -16.5, 1082, -23.5, 797, -36.8, 0.0, -16.5}}, + {1200, {-0.1, 0.3, 1000, -22.2, 798, -34.4, -0.1, 0.3}}, + {1300, { 0.0, -2.3, 943, -19.3, 826, -33.2, 0.0, -2.3}}, + {1400, { 0.0, 13.5, 896, -14.0, 870, -33.8, 0.0, 13.5}}, + {1500, { 0.1, 22.6, 890, -7.2, 916, -36.8, 0.1, 22.6}}, + {1600, { 0.3, 30.3, 940, -0.3, 938, -42.0, 0.3, 30.3}}, + {1700, { 0.5, 12.5, 1052, 4.6, 929, -48.0, 0.5, 12.5}}, + {1800, { 0.8, 458.6, 1212, 6.9, 880, -52.8, 0.8, 458.6}}, + {1900, { 1.1, -5.1, 1410, 3.5, 814, -56.5, 1.1, -5.1}}, + {2000, { 1.4, -5.0, 1579, -3.6, 747, -58.5, 1.4, -5.0}}, + {2100, { 1.5, 6.1, 1618, -13.2, 688, -58.8, 1.5, 6.1}}, + {2200, { 1.5, 33.5, 1491, -21.5, 646, -57.7, 1.5, 33.5}}, + {2300, { 1.4, 80.5, 1275, -24.9, 625, -55.6, 1.4, 80.5}}, + {2400, { 1.3, 142.3, 1078, -20.8, 633, -53.8, 1.3, 142.3}}, + {2500, { 1.4, 196.5, 985, -9.3, 664, -54.5, 1.4, 196.5}}, + {2600, { 1.6, 214.5, 1045, 2.4, 692, -57.6, 1.6, 214.5}}, + {2700, { 2.4, 196.8, 1326, 13.7, 684, -63.5, 2.4, 196.8}}, + {2800, { 3.4, 150.4, 1887, 14.7, 637, -68.3, 3.4, 150.4}}, + {2900, { 4.3, 125.3, 2608, 1.3, 501, -70.7, 4.3, 125.3}}, + {3000, { 4.9, 174.6, 2730, -21.8, 533, -70.6, 4.9, 174.6}}, + {3100, { 4.9, 380.0, 2094, -33.7, 506, -68.5, 4.9, 380.0}}, + {3200, { 5.2, 759.3, 1642, -21.3, 522, -67.0, 5.2, 759.3}}, + {3300, { 8.0, 680.1, 2348, 0.5, 531, -72.9, 8.0, 680.1}}, + {3400, {13.1, 237.8, 4510, -20.9, 482, -77.3, 13.1, 237.8}}, + {3500, {18.2, -18.8, 4116, -59.6, 439, -78.0, 18.2, -18.8}}, + {3600, {22.7, -145.4, 3041, -74.4, 487, -77.7, 22.7, -145.4}}, + {3700, {26.8, -214.5, 2427, -80.1, 383, -77.1, 26.8, -214.5}}, + {3800, {30.4, -257.0, 2054, -82.7, 364, -76.4, 30.4, -257.0}}, + {3900, {33.7, -285.6, 1803, -84.2, 348, -75.0, 33.7, -285.6}}, + {4000, {36.8, -306.2, 1621, -85.1, 334, -75.7, 36.8, -306.2}} +}; + + +/* V.56bis EIA LL-7, non-loaded loop */ + +struct +{ + int freq; + float ad[8]; +} eia_ll7[] = +{ + { 200, { 0.4, -81.3, 1848, -10.5, 1737, -15.6, 0.4, -81.3}}, + { 300, { 0.3, -68.9, 1785, -16.2, 1585, -21.6, 0.3, -68.9}}, + { 400, { 0.2, -68.1, 1646, -22.0, 1388, -25.8, 0.2, -68.1}}, + { 500, { 0.1, -57.0, 1528, -26.2, 1247, -27.7, 0.1, -57.0}}, + { 600, { 0.0, -59.8, 1349, -28.9, 1087, -27.3, 0.0, -59.8}}, + { 700, { 0.0, -45.0, 1205, -29.1, 975, -24.8, 0.0, -45.0}}, + { 800, {-0.1, -36.9, 1064, -26.8, 885, -19.7, -0.1, -36.9}}, + { 900, {-0.1, -37.1, 989, -22.6, 846, -13.5, -0.1, -37.1}}, + {1000, { 5.9, -29.2, 944, -16.6, 847, -6.1, 5.9, -29.2}}, + {1100, { 0.1, -30.8, 951, -10.5, 900, 0.3, 0.1, -30.8}}, + {1200, { 0.2, -40.7, 1008, -5.9, 999, 4.9, 0.2, -40.7}}, + {1300, { 0.4, -53.3, 1897, -4.0, 1122, 4.6, 0.4, -53.3}}, + {1400, { 0.5, -52.7, 1197, -4.8, 1253, 1.9, 0.5, -52.7}}, + {1500, { 0.6, -48.3, 1269, -8.4, 1339, -3.8, 0.6, -48.3}}, + {1600, { 0.6, -38.0, 1274, -13.2, 1337, -10.4, 0.6, -38.0}}, + {1700, { 0.5, -21.6, 1208, -16.9, 1250, -15.2, 0.5, -21.6}}, + {1800, { 0.4, 539.7, 1119, -17.8, 1143, -16.6, 0.4, 539.7}}, + {1900, { 0.3, 35.4, 1027, -14.7, 1036, -13.7, 0.3, 35.4}}, + {2000, { 0.3, 64.1, 989, -7.9, 998, -6.9, 0.3, 64.1}}, + {2100, { 0.4, 76.1, 1045, 0.1, 1040, 1.0, 0.4, 76.1}}, + {2200, { 0.6, 69.8, 1210, 5.3, 1197, 6.9, 0.6, 69.8}}, + {2300, { 1.0, 55.9, 1460, 4.6, 1430, 5.4, 1.0, 55.9}}, + {2400, { 1.2, 51.3, 1692, -2.8, 1640, -1.7, 1.2, 51.3}}, + {2500, { 1.3, 72.6, 1730, -13.4, 1666, -11.5, 1.3, 72.6}}, + {2600, { 1.3, 117.1, 1613, -49.6, 1556, -16.9, 1.3, 117.1}}, + {2700, { 1.1, 222.5, 1371, -19.5, 1334, -16.1, 1.1, 222.5}}, + {2800, { 1.1, 332.3, 1258, -8.9, 1243, -5.1, 1.1, 332.3}}, + {2900, { 1.7, 356.1, 1474, 4.8, 1480, 8.4, 1.7, 356.1}}, + {3000, { 2.8, 299.9, 2128, 6.6, 2143, 9.8, 2.8, 299.9}}, + {3100, { 3.9, 309.4, 2813, -10.5, 2882, -7.1, 3.9, 309.4}}, + {3200, { 4.4, 576.4, 2490, -27.7, 2487, -22.2, 4.4, 576.4}}, + {3300, { 5.6, 1030.6, 2237, -17.4, 2385, -9.0, 5.6, 1030.6}}, + {3400, {10.7, 570.2, 3882, -19.2, 4855, -14.9, 10.7, 570.2}}, + {3500, {17.3, 83.5, 4116, -57.4, 4649, -63.5, 17.3, 83.5}}, + {3600, {23.2, -130.6, 3057, -74.0, 3175, -78.6, 23.2, -130.6}}, + {3700, {28.3, -153.9, 2432, -80.0, 2471, -83.1, 28.3, -153.9}}, + {3800, {32.8, -292.4, 2055, -82.8, 2072, -85.1, 32.8, -292.4}}, + {3900, {36.9, -249.9, 1803, -84.2, 1811, -86.1, 36.9, -249.9}}, + {4000, {40.7, -356.2, 1621, -85.1, 1625, -86.7, 40.7, -356.2}} +}; + + +/* V.56bis ETSI LL-1, non-loaded loop */ + +struct +{ + int freq; + float ad[8]; +} etsi_ll1[] = +{ + { 200, {-0.78, 14.0, 1248.5, -9.7, 1248.5, -9.7, -0.78, 14.0}}, + { 300, {-0.74, 10.0, 1220.9, -14.3, 1220.9, -14.3, -0.74, 10.0}}, + { 400, {-0.68, 8.0, 1185.2, -18.6, 1185.2, -18.6, -0.68, 8.0}}, + { 500, {-0.60, 7.0, 1143.9, -22.6, 1143.9, -22.6, -0.60, 7.0}}, + { 600, {-0.51, 6.0, 1099.0, -26.2, 1099.0, -26.2, -0.51, 6.0}}, + { 700, {-0.40, 5.6, 1052.5, -29.5, 1052.5, -29.5, -0.40, 5.6}}, + { 800, {-0.28, 5.3, 1005.9, -32.4, 1005.9, -32.4, -0.28, 5.3}}, + { 900, {-0.14, 5.0, 960.3, -35.0, 960.3, -35.0, -0.14, 5.0}}, + {1000, { 4.7, 4.6, 916.4, -37.3, 916.4, -37.3, 4.7, 4.6}}, + {1100, { 0.16, 4.3, 874.6, -39.3, 874.6, -39.3, 0.16, 4.3}}, + {1200, { 0.33, 3.6, 835.3, -41.1, 835.3, -41.1, 0.33, 3.6}}, + {1300, { 0.49, 2.6, 798.5, -42.6, 798.5, -42.6, 0.49, 2.6}}, + {1400, { 0.67, 2.0, 764.2, -43.9, 764.2, -43.9, 0.67, 2.0}}, + {1500, { 0.85, 1.0, 732.3, -45.1, 732.3, -45.1, 0.85, 1.0}}, + {1600, { 1.04, 0.6, 702.7, -46.1, 702.7, -46.1, 1.04, 0.6}}, + {1700, { 1.23, 0.3, 675.3, -47.0, 675.3, -47.0, 1.23, 0.3}}, + {1800, { 1.43, 40.0, 649.8, -47.7, 649.8, -47.7, 1.43, 40.0}}, + {1900, { 1.63, -1.0, 626.2, -48.4, 626.2, -48.4, 1.63, -1.0}}, + {2000, { 1.83, -2.0, 604.3, -48.9, 604.3, -48.9, 1.83, -2.0}}, + {2100, { 2.03, -3.3, 584.0, -49.4, 584.0, -49.4, 2.03, -3.3}}, + {2200, { 2.23, -3.6, 565.1, -49.8, 565.1, -49.8, 2.23, -3.6}}, + {2300, { 2.44, -4.3, 547.5, -50.1, 547.5, -50.1, 2.44, -4.3}}, + {2400, { 2.64, -5.0, 531.1, -50.4, 531.1, -50.4, 2.64, -5.0}}, + {2500, { 2.84, -6.1, 515.9, -50.6, 515.9, -50.6, 2.84, -6.1}}, + {2600, { 3.05, -6.6, 501.6, -50.8, 501.6, -50.8, 3.05, -6.6}}, + {2700, { 3.25, -7.3, 488.2, -51.0, 488.2, -51.0, 3.25, -7.3}}, + {2800, { 3.45, -7.6, 475.7, -51.1, 475.7, -51.1, 3.45, -7.6}}, + {2900, { 3.65, -8.3, 464.0, -51.1, 464.0, -51.1, 3.65, -8.3}}, + {3000, { 3.85, -8.6, 453.0, -51.2, 453.0, -51.2, 3.85, -8.6}}, + {3100, { 4.04, -9.3, 442.6, -51.2, 442.6, -51.2, 4.04, -9.3}}, + {3200, { 4.24, -10.3, 432.9, -51.2, 432.9, -51.2, 4.24, -10.3}}, + {3300, { 4.43, -10.6, 423.7, -51.2, 423.7, -51.2, 4.43, -10.6}}, + {3400, { 4.62, -11.3, 415.1, -51.2, 415.1, -51.2, 4.62, -11.3}}, + {3500, { 4.81, -11.6, 406.9, -51.1, 406.9, -51.1, 4.81, -11.6}}, + {3600, { 5.00, -12.3, 399.1, -51.1, 399.1, -51.1, 5.00, -12.3}}, + {3700, { 5.19, -13.0, 391.8, -51.0, 391.8, -51.0, 5.19, -13.0}}, + {3800, { 5.37, -13.4, 384.9, -51.0, 384.9, -51.0, 5.37, -13.4}}, + {3900, { 5.56, -13.8, 378.3, -50.9, 378.3, -50.9, 5.56, -13.8}}, + {4000, { 5.74, -14.4, 372.0, -50.8, 372.0, -50.8, 5.74, -14.4}} +}; + + +/* V.56bis ETSI LL-2, non-loaded loop */ + +struct +{ + int freq; + float ad[8]; +} etsi_ll2[] = +{ + { 200, {-0.10, 15.0, 850.3, -3.4, 850.3, -3.4, -0.10, 15.0}}, + { 300, {-0.09, 8.0, 848.1, -5.1, 848.1, -5.1, -0.09, 8.0}}, + { 400, {-0.09, 7.0, 845.1, -6.7, 845.1, -6.7, -0.09, 7.0}}, + { 500, {-0.08, 5.0, 841.3, -8.4, 841.3, -8.4, -0.08, 5.0}}, + { 600, {-0.07, 4.6, 836.7, -10.0, 836.7, -10.0, -0.07, 4.6}}, + { 700, {-0.06, 4.3, 831.3, -11.6, 831.3, -11.6, -0.06, 4.3}}, + { 800, {-0.04, 3.8, 825.3, -13.2, 825.3, -13.2, -0.04, 3.8}}, + { 900, {-0.02, 3.4, 818.6, -14.8, 818.6, -14.8, -0.02, 3.4}}, + {1000, { 1.80, 3.0, 811.4, -16.3, 811.4, -16.3, 1.8, 3.0}}, + {1100, { 0.02, 2.6, 803.6, -17.8, 803.6, -17.8, 0.02, 2.6}}, + {1200, { 0.04, 2.3, 795.3, -19.3, 795.3, -19.3, 0.04, 2.3}}, + {1300, { 0.06, 1.3, 786.6, -20.7, 786.6, -20.7, 0.06, 1.3}}, + {1400, { 0.09, 0.9, 777.5, -22.1, 777.5, -22.1, 0.09, 0.9}}, + {1500, { 0.12, 0.6, 768.1, -23.5, 768.1, -23.5, 0.12, 0.6}}, + {1600, { 0.15, 0.3, 758.4, -24.8, 758.4, -24.8, 0.15, 0.3}}, + {1700, { 0.18, 0.0, 748.4, -26.1, 748.4, -26.1, 0.18, 0.0}}, + {1800, { 0.21, 15, 738.4, -27.3, 738.4, -27.3, 0.21, 15.0}}, + {1900, { 0.24, -1.0, 728.1, -28.5, 728.1, -28.5, 0.24, -1.0}}, + {2000, { 0.28, -2.3, 717.8, -29.7, 717.8, -29.7, 0.28, -2.3}}, + {2100, { 0.32, -2.6, 707.4, -30.8, 707.4, -30.8, 0.32, -2.6}}, + {2200, { 0.36, -3.0, 697.0, -31.9, 697.0, -31.9, 0.36, -3.0}}, + {2300, { 0.40, -3.3, 686.6, -33.0, 686.6, -33.0, 0.40, -3.3}}, + {2400, { 0.44, -3.6, 676.2, -34.0, 676.2, -34.0, 0.44, -3.6}}, + {2500, { 0.48, -4.5, 665.9, -35.0, 665.9, -35.0, 0.48, -4.5}}, + {2600, { 0.53, -5.4, 655.6, -35.9, 655.6, -35.9, 0.53, -5.4}}, + {2700, { 0.57, -6.3, 645.5, -36.8, 645.5, -36.8, 0.57, -6.3}}, + {2800, { 0.62, -6.6, 635.5, -37.7, 635.5, -37.7, 0.62, -6.6}}, + {2900, { 0.67, -6.9, 625.6, -38.6, 625.6, -38.6, 0.67, -6.9}}, + {3000, { 0.72, -7.5, 615.8, -39.4, 615.8, -39.4, 0.72, -7.5}}, + {3100, { 0.77, -8.3, 606.2, -40.2, 606.2, -40.2, 0.77, -8.3}}, + {3200, { 0.82, -8.6, 596.7, -40.9, 596.7, -40.9, 0.82, -8.6}}, + {3300, { 0.87, -9.3, 587.4, -41.6, 587.4, -41.6, 0.87, -9.3}}, + {3400, { 0.92, -9.6, 578.3, -42.3, 578.3, -42.3, 0.92, -9.6}}, + {3500, { 0.98, -10.3, 569.3, -43.0, 569.3, -43.0, 0.98, -10.3}}, + {3600, { 1.03, -10.6, 560.6, -43.7, 560.6, -43.7, 1.03, -10.6}}, + {3700, { 1.09, -11.3, 552.0, -44.3, 552.0, -44.3, 1.09, -11.3}}, + {3800, { 1.14, -11.6, 543.5, -44.9, 543.5, -44.9, 1.14, -11.6}}, + {3900, { 1.20, -12.3, 535.3, -45.4, 535.3, -45.4, 1.20, -12.3}}, + {4000, { 1.26, -13.3, 527.2, -46.0, 527.2, -46.0, 1.26, -13.3}} +}; + +/* V.56bis AD-1 AD-5 AD-6 AD-7 AD-8 AD-9 */ + +struct +{ + int freq; + float ad[6]; +} ad[] = +{ + { 0, {90.0, 90.0, 90.0, 90.0, 90.0, 90.0}}, + { 200, { 6.0, 3.2, 3.0, 2.9, 11.6, 23.3}}, + { 300, { 1.3, 1.4, 1.2, 1.1, 6.9, 13.9}}, + { 400, { 0.0, 0.4, 0.3, 0.3, 4.0, 7.9}}, + { 500, { 0.0, -0.1, 0.0, 0.1, 2.0, 4.1}}, + { 600, { 0.0, -0.1, 0.0, 0.1, 1.2, 2.4}}, + { 700, { 0.0, 0.1, 0.0, 0.0, 0.8, 1.7}}, + { 800, { 0.0, 0.0, 0.0, -0.1, 0.5, 1.1}}, + { 900, { 0.0, 0.0, 0.0, -0.1, 0.2, 0.4}}, + {1000, { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}}, + {1100, { 0.0, 0.0, 0.1, 0.0, -0.1, -0.2}}, + {1200, { 0.0, 0.0, 0.1, 0.1, -0.1, -0.2}}, + {1300, { 0.0, 0.1, 0.2, 0.3, -0.1, -0.2}}, + {1400, { 0.0, 0.2, 0.3, 0.4, -0.1, -0.3}}, + {1500, { 0.0, 0.2, 0.3, 0.4, -0.2, -0.4}}, + {1600, { 0.0, 0.3, 0.5, 0.5, -0.1, -0.3}}, + {1700, { 0.0, 0.3, 0.5, 0.6, -0.1, -0.1}}, + {1800, { 0.0, 0.3, 0.5, 0.6, 0.0, 0.0}}, + {1900, { 0.0, 0.4, 0.7, 0.7, 0.1, 0.2}}, + {2000, { 0.0, 0.5, 0.8, 0.9, 0.2, 0.5}}, + {2100, { 0.1, 0.6, 1.0, 1.0, 0.5, 0.9}}, + {2200, { 0.2, 0.7, 1.1, 1.1, 0.6, 1.1}}, + {2300, { 0.3, 0.9, 1.2, 1.4, 0.8, 1.5}}, + {2400, { 0.4, 1.1, 1.5, 1.6, 0.9, 1.8}}, + {2500, { 0.5, 1.3, 1.8, 2.0, 1.1, 2.3}}, + {2600, { 0.6, 1.6, 2.4, 2.7, 1.4, 2.8}}, + {2700, { 0.7, 2.0, 3.0, 3.5, 1.7, 3.4}}, + {2800, { 0.7, 2.3, 3.5, 4.3, 2.0, 4.0}}, + {2900, { 0.9, 2.8, 4.2, 5.0, 2.4, 4.9}}, + {3000, { 1.1, 3.2, 4.9, 5.8, 3.0, 5.9}}, + {3100, { 1.2, 3.5, 5.6, 6.7, 3.4, 6.8}}, + {3200, { 1.3, 4.1, 6.7, 8.0, 3.9, 7.7}}, + {3300, { 1.6, 4.8, 8.0, 9.6, 4.6, 9.2}}, + {3400, { 1.8, 5.3, 9.1, 11.0, 5.4, 10.7}}, + {3500, { 2.4, 5.7, 10.3, 12.2, 6.3, 12.6}}, + {3600, { 3.0, 6.6, 12.1, 13.9, 7.8, 15.5}}, + {3700, { 5.7, 8.9, 15.8, 17.3, 10.3, 20.5}}, + {3800, {13.5, 15.7, 24.4, 25.7, 16.2, 32.4}}, + {3900, {31.2, 31.1, 42.2, 43.3, 29.9, 59.9}}, + {4000, {31.2, 31.1, 42.2, 43.3, 29.9, 59.9}} +}; + +/* V.56bis EDD-1 EDD-2 EDD-3 */ + +struct +{ + int freq; + float edd[3]; +} edd[] = +{ + { 0, {3.98, 3.76, 8.00}}, + { 200, {3.98, 3.76, 8.00}}, + { 300, {2.70, 3.76, 8.00}}, + { 400, {1.69, 2.20, 6.90}}, + { 500, {1.15, 1.36, 5.50}}, + { 600, {0.80, 0.91, 4.40}}, + { 700, {0.60, 0.64, 3.40}}, + { 800, {0.50, 0.46, 2.80}}, + { 900, {0.40, 0.34, 2.00}}, + {1000, {0.30, 0.24, 1.50}}, + {1100, {0.20, 0.16, 1.00}}, + {1200, {0.20, 0.11, 0.70}}, + {1300, {0.10, 0.07, 0.40}}, + {1400, {0.05, 0.05, 0.30}}, + {1500, {0.00, 0.03, 0.20}}, + {1600, {0.00, 0.01, 0.10}}, + {1700, {0.00, 0.00, 0.10}}, + {1800, {0.00, 0.00, 0.00}}, + {1900, {0.00, 0.02, 0.10}}, + {2000, {0.00, 0.04, 0.10}}, + {2100, {0.02, 0.08, 0.10}}, + {2200, {0.02, 0.12, 0.20}}, + {2300, {0.02, 0.16, 0.20}}, + {2400, {0.02, 0.20, 0.30}}, + {2500, {0.10, 0.27, 0.40}}, + {2600, {0.12, 0.36, 0.50}}, + {2700, {0.15, 0.47, 0.80}}, + {2800, {0.20, 0.60, 1.10}}, + {2900, {0.27, 0.77, 1.50}}, + {3000, {0.40, 1.01, 2.00}}, + {3100, {0.56, 1.32, 2.60}}, + {3200, {0.83, 1.78, 3.20}}, + {3300, {1.07, 1.78, 4.00}}, + {3400, {1.39, 1.78, 4.00}}, + {3500, {1.39, 1.78, 4.00}}, + {3600, {1.39, 1.78, 4.00}}, + {3700, {1.39, 1.78, 4.00}}, + {3800, {1.39, 1.78, 4.00}}, + {3900, {1.39, 1.78, 4.00}}, + {4000, {1.39, 1.78, 4.00}} +}; + +/* V.56bis PCM AD-1, AD-2, AD-3 */ + +struct +{ + int freq; + float ad[3]; +} pcm_ad[] = +{ + { 50, {41.4, 77.8, 114.2}}, + { 100, {15.5, 27.7, 39.9}}, + { 150, { 3.7, 6.1, 8.6}}, + { 200, { 0.5, 0.8, 1.0}}, + { 250, {-0.2, -0.2, -0.3}}, + { 300, {-0.2, -0.3, -0.4}}, + { 400, { 0.0, -0.2, -0.3}}, + { 500, {-0.2, -0.4, -0.5}}, + { 600, {-0.2, -0.3, -0.5}}, + { 700, {-0.2, -0.3, -0.5}}, + { 800, {-0.2, -0.4, -0.5}}, + { 900, {-0.2, -0.3, -0.4}}, + {1000, {-0.1, -0.2, -0.3}}, + {1100, {-0.2, -0.3, -0.3}}, + {1200, {-0.2, -0.3, -0.4}}, + {1300, {-0.2, -0.3, -0.5}}, + {1400, {-0.1, -0.3, -0.4}}, + {1500, {-0.1, -0.3, -0.4}}, + {1600, {-0.1, -0.2, -0.3}}, + {1700, {-0.1, -0.3, -0.4}}, + {1800, {-0.2, -0.3, -0.4}}, + {1900, {-0.2, -0.3, -0.3}}, + {2000, {-0.1, -0.2, -0.3}}, + {2100, {-0.1, -0.2, -0.3}}, + {2200, {-0.1, -0.3, -0.4}}, + {2300, {-0.1, -0.1, -0.2}}, + {2400, {-0.1, -0.1, -0.2}}, + {2500, { 0.0, -0.1, -0.1}}, + {2600, { 0.0, -0.1, -0.1}}, + {2700, { 0.0, 0.0, 0.1}}, + {2800, { 0.0, 0.0, 0.1}}, + {2900, { 0.1, 0.2, 0.2}}, + {3000, { 0.0, 0.0, 0.1}}, + {3100, { 0.0, 0.0, 0.0}}, + {3200, { 0.0, 0.0, 0.1}}, + {3300, { 0.3, 0.7, 1.0}}, + {3400, { 1.2, 2.4, 3.6}}, + {3500, { 3.2, 6.3, 9.5}}, + {3550, { 5.0, 9.6, 14.3}}, + {3600, { 7.0, 13.5, 19.9}}, + {3650, {10.0, 18.7, 27.5}}, + {3700, {13.4, 24.6, 35.8}}, + {3750, {18.1, 32.1, 46.2}}, + {3800, {24.3, 41.2, 58.2}}, + {3850, {32.5, 52.6, 72.7}}, + {3900, {43.4, 66.6, 89.8}}, + {4000, {43.4, 66.6, 89.8}} +}; + +/* V.56bis PCM EDD-1, EDD-2, EDD-3 */ + +struct +{ + int freq; + float edd[3]; +} pcm_edd[] = +{ + { 150, { 2.76, 5.5, 8.3}}, + { 200, { 1.70, 3.4, 5.1}}, + { 250, { 0.92, 1.8, 2.8}}, + { 300, { 0.55, 1.1, 1.7}}, + { 400, { 0.25, 0.5, 0.7}}, + { 500, { 0.12, 0.2, 0.4}}, + { 600, { 0.06, 0.1, 0.2}}, + { 700, { 0.03, 0.1, 0.1}}, + { 800, { 0.01, 0.0, 0.0}}, + { 900, { 0.00, 0.0, 0.0}}, + {1000, {-0.01, 0.0, 0.0}}, + {1100, {-0.01, 0.0, 0.0}}, + {1200, {-0.02, 0.0, -0.1}}, + {1300, {-0.02, 0.0, -0.1}}, + {1400, {-0.01, 0.0, 0.0}}, + {1500, {-0.01, 0.0, 0.0}}, + {1600, { 0.00, 0.0, 0.0}}, + {1700, { 0.00, 0.0, 0.0}}, + {1800, { 0.01, 0.0, 0.0}}, + {1900, { 0.02, 0.0, 0.0}}, + {2000, { 0.02, 0.0, 0.1}}, + {2100, { 0.04, 0.1, 0.1}}, + {2200, { 0.05, 0.1, 0.2}}, + {2300, { 0.06, 0.1, 0.2}}, + {2400, { 0.07, 0.1, 0.2}}, + {2500, { 0.10, 0.2, 0.3}}, + {2600, { 0.11, 0.2, 0.3}}, + {2700, { 0.14, 0.3, 0.4}}, + {2800, { 0.18, 0.4, 0.5}}, + {2900, { 0.22, 0.4, 0.6}}, + {3000, { 0.27, 0.5, 0.8}}, + {3100, { 0.34, 0.7, 1.0}}, + {3200, { 0.45, 0.9, 1.4}}, + {3250, { 0.52, 1.0, 1.6}}, + {3300, { 0.60, 1.2, 1.8}}, + {3350, { 0.66, 1.3, 2.0}}, + {3400, { 0.74, 1.5, 2.2}}, + {3450, { 0.79, 1.6, 2.4}}, + {3500, { 0.83, 1.7, 2.5}}, + {3550, { 0.84, 1.7, 2.5}}, + {3600, { 0.81, 1.6, 2.4}}, + {3700, { 0.81, 1.6, 2.4}}, + {3800, { 0.81, 1.6, 2.4}}, + {3900, { 0.81, 1.6, 2.4}}, + {4000, { 0.81, 1.6, 2.4}} +}; + +FILE *outfile; + +float impulse_responses[100][LINE_FILTER_SIZE]; +int filter_sets = 0; + +static void generate_ad_edd(void) +{ + float f; + float offset; + float amp; + float phase; + float delay; + float pw; +#if defined(HAVE_FFTW3_H) + double in[FFT_SIZE][2]; + double out[FFT_SIZE][2]; +#else + fftw_complex in[FFT_SIZE]; + fftw_complex out[FFT_SIZE]; +#endif + fftw_plan p; + int i; + int j; + int k; + int l; + +#if defined(HAVE_FFTW3_H) + p = fftw_plan_dft_1d(FFT_SIZE, in, out, FFTW_BACKWARD, FFTW_ESTIMATE); +#else + p = fftw_create_plan(FFT_SIZE, FFTW_BACKWARD, FFTW_ESTIMATE); +#endif + for (j = 0; j < 6; j++) + { + for (k = 0; k < 3; k++) + { + for (i = 0; i < FFT_SIZE; i++) + { +#if defined(HAVE_FFTW3_H) + in[i][0] = + in[i][1] = 0.0f; +#else + in[i].re = + in[i].im = 0.0f; +#endif + } + for (i = 1; i < FFT_SIZE/2; i++) + { + f = (float) i*SAMPLE_RATE/FFT_SIZE; + amp = 0.0f; + for (l = 0; l < (int) (sizeof(ad)/sizeof(ad[0])); l++) + { + if (f < ad[l].freq) + break; + } + if (l < (int) (sizeof(ad)/sizeof(ad[0]))) + { + offset = (f - ad[l - 1].freq)/(ad[l].freq - ad[l - 1].freq); + amp = (1.0 - offset)*ad[l - 1].ad[j] + offset*ad[l].ad[j]; + amp = pow(10.0, -amp/20.0); + } + delay = 0.0f; + for (l = 0; l < (int) (sizeof(edd)/sizeof(edd[0])); l++) + { + if (f < edd[l].freq) + break; + } + if (l < (int) (sizeof(edd)/sizeof(edd[0]))) + { + offset = (f - edd[l - 1].freq)/(edd[l].freq - edd[l - 1].freq); + delay = (1.0f - offset)*edd[l - 1].edd[k] + offset*edd[l].edd[k]; + } + //phase = 2.0f*M_PI*f*delay*0.001f; + phase = 0.0f; +#if defined(HAVE_FFTW3_H) + in[i][0] = amp*cosf(phase); + in[i][1] = amp*sinf(phase); + in[FFT_SIZE - i][0] = in[i][0]; + in[FFT_SIZE - i][1] = -in[i][1]; +#else + in[i].re = amp*cosf(phase); + in[i].im = amp*sinf(phase); + in[FFT_SIZE - i].re = in[i].re; + in[FFT_SIZE - i].im = -in[i].im; +#endif + } +#if 0 + for (i = 0; i < FFT_SIZE; i++) + fprintf(outfile, "%5d %15.5f,%15.5f\n", i, in[i].re, in[i].im); +#endif +#if defined(HAVE_FFTW3_H) + fftw_execute(p); +#else + fftw_one(p, in, out); +#endif + + fprintf(outfile, "/* V.56bis AD-%d, EDD%d */\n", (j == 0) ? 1 : j + 4, k + 1); + + fprintf(outfile, "const float ad_%d_edd_%d_model[] =\n", (j == 0) ? 1 : j + 4, k + 1); + fprintf(outfile, "{\n"); + /* Normalise the filter's gain */ + pw = 0.0f; + l = FFT_SIZE - (LINE_FILTER_SIZE - 1)/2; + for (i = 0; i < LINE_FILTER_SIZE; i++) + { +#if defined(HAVE_FFTW3_H) + pw += out[l][0]*out[l][0]; +#else + pw += out[l].re*out[l].re; +#endif + if (++l == FFT_SIZE) + l = 0; + } + pw = sqrt(pw); + l = FFT_SIZE - (LINE_FILTER_SIZE - 1)/2; + for (i = 0; i < LINE_FILTER_SIZE; i++) + { + +#if defined(HAVE_FFTW3_H) + impulse_responses[filter_sets][i] = out[l][0]/pw; +#else + impulse_responses[filter_sets][i] = out[l].re/pw; +#endif + fprintf(outfile, "%15.5f,\n", impulse_responses[filter_sets][i]); + if (++l == FFT_SIZE) + l = 0; + } + fprintf(outfile, "};\n\n"); + filter_sets++; + } + } +} + +static void generate_proakis(void) +{ + float f; + float f1; + float offset; + float amp; + float phase; + float delay; + float pw; + int index; + int i; + int l; +#if defined(HAVE_FFTW3_H) + double in[FFT_SIZE][2]; + double out[FFT_SIZE][2]; +#else + fftw_complex in[FFT_SIZE]; + fftw_complex out[FFT_SIZE]; +#endif + fftw_plan p; + +#if defined(HAVE_FFTW3_H) + p = fftw_plan_dft_1d(FFT_SIZE, in, out, FFTW_BACKWARD, FFTW_ESTIMATE); +#else + p = fftw_create_plan(FFT_SIZE, FFTW_BACKWARD, FFTW_ESTIMATE); +#endif + for (i = 0; i < FFT_SIZE; i++) + { +#if defined(HAVE_FFTW3_H) + in[i][0] = + in[i][1] = 0.0f; +#else + in[i].re = + in[i].im = 0.0f; +#endif + } + for (i = 1; i < FFT_SIZE/2; i++) + { + f = (float) i*SAMPLE_RATE/FFT_SIZE; + f1 = f/200.0f; + offset = f1 - floor(f1); + index = (int) floor(f1); + + /* Linear interpolation */ + amp = ((1.0f - offset)*proakis[index].amp + offset*proakis[index + 1].amp)/2.3f; + delay = (1.0f - offset)*proakis[index].delay + offset*proakis[index + 1].delay; + //phase = 2.0f*M_PI*f*delay*0.001f; + phase = 0.0f; +#if defined(HAVE_FFTW3_H) + in[i][0] = amp*cosf(phase); + in[i][1] = amp*sinf(phase); + in[FFT_SIZE - i][0] = in[i][0]; + in[FFT_SIZE - i][1] = -in[i][1]; +#else + in[i].re = amp*cosf(phase); + in[i].im = amp*sinf(phase); + in[FFT_SIZE - i].re = in[i].re; + in[FFT_SIZE - i].im = -in[i].im; +#endif + } + +#if defined(HAVE_FFTW3_H) + fftw_execute(p); +#else + fftw_one(p, in, out); +#endif + + fprintf(outfile, "/* Medium range telephone line response\n"); + fprintf(outfile, " (from p 537, Digital Communication, John G. Proakis */\n"); + + fprintf(outfile, "const float proakis_line_model[] =\n"); + fprintf(outfile, "{\n"); + /* Normalise the filter's gain */ + pw = 0.0f; + l = FFT_SIZE - (LINE_FILTER_SIZE - 1)/2; + for (i = 0; i < LINE_FILTER_SIZE; i++) + { +#if defined(HAVE_FFTW3_H) + pw += out[l][0]*out[l][0]; +#else + pw += out[l].re*out[l].re; +#endif + if (++l == FFT_SIZE) + l = 0; + } + pw = sqrt(pw); + l = FFT_SIZE - (LINE_FILTER_SIZE - 1)/2; + for (i = 0; i < LINE_FILTER_SIZE; i++) + { +#if defined(HAVE_FFTW3_H) + impulse_responses[filter_sets][i] = out[l][0]/pw; +#else + impulse_responses[filter_sets][i] = out[l].re/pw; +#endif + fprintf(outfile, "%15.5f,\n", impulse_responses[filter_sets][i]); + if (++l == FFT_SIZE) + l = 0; + } + fprintf(outfile, "};\n\n"); + filter_sets++; +} + +int main(int argc, char *argv[]) +{ + int i; + int j; + + if ((outfile = fopen(LINE_MODEL_FILE_NAME, "w")) == NULL) + { + fprintf(stderr, "Failed to open %s\n", "line_model.txt"); + exit(2); + } + + generate_proakis(); + generate_ad_edd(); + + fclose(outfile); + + if (argc > 1) + { + for (i = 0; i < LINE_FILTER_SIZE; i++) + { + printf("%d, ", i); + for (j = 0; j < filter_sets; j++) + { + printf("%15.5f, ", impulse_responses[j][i]); + } + printf("\n"); + } + } + return 0; +} diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/msvc/make_line_models.2008.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/msvc/make_line_models.2008.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/msvc/msvcproj.foot --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/msvc/msvcproj.foot Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,7 @@ + +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/msvc/msvcproj.head --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/msvc/msvcproj.head Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,92 @@ +# Microsoft Developer Studio Project File - Name="spandsp" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=spandsp - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "spandsp.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "spandsp.mak" CFG="spandsp - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "spandsp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "spandsp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "spandsp - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /D "_WINDLL" /FR /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /map /debug /machine:I386 /out:"Release/libspandsp.dll" + +!ELSEIF "$(CFG)" == "spandsp - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /FR /FD /GZ /c +# SUBTRACT CPP /WX /YX +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug/libspandsp.dll" /pdbtype:sept +# SUBTRACT LINK32 /nodefaultlib + +!ENDIF + +# Begin Target + +# Name "spandsp - Win32 Release" +# Name "spandsp - Win32 Debug" diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/msvc/vc8proj.foot --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/msvc/vc8proj.foot Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,5 @@ + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/msvc/vc8proj.head --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/msvc/vc8proj.head Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/msvc/vc9proj.foot --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/msvc/vc9proj.foot Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,5 @@ + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/msvc/vc9proj.head --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/msvc/vc9proj.head Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,254 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/rfc2198_sim.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/rfc2198_sim.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,179 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * rfc2198_sim.c - Simulate the behaviour of RFC2198 (or UDPTL) redundancy. + * + * Written by Steve Underwood + * + * Copyright (C) 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: rfc2198_sim.c,v 1.10 2009/06/01 16:27:12 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#define GEN_CONST +#include +#endif +#include "floating_fudge.h" + +#include "spandsp.h" +#include "spandsp/g1050.h" +#include "spandsp/rfc2198_sim.h" + +#define PACKET_LOSS_TIME -1 + +#define FALSE 0 +#define TRUE (!FALSE) + +SPAN_DECLARE(rfc2198_sim_state_t *) rfc2198_sim_init(int model, + int speed_pattern, + int packet_size, + int packet_rate, + int redundancy_depth) +{ + rfc2198_sim_state_t *s; + + if ((s = (rfc2198_sim_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + memset(s, 0, sizeof(*s)); + + s->g1050 = g1050_init(model, speed_pattern, packet_size, packet_rate); + s->redundancy_depth = redundancy_depth; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) rfc2198_sim_put(rfc2198_sim_state_t *s, + const uint8_t buf[], + int len, + int seq_no, + double departure_time) +{ + uint8_t buf2[8192]; + uint8_t *p; + uint16_t *q; + int slot; + int i; + + /* Save the packet in the history buffer */ + memcpy(s->tx_pkt[s->next_pkt], buf, len); + s->tx_pkt_len[s->next_pkt] = len; + s->tx_pkt_seq_no[s->next_pkt] = seq_no; + + /* Construct the redundant packet */ + p = buf2; + slot = s->next_pkt; + q = (uint16_t *) p; + *q = s->redundancy_depth; + p += sizeof(uint16_t); + for (i = 0; i < s->redundancy_depth; i++) + { + q = (uint16_t *) p; + *q = s->tx_pkt_len[slot]; + p += sizeof(uint16_t); + memcpy(p, s->tx_pkt[slot], s->tx_pkt_len[slot]); + p += s->tx_pkt_len[slot]; + slot = (slot - 1) & 0x1F; + } + s->next_pkt = (s->next_pkt + 1) & 0x1F; + return g1050_put(s->g1050, buf2, p - buf2, seq_no, departure_time); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) rfc2198_sim_get(rfc2198_sim_state_t *s, + uint8_t buf[], + int max_len, + double current_time, + int *seq_no, + double *departure_time, + double *arrival_time) +{ + int len; + int lenx; + int seq_nox; + int i; +#if defined(_MSC_VER) + uint8_t *bufx = (uint8_t *) _alloca(s->redundancy_depth*1024); +#else + uint8_t bufx[s->redundancy_depth*1024]; +#endif + uint8_t *p; + uint16_t *q; + int redundancy_depth; + + if (s->rx_queued_pkts) + { + /* We have some stuff from the last g1050_get() still to deliver */ + s->rx_queued_pkts--; + memcpy(buf, s->rx_pkt[s->rx_queued_pkts], s->rx_pkt_len[s->rx_queued_pkts]); + *seq_no = s->rx_pkt_seq_no[s->rx_queued_pkts]; + return s->rx_pkt_len[s->rx_queued_pkts]; + } + len = g1050_get(s->g1050, bufx, s->redundancy_depth*1024, current_time, &seq_nox, departure_time, arrival_time); + if (len > 0) + { + p = bufx; + q = (uint16_t *) p; + redundancy_depth = *q; + p += sizeof(uint16_t); + i = 0; + if (seq_nox > s->next_seq_no) + { + /* Some stuff is missing. Try to fill it in. */ + s->rx_queued_pkts = seq_nox - s->next_seq_no; + if (s->rx_queued_pkts >= redundancy_depth) + s->rx_queued_pkts = redundancy_depth - 1; + for (i = 0; i < s->rx_queued_pkts; i++) + { + q = (uint16_t *) p; + s->rx_pkt_len[i] = *q; + p += sizeof(uint16_t); + memcpy(s->rx_pkt[i], p, s->rx_pkt_len[i]); + s->rx_pkt_seq_no[i] = seq_nox - i; + p += s->rx_pkt_len[i]; + } + } + *seq_no = seq_nox - i; + q = (uint16_t *) p; + lenx = *q; + p += sizeof(uint16_t); + memcpy(buf, p, lenx); + s->next_seq_no = seq_nox + 1; + } + else + { + lenx = len; + } + return lenx; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/spandsp-sim.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/spandsp-sim.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,45 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * spandsp-sim.h - The head guy amongst the simulator headers + * + * Written by Steve Underwood + * + * Copyright (C) 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: spandsp-sim.h,v 1.5 2008/04/26 13:39:16 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_SIM_H_) +#define _SPANDSP_SIM_H_ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/spandsp/g1050.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/spandsp/g1050.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,300 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * g1050.h - IP network modeling, as per G.1050/TIA-921. + * + * Written by Steve Underwood + * + * Copyright (C) 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: g1050.h,v 1.12 2009/06/01 16:27:12 steveu Exp $ + */ + +/*! \file */ + +/*! \page g1050_ip_network_model_page G.1050/TIA-921 IP network path model +\section g1050_ip_network_model_page_sec_1 What does it do? +The ITU G.1050 specification defines a model of an IP network, appropriate +for the testing of how streaming media woud behave across the internet. The +model is based on a path having 5 segments: + - a local LAN (wired or wireless) + - an access link to the internet + - an internet of arbitrary complexity + - an access link from the internet + - a distant LAN (wired or wireless) +The impairments typical of these segments at various service levels are modelled. +8 standard service level behaviours are defined, covering lightly loaded to heavily +congested levels. 168 standard sets of link speeds are defined, covering typical +wired and wireless LAN, broadband access link, and backbone characteristics. + +The G.1050 model is suitable for testing the behaviour of RTP, UDPTL and other streaming +protocols for packet loss and jitter behaviour. +*/ + +#if !defined(_G1050_H_) +#define _G1050_H_ + +/* This is the time slice at which delays, packet loss, etc. are calculated. */ +#define G1050_TICKS_PER_SEC 1000 + +/* Search back 200 ms to preserve order of legitimately out of sequence packets. */ +#define SEARCHBACK_PERIOD 200 + +#define G1050_LOW_LOSS 0 +#define G1050_HIGH_LOSS 1 + +#define G1050_LAN_LINK 1 +#define G1050_ACCESS_LINK 2 + +/*! Segment constants, as defined in G.1050. */ +typedef struct +{ + /*! Probability of changing from low to high and high to low loss states */ + double prob_loss_rate_change[2]; + /*! Probability of an impulse in the low and high loss states */ + double prob_impulse[2][2]; + + /*! Impulse height, based on MTU and bit rate */ + double impulse_height; + /*! Impulse decay coefficient for the single pole IIR filter. */ + double impulse_coeff; + + /*! Probability of packet loss due to occupancy. */ + double prob_packet_loss; + /*! Probability of packet loss due to a multiple access collision. */ + double prob_packet_collision_loss; +} g1050_segment_constants_t; + +/*! End-to-end constants, as defined in G.1050. */ +typedef struct +{ + g1050_segment_constants_t segment[4]; +} g1050_constants_t; + +/*! The model definition for a LAN or access link segment */ +typedef struct +{ + /*! Percentage occupancy of the media */ + double percentage_occupancy; + /*! MTU of the media */ + int mtu; + /*! Maximum jitter in the segment. */ + double max_jitter; +} g1050_segment_model_t; + +/*! The model definition for the core network (backbone) segment */ +typedef struct +{ + /*! Basic delay of the backbone for regional paths */ + double base_regional_delay; + /*! Basic delay of the backbone for intercontinental paths */ + double base_intercontinental_delay; + /*! Percentage packet loss of the backbone */ + /*! Percentage packet loss of the backbone. */ + double percentage_packet_loss; + /*! Maximum jitter in the backbone. */ + double max_jitter; + /*! Interval between the backbone route flapping between two paths, in seconds. */ + double route_flap_interval; + /*! The difference in backbone delay between the two routes we flap between, in seconds. */ + double route_flap_delay; + /*! The interval between link failures. */ + double link_failure_interval; + /*! The duration of link failures. */ + double link_failure_duration; + /*! Probability of packet loss in the backbone. */ + double prob_packet_loss; + /*! Probability of a packet going out of sequence in the backbone. */ + double prob_oos; +} g1050_core_model_t; + +/*! The model definition for a complete end-to-end path */ +typedef struct +{ + /*! The likelyhood of occurance probabilities for the A, B and C scenarios defined in G.1050 */ + int loo[3]; + g1050_segment_model_t sidea_lan; + g1050_segment_model_t sidea_access_link; + g1050_core_model_t core; + g1050_segment_model_t sideb_access_link; + g1050_segment_model_t sideb_lan; +} g1050_model_t; + +/*! The speed model for a complete end-to-end path */ +typedef struct +{ + int sidea_lan_bit_rate; + int sidea_lan_multiple_access; + int sidea_access_link_bit_rate_ab; + int sidea_access_link_bit_rate_ba; + int sidea_access_link_qos_enabled; + int sideb_lan_bit_rate; + int sideb_lan_multiple_access; + int sideb_access_link_bit_rate_ab; + int sideb_access_link_bit_rate_ba; + int sideb_access_link_qos_enabled; + double loo; +} g1050_channel_speeds_t; + +/*! The model state for a LAN or access link segment */ +typedef struct +{ + /*! The type of link, G1050_LAN_LINK or G_1050_ACCESS_LINK */ + int link_type; + /*! 1 if in the high loss state, or 0 if in the low loss state. */ + int high_loss; + + /*! The probability of a loss rate change, for both loss rate states. */ + double prob_loss_rate_change[2]; + /*! The probability of a impulse occuring, for both loss rate states. */ + double prob_impulse[2]; + + /*! The maximum permitted height of impulses. */ + double impulse_height; + /*! The impulse decay coefficient. */ + double impulse_coeff; + + /*! The basic serial delay due to the link. */ + double serial_delay; + /*! Peak jitter in the segment. */ + double max_jitter; + /*! The probability of packet loss. */ + double prob_packet_loss; + /*! The probability of packet loss due to collision. */ + double prob_packet_collision_loss; + /*! The maximum addition delay due to congestion. */ + double congestion_delay; + + /*! TRUE if QoS is enabled on the link. */ + int qos_enabled; + /*! TRUE if the link is a multiple access type (e.g. an ethernet hub). */ + int multiple_access; + + /*! The latest packet arrival time seen on the link. */ + double last_arrival_time; + + /*! 3 seconds of predicted delays for the link */ + double delays[3*G1050_TICKS_PER_SEC]; + + /*! A count of packets lost on the link. */ + uint32_t lost_packets; + /*! An extra debug count of packets lost on the link. */ + uint32_t lost_packets_2; +} g1050_segment_state_t; + +/*! The model state for the core network (backbone) segment */ +typedef struct +{ + /* Router model. */ + int32_t route_flap_counter; + int32_t route_flap_interval; + double route_flap_delta; + + /* Link failure model. */ + int32_t link_failure_counter; + int32_t link_recovery_counter; + + int32_t link_failure_interval_ticks; + int32_t link_failure_duration_ticks; + + /*! Basic backbone delay */ + double base_delay; + /*! Peak jitter in the backbone delay */ + double max_jitter; + /*! Probability of packet loss in the backbone, in percent */ + double prob_packet_loss; + /*! Probability of a packet going out of sequence in the backbone. */ + double prob_oos; + + /*! The latest packet arrival time seen on the link. */ + double last_arrival_time; + double delay_delta; + + /*! 3 seconds of predicted delays for the link */ + double delays[3*G1050_TICKS_PER_SEC]; + + /*! A count of packets lost on the link. */ + uint32_t lost_packets; + /*! An extra debug count of packets lost on the link. */ + uint32_t lost_packets_2; +} g1050_core_state_t; + +/*! The definition of an element in the packet queue */ +typedef struct g1050_queue_element_s +{ + struct g1050_queue_element_s *next; + struct g1050_queue_element_s *prev; + int seq_no; + double departure_time; + double arrival_time; + int len; + uint8_t pkt[]; +} g1050_queue_element_t; + +/*! The model definition for a complete end-to-end path */ +typedef struct +{ + int packet_rate; + int packet_size; + float base_time; + g1050_segment_state_t segment[4]; + g1050_core_state_t core; + double arrival_times_1[3*G1050_TICKS_PER_SEC]; + double arrival_times_2[3*G1050_TICKS_PER_SEC]; + g1050_queue_element_t *first; + g1050_queue_element_t *last; +} g1050_state_t; + +extern g1050_constants_t g1050_constants[1]; +extern g1050_channel_speeds_t g1050_speed_patterns[168]; +extern g1050_model_t g1050_standard_models[9]; + +#ifdef __cplusplus +extern "C" +{ +#endif + +SPAN_DECLARE(g1050_state_t *) g1050_init(int model, + int speed_pattern, + int packet_size, + int packet_rate); + +SPAN_DECLARE(void) g1050_dump_parms(int model, int speed_pattern); + +SPAN_DECLARE(int) g1050_put(g1050_state_t *s, + const uint8_t buf[], + int len, + int seq_no, + double departure_time); + +SPAN_DECLARE(int) g1050_get(g1050_state_t *s, + uint8_t buf[], + int max_len, + double current_time, + int *seq_no, + double *departure_time, + double *arrival_time); + +SPAN_DECLARE(void) g1050_queue_dump(g1050_state_t *s); + +#ifdef __cplusplus +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/spandsp/line_model.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/spandsp/line_model.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,175 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * line_model.h - Model a telephone line. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: line_model.h,v 1.7.4.1 2009/12/19 10:16:44 steveu Exp $ + */ + +/*! \file */ + +/*! \page line_model_page Telephone line model +\section line_model_page_sec_1 What does it do? +The telephone line modelling module provides simple modelling of one way and two +way telephone lines. + +The path being modelled is: + + - terminal + - | < hybrid echo (2-way models) + - | + - | < noise and filtering + - | + - | < hybrid echo (2-way models) + - CO + - | + - | < A-law distortion + bulk delay + - | + - CO + - | < hybrid echo (2-way models) + - | + - | < noise and filtering + - | + - | < hybrid echo (2-way models) + - terminal +*/ + +#if !defined(_SPANDSP_LINE_MODEL_H_) +#define _SPANDSP_LINE_MODEL_H_ + +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +#include + +#define LINE_FILTER_SIZE 129 + +/*! + One way line model descriptor. This holds the complete state of + a line model with transmission in only one direction. +*/ +typedef struct +{ + codec_munge_state_t *munge; + + /*! The coefficients for the near end analogue section simulation filter */ + const float *near_filter; + /*! The number of coefficients for the near end analogue section simulation filter */ + int near_filter_len; + /*! Last transmitted samples (ring buffer, used by the line filter) */ + float near_buf[LINE_FILTER_SIZE]; + /*! Pointer of the last transmitted sample in buf */ + int near_buf_ptr; + /*! The noise source for local analogue section of the line */ + awgn_state_t near_noise; + + /*! The bulk delay of the path, in samples */ + int bulk_delay; + /*! A pointer to the current write position in the bulk delay store. */ + int bulk_delay_ptr; + /*! The data store for simulating the bulk delay */ + int16_t bulk_delay_buf[8000]; + + /*! The coefficients for the far end analogue section simulation filter */ + const float *far_filter; + /*! The number of coefficients for the far end analogue section simulation filter */ + int far_filter_len; + /*! Last transmitted samples (ring buffer, used by the line filter) */ + float far_buf[LINE_FILTER_SIZE]; + /*! Pointer of the last transmitted sample in buf */ + int far_buf_ptr; + /*! The noise source for distant analogue section of the line */ + awgn_state_t far_noise; + + /*! The scaling factor for the local CPE hybrid echo */ + float near_cpe_hybrid_echo; + /*! The scaling factor for the local CO hybrid echo */ + float near_co_hybrid_echo; + + /*! The scaling factor for the far CPE hybrid echo */ + float far_cpe_hybrid_echo; + /*! The scaling factor for the far CO hybrid echo */ + float far_co_hybrid_echo; + /*! DC offset impairment */ + float dc_offset; + + /*! Mains pickup impairment */ + int mains_interference; + tone_gen_state_t mains_tone; +} one_way_line_model_state_t; + +/*! + Two way line model descriptor. This holds the complete state of + a line model with transmission in both directions. +*/ +typedef struct +{ + one_way_line_model_state_t line1; + one_way_line_model_state_t line2; + float fout1; + float fout2; +} both_ways_line_model_state_t; + +#ifdef __cplusplus +extern "C" +{ +#endif + +SPAN_DECLARE_DATA extern const float *line_models[]; + +SPAN_DECLARE(void) both_ways_line_model(both_ways_line_model_state_t *s, + int16_t output1[], + const int16_t input1[], + int16_t output2[], + const int16_t input2[], + int samples); + +SPAN_DECLARE(void) both_ways_line_model_set_dc(both_ways_line_model_state_t *s, float dc1, float dc2); + +SPAN_DECLARE(void) both_ways_line_model_set_mains_pickup(both_ways_line_model_state_t *s, int f, float level1, float level2); + +SPAN_DECLARE(both_ways_line_model_state_t *) both_ways_line_model_init(int model1, + float noise1, + int model2, + float noise2, + int codec, + int rbs_pattern); + +SPAN_DECLARE(int) both_ways_line_model_release(both_ways_line_model_state_t *s); + +SPAN_DECLARE(void) one_way_line_model(one_way_line_model_state_t *s, + int16_t output[], + const int16_t input[], + int samples); + +SPAN_DECLARE(void) one_way_line_model_set_dc(one_way_line_model_state_t *s, float dc); + +SPAN_DECLARE(void) one_way_line_model_set_mains_pickup(one_way_line_model_state_t *s, int f, float level); + +SPAN_DECLARE(one_way_line_model_state_t *) one_way_line_model_init(int model, float noise, int codec, int rbs_pattern); + +SPAN_DECLARE(int) one_way_line_model_release(one_way_line_model_state_t *s); + +#ifdef __cplusplus +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/spandsp/line_models.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/spandsp/line_models.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,63 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * line_model.h - Model a telephone line. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: line_models.h,v 1.3 2008/04/17 18:03:23 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_LINE_MODELS_H_) +#define _SPANDSP_LINE_MODELS_H_ + +extern float proakis_line_model[]; +extern float ad_1_edd_1_model[]; +extern float ad_1_edd_2_model[]; +extern float ad_1_edd_3_model[]; +extern float ad_5_edd_1_model[]; +extern float ad_5_edd_2_model[]; +extern float ad_5_edd_3_model[]; +extern float ad_6_edd_1_model[]; +extern float ad_6_edd_2_model[]; +extern float ad_6_edd_3_model[]; +extern float ad_7_edd_1_model[]; +extern float ad_7_edd_2_model[]; +extern float ad_7_edd_3_model[]; +extern float ad_8_edd_1_model[]; +extern float ad_8_edd_2_model[]; +extern float ad_8_edd_3_model[]; +extern float ad_9_edd_1_model[]; +extern float ad_9_edd_2_model[]; +extern float ad_9_edd_3_model[]; + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifdef __cplusplus +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/spandsp/rfc2198_sim.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/spandsp/rfc2198_sim.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,97 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * rfc2198_sim.h - Simulate the behaviour of RFC2198 (or UDPTL) redundancy. + * + * Written by Steve Underwood + * + * Copyright (C) 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: rfc2198_sim.h,v 1.6 2009/05/31 14:47:10 steveu Exp $ + */ + +/*! \file */ + +/*! \page rfc2198_model_page RFC2198 simulation +\section rfc2198_model_page_sec_1 What does it do? +*/ + +#if !defined(_RFC2198_SIM_H_) +#define _RFC2198_SIM_H_ + +/*! The definition of an element in the packet queue */ +typedef struct rfc2198_sim_queue_element_s +{ + struct rfc2198_sim_queue_element_s *next; + struct rfc2198_sim_queue_element_s *prev; + int seq_no; + double departure_time; + double arrival_time; + int len; + uint8_t pkt[]; +} rfc2198_sim_queue_element_t; + +/*! The model definition for a complete end-to-end path */ +typedef struct +{ + int redundancy_depth; + int next_seq_no; + g1050_state_t *g1050; + rfc2198_sim_queue_element_t *first; + rfc2198_sim_queue_element_t *last; + uint8_t tx_pkt[32][1024]; + int tx_pkt_len[32]; + int tx_pkt_seq_no[32]; + int next_pkt; + uint8_t rx_pkt[32][1024]; + int rx_pkt_len[32]; + int rx_pkt_seq_no[32]; + int rx_queued_pkts; +} rfc2198_sim_state_t; + +#ifdef __cplusplus +extern "C" +{ +#endif + +SPAN_DECLARE(rfc2198_sim_state_t *) rfc2198_sim_init(int model, + int speed_pattern, + int packet_size, + int packet_rate, + int redundancy_depth); + +SPAN_DECLARE(int) rfc2198_sim_put(rfc2198_sim_state_t *s, + const uint8_t buf[], + int len, + int seq_no, + double departure_time); + +SPAN_DECLARE(int) rfc2198_sim_get(rfc2198_sim_state_t *s, + uint8_t buf[], + int max_len, + double current_time, + int *seq_no, + double *departure_time, + double *arrival_time); + +#ifdef __cplusplus +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/spandsp/test_utils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/spandsp/test_utils.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,79 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * test_utils.h - Utility routines for module tests. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: test_utils.h,v 1.9 2009/05/31 14:47:10 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_TEST_UTILS_H_) +#define _TEST_UTILS_H_ + +#include + +enum +{ + MUNGE_CODEC_NONE = 0, + MUNGE_CODEC_ALAW, + MUNGE_CODEC_ULAW, + MUNGE_CODEC_G726_40K, + MUNGE_CODEC_G726_32K, + MUNGE_CODEC_G726_24K, + MUNGE_CODEC_G726_16K, +}; + +typedef struct codec_munge_state_s codec_munge_state_t; + +typedef struct complexify_state_s complexify_state_t; + +#ifdef __cplusplus +extern "C" { +#endif + +SPAN_DECLARE(complexify_state_t *) complexify_init(void); + +SPAN_DECLARE(void) complexify_release(complexify_state_t *s); + +SPAN_DECLARE(complexf_t) complexify(complexify_state_t *s, int16_t amp); + +SPAN_DECLARE(void) fft(complex_t data[], int len); + +SPAN_DECLARE(void) ifft(complex_t data[], int len); + +SPAN_DECLARE(codec_munge_state_t *) codec_munge_init(int codec, int info); + +SPAN_DECLARE(void) codec_munge_release(codec_munge_state_t *s); + +SPAN_DECLARE(void) codec_munge(codec_munge_state_t *s, int16_t amp[], int len); + +SPAN_DECLARE(SNDFILE *) sf_open_telephony_read(const char *name, int channels); + +SPAN_DECLARE(SNDFILE *) sf_open_telephony_write(const char *name, int channels); + +#ifdef __cplusplus +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp-sim/test_utils.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp-sim/test_utils.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,402 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * test_utils.c - Utility routines for module tests. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: test_utils.c,v 1.14 2009/06/01 16:27:12 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include +#include +#include + +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +#include "spandsp.h" +#include "spandsp-sim.h" + +#define MAX_FFT_LEN 8192 + +struct codec_munge_state_s +{ + int munging_codec; + g726_state_t g726_enc_state; + g726_state_t g726_dec_state; + int rbs_pattern; + int sequence; +}; + +struct complexify_state_s +{ + float history[128]; + int ptr; +}; + +static complex_t circle[MAX_FFT_LEN/2]; +static int circle_init = FALSE; +static complex_t icircle[MAX_FFT_LEN/2]; +static int icircle_init = FALSE; + +SPAN_DECLARE(complexify_state_t *) complexify_init(void) +{ + complexify_state_t *s; + int i; + + if ((s = (complexify_state_t *) malloc(sizeof(*s)))) + { + s->ptr = 0; + for (i = 0; i < 128; i++) + s->history[i] = 0.0f; + } + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) complexify_release(complexify_state_t *s) +{ + free(s); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(complexf_t) complexify(complexify_state_t *s, int16_t amp) +{ +#define HILBERT_GAIN 1.569546344 + static const float hilbert_coeffs[] = + { + +0.0012698413f, +0.0013489483f, + +0.0015105196f, +0.0017620440f, + +0.0021112899f, +0.0025663788f, + +0.0031358856f, +0.0038289705f, + +0.0046555545f, +0.0056265487f, + +0.0067541562f, +0.0080522707f, + +0.0095370033f, +0.0112273888f, + +0.0131463382f, +0.0153219442f, + +0.0177892941f, +0.0205930381f, + +0.0237910974f, +0.0274601544f, + +0.0317040029f, +0.0366666667f, + +0.0425537942f, +0.0496691462f, + +0.0584802574f, +0.0697446887f, + +0.0847739823f, +0.1060495199f, + +0.1388940865f, +0.1971551103f, + +0.3316207267f, +0.9994281838f, + }; + float famp; + int i; + int j; + int k; + complexf_t res; + + s->history[s->ptr] = amp; + i = s->ptr - 63; + if (i < 0) + i += 128; + res.re = s->history[i]; + + famp = 0.0f; + j = s->ptr - 126; + if (j < 0) + j += 128; + for (i = 0, k = s->ptr; i < 32; i++) + { + famp += (s->history[k] - s->history[j])*hilbert_coeffs[i]; + j += 2; + if (j >= 128) + j -= 128; + k -= 2; + if (k < 0) + k += 128; + } + res.im = famp/HILBERT_GAIN; + + if (++s->ptr >= 128) + s->ptr = 0; + return res; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complex_t expj(double theta) +{ + return complex_set(cos(theta), sin(theta)); +} +/*- End of function --------------------------------------------------------*/ + +static void fftx(complex_t data[], complex_t temp[], int n) +{ + int i; + int h; + int p; + int t; + int i2; + complex_t wkt; + + if (n > 1) + { + h = n/2; + for (i = 0; i < h; i++) + { + i2 = i*2; + temp[i] = data[i2]; /* Even */ + temp[h + i] = data[i2 + 1]; /* Odd */ + } + fftx(&temp[0], &data[0], h); + fftx(&temp[h], &data[h], h); + p = 0; + t = MAX_FFT_LEN/n; + for (i = 0; i < h; i++) + { + wkt = complex_mul(&circle[p], &temp[h + i]); + data[i] = complex_add(&temp[i], &wkt); + data[h + i] = complex_sub(&temp[i], &wkt); + p += t; + } + } +} +/*- End of function --------------------------------------------------------*/ + +static void ifftx(complex_t data[], complex_t temp[], int n) +{ + int i; + int h; + int p; + int t; + int i2; + complex_t wkt; + + if (n > 1) + { + h = n/2; + for (i = 0; i < h; i++) + { + i2 = i*2; + temp[i] = data[i2]; /* Even */ + temp[h + i] = data[i2 + 1]; /* Odd */ + } + fftx(&temp[0], &data[0], h); + fftx(&temp[h], &data[h], h); + p = 0; + t = MAX_FFT_LEN/n; + for (i = 0; i < h; i++) + { + wkt = complex_mul(île[p], &temp[h + i]); + data[i] = complex_add(&temp[i], &wkt); + data[h + i] = complex_sub(&temp[i], &wkt); + p += t; + } + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) fft(complex_t data[], int len) +{ + int i; + double x; + complex_t temp[MAX_FFT_LEN]; + + /* A very slow and clunky FFT, that's just fine for tests. */ + if (!circle_init) + { + for (i = 0; i < MAX_FFT_LEN/2; i++) + { + x = -(2.0*3.1415926535*i)/(double) MAX_FFT_LEN; + circle[i] = expj(x); + } + circle_init = TRUE; + } + fftx(data, temp, len); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) ifft(complex_t data[], int len) +{ + int i; + double x; + complex_t temp[MAX_FFT_LEN]; + + /* A very slow and clunky FFT, that's just fine for tests. */ + if (!icircle_init) + { + for (i = 0; i < MAX_FFT_LEN/2; i++) + { + x = (2.0*3.1415926535*i)/(double) MAX_FFT_LEN; + icircle[i] = expj(x); + } + icircle_init = TRUE; + } + ifftx(data, temp, len); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(codec_munge_state_t *) codec_munge_init(int codec, int info) +{ + codec_munge_state_t *s; + + if ((s = (codec_munge_state_t *) malloc(sizeof(*s)))) + { + switch (codec) + { + case MUNGE_CODEC_G726_40K: + g726_init(&s->g726_enc_state, 40000, G726_ENCODING_LINEAR, G726_PACKING_NONE); + g726_init(&s->g726_dec_state, 40000, G726_ENCODING_LINEAR, G726_PACKING_NONE); + s->munging_codec = MUNGE_CODEC_G726_32K; + break; + case MUNGE_CODEC_G726_32K: + g726_init(&s->g726_enc_state, 32000, G726_ENCODING_LINEAR, G726_PACKING_NONE); + g726_init(&s->g726_dec_state, 32000, G726_ENCODING_LINEAR, G726_PACKING_NONE); + s->munging_codec = MUNGE_CODEC_G726_32K; + break; + case MUNGE_CODEC_G726_24K: + g726_init(&s->g726_enc_state, 24000, G726_ENCODING_LINEAR, G726_PACKING_NONE); + g726_init(&s->g726_dec_state, 24000, G726_ENCODING_LINEAR, G726_PACKING_NONE); + s->munging_codec = MUNGE_CODEC_G726_32K; + break; + case MUNGE_CODEC_G726_16K: + g726_init(&s->g726_enc_state, 16000, G726_ENCODING_LINEAR, G726_PACKING_NONE); + g726_init(&s->g726_dec_state, 16000, G726_ENCODING_LINEAR, G726_PACKING_NONE); + s->munging_codec = MUNGE_CODEC_G726_32K; + break; + default: + s->munging_codec = codec; + break; + } + s->sequence = 0; + s->rbs_pattern = info; + } + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) codec_munge_release(codec_munge_state_t *s) +{ + free(s); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) codec_munge(codec_munge_state_t *s, int16_t amp[], int len) +{ + uint8_t law; + uint8_t adpcmdata[160]; + int i; + int adpcm; + int x; + + switch (s->munging_codec) + { + case MUNGE_CODEC_NONE: + /* Do nothing */ + break; + case MUNGE_CODEC_ALAW: + for (i = 0; i < len; i++) + { + law = linear_to_alaw(amp[i]); + amp[i] = alaw_to_linear(law); + } + break; + case MUNGE_CODEC_ULAW: + for (i = 0; i < len; i++) + { + law = linear_to_ulaw(amp[i]); + if (s->rbs_pattern & (1 << s->sequence)) + { + /* Strip the bottom bit at the RBS rate */ + law &= 0xFE; + } + amp[i] = ulaw_to_linear(law); + } + break; + case MUNGE_CODEC_G726_32K: + /* This could actually be any of the G.726 rates */ + for (i = 0; i < len; i += x) + { + x = (len - i >= 160) ? 160 : (len - i); + adpcm = g726_encode(&s->g726_enc_state, adpcmdata, amp + i, x); + g726_decode(&s->g726_dec_state, amp + i, adpcmdata, adpcm); + } + break; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(SNDFILE *) sf_open_telephony_read(const char *name, int channels) +{ + SNDFILE *handle; + SF_INFO info; + + memset(&info, 0, sizeof(info)); + if ((handle = sf_open(name, SFM_READ, &info)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s' for reading\n", name); + exit(2); + } + if (info.samplerate != SAMPLE_RATE) + { + printf(" Unexpected sample rate in audio file '%s'\n", name); + exit(2); + } + if (info.channels != channels) + { + printf(" Unexpected number of channels in audio file '%s'\n", name); + exit(2); + } + + return handle; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(SNDFILE *) sf_open_telephony_write(const char *name, int channels) +{ + SNDFILE *handle; + SF_INFO info; + + memset(&info, 0, sizeof(info)); + info.frames = 0; + info.samplerate = SAMPLE_RATE; + info.channels = channels; + info.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16; + info.sections = 1; + info.seekable = 1; + + if ((handle = sf_open(name, SFM_WRITE, &info)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s' for writing\n", name); + exit(2); + } + + return handle; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp.pc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp.pc Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,11 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=$(exec_prefix)/lib64 +includedir=${prefix}/include + +Name: spandsp +Description: A DSP library for telephony. +Requires: +Version: 0.0.6 +Libs: -L${libdir} -lspandsp -ltiff -lm +Cflags: -I${includedir} diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp.pc.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp.pc.in Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: spandsp +Description: A DSP library for telephony. +Requires: +Version: @VERSION@ +Libs: -L${libdir} -lspandsp -ltiff -lm +Cflags: -I${includedir} diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp.spec --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp.spec Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,86 @@ +Summary: A DSP library for telephony. +Name: spandsp +Version: 0.0.6 +Release: 1 +License: LGPL +Group: System Environment/Libraries +URL: http://www.soft-switch.org/spandsp +BuildRoot: %{_tmppath}/%{name}-%{version}-root +Source: http://www.soft-switch.org/downloads/spandsp/spandsp-0.0.6.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: libtiff-devel +BuildRequires: audiofile-devel +BuildRequires: doxygen +# for xsltproc: +BuildRequires: libxslt + +%description +SpanDSP is a library of DSP functions for telephony, in the 8000 +sample per second world of E1s, T1s, and higher order PCM channels. It +contains low level functions, such as basic filters. It also contains +higher level functions, such as cadenced supervisory tone detection, +and a complete software FAX machine. The software has been designed to +avoid intellectual property issues, using mature techniques where all +relevant patents have expired. See the file DueDiligence for important +information about these intellectual property issues. + +%package devel +Summary: SpanDSP development files +Group: Development/Libraries +Requires: spandsp = %{version} +Requires: libtiff-devel +PreReq: /sbin/install-info + +%description devel +SpanDSP development files. + +%prep +%setup -q + +%build +%configure --enable-doc --disable-static --disable-rpath +make + +%install +rm -rf %{buildroot} +make install DESTDIR=%{buildroot} +rm %{buildroot}%{_libdir}/libspandsp.la + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root,-) +%doc DueDiligence ChangeLog AUTHORS COPYING NEWS README + +%{_libdir}/libspandsp.so.* + +%files devel +%defattr(-,root,root,-) +%doc doc/api +%{_includedir}/spandsp.h +%{_includedir}/spandsp +%{_libdir}/libspandsp.so +%{_libdir}/pkgconfig/spandsp.pc + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%changelog +* Wed Sep 24 2008 Tzafrir Cohen 0.0.5-1 +- Preparing for 0.0.5pre4 release +- License: LGPL + +* Mon Jun 23 2008 Steve Underwood 0.0.5-1 +- Cleared out the dependency on libxml2 + +* Sun Dec 31 2006 Steve Underwood 0.0.3-1 +- Preparing for 0.0.3 release + +* Sat Oct 16 2004 Steve Underwood 0.0.2-1 +- Preparing for 0.0.2 release + +* Thu Apr 15 2004 Steve Underwood 0.0.1-1 +- Initial version diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp.spec.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp.spec.in Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,86 @@ +Summary: A DSP library for telephony. +Name: @PACKAGE@ +Version: @VERSION@ +Release: 1 +License: LGPL +Group: System Environment/Libraries +URL: http://www.soft-switch.org/spandsp +BuildRoot: %{_tmppath}/%{name}-%{version}-root +Source: http://www.soft-switch.org/downloads/spandsp/@PACKAGE@-@VERSION@.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: libtiff-devel +BuildRequires: audiofile-devel +BuildRequires: doxygen +# for xsltproc: +BuildRequires: libxslt + +%description +SpanDSP is a library of DSP functions for telephony, in the 8000 +sample per second world of E1s, T1s, and higher order PCM channels. It +contains low level functions, such as basic filters. It also contains +higher level functions, such as cadenced supervisory tone detection, +and a complete software FAX machine. The software has been designed to +avoid intellectual property issues, using mature techniques where all +relevant patents have expired. See the file DueDiligence for important +information about these intellectual property issues. + +%package devel +Summary: SpanDSP development files +Group: Development/Libraries +Requires: spandsp = %{version} +Requires: libtiff-devel +PreReq: /sbin/install-info + +%description devel +SpanDSP development files. + +%prep +%setup -q + +%build +%configure --enable-doc --disable-static --disable-rpath +make + +%install +rm -rf %{buildroot} +make install DESTDIR=%{buildroot} +rm %{buildroot}%{_libdir}/libspandsp.la + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root,-) +%doc DueDiligence ChangeLog AUTHORS COPYING NEWS README + +%{_libdir}/libspandsp.so.* + +%files devel +%defattr(-,root,root,-) +%doc doc/api +%{_includedir}/spandsp.h +%{_includedir}/spandsp +%{_libdir}/libspandsp.so +%{_libdir}/pkgconfig/spandsp.pc + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%changelog +* Wed Sep 24 2008 Tzafrir Cohen 0.0.5-1 +- Preparing for 0.0.5pre4 release +- License: LGPL + +* Mon Jun 23 2008 Steve Underwood 0.0.5-1 +- Cleared out the dependency on libxml2 + +* Sun Dec 31 2006 Steve Underwood 0.0.3-1 +- Preparing for 0.0.3 release + +* Sat Oct 16 2004 Steve Underwood 0.0.2-1 +- Preparing for 0.0.2 release + +* Thu Apr 15 2004 Steve Underwood 0.0.1-1 +- Initial version diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp/fax-tests.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp/fax-tests.dtd Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp/global-tones.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp/global-tones.xml Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,7334 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp/tones.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp/tones.dtd Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/spandsp/tsb85.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/spandsp/tsb85.xml Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,6688 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/Makefile.am Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,529 @@ +## +## SpanDSP - a series of DSP components for telephony +## +## Makefile.am - Process this file with automake to produce Makefile.in +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU Lesser General Public License version 2.1, +## as published by the Free Software Foundation. +## +## 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 Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this program; if not, write to the Free Software +## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +## +## $Id: Makefile.am,v 1.138.4.3 2009/12/19 10:30:10 steveu Exp $ + +AM_CFLAGS = $(COMP_VENDOR_CFLAGS) +AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) + +MAINTAINERCLEANFILES = Makefile.in + +DISTCLEANFILES = $(srcdir)/at_interpreter_dictionary.h \ + $(srcdir)/v17_v32bis_rx_fixed_rrc.h \ + $(srcdir)/v17_v32bis_rx_floating_rrc.h \ + $(srcdir)/v17_v32bis_tx_fixed_rrc.h \ + $(srcdir)/v17_v32bis_tx_floating_rrc.h \ + $(srcdir)/v22bis_rx_1200_fixed_rrc.h \ + $(srcdir)/v22bis_rx_2400_fixed_rrc.h \ + $(srcdir)/v22bis_rx_1200_floating_rrc.h \ + $(srcdir)/v22bis_rx_2400_floating_rrc.h \ + $(srcdir)/v22bis_tx_fixed_rrc.h \ + $(srcdir)/v22bis_tx_floating_rrc.h \ + $(srcdir)/v27ter_rx_2400_fixed_rrc.h \ + $(srcdir)/v27ter_rx_4800_fixed_rrc.h \ + $(srcdir)/v27ter_rx_2400_floating_rrc.h \ + $(srcdir)/v27ter_rx_4800_floating_rrc.h \ + $(srcdir)/v27ter_tx_2400_fixed_rrc.h \ + $(srcdir)/v27ter_tx_4800_fixed_rrc.h \ + $(srcdir)/v27ter_tx_2400_floating_rrc.h \ + $(srcdir)/v27ter_tx_4800_floating_rrc.h \ + $(srcdir)/v29rx_fixed_rrc.h \ + $(srcdir)/v29rx_floating_rrc.h \ + $(srcdir)/v29tx_fixed_rrc.h \ + $(srcdir)/v29tx_floating_rrc.h + +EXTRA_DIST = floating_fudge.h \ + libspandsp.dsp \ + libspandsp.2005.sln \ + libspandsp.2008.sln \ + libspandsp.2005.vcproj \ + libspandsp.2008.vcproj \ + libtiff.2005.vcproj \ + libtiff.2008.vcproj \ + filter_tools.c \ + make_at_dictionary.c \ + make_modem_filter.c \ + msvc/config.h \ + msvc/Download_TIFF.2005.vcproj \ + msvc/Download_TIFF.2008.vcproj \ + msvc/getopt.c \ + msvc/gettimeofday.c \ + msvc/inttypes.h \ + msvc/make_at_dictionary.2005.vcproj \ + msvc/make_at_dictionary.2008.vcproj \ + msvc/make_modem_filter.2005.vcproj \ + msvc/make_modem_filter.2008.vcproj \ + msvc/msvcproj.head \ + msvc/msvcproj.foot \ + msvc/spandsp.h \ + msvc/tgmath.h \ + msvc/tiff/cleancount \ + msvc/unistd.h \ + msvc/util.vbs \ + msvc/vc8proj.foot \ + msvc/vc8proj.head \ + msvc/vc9proj.foot \ + msvc/vc9proj.head \ + msvc/sys/time.h \ + spandsp/private/README \ + spandsp/version.h.in + +INCLUDES = -I$(top_builddir) + +lib_LTLIBRARIES = libspandsp.la + +libspandsp_la_SOURCES = adsi.c \ + async.c \ + at_interpreter.c \ + awgn.c \ + bell_r2_mf.c \ + bert.c \ + bit_operations.c \ + bitstream.c \ + complex_filters.c \ + complex_vector_float.c \ + complex_vector_int.c \ + crc.c \ + dds_float.c \ + dds_int.c \ + dtmf.c \ + echo.c \ + fax.c \ + fax_modems.c \ + fsk.c \ + g711.c \ + g722.c \ + g726.c \ + gsm0610_decode.c \ + gsm0610_encode.c \ + gsm0610_long_term.c \ + gsm0610_lpc.c \ + gsm0610_preprocess.c \ + gsm0610_rpe.c \ + gsm0610_short_term.c \ + hdlc.c \ + ima_adpcm.c \ + logging.c \ + lpc10_analyse.c \ + lpc10_decode.c \ + lpc10_encode.c \ + lpc10_placev.c \ + lpc10_voicing.c \ + modem_echo.c \ + modem_connect_tones.c \ + noise.c \ + oki_adpcm.c \ + playout.c \ + plc.c \ + power_meter.c \ + queue.c \ + schedule.c \ + sig_tone.c \ + silence_gen.c \ + super_tone_rx.c \ + super_tone_tx.c \ + swept_tone.c \ + t4_rx.c \ + t4_tx.c \ + t30.c \ + t30_api.c \ + t30_logging.c \ + t31.c \ + t35.c \ + t38_core.c \ + t38_gateway.c \ + t38_non_ecm_buffer.c \ + t38_terminal.c \ + testcpuid.c \ + time_scale.c \ + tone_detect.c \ + tone_generate.c \ + v17rx.c \ + v17tx.c \ + v18.c \ + v22bis_rx.c \ + v22bis_tx.c \ + v27ter_rx.c \ + v27ter_tx.c \ + v29rx.c \ + v29tx.c \ + v42.c \ + v42bis.c \ + v8.c \ + vector_float.c \ + vector_int.c + +libspandsp_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@:@SPANDSP_LT_AGE@ $(COMP_VENDOR_LDFLAGS) + +nobase_include_HEADERS = spandsp/adsi.h \ + spandsp/async.h \ + spandsp/arctan2.h \ + spandsp/at_interpreter.h \ + spandsp/awgn.h \ + spandsp/bell_r2_mf.h \ + spandsp/bert.h \ + spandsp/biquad.h \ + spandsp/bit_operations.h \ + spandsp/bitstream.h \ + spandsp/crc.h \ + spandsp/complex.h \ + spandsp/complex_filters.h \ + spandsp/complex_vector_float.h \ + spandsp/complex_vector_int.h \ + spandsp/dc_restore.h \ + spandsp/dds.h \ + spandsp/dtmf.h \ + spandsp/echo.h \ + spandsp/fast_convert.h \ + spandsp/fax.h \ + spandsp/fax_modems.h \ + spandsp/fir.h \ + spandsp/fsk.h \ + spandsp/g168models.h \ + spandsp/g711.h \ + spandsp/g722.h \ + spandsp/g726.h \ + spandsp/gsm0610.h \ + spandsp/hdlc.h \ + spandsp/ima_adpcm.h \ + spandsp/logging.h \ + spandsp/lpc10.h \ + spandsp/modem_echo.h \ + spandsp/modem_connect_tones.h \ + spandsp/noise.h \ + spandsp/oki_adpcm.h \ + spandsp/playout.h \ + spandsp/plc.h \ + spandsp/power_meter.h \ + spandsp/queue.h \ + spandsp/saturated.h \ + spandsp/schedule.h \ + spandsp/sig_tone.h \ + spandsp/silence_gen.h \ + spandsp/super_tone_rx.h \ + spandsp/super_tone_tx.h \ + spandsp/swept_tone.h \ + spandsp/t4_rx.h \ + spandsp/t4_tx.h \ + spandsp/t30.h \ + spandsp/t30_api.h \ + spandsp/t30_fcf.h \ + spandsp/t30_logging.h \ + spandsp/t31.h \ + spandsp/t35.h \ + spandsp/t38_core.h \ + spandsp/t38_gateway.h \ + spandsp/t38_non_ecm_buffer.h \ + spandsp/t38_terminal.h \ + spandsp/telephony.h \ + spandsp/time_scale.h \ + spandsp/timing.h \ + spandsp/tone_detect.h \ + spandsp/tone_generate.h \ + spandsp/v17rx.h \ + spandsp/v17tx.h \ + spandsp/v18.h \ + spandsp/v22bis.h \ + spandsp/v27ter_rx.h \ + spandsp/v27ter_tx.h \ + spandsp/v29rx.h \ + spandsp/v29tx.h \ + spandsp/v42.h \ + spandsp/v42bis.h \ + spandsp/v8.h \ + spandsp/vector_float.h \ + spandsp/vector_int.h \ + spandsp/version.h \ + spandsp/private/adsi.h \ + spandsp/private/async.h \ + spandsp/private/at_interpreter.h \ + spandsp/private/awgn.h \ + spandsp/private/bell_r2_mf.h \ + spandsp/private/bert.h \ + spandsp/private/bitstream.h \ + spandsp/private/dtmf.h \ + spandsp/private/echo.h \ + spandsp/private/fax.h \ + spandsp/private/fax_modems.h \ + spandsp/private/fsk.h \ + spandsp/private/g711.h \ + spandsp/private/g722.h \ + spandsp/private/g726.h \ + spandsp/private/gsm0610.h \ + spandsp/private/hdlc.h \ + spandsp/private/ima_adpcm.h \ + spandsp/private/logging.h \ + spandsp/private/lpc10.h \ + spandsp/private/modem_connect_tones.h \ + spandsp/private/modem_echo.h \ + spandsp/private/noise.h \ + spandsp/private/oki_adpcm.h \ + spandsp/private/queue.h \ + spandsp/private/schedule.h \ + spandsp/private/sig_tone.h \ + spandsp/private/silence_gen.h \ + spandsp/private/super_tone_rx.h \ + spandsp/private/super_tone_tx.h \ + spandsp/private/swept_tone.h \ + spandsp/private/t30.h \ + spandsp/private/t30_dis_dtc_dcs_bits.h \ + spandsp/private/t31.h \ + spandsp/private/t38_core.h \ + spandsp/private/t38_gateway.h \ + spandsp/private/t38_non_ecm_buffer.h \ + spandsp/private/t38_terminal.h \ + spandsp/private/t4_rx.h \ + spandsp/private/t4_tx.h \ + spandsp/private/time_scale.h \ + spandsp/private/tone_detect.h \ + spandsp/private/tone_generate.h \ + spandsp/private/v17rx.h \ + spandsp/private/v17tx.h \ + spandsp/private/v18.h \ + spandsp/private/v22bis.h \ + spandsp/private/v27ter_rx.h \ + spandsp/private/v27ter_tx.h \ + spandsp/private/v29rx.h \ + spandsp/private/v29tx.h \ + spandsp/private/v42.h \ + spandsp/private/v42bis.h \ + spandsp/private/v8.h \ + spandsp/expose.h + +nodist_include_HEADERS = spandsp.h + +noinst_HEADERS = faxfont.h \ + filter_tools.h \ + gsm0610_local.h \ + lpc10_encdecs.h \ + mmx_sse_decs.h \ + t30_local.h \ + t4_t6_decode_states.h \ + v17_v32bis_rx_constellation_maps.h \ + v17_v32bis_tx_constellation_maps.h \ + v29tx_constellation_maps.h + +make_at_dictionary$(EXEEXT): $(top_srcdir)/src/make_at_dictionary.c + $(CC_FOR_BUILD) -o make_at_dictionary$(EXEEXT) $(top_srcdir)/src/make_at_dictionary.c -DHAVE_CONFIG_H -I$(top_builddir)/src + +make_modem_filter$(EXEEXT): $(top_srcdir)/src/make_modem_filter.c $(top_srcdir)/src/filter_tools.c + $(CC_FOR_BUILD) -o make_modem_filter$(EXEEXT) $(top_srcdir)/src/make_modem_filter.c $(top_srcdir)/src/filter_tools.c -DHAVE_CONFIG_H -I$(top_builddir)/src -lm + +# We need to run make_at_dictionary, so it generates the +# at_interpreter_dictionary.h file + +at_interpreter.$(OBJEXT): at_interpreter_dictionary.h + +at_interpreter.lo: at_interpreter_dictionary.h + +at_interpreter_dictionary.h: make_at_dictionary$(EXEEXT) + ./make_at_dictionary$(EXEEXT) >at_interpreter_dictionary.h + +t4.$(OBJEXT): spandsp/version.h + +t4.lo: spandsp/version.h + +v17rx.$(OBJEXT): v17_v32bis_rx_fixed_rrc.h v17_v32bis_rx_floating_rrc.h + +v17rx.lo: v17_v32bis_rx_fixed_rrc.h v17_v32bis_rx_floating_rrc.h + +v17_v32bis_rx_fixed_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.17 -i -r >v17_v32bis_rx_fixed_rrc.h + +v17_v32bis_rx_floating_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.17 -r >v17_v32bis_rx_floating_rrc.h + +v17tx.$(OBJEXT): v17_v32bis_tx_fixed_rrc.h v17_v32bis_tx_floating_rrc.h + +v17tx.lo: v17_v32bis_tx_fixed_rrc.h v17_v32bis_tx_floating_rrc.h + +v17_v32bis_tx_fixed_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.17 -i -t >v17_v32bis_tx_fixed_rrc.h + +v17_v32bis_tx_floating_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.17 -t >v17_v32bis_tx_floating_rrc.h + +v22bis_rx.$(OBJEXT): v22bis_rx_1200_fixed_rrc.h \ + v22bis_rx_2400_fixed_rrc.h \ + v22bis_rx_1200_floating_rrc.h \ + v22bis_rx_2400_floating_rrc.h + +v22bis_rx.lo: v22bis_rx_1200_fixed_rrc.h \ + v22bis_rx_2400_fixed_rrc.h \ + v22bis_rx_1200_floating_rrc.h \ + v22bis_rx_2400_floating_rrc.h + +v22bis_rx_1200_fixed_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.22bis1200 -i -r >v22bis_rx_1200_fixed_rrc.h + +v22bis_rx_2400_fixed_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.22bis2400 -i -r >v22bis_rx_2400_fixed_rrc.h + +v22bis_rx_1200_floating_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.22bis1200 -r >v22bis_rx_1200_floating_rrc.h + +v22bis_rx_2400_floating_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.22bis2400 -r >v22bis_rx_2400_floating_rrc.h + +v22bis_tx.$(OBJEXT): v22bis_tx_fixed_rrc.h v22bis_tx_floating_rrc.h + +v22bis_tx.lo: v22bis_tx_fixed_rrc.h v22bis_tx_floating_rrc.h + +v22bis_tx_fixed_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.22bis -i -t >v22bis_tx_fixed_rrc.h + +v22bis_tx_floating_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.22bis -t >v22bis_tx_floating_rrc.h + +v27ter_rx_.$(OBJEXT): v27ter_rx_2400_fixed_rrc.h \ + v27ter_rx_4800_fixed_rrc.h \ + v27ter_rx_2400_floating_rrc.h \ + v27ter_rx_4800_floating_rrc.h + +v27ter_rx.lo: v27ter_rx_2400_fixed_rrc.h \ + v27ter_rx_4800_fixed_rrc.h \ + v27ter_rx_2400_floating_rrc.h \ + v27ter_rx_4800_floating_rrc.h + +v27ter_rx_2400_fixed_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.27ter2400 -i -r >v27ter_rx_2400_fixed_rrc.h + +v27ter_rx_4800_fixed_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.27ter4800 -i -r >v27ter_rx_4800_fixed_rrc.h + +v27ter_rx_2400_floating_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.27ter2400 -r >v27ter_rx_2400_floating_rrc.h + +v27ter_rx_4800_floating_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.27ter4800 -r >v27ter_rx_4800_floating_rrc.h + +v27ter_tx_.$(OBJEXT): v27ter_tx_2400_fixed_rrc.h \ + v27ter_tx_4800_fixed_rrc.h \ + v27ter_tx_2400_floating_rrc.h \ + v27ter_tx_4800_floating_rrc.h + +v27ter_tx.lo: v27ter_tx_2400_fixed_rrc.h \ + v27ter_tx_4800_fixed_rrc.h \ + v27ter_tx_2400_floating_rrc.h \ + v27ter_tx_4800_floating_rrc.h + +v27ter_tx_2400_fixed_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.27ter2400 -i -t >v27ter_tx_2400_fixed_rrc.h + +v27ter_tx_4800_fixed_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.27ter4800 -i -t >v27ter_tx_4800_fixed_rrc.h + +v27ter_tx_2400_floating_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.27ter2400 -t >v27ter_tx_2400_floating_rrc.h + +v27ter_tx_4800_floating_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.27ter4800 -t >v27ter_tx_4800_floating_rrc.h + +v29rx.$(OBJEXT): v29rx_fixed_rrc.h v29rx_floating_rrc.h + +v29rx.lo: v29rx_fixed_rrc.h v29rx_floating_rrc.h + +v29rx_fixed_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.29 -i -r >v29rx_fixed_rrc.h + +v29rx_floating_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.29 -r >v29rx_floating_rrc.h + +v29tx.$(OBJEXT): v29tx_fixed_rrc.h v29tx_floating_rrc.h + +v29tx.lo: v29tx_fixed_rrc.h v29tx_floating_rrc.h + +v29tx_fixed_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.29 -i -t >v29tx_fixed_rrc.h + +v29tx_floating_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.29 -t >v29tx_floating_rrc.h + +DSP = libspandsp.dsp +VCPROJ8 = libspandsp.2005.vcproj +VCPROJ9 = libspandsp.2008.vcproj + +WIN32SOURCES = $(libspandsp_la_SOURCES) .\\msvc\\gettimeofday.c +WIN32HEADERS = $(nobase_include_HEADERS) spandsp.h + +DSPOUT = | awk '{printf("%s\r\n", $$0)}' >> $(DSP) +VCPROJOUT8 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ8) +VCPROJOUT9 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ9) + +$(DSP): msvc/msvcproj.head msvc/msvcproj.foot Makefile.am + echo "creating $(DSP)" + @(cp $(srcdir)/msvc/msvcproj.head $(DSP); \ + echo "# Begin Group \"Source Files\"" $(DSPOUT); \ + for file in $(WIN32SOURCES); do \ + echo "# Begin Source File" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "SOURCE=.\\"$$file $(DSPOUT); \ + echo "# End Source File" $(DSPOUT); \ + done; \ + echo "# End Group" $(DSPOUT); \ + echo "# Begin Group \"Header Files\"" $(DSPOUT); \ + for file in $(WIN32HEADERS); do \ + echo "# Begin Source File" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "SOURCE=.\\"$$file $(DSPOUT); \ + echo "# End Source File" $(DSPOUT); \ + done; \ + echo "# End Group" $(DSPOUT); \ + cat $(srcdir)/msvc/msvcproj.foot $(DSPOUT) ) + +$(VCPROJ8): msvc/vc8proj.head msvc/vc8proj.foot Makefile.am + echo "creating $(VCPROJ8)" + @(cp $(srcdir)/msvc/vc8proj.head $(VCPROJ8); \ + for file in $(WIN32SOURCES); do \ + echo "" $(VCPROJOUT8); \ + done; \ + echo "" $(VCPROJOUT8); \ + for file in $(WIN32HEADERS); do \ + echo "" $(VCPROJOUT8); \ + done; \ + cat $(srcdir)/msvc/vc8proj.foot $(VCPROJOUT8) ) + +$(VCPROJ9): msvc/vc9proj.head msvc/vc9proj.foot Makefile.am + echo "creating $(VCPROJ9)" + @(cp $(srcdir)/msvc/vc9proj.head $(VCPROJ9); \ + for file in $(WIN32SOURCES); do \ + echo "" $(VCPROJOUT9); \ + done; \ + echo "" $(VCPROJOUT9); \ + for file in $(WIN32HEADERS); do \ + echo "" $(VCPROJOUT9); \ + done; \ + cat $(srcdir)/msvc/vc9proj.foot $(VCPROJOUT9) ) + +$(srcdir)/msvc/spandsp.h: spandsp.h.in + echo "creating $(srcdir)/msvc/spandsp.h" + @sed -e "s/#define _SPANDSP_H_/#define _SPANDSP_H_\n\n#define __inline__ __inline\n#pragma warning(disable:4200)/" \ + -e "s/\@SPANDSP_USE_FIXED_POINT\@/#undef SPANDSP_USE_FIXED_POINT/" \ + -e "s/\@SPANDSP_MISALIGNED_ACCESS_FAILS\@/#undef SPANDSP_MISALIGNED_ACCESS_FAILS/" \ + -e "s/\@SPANDSP_USE_EXPORT_CAPABILITY\@/#define SPANDSP_USE_EXPORT_CAPABILITY 1/" \ + -e "s/\@INSERT_INTTYPES_HEADER\@/#include /" \ + -e "s/\@INSERT_MATH_HEADER\@/#include /" $(srcdir)/spandsp.h.in > $(srcdir)/msvc/spandsp.h + +spandsp/version.h: + mkdir -p $(@D) + NOWDATE=`date --utc +"%Y%m%d"` ; \ + NOWTIME=`date --utc +"%H%M%S"` ; \ + sed 's/$$SPANDSP_RELEASE_DATE/'$$NOWDATE'/;s/$$SPANDSP_RELEASE_TIME/'$$NOWTIME'/' \ + <$(srcdir)/spandsp/version.h.in >$@ + +dist-hook: spandsp/version.h diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/Makefile.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/Makefile.in Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1171 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src +DIST_COMMON = $(nobase_include_HEADERS) $(noinst_HEADERS) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/spandsp.h.in $(top_srcdir)/config-h.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/config/ax_compiler_vendor.m4 \ + $(top_srcdir)/config/ax_check_real_file.m4 \ + $(top_srcdir)/config/ax_fixed_point_machine.m4 \ + $(top_srcdir)/config/ax_misaligned_access_fails.m4 \ + $(top_srcdir)/config/ax_c99_features.m4 \ + $(top_srcdir)/config/ax_check_export_capability.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = spandsp.h +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" \ + "$(DESTDIR)$(includedir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +libspandsp_la_LIBADD = +am_libspandsp_la_OBJECTS = adsi.lo async.lo at_interpreter.lo awgn.lo \ + bell_r2_mf.lo bert.lo bit_operations.lo bitstream.lo \ + complex_filters.lo complex_vector_float.lo \ + complex_vector_int.lo crc.lo dds_float.lo dds_int.lo dtmf.lo \ + echo.lo fax.lo fax_modems.lo fsk.lo g711.lo g722.lo g726.lo \ + gsm0610_decode.lo gsm0610_encode.lo gsm0610_long_term.lo \ + gsm0610_lpc.lo gsm0610_preprocess.lo gsm0610_rpe.lo \ + gsm0610_short_term.lo hdlc.lo ima_adpcm.lo logging.lo \ + lpc10_analyse.lo lpc10_decode.lo lpc10_encode.lo \ + lpc10_placev.lo lpc10_voicing.lo modem_echo.lo \ + modem_connect_tones.lo noise.lo oki_adpcm.lo playout.lo plc.lo \ + power_meter.lo queue.lo schedule.lo sig_tone.lo silence_gen.lo \ + super_tone_rx.lo super_tone_tx.lo swept_tone.lo t4_rx.lo \ + t4_tx.lo t30.lo t30_api.lo t30_logging.lo t31.lo t35.lo \ + t38_core.lo t38_gateway.lo t38_non_ecm_buffer.lo \ + t38_terminal.lo testcpuid.lo time_scale.lo tone_detect.lo \ + tone_generate.lo v17rx.lo v17tx.lo v18.lo v22bis_rx.lo \ + v22bis_tx.lo v27ter_rx.lo v27ter_tx.lo v29rx.lo v29tx.lo \ + v42.lo v42bis.lo v8.lo vector_float.lo vector_int.lo +libspandsp_la_OBJECTS = $(am_libspandsp_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I. +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libspandsp_la_SOURCES) +DIST_SOURCES = $(libspandsp_la_SOURCES) +nobase_includeHEADERS_INSTALL = $(install_sh_DATA) +nodist_includeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(nobase_include_HEADERS) $(nodist_include_HEADERS) \ + $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_FOR_BUILD = @CC_FOR_BUILD@ +CFLAGS = @CFLAGS@ +COMP_VENDOR_CFLAGS = @COMP_VENDOR_CFLAGS@ +COMP_VENDOR_LDFLAGS = @COMP_VENDOR_LDFLAGS@ +COND_DOC_FALSE = @COND_DOC_FALSE@ +COND_DOC_TRUE = @COND_DOC_TRUE@ +COND_MMX_FALSE = @COND_MMX_FALSE@ +COND_MMX_TRUE = @COND_MMX_TRUE@ +COND_SSE2_FALSE = @COND_SSE2_FALSE@ +COND_SSE2_TRUE = @COND_SSE2_TRUE@ +COND_SSE3_FALSE = @COND_SSE3_FALSE@ +COND_SSE3_TRUE = @COND_SSE3_TRUE@ +COND_SSE4A_FALSE = @COND_SSE4A_FALSE@ +COND_SSE4A_TRUE = @COND_SSE4A_TRUE@ +COND_SSE4_1_FALSE = @COND_SSE4_1_FALSE@ +COND_SSE4_1_TRUE = @COND_SSE4_1_TRUE@ +COND_SSE4_2_FALSE = @COND_SSE4_2_FALSE@ +COND_SSE4_2_TRUE = @COND_SSE4_2_TRUE@ +COND_SSE5_FALSE = @COND_SSE5_FALSE@ +COND_SSE5_TRUE = @COND_SSE5_TRUE@ +COND_SSE_FALSE = @COND_SSE_FALSE@ +COND_SSE_TRUE = @COND_SSE_TRUE@ +COND_SSSE3_FALSE = @COND_SSSE3_FALSE@ +COND_SSSE3_TRUE = @COND_SSSE3_TRUE@ +COND_TESTDATA_FALSE = @COND_TESTDATA_FALSE@ +COND_TESTDATA_TRUE = @COND_TESTDATA_TRUE@ +COND_TESTS_FALSE = @COND_TESTS_FALSE@ +COND_TESTS_TRUE = @COND_TESTS_TRUE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSERT_INTTYPES_HEADER = @INSERT_INTTYPES_HEADER@ +INSERT_MATH_HEADER = @INSERT_MATH_HEADER@ +INSERT_STDINT_HEADER = @INSERT_STDINT_HEADER@ +INSERT_TGMATH_HEADER = @INSERT_TGMATH_HEADER@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIMLIBS = @SIMLIBS@ +SPANDSP_LT_AGE = @SPANDSP_LT_AGE@ +SPANDSP_LT_CURRENT = @SPANDSP_LT_CURRENT@ +SPANDSP_LT_REVISION = @SPANDSP_LT_REVISION@ +SPANDSP_MISALIGNED_ACCESS_FAILS = @SPANDSP_MISALIGNED_ACCESS_FAILS@ +SPANDSP_USE_EXPORT_CAPABILITY = @SPANDSP_USE_EXPORT_CAPABILITY@ +SPANDSP_USE_FIXED_POINT = @SPANDSP_USE_FIXED_POINT@ +STRIP = @STRIP@ +TESTLIBS = @TESTLIBS@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DSYMUTIL = @ac_ct_DSYMUTIL@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_NMEDIT = @ac_ct_NMEDIT@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AM_CFLAGS = $(COMP_VENDOR_CFLAGS) +AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) +MAINTAINERCLEANFILES = Makefile.in +DISTCLEANFILES = $(srcdir)/at_interpreter_dictionary.h \ + $(srcdir)/v17_v32bis_rx_fixed_rrc.h \ + $(srcdir)/v17_v32bis_rx_floating_rrc.h \ + $(srcdir)/v17_v32bis_tx_fixed_rrc.h \ + $(srcdir)/v17_v32bis_tx_floating_rrc.h \ + $(srcdir)/v22bis_rx_1200_fixed_rrc.h \ + $(srcdir)/v22bis_rx_2400_fixed_rrc.h \ + $(srcdir)/v22bis_rx_1200_floating_rrc.h \ + $(srcdir)/v22bis_rx_2400_floating_rrc.h \ + $(srcdir)/v22bis_tx_fixed_rrc.h \ + $(srcdir)/v22bis_tx_floating_rrc.h \ + $(srcdir)/v27ter_rx_2400_fixed_rrc.h \ + $(srcdir)/v27ter_rx_4800_fixed_rrc.h \ + $(srcdir)/v27ter_rx_2400_floating_rrc.h \ + $(srcdir)/v27ter_rx_4800_floating_rrc.h \ + $(srcdir)/v27ter_tx_2400_fixed_rrc.h \ + $(srcdir)/v27ter_tx_4800_fixed_rrc.h \ + $(srcdir)/v27ter_tx_2400_floating_rrc.h \ + $(srcdir)/v27ter_tx_4800_floating_rrc.h \ + $(srcdir)/v29rx_fixed_rrc.h \ + $(srcdir)/v29rx_floating_rrc.h \ + $(srcdir)/v29tx_fixed_rrc.h \ + $(srcdir)/v29tx_floating_rrc.h + +EXTRA_DIST = floating_fudge.h \ + libspandsp.dsp \ + libspandsp.2005.sln \ + libspandsp.2008.sln \ + libspandsp.2005.vcproj \ + libspandsp.2008.vcproj \ + libtiff.2005.vcproj \ + libtiff.2008.vcproj \ + filter_tools.c \ + make_at_dictionary.c \ + make_modem_filter.c \ + msvc/config.h \ + msvc/Download_TIFF.2005.vcproj \ + msvc/Download_TIFF.2008.vcproj \ + msvc/getopt.c \ + msvc/gettimeofday.c \ + msvc/inttypes.h \ + msvc/make_at_dictionary.2005.vcproj \ + msvc/make_at_dictionary.2008.vcproj \ + msvc/make_modem_filter.2005.vcproj \ + msvc/make_modem_filter.2008.vcproj \ + msvc/msvcproj.head \ + msvc/msvcproj.foot \ + msvc/spandsp.h \ + msvc/tgmath.h \ + msvc/tiff/cleancount \ + msvc/unistd.h \ + msvc/util.vbs \ + msvc/vc8proj.foot \ + msvc/vc8proj.head \ + msvc/vc9proj.foot \ + msvc/vc9proj.head \ + msvc/sys/time.h \ + spandsp/private/README \ + spandsp/version.h.in + +INCLUDES = -I$(top_builddir) +lib_LTLIBRARIES = libspandsp.la +libspandsp_la_SOURCES = adsi.c \ + async.c \ + at_interpreter.c \ + awgn.c \ + bell_r2_mf.c \ + bert.c \ + bit_operations.c \ + bitstream.c \ + complex_filters.c \ + complex_vector_float.c \ + complex_vector_int.c \ + crc.c \ + dds_float.c \ + dds_int.c \ + dtmf.c \ + echo.c \ + fax.c \ + fax_modems.c \ + fsk.c \ + g711.c \ + g722.c \ + g726.c \ + gsm0610_decode.c \ + gsm0610_encode.c \ + gsm0610_long_term.c \ + gsm0610_lpc.c \ + gsm0610_preprocess.c \ + gsm0610_rpe.c \ + gsm0610_short_term.c \ + hdlc.c \ + ima_adpcm.c \ + logging.c \ + lpc10_analyse.c \ + lpc10_decode.c \ + lpc10_encode.c \ + lpc10_placev.c \ + lpc10_voicing.c \ + modem_echo.c \ + modem_connect_tones.c \ + noise.c \ + oki_adpcm.c \ + playout.c \ + plc.c \ + power_meter.c \ + queue.c \ + schedule.c \ + sig_tone.c \ + silence_gen.c \ + super_tone_rx.c \ + super_tone_tx.c \ + swept_tone.c \ + t4_rx.c \ + t4_tx.c \ + t30.c \ + t30_api.c \ + t30_logging.c \ + t31.c \ + t35.c \ + t38_core.c \ + t38_gateway.c \ + t38_non_ecm_buffer.c \ + t38_terminal.c \ + testcpuid.c \ + time_scale.c \ + tone_detect.c \ + tone_generate.c \ + v17rx.c \ + v17tx.c \ + v18.c \ + v22bis_rx.c \ + v22bis_tx.c \ + v27ter_rx.c \ + v27ter_tx.c \ + v29rx.c \ + v29tx.c \ + v42.c \ + v42bis.c \ + v8.c \ + vector_float.c \ + vector_int.c + +libspandsp_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@:@SPANDSP_LT_AGE@ $(COMP_VENDOR_LDFLAGS) +nobase_include_HEADERS = spandsp/adsi.h \ + spandsp/async.h \ + spandsp/arctan2.h \ + spandsp/at_interpreter.h \ + spandsp/awgn.h \ + spandsp/bell_r2_mf.h \ + spandsp/bert.h \ + spandsp/biquad.h \ + spandsp/bit_operations.h \ + spandsp/bitstream.h \ + spandsp/crc.h \ + spandsp/complex.h \ + spandsp/complex_filters.h \ + spandsp/complex_vector_float.h \ + spandsp/complex_vector_int.h \ + spandsp/dc_restore.h \ + spandsp/dds.h \ + spandsp/dtmf.h \ + spandsp/echo.h \ + spandsp/fast_convert.h \ + spandsp/fax.h \ + spandsp/fax_modems.h \ + spandsp/fir.h \ + spandsp/fsk.h \ + spandsp/g168models.h \ + spandsp/g711.h \ + spandsp/g722.h \ + spandsp/g726.h \ + spandsp/gsm0610.h \ + spandsp/hdlc.h \ + spandsp/ima_adpcm.h \ + spandsp/logging.h \ + spandsp/lpc10.h \ + spandsp/modem_echo.h \ + spandsp/modem_connect_tones.h \ + spandsp/noise.h \ + spandsp/oki_adpcm.h \ + spandsp/playout.h \ + spandsp/plc.h \ + spandsp/power_meter.h \ + spandsp/queue.h \ + spandsp/saturated.h \ + spandsp/schedule.h \ + spandsp/sig_tone.h \ + spandsp/silence_gen.h \ + spandsp/super_tone_rx.h \ + spandsp/super_tone_tx.h \ + spandsp/swept_tone.h \ + spandsp/t4_rx.h \ + spandsp/t4_tx.h \ + spandsp/t30.h \ + spandsp/t30_api.h \ + spandsp/t30_fcf.h \ + spandsp/t30_logging.h \ + spandsp/t31.h \ + spandsp/t35.h \ + spandsp/t38_core.h \ + spandsp/t38_gateway.h \ + spandsp/t38_non_ecm_buffer.h \ + spandsp/t38_terminal.h \ + spandsp/telephony.h \ + spandsp/time_scale.h \ + spandsp/timing.h \ + spandsp/tone_detect.h \ + spandsp/tone_generate.h \ + spandsp/v17rx.h \ + spandsp/v17tx.h \ + spandsp/v18.h \ + spandsp/v22bis.h \ + spandsp/v27ter_rx.h \ + spandsp/v27ter_tx.h \ + spandsp/v29rx.h \ + spandsp/v29tx.h \ + spandsp/v42.h \ + spandsp/v42bis.h \ + spandsp/v8.h \ + spandsp/vector_float.h \ + spandsp/vector_int.h \ + spandsp/version.h \ + spandsp/private/adsi.h \ + spandsp/private/async.h \ + spandsp/private/at_interpreter.h \ + spandsp/private/awgn.h \ + spandsp/private/bell_r2_mf.h \ + spandsp/private/bert.h \ + spandsp/private/bitstream.h \ + spandsp/private/dtmf.h \ + spandsp/private/echo.h \ + spandsp/private/fax.h \ + spandsp/private/fax_modems.h \ + spandsp/private/fsk.h \ + spandsp/private/g711.h \ + spandsp/private/g722.h \ + spandsp/private/g726.h \ + spandsp/private/gsm0610.h \ + spandsp/private/hdlc.h \ + spandsp/private/ima_adpcm.h \ + spandsp/private/logging.h \ + spandsp/private/lpc10.h \ + spandsp/private/modem_connect_tones.h \ + spandsp/private/modem_echo.h \ + spandsp/private/noise.h \ + spandsp/private/oki_adpcm.h \ + spandsp/private/queue.h \ + spandsp/private/schedule.h \ + spandsp/private/sig_tone.h \ + spandsp/private/silence_gen.h \ + spandsp/private/super_tone_rx.h \ + spandsp/private/super_tone_tx.h \ + spandsp/private/swept_tone.h \ + spandsp/private/t30.h \ + spandsp/private/t30_dis_dtc_dcs_bits.h \ + spandsp/private/t31.h \ + spandsp/private/t38_core.h \ + spandsp/private/t38_gateway.h \ + spandsp/private/t38_non_ecm_buffer.h \ + spandsp/private/t38_terminal.h \ + spandsp/private/t4_rx.h \ + spandsp/private/t4_tx.h \ + spandsp/private/time_scale.h \ + spandsp/private/tone_detect.h \ + spandsp/private/tone_generate.h \ + spandsp/private/v17rx.h \ + spandsp/private/v17tx.h \ + spandsp/private/v18.h \ + spandsp/private/v22bis.h \ + spandsp/private/v27ter_rx.h \ + spandsp/private/v27ter_tx.h \ + spandsp/private/v29rx.h \ + spandsp/private/v29tx.h \ + spandsp/private/v42.h \ + spandsp/private/v42bis.h \ + spandsp/private/v8.h \ + spandsp/expose.h + +nodist_include_HEADERS = spandsp.h +noinst_HEADERS = faxfont.h \ + filter_tools.h \ + gsm0610_local.h \ + lpc10_encdecs.h \ + mmx_sse_decs.h \ + t30_local.h \ + t4_t6_decode_states.h \ + v17_v32bis_rx_constellation_maps.h \ + v17_v32bis_tx_constellation_maps.h \ + v29tx_constellation_maps.h + +DSP = libspandsp.dsp +VCPROJ8 = libspandsp.2005.vcproj +VCPROJ9 = libspandsp.2008.vcproj +WIN32SOURCES = $(libspandsp_la_SOURCES) .\\msvc\\gettimeofday.c +WIN32HEADERS = $(nobase_include_HEADERS) spandsp.h +DSPOUT = | awk '{printf("%s\r\n", $$0)}' >> $(DSP) +VCPROJOUT8 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ8) +VCPROJOUT9 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ9) +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ + else :; fi + +stamp-h1: $(top_srcdir)/config-h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status src/config.h +$(top_srcdir)/config-h.in: $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +spandsp.h: $(top_builddir)/config.status $(srcdir)/spandsp.h.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libspandsp.la: $(libspandsp_la_OBJECTS) $(libspandsp_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libspandsp_la_LDFLAGS) $(libspandsp_la_OBJECTS) $(libspandsp_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adsi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/async.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/at_interpreter.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/awgn.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bell_r2_mf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bert.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bit_operations.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitstream.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/complex_filters.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/complex_vector_float.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/complex_vector_int.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dds_float.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dds_int.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtmf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/echo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fax.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fax_modems.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsk.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g711.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g722.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g726.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm0610_decode.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm0610_encode.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm0610_long_term.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm0610_lpc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm0610_preprocess.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm0610_rpe.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm0610_short_term.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hdlc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ima_adpcm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logging.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc10_analyse.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc10_decode.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc10_encode.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc10_placev.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc10_voicing.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modem_connect_tones.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modem_echo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/noise.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oki_adpcm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/playout.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/power_meter.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/queue.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/schedule.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sig_tone.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/silence_gen.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/super_tone_rx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/super_tone_tx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/swept_tone.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t30.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t30_api.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t30_logging.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t31.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t35.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t38_core.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t38_gateway.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t38_non_ecm_buffer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t38_terminal.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t4_rx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t4_tx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testcpuid.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time_scale.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tone_detect.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tone_generate.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v17rx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v17tx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v18.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v22bis_rx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v22bis_tx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v27ter_rx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v27ter_tx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v29rx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v29tx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v42.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v42bis.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v8.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector_float.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector_int.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-nobase_includeHEADERS: $(nobase_include_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)" + @$(am__vpath_adj_setup) \ + list='$(nobase_include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + $(am__vpath_adj) \ + echo " $(nobase_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ + $(nobase_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ + done + +uninstall-nobase_includeHEADERS: + @$(NORMAL_UNINSTALL) + @$(am__vpath_adj_setup) \ + list='$(nobase_include_HEADERS)'; for p in $$list; do \ + $(am__vpath_adj) \ + echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ + rm -f "$(DESTDIR)$(includedir)/$$f"; \ + done +install-nodist_includeHEADERS: $(nodist_include_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)" + @list='$(nodist_include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(nodist_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ + $(nodist_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ + done + +uninstall-nodist_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(nodist_include_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ + rm -f "$(DESTDIR)$(includedir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(mkdir_p) $(distdir)/.. $(distdir)/msvc $(distdir)/msvc/sys $(distdir)/msvc/tiff $(distdir)/spandsp $(distdir)/spandsp/private + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) config.h +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-nobase_includeHEADERS \ + install-nodist_includeHEADERS + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES \ + uninstall-nobase_includeHEADERS \ + uninstall-nodist_includeHEADERS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags dist-hook distclean \ + distclean-compile distclean-generic distclean-hdr \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-libLTLIBRARIES install-man \ + install-nobase_includeHEADERS install-nodist_includeHEADERS \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-info-am uninstall-libLTLIBRARIES \ + uninstall-nobase_includeHEADERS \ + uninstall-nodist_includeHEADERS + + +make_at_dictionary$(EXEEXT): $(top_srcdir)/src/make_at_dictionary.c + $(CC_FOR_BUILD) -o make_at_dictionary$(EXEEXT) $(top_srcdir)/src/make_at_dictionary.c -DHAVE_CONFIG_H -I$(top_builddir)/src + +make_modem_filter$(EXEEXT): $(top_srcdir)/src/make_modem_filter.c $(top_srcdir)/src/filter_tools.c + $(CC_FOR_BUILD) -o make_modem_filter$(EXEEXT) $(top_srcdir)/src/make_modem_filter.c $(top_srcdir)/src/filter_tools.c -DHAVE_CONFIG_H -I$(top_builddir)/src -lm + +# We need to run make_at_dictionary, so it generates the +# at_interpreter_dictionary.h file + +at_interpreter.$(OBJEXT): at_interpreter_dictionary.h + +at_interpreter.lo: at_interpreter_dictionary.h + +at_interpreter_dictionary.h: make_at_dictionary$(EXEEXT) + ./make_at_dictionary$(EXEEXT) >at_interpreter_dictionary.h + +t4.$(OBJEXT): spandsp/version.h + +t4.lo: spandsp/version.h + +v17rx.$(OBJEXT): v17_v32bis_rx_fixed_rrc.h v17_v32bis_rx_floating_rrc.h + +v17rx.lo: v17_v32bis_rx_fixed_rrc.h v17_v32bis_rx_floating_rrc.h + +v17_v32bis_rx_fixed_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.17 -i -r >v17_v32bis_rx_fixed_rrc.h + +v17_v32bis_rx_floating_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.17 -r >v17_v32bis_rx_floating_rrc.h + +v17tx.$(OBJEXT): v17_v32bis_tx_fixed_rrc.h v17_v32bis_tx_floating_rrc.h + +v17tx.lo: v17_v32bis_tx_fixed_rrc.h v17_v32bis_tx_floating_rrc.h + +v17_v32bis_tx_fixed_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.17 -i -t >v17_v32bis_tx_fixed_rrc.h + +v17_v32bis_tx_floating_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.17 -t >v17_v32bis_tx_floating_rrc.h + +v22bis_rx.$(OBJEXT): v22bis_rx_1200_fixed_rrc.h \ + v22bis_rx_2400_fixed_rrc.h \ + v22bis_rx_1200_floating_rrc.h \ + v22bis_rx_2400_floating_rrc.h + +v22bis_rx.lo: v22bis_rx_1200_fixed_rrc.h \ + v22bis_rx_2400_fixed_rrc.h \ + v22bis_rx_1200_floating_rrc.h \ + v22bis_rx_2400_floating_rrc.h + +v22bis_rx_1200_fixed_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.22bis1200 -i -r >v22bis_rx_1200_fixed_rrc.h + +v22bis_rx_2400_fixed_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.22bis2400 -i -r >v22bis_rx_2400_fixed_rrc.h + +v22bis_rx_1200_floating_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.22bis1200 -r >v22bis_rx_1200_floating_rrc.h + +v22bis_rx_2400_floating_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.22bis2400 -r >v22bis_rx_2400_floating_rrc.h + +v22bis_tx.$(OBJEXT): v22bis_tx_fixed_rrc.h v22bis_tx_floating_rrc.h + +v22bis_tx.lo: v22bis_tx_fixed_rrc.h v22bis_tx_floating_rrc.h + +v22bis_tx_fixed_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.22bis -i -t >v22bis_tx_fixed_rrc.h + +v22bis_tx_floating_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.22bis -t >v22bis_tx_floating_rrc.h + +v27ter_rx_.$(OBJEXT): v27ter_rx_2400_fixed_rrc.h \ + v27ter_rx_4800_fixed_rrc.h \ + v27ter_rx_2400_floating_rrc.h \ + v27ter_rx_4800_floating_rrc.h + +v27ter_rx.lo: v27ter_rx_2400_fixed_rrc.h \ + v27ter_rx_4800_fixed_rrc.h \ + v27ter_rx_2400_floating_rrc.h \ + v27ter_rx_4800_floating_rrc.h + +v27ter_rx_2400_fixed_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.27ter2400 -i -r >v27ter_rx_2400_fixed_rrc.h + +v27ter_rx_4800_fixed_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.27ter4800 -i -r >v27ter_rx_4800_fixed_rrc.h + +v27ter_rx_2400_floating_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.27ter2400 -r >v27ter_rx_2400_floating_rrc.h + +v27ter_rx_4800_floating_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.27ter4800 -r >v27ter_rx_4800_floating_rrc.h + +v27ter_tx_.$(OBJEXT): v27ter_tx_2400_fixed_rrc.h \ + v27ter_tx_4800_fixed_rrc.h \ + v27ter_tx_2400_floating_rrc.h \ + v27ter_tx_4800_floating_rrc.h + +v27ter_tx.lo: v27ter_tx_2400_fixed_rrc.h \ + v27ter_tx_4800_fixed_rrc.h \ + v27ter_tx_2400_floating_rrc.h \ + v27ter_tx_4800_floating_rrc.h + +v27ter_tx_2400_fixed_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.27ter2400 -i -t >v27ter_tx_2400_fixed_rrc.h + +v27ter_tx_4800_fixed_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.27ter4800 -i -t >v27ter_tx_4800_fixed_rrc.h + +v27ter_tx_2400_floating_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.27ter2400 -t >v27ter_tx_2400_floating_rrc.h + +v27ter_tx_4800_floating_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.27ter4800 -t >v27ter_tx_4800_floating_rrc.h + +v29rx.$(OBJEXT): v29rx_fixed_rrc.h v29rx_floating_rrc.h + +v29rx.lo: v29rx_fixed_rrc.h v29rx_floating_rrc.h + +v29rx_fixed_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.29 -i -r >v29rx_fixed_rrc.h + +v29rx_floating_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.29 -r >v29rx_floating_rrc.h + +v29tx.$(OBJEXT): v29tx_fixed_rrc.h v29tx_floating_rrc.h + +v29tx.lo: v29tx_fixed_rrc.h v29tx_floating_rrc.h + +v29tx_fixed_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.29 -i -t >v29tx_fixed_rrc.h + +v29tx_floating_rrc.h: make_modem_filter$(EXEEXT) + ./make_modem_filter$(EXEEXT) -m V.29 -t >v29tx_floating_rrc.h + +$(DSP): msvc/msvcproj.head msvc/msvcproj.foot Makefile.am + echo "creating $(DSP)" + @(cp $(srcdir)/msvc/msvcproj.head $(DSP); \ + echo "# Begin Group \"Source Files\"" $(DSPOUT); \ + for file in $(WIN32SOURCES); do \ + echo "# Begin Source File" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "SOURCE=.\\"$$file $(DSPOUT); \ + echo "# End Source File" $(DSPOUT); \ + done; \ + echo "# End Group" $(DSPOUT); \ + echo "# Begin Group \"Header Files\"" $(DSPOUT); \ + for file in $(WIN32HEADERS); do \ + echo "# Begin Source File" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "SOURCE=.\\"$$file $(DSPOUT); \ + echo "# End Source File" $(DSPOUT); \ + done; \ + echo "# End Group" $(DSPOUT); \ + cat $(srcdir)/msvc/msvcproj.foot $(DSPOUT) ) + +$(VCPROJ8): msvc/vc8proj.head msvc/vc8proj.foot Makefile.am + echo "creating $(VCPROJ8)" + @(cp $(srcdir)/msvc/vc8proj.head $(VCPROJ8); \ + for file in $(WIN32SOURCES); do \ + echo "" $(VCPROJOUT8); \ + done; \ + echo "" $(VCPROJOUT8); \ + for file in $(WIN32HEADERS); do \ + echo "" $(VCPROJOUT8); \ + done; \ + cat $(srcdir)/msvc/vc8proj.foot $(VCPROJOUT8) ) + +$(VCPROJ9): msvc/vc9proj.head msvc/vc9proj.foot Makefile.am + echo "creating $(VCPROJ9)" + @(cp $(srcdir)/msvc/vc9proj.head $(VCPROJ9); \ + for file in $(WIN32SOURCES); do \ + echo "" $(VCPROJOUT9); \ + done; \ + echo "" $(VCPROJOUT9); \ + for file in $(WIN32HEADERS); do \ + echo "" $(VCPROJOUT9); \ + done; \ + cat $(srcdir)/msvc/vc9proj.foot $(VCPROJOUT9) ) + +$(srcdir)/msvc/spandsp.h: spandsp.h.in + echo "creating $(srcdir)/msvc/spandsp.h" + @sed -e "s/#define _SPANDSP_H_/#define _SPANDSP_H_\n\n#define __inline__ __inline\n#pragma warning(disable:4200)/" \ + -e "s/\@SPANDSP_USE_FIXED_POINT\@/#undef SPANDSP_USE_FIXED_POINT/" \ + -e "s/\@SPANDSP_MISALIGNED_ACCESS_FAILS\@/#undef SPANDSP_MISALIGNED_ACCESS_FAILS/" \ + -e "s/\@SPANDSP_USE_EXPORT_CAPABILITY\@/#define SPANDSP_USE_EXPORT_CAPABILITY 1/" \ + -e "s/\@INSERT_INTTYPES_HEADER\@/#include /" \ + -e "s/\@INSERT_MATH_HEADER\@/#include /" $(srcdir)/spandsp.h.in > $(srcdir)/msvc/spandsp.h + +spandsp/version.h: + mkdir -p $(@D) + NOWDATE=`date --utc +"%Y%m%d"` ; \ + NOWTIME=`date --utc +"%H%M%S"` ; \ + sed 's/$$SPANDSP_RELEASE_DATE/'$$NOWDATE'/;s/$$SPANDSP_RELEASE_TIME/'$$NOWTIME'/' \ + <$(srcdir)/spandsp/version.h.in >$@ + +dist-hook: spandsp/version.h +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/adsi.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/adsi.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1108 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * adsi.c - Analogue display service interfaces of various types, including + * ADSI, TDD and most caller ID formats. + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: adsi.c,v 1.77 2009/11/02 13:25:20 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/logging.h" +#include "spandsp/queue.h" +#include "spandsp/complex.h" +#include "spandsp/dds.h" +#include "spandsp/power_meter.h" +#include "spandsp/async.h" +#include "spandsp/crc.h" +#include "spandsp/fsk.h" +#include "spandsp/tone_detect.h" +#include "spandsp/tone_generate.h" +#include "spandsp/super_tone_rx.h" +#include "spandsp/dtmf.h" +#include "spandsp/adsi.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/queue.h" +#include "spandsp/private/tone_generate.h" +#include "spandsp/private/async.h" +#include "spandsp/private/fsk.h" +#include "spandsp/private/dtmf.h" +#include "spandsp/private/adsi.h" + +/*! The baudot code to shift from alpha to digits and symbols */ +#define BAUDOT_FIGURE_SHIFT 0x1B +/*! The baudot code to shift from digits and symbols to alpha */ +#define BAUDOT_LETTER_SHIFT 0x1F + +enum +{ + SOH = 0x01, + STX = 0x02, + ETX = 0x03, + DLE = 0x10, + SUB = 0x1A +}; + +static uint16_t adsi_encode_baudot(adsi_tx_state_t *s, uint8_t ch); +static uint8_t adsi_decode_baudot(adsi_rx_state_t *s, uint8_t ch); + +static int adsi_tx_get_bit(void *user_data) +{ + int bit; + adsi_tx_state_t *s; + + s = (adsi_tx_state_t *) user_data; + /* This is similar to the async. handling code in fsk.c, but a few special + things are needed in the preamble, and postamble of an ADSI message. */ + if (s->bit_no < s->preamble_len) + { + /* Alternating bit preamble */ + bit = s->bit_no & 1; + s->bit_no++; + } + else if (s->bit_no < s->preamble_len + s->preamble_ones_len) + { + /* All 1s for receiver conditioning */ + /* NB: The receiver is an async one. It needs a rest after the + alternating 1/0 sequence so it can reliably pick up on + the next start bit, and sync to the byte stream. */ + /* The length of this period varies with the circumstance */ + bit = 1; + s->bit_no++; + } + else if (s->bit_no <= s->preamble_len + s->preamble_ones_len) + { + /* Push out the 8 bit async. chars, with an appropriate number of stop bits */ + if (s->bit_pos == 0) + { + /* Start bit */ + bit = 0; + s->bit_pos++; + } + else if (s->bit_pos < 1 + 8) + { + bit = (s->msg[s->byte_no] >> (s->bit_pos - 1)) & 1; + s->bit_pos++; + } + else if (s->bit_pos < 1 + 8 + s->stop_bits - 1) + { + /* Stop bit */ + bit = 1; + s->bit_pos++; + } + else + { + /* Stop bit */ + bit = 1; + s->bit_pos = 0; + if (++s->byte_no >= s->msg_len) + s->bit_no++; + } + } + else if (s->bit_no <= s->preamble_len + s->preamble_ones_len + s->postamble_ones_len) + { + /* Extra stop bits beyond the last character, to meet the specs., and ensure + all bits are out of the DSP before we shut off the FSK modem. */ + bit = 1; + s->bit_no++; + } + else + { + bit = SIG_STATUS_END_OF_DATA; + if (s->tx_signal_on) + { + /* The FSK should now be switched off. */ + s->tx_signal_on = FALSE; + s->msg_len = 0; + } + } + //printf("Tx bit %d\n", bit); + return bit; +} +/*- End of function --------------------------------------------------------*/ + +static int adsi_tdd_get_async_byte(void *user_data) +{ + adsi_tx_state_t *s; + + s = (adsi_tx_state_t *) user_data; + if (s->byte_no < s->msg_len) + return s->msg[s->byte_no++]; + if (s->tx_signal_on) + { + /* The FSK should now be switched off. */ + s->tx_signal_on = FALSE; + s->msg_len = 0; + } + return 0x1F; +} +/*- End of function --------------------------------------------------------*/ + +static void adsi_rx_put_bit(void *user_data, int bit) +{ + adsi_rx_state_t *s; + int i; + int sum; + + s = (adsi_rx_state_t *) user_data; + if (bit < 0) + { + /* Special conditions */ + span_log(&s->logging, SPAN_LOG_FLOW, "ADSI signal status is %s (%d)\n", signal_status_to_str(bit), bit); + switch (bit) + { + case SIG_STATUS_CARRIER_UP: + s->consecutive_ones = 0; + s->bit_pos = 0; + s->in_progress = 0; + s->msg_len = 0; + break; + case SIG_STATUS_CARRIER_DOWN: + break; + default: + span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected special put bit value - %d!\n", bit); + break; + } + return; + } + bit &= 1; + if (s->bit_pos == 0) + { + if (bit == 0) + { + /* Start bit */ + s->bit_pos++; + if (s->consecutive_ones > 10) + { + /* This is a line idle condition, which means we should + restart message acquisition */ + s->msg_len = 0; + } + s->consecutive_ones = 0; + } + else + { + s->consecutive_ones++; + } + } + else if (s->bit_pos <= 8) + { + s->in_progress >>= 1; + if (bit) + s->in_progress |= 0x80; + s->bit_pos++; + } + else + { + /* Stop bit */ + if (bit) + { + if (s->msg_len < 256) + { + if (s->standard == ADSI_STANDARD_JCLIP) + { + if (s->msg_len == 0) + { + /* A message should start DLE SOH, but let's just check + we are starting with a DLE for now */ + if (s->in_progress == (0x80 | DLE)) + s->msg[s->msg_len++] = (uint8_t) s->in_progress; + } + else + { + s->msg[s->msg_len++] = (uint8_t) s->in_progress; + } + if (s->msg_len >= 11 && s->msg_len == ((s->msg[6] & 0x7F) + 11)) + { + /* Test the CRC-16 */ + if (crc_itu16_calc(s->msg + 2, s->msg_len - 2, 0) == 0) + { + /* Strip off the parity bits. It doesn't seem + worthwhile actually checking the parity if a + CRC check has succeeded. */ + for (i = 0; i < s->msg_len - 2; i++) + s->msg[i] &= 0x7F; + /* Put everything, except the CRC octets */ + s->put_msg(s->user_data, s->msg, s->msg_len - 2); + } + else + { + span_log(&s->logging, SPAN_LOG_WARNING, "CRC failed\n"); + } + s->msg_len = 0; + } + } + else + { + s->msg[s->msg_len++] = (uint8_t) s->in_progress; + if (s->msg_len >= 3 && s->msg_len == (s->msg[1] + 3)) + { + /* Test the checksum */ + sum = 0; + for (i = 0; i < s->msg_len - 1; i++) + sum += s->msg[i]; + if ((-sum & 0xFF) == s->msg[i]) + s->put_msg(s->user_data, s->msg, s->msg_len - 1); + else + span_log(&s->logging, SPAN_LOG_WARNING, "Sumcheck failed\n"); + s->msg_len = 0; + } + } + } + } + else + { + s->framing_errors++; + } + s->bit_pos = 0; + s->in_progress = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +static void adsi_tdd_put_async_byte(void *user_data, int byte) +{ + adsi_rx_state_t *s; + uint8_t octet; + + s = (adsi_rx_state_t *) user_data; + //printf("Rx bit %x\n", bit); + if (byte < 0) + { + /* Special conditions */ + span_log(&s->logging, SPAN_LOG_FLOW, "ADSI signal status is %s (%d)\n", signal_status_to_str(byte), byte); + switch (byte) + { + case SIG_STATUS_CARRIER_UP: + s->consecutive_ones = 0; + s->bit_pos = 0; + s->in_progress = 0; + s->msg_len = 0; + break; + case SIG_STATUS_CARRIER_DOWN: + if (s->msg_len > 0) + { + /* Whatever we have to date constitutes the message */ + s->put_msg(s->user_data, s->msg, s->msg_len); + s->msg_len = 0; + } + break; + default: + span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected special put byte value - %d!\n", byte); + break; + } + return; + } + if ((octet = adsi_decode_baudot(s, (uint8_t) (byte & 0x1F)))) + s->msg[s->msg_len++] = octet; + if (s->msg_len >= 256) + { + s->put_msg(s->user_data, s->msg, s->msg_len); + s->msg_len = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +static void adsi_rx_dtmf(void *user_data, const char *digits, int len) +{ + adsi_rx_state_t *s; + + s = (adsi_rx_state_t *) user_data; + if (s->msg_len == 0) + { + /* Message starting. Start a 10s timeout, to make things more noise + tolerant for a detector running continuously when on hook. */ + s->in_progress = 80000; + } + /* It seems all the DTMF variants are a string of digits and letters, + terminated by a "#", or a "C". It appears these are unambiguous, and + non-conflicting. */ + for ( ; len && s->msg_len < 256; len--) + { + s->msg[s->msg_len++] = *digits; + if (*digits == '#' || *digits == 'C') + { + s->put_msg(s->user_data, s->msg, s->msg_len); + s->msg_len = 0; + } + digits++; + } +} +/*- End of function --------------------------------------------------------*/ + +static void start_tx(adsi_tx_state_t *s) +{ + switch (s->standard) + { + case ADSI_STANDARD_CLASS: + fsk_tx_init(&(s->fsktx), &preset_fsk_specs[FSK_BELL202], adsi_tx_get_bit, s); + break; + case ADSI_STANDARD_CLIP: + case ADSI_STANDARD_ACLIP: + case ADSI_STANDARD_JCLIP: + fsk_tx_init(&(s->fsktx), &preset_fsk_specs[FSK_V23CH1], adsi_tx_get_bit, s); + break; + case ADSI_STANDARD_CLIP_DTMF: + dtmf_tx_init(&(s->dtmftx)); + break; + case ADSI_STANDARD_TDD: + fsk_tx_init(&(s->fsktx), &preset_fsk_specs[FSK_WEITBRECHT], async_tx_get_bit, &(s->asynctx)); + async_tx_init(&(s->asynctx), 5, ASYNC_PARITY_NONE, 2, FALSE, adsi_tdd_get_async_byte, s); + /* Schedule an explicit shift at the start of baudot transmission */ + s->baudot_shift = 2; + break; + } + s->tx_signal_on = TRUE; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) adsi_rx(adsi_rx_state_t *s, const int16_t amp[], int len) +{ + switch (s->standard) + { + case ADSI_STANDARD_CLIP_DTMF: + /* Apply a message timeout. */ + s->in_progress -= len; + if (s->in_progress <= 0) + s->msg_len = 0; + dtmf_rx(&(s->dtmfrx), amp, len); + break; + default: + fsk_rx(&(s->fskrx), amp, len); + break; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(adsi_rx_state_t *) adsi_rx_init(adsi_rx_state_t *s, + int standard, + put_msg_func_t put_msg, + void *user_data) +{ + if (s == NULL) + { + if ((s = (adsi_rx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + s->put_msg = put_msg; + s->user_data = user_data; + switch (standard) + { + case ADSI_STANDARD_CLASS: + fsk_rx_init(&(s->fskrx), &preset_fsk_specs[FSK_BELL202], FSK_FRAME_MODE_ASYNC, adsi_rx_put_bit, s); + break; + case ADSI_STANDARD_CLIP: + case ADSI_STANDARD_ACLIP: + case ADSI_STANDARD_JCLIP: + fsk_rx_init(&(s->fskrx), &preset_fsk_specs[FSK_V23CH1], FSK_FRAME_MODE_ASYNC, adsi_rx_put_bit, s); + break; + case ADSI_STANDARD_CLIP_DTMF: + dtmf_rx_init(&(s->dtmfrx), adsi_rx_dtmf, s); + break; + case ADSI_STANDARD_TDD: + /* TDD uses 5 bit data, no parity and 1.5 stop bits. We scan for the first stop bit, and + ride over the fraction. */ + fsk_rx_init(&(s->fskrx), &preset_fsk_specs[FSK_WEITBRECHT], FSK_FRAME_MODE_5N1_FRAMES, adsi_tdd_put_async_byte, s); + break; + } + s->standard = standard; + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) adsi_rx_release(adsi_rx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) adsi_rx_free(adsi_rx_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) adsi_tx(adsi_tx_state_t *s, int16_t amp[], int max_len) +{ + int len; + int lenx; + + len = tone_gen(&(s->alert_tone_gen), amp, max_len); + if (s->tx_signal_on) + { + switch (s->standard) + { + case ADSI_STANDARD_CLIP_DTMF: + if (len < max_len) + len += dtmf_tx(&(s->dtmftx), amp, max_len - len); + break; + default: + if (len < max_len) + { + if ((lenx = fsk_tx(&(s->fsktx), amp + len, max_len - len)) <= 0) + s->tx_signal_on = FALSE; + len += lenx; + } + break; + } + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) adsi_tx_send_alert_tone(adsi_tx_state_t *s) +{ + tone_gen_init(&(s->alert_tone_gen), &(s->alert_tone_desc)); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) adsi_tx_set_preamble(adsi_tx_state_t *s, + int preamble_len, + int preamble_ones_len, + int postamble_ones_len, + int stop_bits) +{ + if (preamble_len < 0) + { + if (s->standard == ADSI_STANDARD_JCLIP) + s->preamble_len = 0; + else + s->preamble_len = 300; + } + else + { + s->preamble_len = preamble_len; + } + if (preamble_ones_len < 0) + { + if (s->standard == ADSI_STANDARD_JCLIP) + s->preamble_ones_len = 75; + else + s->preamble_ones_len = 80; + } + else + { + s->preamble_ones_len = preamble_ones_len; + } + if (postamble_ones_len < 0) + { + if (s->standard == ADSI_STANDARD_JCLIP) + s->postamble_ones_len = 5; + else + s->postamble_ones_len = 5; + } + else + { + s->postamble_ones_len = postamble_ones_len; + } + if (stop_bits < 0) + { + if (s->standard == ADSI_STANDARD_JCLIP) + s->stop_bits = 4; + else + s->stop_bits = 1; + } + else + { + s->stop_bits = stop_bits; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) adsi_tx_put_message(adsi_tx_state_t *s, const uint8_t *msg, int len) +{ + int i; + int j; + int k; + int byte; + int parity; + int sum; + size_t ii; + uint16_t crc_value; + + /* Don't inject a new message when a previous one is still in progress */ + if (s->msg_len > 0) + return 0; + if (!s->tx_signal_on) + { + /* We need to restart the modem */ + start_tx(s); + } + switch (s->standard) + { + case ADSI_STANDARD_CLIP_DTMF: + if (len >= 128) + return -1; + len -= (int) dtmf_tx_put(&(s->dtmftx), (char *) msg, len); + break; + case ADSI_STANDARD_JCLIP: + if (len > 128 - 9) + return -1; + i = 0; + s->msg[i++] = DLE; + s->msg[i++] = SOH; + s->msg[i++] = 0x07; //header + s->msg[i++] = DLE; + s->msg[i++] = STX; + s->msg[i++] = msg[0]; + s->msg[i++] = (uint8_t) (len - 2); + /* We might need to byte stuff the overall length, but the rest of the + message should already be stuffed. */ + if (len - 2 == DLE) + s->msg[i++] = DLE; + memcpy(&s->msg[i], &msg[2], len - 2); + i += len - 2; + s->msg[i++] = DLE; + s->msg[i++] = ETX; + + /* Set the parity bits */ + for (j = 0; j < i; j++) + { + byte = s->msg[j]; + parity = 0; + for (k = 1; k <= 7; k++) + parity ^= (byte << k); + s->msg[j] = (s->msg[j] & 0x7F) | ((uint8_t) parity & 0x80); + } + + crc_value = crc_itu16_calc(s->msg + 2, i - 2, 0); + s->msg[i++] = (uint8_t) (crc_value & 0xFF); + s->msg[i++] = (uint8_t) ((crc_value >> 8) & 0xFF); + s->msg_len = i; + break; + case ADSI_STANDARD_TDD: + if (len > 255) + return -1; + memcpy(s->msg, msg, len); + s->msg_len = len; + break; + default: + if (len > 255) + return -1; + memcpy(s->msg, msg, len); + /* Force the length in case it is wrong */ + s->msg[1] = (uint8_t) (len - 2); + /* Add the sumcheck */ + sum = 0; + for (ii = 0; ii < (size_t) len; ii++) + sum += s->msg[ii]; + s->msg[len] = (uint8_t) ((-sum) & 0xFF); + s->msg_len = len + 1; + break; + } + /* Prepare the bit sequencing */ + s->byte_no = 0; + s->bit_pos = 0; + s->bit_no = 0; + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(adsi_tx_state_t *) adsi_tx_init(adsi_tx_state_t *s, int standard) +{ + if (s == NULL) + { + if ((s = (adsi_tx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + make_tone_gen_descriptor(&(s->alert_tone_desc), + 2130, + -13, + 2750, + -13, + 110, + 60, + 0, + 0, + FALSE); + s->standard = standard; + adsi_tx_set_preamble(s, -1, -1, -1, -1); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + start_tx(s); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) adsi_tx_release(adsi_tx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) adsi_tx_free(adsi_tx_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static uint16_t adsi_encode_baudot(adsi_tx_state_t *s, uint8_t ch) +{ + static const uint8_t conv[128] = + { + 0x00, /* NUL */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0x42, /* LF */ + 0xFF, /* */ + 0xFF, /* */ + 0x48, /* CR */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0xFF, /* */ + 0x44, /* */ + 0xFF, /* ! */ + 0xFF, /* " */ + 0x94, /* # */ + 0x89, /* $ */ + 0xFF, /* % */ + 0xFF, /* & */ + 0x85, /* ' */ + 0x8F, /* ( */ + 0x92, /* ) */ + 0x8B, /* * */ + 0x91, /* + */ + 0x8C, /* , */ + 0x83, /* - */ + 0x9C, /* . */ + 0x9D, /* / */ + 0x96, /* 0 */ + 0x97, /* 1 */ + 0x93, /* 2 */ + 0x81, /* 3 */ + 0x8A, /* 4 */ + 0x90, /* 5 */ + 0x95, /* 6 */ + 0x87, /* 7 */ + 0x86, /* 8 */ + 0x98, /* 9 */ + 0x8E, /* : */ + 0xFF, /* ; */ + 0xFF, /* < */ + 0x9E, /* = */ + 0xFF, /* > */ + 0x99, /* ? */ + 0xFF, /* @ */ + 0x03, /* A */ + 0x19, /* B */ + 0x0E, /* C */ + 0x09, /* D */ + 0x01, /* E */ + 0x0D, /* F */ + 0x1A, /* G */ + 0x14, /* H */ + 0x06, /* I */ + 0x0B, /* J */ + 0x0F, /* K */ + 0x12, /* L */ + 0x1C, /* M */ + 0x0C, /* N */ + 0x18, /* O */ + 0x16, /* P */ + 0x17, /* Q */ + 0x0A, /* R */ + 0x05, /* S */ + 0x10, /* T */ + 0x07, /* U */ + 0x1E, /* V */ + 0x13, /* W */ + 0x1D, /* X */ + 0x15, /* Y */ + 0x11, /* Z */ + 0xFF, /* [ */ + 0xFF, /* \ */ + 0xFF, /* ] */ + 0x9B, /* ^ */ + 0xFF, /* _ */ + 0xFF, /* ` */ + 0x03, /* a */ + 0x19, /* b */ + 0x0E, /* c */ + 0x09, /* d */ + 0x01, /* e */ + 0x0D, /* f */ + 0x1A, /* g */ + 0x14, /* h */ + 0x06, /* i */ + 0x0B, /* j */ + 0x0F, /* k */ + 0x12, /* l */ + 0x1C, /* m */ + 0x0C, /* n */ + 0x18, /* o */ + 0x16, /* p */ + 0x17, /* q */ + 0x0A, /* r */ + 0x05, /* s */ + 0x10, /* t */ + 0x07, /* u */ + 0x1E, /* v */ + 0x13, /* w */ + 0x1D, /* x */ + 0x15, /* y */ + 0x11, /* z */ + 0xFF, /* { */ + 0xFF, /* | */ + 0xFF, /* } */ + 0xFF, /* ~ */ + 0xFF, /* DEL */ + }; + uint16_t shift; + + ch = conv[ch]; + if (ch == 0xFF) + return 0; + if ((ch & 0x40)) + return ch & 0x1F; + if ((ch & 0x80)) + { + if (s->baudot_shift == 1) + return ch & 0x1F; + s->baudot_shift = 1; + shift = BAUDOT_FIGURE_SHIFT; + } + else + { + if (s->baudot_shift == 0) + return ch & 0x1F; + s->baudot_shift = 0; + shift = BAUDOT_LETTER_SHIFT; + } + return (shift << 5) | (ch & 0x1F); +} +/*- End of function --------------------------------------------------------*/ + +static uint8_t adsi_decode_baudot(adsi_rx_state_t *s, uint8_t ch) +{ + static const uint8_t conv[2][32] = + { + {"\000E\nA SIU\rDRJNFCKTZLWHYPQOBG^MXV^"}, + {"\0003\n- '87\r$4*,*:(5+)2#6019?*^./=^"} + }; + + switch (ch) + { + case BAUDOT_FIGURE_SHIFT: + s->baudot_shift = 1; + break; + case BAUDOT_LETTER_SHIFT: + s->baudot_shift = 0; + break; + default: + return conv[s->baudot_shift][ch]; + } + /* return 0 if we did not produce a character */ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) adsi_next_field(adsi_rx_state_t *s, const uint8_t *msg, int msg_len, int pos, uint8_t *field_type, uint8_t const **field_body, int *field_len) +{ + int i; + + /* Return -1 for no more fields. Return -2 for message structure corrupt. */ + switch (s->standard) + { + case ADSI_STANDARD_CLASS: + case ADSI_STANDARD_CLIP: + case ADSI_STANDARD_ACLIP: + if (pos >= msg_len) + return -1; + /* For MDMF type messages, these standards all use "IE" type fields - type, + length, contents - and similar headers */ + if (pos <= 0) + { + /* Return the message type */ + *field_type = msg[0]; + *field_len = 0; + *field_body = NULL; + pos = 2; + } + else + { + if ((msg[0] & 0x80)) + { + /* MDMF messages seem to always have a message type with the MSB set. Is that + guaranteed? */ + *field_type = msg[pos++]; + *field_len = msg[pos++]; + *field_body = msg + pos; + } + else + { + /* SDMF */ + *field_type = 0; + *field_len = msg_len - pos; + *field_body = msg + pos; + } + pos += *field_len; + } + if (pos > msg_len) + return -2; + break; + case ADSI_STANDARD_JCLIP: + if (pos >= msg_len - 2) + return -1; + if (pos <= 0) + { + /* Return the message type */ + pos = 5; + *field_type = msg[pos++]; + if (*field_type == DLE) + pos++; + if (msg[pos++] == DLE) + pos++; + *field_len = 0; + *field_body = NULL; + } + else + { + *field_type = msg[pos++]; + if (*field_type == DLE) + pos++; + *field_len = msg[pos++]; + if (*field_len == DLE) + pos++; + /* TODO: we assume here that the body contains no DLE's that would have been stuffed */ + *field_body = msg + pos; + pos += *field_len; + } + if (pos > msg_len - 2) + return -2; + break; + case ADSI_STANDARD_CLIP_DTMF: + if (pos > msg_len) + return -1; + if (pos <= 0) + { + pos = 1; + *field_type = msg[msg_len - 1]; + *field_len = 0; + *field_body = NULL; + } + else + { + /* Remove bias on the pos value */ + pos--; + if (msg[pos] >= '0' && msg[pos] <= '9') + *field_type = CLIP_DTMF_HASH_UNSPECIFIED; + else + *field_type = msg[pos++]; + *field_body = msg + pos; + i = pos; + while (i < msg_len && msg[i] >= '0' && msg[i] <= '9') + i++; + *field_len = i - pos; + pos = i; + /* Check if we have reached the end of message marker. */ + if (msg[pos] == '#' || msg[pos] == 'C') + pos++; + if (pos > msg_len) + return -2; + /* Bias the pos value, so we don't return 0 inappropriately */ + pos++; + } + break; + case ADSI_STANDARD_TDD: + if (pos >= msg_len) + return -1; + *field_type = 0; + *field_body = msg; + *field_len = msg_len; + pos = msg_len; + break; + } + return pos; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) adsi_add_field(adsi_tx_state_t *s, uint8_t *msg, int len, uint8_t field_type, uint8_t const *field_body, int field_len) +{ + int i; + int x; + + switch (s->standard) + { + case ADSI_STANDARD_CLASS: + case ADSI_STANDARD_CLIP: + case ADSI_STANDARD_ACLIP: + /* These standards all use "IE" type fields - type, length, value - and similar headers */ + if (len <= 0) + { + /* Initialise a new message. The field type is actually the message type. */ + msg[0] = field_type; + msg[1] = 0; + len = 2; + } + else + { + /* Add to a message in progress. */ + if (field_type) + { + msg[len++] = field_type; + msg[len++] = (uint8_t) field_len; + if (field_len == DLE) + msg[len++] = (uint8_t) field_len; + memcpy(msg + len, field_body, field_len); + len += field_len; + } + else + { + /* No field type or length, for restricted single message formats */ + memcpy(msg + len, field_body, field_len); + len += field_len; + } + } + break; + case ADSI_STANDARD_JCLIP: + /* This standard uses "IE" type fields - type, length, value - but escapes DLE characters, + to prevent immitation of a control octet. */ + if (len <= 0) + { + /* Initialise a new message. The field type is actually the message type. */ + msg[0] = field_type; + msg[1] = 0; + len = 2; + } + else + { + /* Add to a message in progress. */ + msg[len++] = field_type; + if (field_type == DLE) + msg[len++] = field_type; + msg[len++] = (uint8_t) field_len; + if (field_len == DLE) + msg[len++] = (uint8_t) field_len; + for (i = 0; i < field_len; i++) + { + msg[len++] = field_body[i]; + if (field_body[i] == DLE) + msg[len++] = field_body[i]; + } + } + break; + case ADSI_STANDARD_CLIP_DTMF: + if (len <= 0) + { + /* Initialise a new message. The field type is actually the message type. */ + msg[0] = field_type; + len = 1; + } + else + { + /* Save and reuse the terminator/message type */ + x = msg[--len]; + if (field_type != CLIP_DTMF_HASH_UNSPECIFIED) + msg[len++] = field_type; + memcpy(msg + len, field_body, field_len); + msg[len + field_len] = (uint8_t) x; + len += (field_len + 1); + } + break; + case ADSI_STANDARD_TDD: + if (len < 0) + len = 0; + for (i = 0; i < field_len; i++) + { + if ((x = adsi_encode_baudot(s, field_body[i]))) + { + if ((x & 0x3E0)) + msg[len++] = (uint8_t) ((x >> 5) & 0x1F); + msg[len++] = (uint8_t) (x & 0x1F); + } + } + break; + } + + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) adsi_standard_to_str(int standard) +{ + switch (standard) + { + case ADSI_STANDARD_CLASS: + return "CLASS"; + case ADSI_STANDARD_CLIP: + return "CLIP"; + case ADSI_STANDARD_ACLIP: + return "A-CLIP"; + case ADSI_STANDARD_JCLIP: + return "J-CLIP"; + case ADSI_STANDARD_CLIP_DTMF: + return "CLIP-DTMF"; + case ADSI_STANDARD_TDD: + return "TDD"; + } + return "???"; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/async.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/async.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,294 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * async.c - Asynchronous serial bit stream encoding and decoding + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: async.c,v 1.19 2009/04/23 14:12:34 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/async.h" + +#include "spandsp/private/async.h" + +SPAN_DECLARE(const char *) signal_status_to_str(int status) +{ + switch (status) + { + case SIG_STATUS_CARRIER_DOWN: + return "Carrier down"; + case SIG_STATUS_CARRIER_UP: + return "Carrier up"; + case SIG_STATUS_TRAINING_IN_PROGRESS: + return "Training in progress"; + case SIG_STATUS_TRAINING_SUCCEEDED: + return "Training succeeded"; + case SIG_STATUS_TRAINING_FAILED: + return "Training failed"; + case SIG_STATUS_FRAMING_OK: + return "Framing OK"; + case SIG_STATUS_END_OF_DATA: + return "End of data"; + case SIG_STATUS_ABORT: + return "Abort"; + case SIG_STATUS_BREAK: + return "Break"; + case SIG_STATUS_SHUTDOWN_COMPLETE: + return "Shutdown complete"; + case SIG_STATUS_OCTET_REPORT: + return "Octet report"; + case SIG_STATUS_POOR_SIGNAL_QUALITY: + return "Poor signal quality"; + case SIG_STATUS_MODEM_RETRAIN_OCCURRED: + return "Modem retrain occurred"; + } + return "???"; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(async_rx_state_t *) async_rx_init(async_rx_state_t *s, + int data_bits, + int parity, + int stop_bits, + int use_v14, + put_byte_func_t put_byte, + void *user_data) +{ + if (s == NULL) + { + if ((s = (async_rx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + s->data_bits = data_bits; + s->parity = parity; + s->stop_bits = stop_bits; + s->use_v14 = use_v14; + + s->put_byte = put_byte; + s->user_data = user_data; + + s->byte_in_progress = 0; + s->bitpos = 0; + s->parity_bit = 0; + + s->parity_errors = 0; + s->framing_errors = 0; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) async_rx_release(async_rx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) async_rx_free(async_rx_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(void) async_rx_put_bit(void *user_data, int bit) +{ + async_rx_state_t *s; + + s = (async_rx_state_t *) user_data; + if (bit < 0) + { + /* Special conditions */ + switch (bit) + { + case SIG_STATUS_CARRIER_UP: + case SIG_STATUS_CARRIER_DOWN: + case SIG_STATUS_TRAINING_IN_PROGRESS: + case SIG_STATUS_TRAINING_SUCCEEDED: + case SIG_STATUS_TRAINING_FAILED: + case SIG_STATUS_END_OF_DATA: + s->put_byte(s->user_data, bit); + s->bitpos = 0; + s->byte_in_progress = 0; + break; + default: + //printf("Eh!\n"); + break; + } + return; + } + if (s->bitpos == 0) + { + /* Search for the start bit */ + s->bitpos += (bit ^ 1); + s->parity_bit = 0; + s->byte_in_progress = 0; + } + else if (s->bitpos <= s->data_bits) + { + s->byte_in_progress = (s->byte_in_progress >> 1) | (bit << 7); + s->parity_bit ^= bit; + s->bitpos++; + } + else if (s->parity && s->bitpos == s->data_bits + 1) + { + if (s->parity == ASYNC_PARITY_ODD) + s->parity_bit ^= 1; + + if (s->parity_bit != bit) + s->parity_errors++; + s->bitpos++; + } + else + { + /* Stop bit */ + if (bit == 1) + { + /* Align the received value */ + if (s->data_bits < 8) + s->byte_in_progress >>= (8 - s->data_bits); + s->put_byte(s->user_data, s->byte_in_progress); + s->bitpos = 0; + } + else if (s->use_v14) + { + /* This is actually the start bit for the next character, and + the stop bit has been dropped from the stream. This is the + rate adaption specified in V.14 */ + /* Align the received value */ + if (s->data_bits < 8) + s->byte_in_progress >>= (8 - s->data_bits); + s->put_byte(s->user_data, s->byte_in_progress); + s->bitpos = 1; + s->parity_bit = 0; + s->byte_in_progress = 0; + } + else + { + s->framing_errors++; + s->bitpos = 0; + } + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(async_tx_state_t *) async_tx_init(async_tx_state_t *s, + int data_bits, + int parity, + int stop_bits, + int use_v14, + get_byte_func_t get_byte, + void *user_data) +{ + if (s == NULL) + { + if ((s = (async_tx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + /* We have a use_v14 parameter for completeness, but right now V.14 only + applies to the receive side. We are unlikely to have an application where + flow control does not exist, so V.14 stuffing is not needed. */ + s->data_bits = data_bits; + s->parity = parity; + s->stop_bits = stop_bits; + if (parity != ASYNC_PARITY_NONE) + s->stop_bits++; + + s->get_byte = get_byte; + s->user_data = user_data; + + s->byte_in_progress = 0; + s->bitpos = 0; + s->parity_bit = 0; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) async_tx_release(async_tx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) async_tx_free(async_tx_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) async_tx_get_bit(void *user_data) +{ + async_tx_state_t *s; + int bit; + + s = (async_tx_state_t *) user_data; + if (s->bitpos == 0) + { + if ((s->byte_in_progress = s->get_byte(s->user_data)) < 0) + { + /* No more data */ + bit = SIG_STATUS_END_OF_DATA; + } + else + { + /* Start bit */ + bit = 0; + s->parity_bit = 0; + s->bitpos++; + } + } + else if (s->bitpos <= s->data_bits) + { + bit = s->byte_in_progress & 1; + s->byte_in_progress >>= 1; + s->parity_bit ^= bit; + s->bitpos++; + } + else if (s->parity && s->bitpos == s->data_bits + 1) + { + if (s->parity == ASYNC_PARITY_ODD) + s->parity_bit ^= 1; + bit = s->parity_bit; + s->bitpos++; + } + else + { + /* Stop bit(s) */ + bit = 1; + if (++s->bitpos > s->data_bits + s->stop_bits) + s->bitpos = 0; + } + return bit; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/at_interpreter.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/at_interpreter.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,5534 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * at_interpreter.c - AT command interpreter to V.251, V.252, V.253, T.31 and the 3GPP specs. + * + * Written by Steve Underwood + * + * Special thanks to Lee Howard + * for his great work debugging and polishing this code. + * + * Copyright (C) 2004, 2005, 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: at_interpreter.c,v 1.42.4.1 2009/12/23 14:18:32 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#if defined(__sun) +#define __EXTENSIONS__ +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/queue.h" +#include "spandsp/power_meter.h" +#include "spandsp/complex.h" +#include "spandsp/tone_generate.h" +#include "spandsp/async.h" +#include "spandsp/hdlc.h" +#include "spandsp/fsk.h" +#include "spandsp/super_tone_rx.h" +#include "spandsp/fax_modems.h" + +#include "spandsp/at_interpreter.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/at_interpreter.h" + +#define MANUFACTURER "www.soft-switch.org" +#define SERIAL_NUMBER "42" +#define GLOBAL_OBJECT_IDENTITY "42" + +enum +{ + ASCII_RESULT_CODES = 1, + NUMERIC_RESULT_CODES, + NO_RESULT_CODES +}; + +static at_profile_t profiles[3] = +{ + { +#if defined(_MSC_VER) || defined(__sunos) || defined(__solaris) || defined(__sun) + /*.echo =*/ TRUE, + /*.verbose =*/ TRUE, + /*.result_code_format =*/ ASCII_RESULT_CODES, + /*.pulse_dial =*/ FALSE, + /*.double_escape =*/ FALSE, + /*.adaptive_receive =*/ FALSE, + /*.s_regs[100] =*/ {0, 0, 0, '\r', '\n', '\b', 1, 60, 5, 0, 0} +#else + .echo = TRUE, + .verbose = TRUE, + .result_code_format = ASCII_RESULT_CODES, + .pulse_dial = FALSE, + .double_escape = FALSE, + .adaptive_receive = FALSE, + .s_regs[0] = 0, + .s_regs[3] = '\r', + .s_regs[4] = '\n', + .s_regs[5] = '\b', + .s_regs[6] = 1, + .s_regs[7] = 60, + .s_regs[8] = 5, + .s_regs[10] = 0 +#endif + } +}; + +typedef const char *(*at_cmd_service_t)(at_state_t *s, const char *cmd); + +static const char *manufacturer = MANUFACTURER; +static const char *model = PACKAGE; +static const char *revision = VERSION; + +#define ETX 0x03 +#define DLE 0x10 +#define SUB 0x1A + +static const char *at_response_codes[] = +{ + "OK", + "CONNECT", + "RING", + "NO CARRIER", + "ERROR", + "???", + "NO DIALTONE", + "BUSY", + "NO ANSWER", + "+FCERROR", + "+FRH:3" +}; + +SPAN_DECLARE(void) at_set_at_rx_mode(at_state_t *s, int new_mode) +{ + /* The use of a DTE timeout is mode dependent. Set the timeout appropriately in + the modem. */ + switch (new_mode) + { + case AT_MODE_HDLC: + case AT_MODE_STUFFED: + at_modem_control(s, s->dte_inactivity_timeout*1000, (void *) (intptr_t) s->dte_inactivity_timeout); + break; + default: + at_modem_control(s, AT_MODEM_CONTROL_DTE_TIMEOUT, NULL); + break; + } + s->at_rx_mode = new_mode; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) at_put_response(at_state_t *s, const char *t) +{ + uint8_t buf[3]; + + buf[0] = s->p.s_regs[3]; + buf[1] = s->p.s_regs[4]; + buf[2] = '\0'; + if (s->p.result_code_format == ASCII_RESULT_CODES) + s->at_tx_handler(s, s->at_tx_user_data, buf, 2); + s->at_tx_handler(s, s->at_tx_user_data, (uint8_t *) t, strlen(t)); + s->at_tx_handler(s, s->at_tx_user_data, buf, 2); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) at_put_numeric_response(at_state_t *s, int val) +{ + char buf[20]; + + snprintf(buf, sizeof(buf), "%d", val); + at_put_response(s, buf); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) at_put_response_code(at_state_t *s, int code) +{ + uint8_t buf[20]; + + span_log(&s->logging, SPAN_LOG_FLOW, "Sending AT response code %s\n", at_response_codes[code]); + switch (s->p.result_code_format) + { + case ASCII_RESULT_CODES: + at_put_response(s, at_response_codes[code]); + break; + case NUMERIC_RESULT_CODES: + snprintf((char *) buf, sizeof(buf), "%d%c", code, s->p.s_regs[3]); + s->at_tx_handler(s, s->at_tx_user_data, buf, strlen((char *) buf)); + break; + default: + /* No result codes */ + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static int answer_call(at_state_t *s) +{ + if (at_modem_control(s, AT_MODEM_CONTROL_ANSWER, NULL) < 0) + return FALSE; + /* Answering should now be in progress. No AT response should be + issued at this point. */ + s->do_hangup = FALSE; + return TRUE; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) at_call_event(at_state_t *s, int event) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "Call event %d received\n", event); + switch (event) + { + case AT_CALL_EVENT_ALERTING: + at_modem_control(s, AT_MODEM_CONTROL_RNG, (void *) 1); + if (s->display_call_info && !s->call_info_displayed) + at_display_call_info(s); + at_put_response_code(s, AT_RESPONSE_CODE_RING); + if ((++s->rings_indicated) >= s->p.s_regs[0] && s->p.s_regs[0]) + { + /* The modem is set to auto-answer now */ + answer_call(s); + } + break; + case AT_CALL_EVENT_ANSWERED: + at_modem_control(s, AT_MODEM_CONTROL_RNG, (void *) 0); + if (s->fclass_mode == 0) + { + /* Normal data modem connection */ + at_set_at_rx_mode(s, AT_MODE_CONNECTED); + /* TODO: */ + } + else + { + /* FAX modem connection */ + at_set_at_rx_mode(s, AT_MODE_DELIVERY); + at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_CED_TONE); + } + break; + case AT_CALL_EVENT_CONNECTED: + span_log(&s->logging, SPAN_LOG_FLOW, "Dial call - connected. FCLASS=%d\n", s->fclass_mode); + at_modem_control(s, AT_MODEM_CONTROL_RNG, (void *) 0); + if (s->fclass_mode == 0) + { + /* Normal data modem connection */ + at_set_at_rx_mode(s, AT_MODE_CONNECTED); + /* TODO: */ + } + else + { + /* FAX modem connection */ + at_set_at_rx_mode(s, AT_MODE_DELIVERY); + if (s->silent_dial) + at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_NOCNG_TONE); + else + at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_CNG_TONE); + s->dte_is_waiting = TRUE; + } + break; + case AT_CALL_EVENT_BUSY: + at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND); + at_put_response_code(s, AT_RESPONSE_CODE_BUSY); + break; + case AT_CALL_EVENT_NO_DIALTONE: + at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND); + at_put_response_code(s, AT_RESPONSE_CODE_NO_DIALTONE); + break; + case AT_CALL_EVENT_NO_ANSWER: + at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND); + at_put_response_code(s, AT_RESPONSE_CODE_NO_ANSWER); + break; + case AT_CALL_EVENT_HANGUP: + span_log(&s->logging, SPAN_LOG_FLOW, "Hangup... at_rx_mode %d\n", s->at_rx_mode); + at_modem_control(s, AT_MODEM_CONTROL_ONHOOK, NULL); + if (s->dte_is_waiting) + { + if (s->ok_is_pending) + { + at_put_response_code(s, AT_RESPONSE_CODE_OK); + s->ok_is_pending = FALSE; + } + else + { + at_put_response_code(s, AT_RESPONSE_CODE_NO_CARRIER); + } + s->dte_is_waiting = FALSE; + at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND); + } + else if (s->fclass_mode && s->rx_signal_present) + { + s->rx_data[s->rx_data_bytes++] = DLE; + s->rx_data[s->rx_data_bytes++] = ETX; + s->at_tx_handler(s, s->at_tx_user_data, s->rx_data, s->rx_data_bytes); + s->rx_data_bytes = 0; + } + if (s->at_rx_mode != AT_MODE_OFFHOOK_COMMAND && s->at_rx_mode != AT_MODE_ONHOOK_COMMAND) + at_put_response_code(s, AT_RESPONSE_CODE_NO_CARRIER); + s->rx_signal_present = FALSE; + at_modem_control(s, AT_MODEM_CONTROL_RNG, (void *) 0); + at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND); + break; + default: + span_log(&s->logging, SPAN_LOG_WARNING, "Invalid call event %d received.\n", event); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) at_reset_call_info(at_state_t *s) +{ + at_call_id_t *call_id; + at_call_id_t *next; + + for (call_id = s->call_id; call_id; call_id = next) + { + next = call_id->next; + free(call_id); + } + s->call_id = NULL; + s->rings_indicated = 0; + s->call_info_displayed = FALSE; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) at_set_call_info(at_state_t *s, char const *id, char const *value) +{ + at_call_id_t *new_call_id; + at_call_id_t *call_id; + + /* TODO: We should really not merely ignore a failure to malloc */ + if ((new_call_id = (at_call_id_t *) malloc(sizeof(*new_call_id))) == NULL) + return; + call_id = s->call_id; + /* If these strdups fail its pretty harmless. We just appear to not + have the relevant field. */ + new_call_id->id = (id) ? strdup(id) : NULL; + new_call_id->value = (value) ? strdup(value) : NULL; + new_call_id->next = NULL; + + if (call_id) + { + while (call_id->next) + call_id = call_id->next; + call_id->next = new_call_id; + } + else + { + s->call_id = new_call_id; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) at_display_call_info(at_state_t *s) +{ + char buf[132 + 1]; + at_call_id_t *call_id = s->call_id; + + while (call_id) + { + snprintf(buf, sizeof(buf), "%s=%s", + call_id->id ? call_id->id : "NULL", call_id->value ? call_id->value : ""); + at_put_response(s, buf); + call_id = call_id->next; + } + s->call_info_displayed = TRUE; +} +/*- End of function --------------------------------------------------------*/ + +static int parse_num(const char **s, int max_value) +{ + int i; + + /* The spec. says no digits is valid, and should be treated as zero. */ + i = 0; + while (isdigit(**s)) + { + i = i*10 + ((**s) - '0'); + (*s)++; + } + if (i > max_value) + i = -1; + return i; +} +/*- End of function --------------------------------------------------------*/ + +static int parse_hex_num(const char **s, int max_value) +{ + int i; + + /* The spec. says a hex value is always 2 digits, and the alpha digits are + upper case. */ + i = 0; + if (isdigit(**s)) + i = **s - '0'; + else if (**s >= 'A' && **s <= 'F') + i = **s - 'A'; + else + return -1; + (*s)++; + + if (isdigit(**s)) + i = (i << 4) | (**s - '0'); + else if (**s >= 'A' && **s <= 'F') + i = (i << 4) | (**s - 'A'); + else + return -1; + (*s)++; + if (i > max_value) + i = -1; + return i; +} +/*- End of function --------------------------------------------------------*/ + +static int match_element(const char **variant, const char *variants) +{ + int i; + size_t len; + char const *s; + char const *t; + + s = variants; + for (i = 0; *s; i++) + { + if ((t = strchr(s, ','))) + len = t - s; + else + len = strlen(s); + if (len == (int) strlen(*variant) && memcmp(*variant, s, len) == 0) + { + *variant += len; + return i; + } + s += len; + if (*s == ',') + s++; + } + return -1; +} +/*- End of function --------------------------------------------------------*/ + +static int parse_out(at_state_t *s, const char **t, int *target, int max_value, const char *prefix, const char *def) +{ + char buf[100]; + int val; + + switch (*(*t)++) + { + case '=': + switch (**t) + { + case '?': + /* Show possible values */ + (*t)++; + snprintf(buf, sizeof(buf), "%s%s", (prefix) ? prefix : "", def); + at_put_response(s, buf); + break; + default: + /* Set value */ + if ((val = parse_num(t, max_value)) < 0) + return FALSE; + if (target) + *target = val; + break; + } + break; + case '?': + /* Show current value */ + val = (target) ? *target : 0; + snprintf(buf, sizeof(buf), "%s%d", (prefix) ? prefix : "", val); + at_put_response(s, buf); + break; + default: + return FALSE; + } + return TRUE; +} +/*- End of function --------------------------------------------------------*/ + +static int parse_2_out(at_state_t *s, const char **t, int *target1, int max_value1, int *target2, int max_value2, const char *prefix, const char *def) +{ + char buf[100]; + int val1; + int val2; + + switch (*(*t)++) + { + case '=': + switch (**t) + { + case '?': + /* Show possible values */ + (*t)++; + snprintf(buf, sizeof(buf), "%s%s", (prefix) ? prefix : "", def); + at_put_response(s, buf); + break; + default: + /* Set value */ + if ((val1 = parse_num(t, max_value1)) < 0) + return FALSE; + if (target1) + *target1 = val1; + if (**t == ',') + { + (*t)++; + if ((val2 = parse_num(t, max_value2)) < 0) + return FALSE; + if (target2) + *target2 = val2; + } + break; + } + break; + case '?': + /* Show current value */ + val1 = (target1) ? *target1 : 0; + val2 = (target2) ? *target2 : 0; + snprintf(buf, sizeof(buf), "%s%d,%d", (prefix) ? prefix : "", val1, val2); + at_put_response(s, buf); + break; + default: + return FALSE; + } + return TRUE; +} +/*- End of function --------------------------------------------------------*/ + +static int parse_n_out(at_state_t *s, + const char **t, + int *targets[], + const int max_values[], + int entries, + const char *prefix, + const char *def) +{ + char buf[100]; + int val; + int len; + int i; + + switch (*(*t)++) + { + case '=': + switch (**t) + { + case '?': + /* Show possible values */ + (*t)++; + snprintf(buf, sizeof(buf), "%s%s", (prefix) ? prefix : "", def); + at_put_response(s, buf); + break; + default: + /* Set value */ + for (i = 0; i < entries; i++) + { + if ((val = parse_num(t, max_values[i])) < 0) + return FALSE; + if (targets[i]) + *targets[i] = val; + if (**t != ',') + break; + (*t)++; + } + break; + } + break; + case '?': + /* Show current value */ + len = snprintf(buf, sizeof(buf), "%s", (prefix) ? prefix : ""); + for (i = 0; i < entries; i++) + { + if (i > 0) + len += snprintf(&buf[len], sizeof(buf) - len, ","); + val = (targets[i]) ? *targets[i] : 0; + len += snprintf(&buf[len], sizeof(buf) - len, "%d", val); + } + at_put_response(s, buf); + break; + default: + return FALSE; + } + return TRUE; +} +/*- End of function --------------------------------------------------------*/ + +static int parse_hex_out(at_state_t *s, const char **t, int *target, int max_value, const char *prefix, const char *def) +{ + char buf[100]; + int val; + + switch (*(*t)++) + { + case '=': + switch (**t) + { + case '?': + /* Show possible values */ + (*t)++; + snprintf(buf, sizeof(buf), "%s%s", (prefix) ? prefix : "", def); + at_put_response(s, buf); + break; + default: + /* Set value */ + if ((val = parse_hex_num(t, max_value)) < 0) + return FALSE; + if (target) + *target = val; + break; + } + break; + case '?': + /* Show current value */ + val = (target) ? *target : 0; + snprintf(buf, sizeof(buf), "%s%02X", (prefix) ? prefix : "", val); + at_put_response(s, buf); + break; + default: + return FALSE; + } + return TRUE; +} +/*- End of function --------------------------------------------------------*/ + +static int parse_string_list_out(at_state_t *s, const char **t, int *target, int max_value, const char *prefix, const char *def) +{ + char buf[100]; + int val; + size_t len; + char *tmp; + + switch (*(*t)++) + { + case '=': + switch (**t) + { + case '?': + /* Show possible values */ + (*t)++; + snprintf(buf, sizeof(buf), "%s%s", (prefix) ? prefix : "", def); + at_put_response(s, buf); + break; + default: + /* Set value */ + if ((val = match_element(t, def)) < 0) + return FALSE; + if (target) + *target = val; + break; + } + break; + case '?': + /* Show current index value from def */ + val = (target) ? *target : 0; + while (val-- && (def = strchr(def, ','))) + def++; + if ((tmp = strchr(def, ','))) + len = tmp - def; + else + len = strlen(def); + snprintf(buf, sizeof(buf), "%s%.*s", (prefix) ? prefix : "", (int) len, def); + at_put_response(s, buf); + break; + default: + return FALSE; + } + return TRUE; +} +/*- End of function --------------------------------------------------------*/ + +static int parse_string_out(at_state_t *s, const char **t, char **target, const char *prefix) +{ + char buf[100]; + + switch (*(*t)++) + { + case '=': + switch (**t) + { + case '?': + /* Show possible values */ + (*t)++; + snprintf(buf, sizeof(buf), "%s", (prefix) ? prefix : ""); + at_put_response(s, buf); + break; + default: + /* Set value */ + if (*target) + free(*target); + /* If this strdup fails, it should be harmless */ + *target = strdup(*t); + break; + } + break; + case '?': + /* Show current index value */ + at_put_response(s, (*target) ? *target : ""); + break; + default: + return FALSE; + } + while (*t) + t++; + return TRUE; +} +/*- End of function --------------------------------------------------------*/ + +static const char *s_reg_handler(at_state_t *s, const char *t, int reg) +{ + int val; + int b; + char buf[4]; + + /* Set or get an S register */ + switch (*t++) + { + case '=': + switch (*t) + { + case '?': + t++; + snprintf(buf, sizeof(buf), "%3.3d", 0); + at_put_response(s, buf); + break; + default: + if ((val = parse_num(&t, 255)) < 0) + return NULL; + s->p.s_regs[reg] = (uint8_t) val; + break; + } + break; + case '?': + snprintf(buf, sizeof(buf), "%3.3d", s->p.s_regs[reg]); + at_put_response(s, buf); + break; + case '.': + if ((b = parse_num(&t, 7)) < 0) + return NULL; + switch (*t++) + { + case '=': + switch (*t) + { + case '?': + t++; + at_put_numeric_response(s, 0); + break; + default: + if ((val = parse_num(&t, 1)) < 0) + return NULL; + if (val) + s->p.s_regs[reg] |= (1 << b); + else + s->p.s_regs[reg] &= ~(1 << b); + break; + } + break; + case '?': + at_put_numeric_response(s, (int) ((s->p.s_regs[reg] >> b) & 1)); + break; + default: + return NULL; + } + break; + default: + return NULL; + } + return t; +} +/*- End of function --------------------------------------------------------*/ + +static int process_class1_cmd(at_state_t *s, const char **t) +{ + int val; + int operation; + int direction; + int result; + const char *allowed; + + direction = (*(*t + 2) == 'T'); + operation = *(*t + 3); + /* Step past the "+Fxx" */ + *t += 4; + switch (operation) + { + case 'S': + allowed = "0-255"; + break; + case 'H': + allowed = "3"; + break; + default: + allowed = "24,48,72,73,74,96,97,98,121,122,145,146"; + break; + } + + val = -1; + if (!parse_out(s, t, &val, 255, NULL, allowed)) + return TRUE; + if (val < 0) + { + /* It was just a query */ + return TRUE; + } + /* All class 1 FAX commands are supposed to give an ERROR response, if the phone + is on-hook. */ + if (s->at_rx_mode == AT_MODE_ONHOOK_COMMAND) + return FALSE; + + result = TRUE; + if (s->class1_handler) + result = s->class1_handler(s, s->class1_user_data, direction, operation, val); + switch (result) + { + case 0: + /* Inhibit an immediate response. (These commands should not be part of a multi-command entry.) */ + *t = (const char *) -1; + return TRUE; + case -1: + return FALSE; + } + return TRUE; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_dummy(at_state_t *s, const char *t) +{ + /* Dummy routine to absorb delimiting characters from a command string */ + return t + 1; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_A(at_state_t *s, const char *t) +{ + /* V.250 6.3.5 - Answer (abortable) */ + t += 1; + if (!answer_call(s)) + return NULL; + return (const char *) -1; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_D(at_state_t *s, const char *t) +{ + int ok; + char *u; + const char *w; + char num[100 + 1]; + char ch; + + /* V.250 6.3.1 - Dial (abortable) */ + at_reset_call_info(s); + s->do_hangup = FALSE; + s->silent_dial = FALSE; + t += 1; + ok = FALSE; + /* There are a numbers of options in a dial command string. + Many are completely irrelevant in this application. */ + w = t; + u = num; + for ( ; (ch = *t); t++) + { + if (isdigit(ch)) + { + /* V.250 6.3.1.1 Basic digit set */ + *u++ = ch; + } + else + { + switch (ch) + { + case 'A': + case 'B': + case 'C': + case 'D': + case '*': + case '#': + /* V.250 6.3.1.1 Full DTMF repertoire */ + if (!s->p.pulse_dial) + *u++ = ch; + break; + case ' ': + case '-': + /* Ignore spaces and dashes */ + /* This is not a standards based thing. It just improves + compatibility with some other modems. */ + break; + case '+': + /* V.250 6.3.1.1 International access code */ + /* TODO: */ + break; + case ',': + /* V.250 6.3.1.2 Pause */ + /* Pass these through to the application to handle. */ + *u++ = ch; + break; + case 'T': + /* V.250 6.3.1.3 Tone dial */ + s->p.pulse_dial = FALSE; + break; + case 'P': + /* V.250 6.3.1.4 Pulse dial */ + s->p.pulse_dial = TRUE; + break; + case '!': + /* V.250 6.3.1.5 Hook flash, register recall */ + /* TODO: */ + break; + case 'W': + /* V.250 6.3.1.6 Wait for dial tone */ + /* TODO: */ + break; + case '@': + /* V.250 6.3.1.7 Wait for quiet answer */ + s->silent_dial = TRUE; + break; + case 'S': + /* V.250 6.3.1.8 Invoke stored string */ + /* S= */ + /* TODO: */ + break; + case 'G': + case 'g': + /* GSM07.07 6.2 - Control the CUG supplementary service for this call */ + /* TODO: */ + break; + case 'I': + case 'i': + /* GSM07.07 6.2 - Override Calling Line Identification Restriction (CLIR) */ + /* TODO: */ + break; + case ';': + /* V.250 6.3.1 - Dial string terminator - make voice call and remain in command mode */ + /* TODO: */ + break; + case '>': + /* GSM07.07 6.2 - Direct dialling from phone book supplementary service subscription + default value for this call */ + /* TODO: */ + break; + default: + return NULL; + } + } + } + *u = '\0'; + if ((ok = at_modem_control(s, AT_MODEM_CONTROL_CALL, num)) < 0) + return NULL; + /* Dialing should now be in progress. No AT response should be + issued at this point. */ + return (const char *) -1; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_E(at_state_t *s, const char *t) +{ + int val; + + /* V.250 6.2.4 - Command echo */ + t += 1; + if ((val = parse_num(&t, 1)) < 0) + return NULL; + s->p.echo = val; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_H(at_state_t *s, const char *t) +{ + int val; + + /* V.250 6.3.6 - Hook control */ + t += 1; + if ((val = parse_num(&t, 1)) < 0) + return NULL; + if (val) + { + /* Take the receiver off-hook, effectively busying-out the modem. */ + if (s->at_rx_mode != AT_MODE_ONHOOK_COMMAND && s->at_rx_mode != AT_MODE_OFFHOOK_COMMAND) + return NULL; + at_modem_control(s, AT_MODEM_CONTROL_OFFHOOK, NULL); + at_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND); + return t; + } + at_reset_call_info(s); + if (s->at_rx_mode != AT_MODE_ONHOOK_COMMAND && s->at_rx_mode != AT_MODE_OFFHOOK_COMMAND) + { + /* Push out the last of the audio (probably by sending a short silence). */ + at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_FLUSH); + s->do_hangup = TRUE; + at_set_at_rx_mode(s, AT_MODE_CONNECTED); + return (const char *) -1; + } + at_modem_control(s, AT_MODEM_CONTROL_HANGUP, NULL); + at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND); + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_I(at_state_t *s, const char *t) +{ + int val; + + /* V.250 6.1.3 - Request identification information */ + /* N.B. The information supplied in response to an ATIx command is very + variable. It was widely used in different ways before the AT command + set was standardised by the ITU. */ + t += 1; + switch (val = parse_num(&t, 255)) + { + case 0: + at_put_response(s, model); + break; + case 3: + at_put_response(s, manufacturer); + break; + default: + return NULL; + } + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_L(at_state_t *s, const char *t) +{ + int val; + + /* V.250 6.3.13 - Monitor speaker loudness */ + /* Just absorb this command, as we have no speaker */ + t += 1; + if ((val = parse_num(&t, 255)) < 0) + return NULL; + s->speaker_volume = val; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_M(at_state_t *s, const char *t) +{ + int val; + + /* V.250 6.3.14 - Monitor speaker mode */ + /* Just absorb this command, as we have no speaker */ + t += 1; + if ((val = parse_num(&t, 255)) < 0) + return NULL; + s->speaker_mode = val; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_O(at_state_t *s, const char *t) +{ + int val; + + /* V.250 6.3.7 - Return to online data state */ + t += 1; + if ((val = parse_num(&t, 1)) < 0) + return NULL; + if (val == 0) + { + at_set_at_rx_mode(s, AT_MODE_CONNECTED); + at_put_response_code(s, AT_RESPONSE_CODE_CONNECT); + } + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_P(at_state_t *s, const char *t) +{ + /* V.250 6.3.3 - Select pulse dialling (command) */ + t += 1; + s->p.pulse_dial = TRUE; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_Q(at_state_t *s, const char *t) +{ + int val; + + /* V.250 6.2.5 - Result code suppression */ + t += 1; + if ((val = parse_num(&t, 1)) < 0) + return NULL; + switch (val) + { + case 0: + s->p.result_code_format = (s->p.verbose) ? ASCII_RESULT_CODES : NUMERIC_RESULT_CODES; + break; + case 1: + s->p.result_code_format = NO_RESULT_CODES; + break; + } + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_S0(at_state_t *s, const char *t) +{ + /* V.250 6.3.8 - Automatic answer */ + t += 2; + return s_reg_handler(s, t, 0); +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_S10(at_state_t *s, const char *t) +{ + /* V.250 6.3.12 - Automatic disconnect delay */ + t += 3; + return s_reg_handler(s, t, 10); +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_S3(at_state_t *s, const char *t) +{ + /* V.250 6.2.1 - Command line termination character */ + t += 2; + return s_reg_handler(s, t, 3); +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_S4(at_state_t *s, const char *t) +{ + /* V.250 6.2.2 - Response formatting character */ + t += 2; + return s_reg_handler(s, t, 4); +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_S5(at_state_t *s, const char *t) +{ + /* V.250 6.2.3 - Command line editing character */ + t += 2; + return s_reg_handler(s, t, 5); +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_S6(at_state_t *s, const char *t) +{ + /* V.250 6.3.9 - Pause before blind dialling */ + t += 2; + return s_reg_handler(s, t, 6); +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_S7(at_state_t *s, const char *t) +{ + /* V.250 6.3.10 - Connection completion timeout */ + t += 2; + return s_reg_handler(s, t, 7); +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_S8(at_state_t *s, const char *t) +{ + /* V.250 6.3.11 - Comma dial modifier time */ + t += 2; + return s_reg_handler(s, t, 8); +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_T(at_state_t *s, const char *t) +{ + /* V.250 6.3.2 - Select tone dialling (command) */ + t += 1; + s->p.pulse_dial = FALSE; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_V(at_state_t *s, const char *t) +{ + int val; + + /* V.250 6.2.6 - DCE response format */ + t += 1; + if ((val = parse_num(&t, 1)) < 0) + return NULL; + s->p.verbose = val; + if (s->p.result_code_format != NO_RESULT_CODES) + s->p.result_code_format = (s->p.verbose) ? ASCII_RESULT_CODES : NUMERIC_RESULT_CODES; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_X(at_state_t *s, const char *t) +{ + int val; + + /* V.250 6.2.7 - Result code selection and call progress monitoring control */ + /* 0 CONNECT result code is given upon entering online data state. + Dial tone and busy detection are disabled. + 1 CONNECT result code is given upon entering online data state. + Dial tone and busy detection are disabled. + 2 CONNECT result code is given upon entering online data state. + Dial tone detection is enabled, and busy detection is disabled. + 3 CONNECT result code is given upon entering online data state. + Dial tone detection is disabled, and busy detection is enabled. + 4 CONNECT result code is given upon entering online data state. + Dial tone and busy detection are both enabled. */ + t += 1; + if ((val = parse_num(&t, 4)) < 0) + return NULL; + s->result_code_mode = val; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_Z(at_state_t *s, const char *t) +{ + int val; + + /* V.250 6.1.1 - Reset to default configuration */ + t += 1; + if ((val = parse_num(&t, sizeof(profiles)/sizeof(profiles[0]) - 1)) < 0) + return NULL; + /* Just make sure we are on hook */ + at_modem_control(s, AT_MODEM_CONTROL_HANGUP, NULL); + at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND); + s->p = profiles[val]; + at_reset_call_info(s); + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_amp_C(at_state_t *s, const char *t) +{ + int val; + + /* V.250 6.2.8 - Circuit 109 (received line signal detector) behaviour */ + /* We have no RLSD pin, so just absorb this. */ + t += 2; + if ((val = parse_num(&t, 1)) < 0) + return NULL; + s->rlsd_behaviour = val; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_amp_D(at_state_t *s, const char *t) +{ + int val; + + /* V.250 6.2.9 - Circuit 108 (data terminal ready) behaviour */ + t += 2; + if ((val = parse_num(&t, 2)) < 0) + return NULL; + /* TODO: We have no DTR pin, but we need this to get into online + command state. */ + s->dtr_behaviour = val; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_amp_F(at_state_t *s, const char *t) +{ + t += 2; + + /* V.250 6.1.2 - Set to factory-defined configuration */ + /* Just make sure we are on hook */ + at_modem_control(s, AT_MODEM_CONTROL_HANGUP, NULL); + at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND); + s->p = profiles[0]; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_A8A(at_state_t *s, const char *t) +{ + /* V.251 6.3 - V.8 calling tone indication */ + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_A8C(at_state_t *s, const char *t) +{ + /* V.251 6.2 - V.8 answer signal indication */ + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_A8E(at_state_t *s, const char *t) +{ + int val; + + /* V.251 5.1 - V.8 and V.8bis operation controls */ + /* Syntax: +A8E=,,[,][,][,] */ + /* =0 Disable V.8 origination negotiation + =1 Enable DCE-controlled V.8 origination negotiation + =2 Enable DTE-controlled V.8 origination negotiation, send V.8 CI only + =3 Enable DTE-controlled V.8 origination negotiation, send 1100Hz CNG only + =4 Enable DTE-controlled V.8 origination negotiation, send 1300Hz CT only + =5 Enable DTE-controlled V.8 origination negotiation, send no tones + =6 Enable DCE-controlled V.8 origination negotiation, issue +A8x indications + =0 Disable V.8 answer negotiation + =1 Enable DCE-controlled V.8 answer negotiation + =2 Enable DTE-controlled V.8 answer negotiation, send ANSam + =3 Enable DTE-controlled V.8 answer negotiation, send no signal + =4 Disable DTE-controlled V.8 answer negotiation, send ANS + =5 Enable DCE-controlled V.8 answer negotiation, issue +A8x indications + =X..Y Set the V.8 CI signal call function to the hexadecimal octet value X..Y + =0 Disable V.8bis negotiation + =1 Enable DCE-controlled V.8bis negotiation + =2 Enable DTE-controlled V.8bis negotiation + ="" Set to alternative list of call function "option bit" + values that the answering DCE shall accept from the caller + ="" Set to alternative list of protocol "option bit" values that + the answering DCE shall accept from the caller + */ + /* TODO: */ + t += 4; + if (!parse_out(s, &t, &val, 6, "+A8E:", "(0-6),(0-5),(00-FF)")) + return NULL; + if (*t != ',') + return t; + if ((val = parse_num(&t, 5)) < 0) + return NULL; + if (*t != ',') + return t; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_A8I(at_state_t *s, const char *t) +{ + /* V.251 6.1 - V.8 CI signal indication */ + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_A8J(at_state_t *s, const char *t) +{ + /* V.251 6.4 - V.8 negotiation complete */ + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_A8M(at_state_t *s, const char *t) +{ + /* V.251 5.2 - Send V.8 menu signals */ + /* Syntax: +A8M= */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_A8R(at_state_t *s, const char *t) +{ + /* V.251 6.6 - V.8bis signal and message reporting */ + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_A8T(at_state_t *s, const char *t) +{ + int val; + + /* V.251 5.3 - Send V.8bis signal and/or message(s) */ + /* Syntax: +A8T=[,<1st message>][,<2nd message>][,][,][,] */ + /* =0 None + =1 Initiating Mre + =2 Initiating MRd + =3 Initiating CRe, low power + =4 Initiating CRe, high power + =5 Initiating CRd + =6 Initiating Esi + =7 Responding MRd, low power + =8 Responding MRd, high power + =9 Responding CRd + =10 Responding Esr + */ + /* TODO: */ + t += 4; + if (!parse_out(s, &t, &val, 10, "+A8T:", "(0-10)")) + return NULL; + s->v8bis_signal = val; + if (*t != ',') + return t; + if ((val = parse_num(&t, 255)) < 0) + return NULL; + s->v8bis_1st_message = val; + if (*t != ',') + return t; + if ((val = parse_num(&t, 255)) < 0) + return NULL; + s->v8bis_2nd_message = val; + if (*t != ',') + return t; + if ((val = parse_num(&t, 255)) < 0) + return NULL; + s->v8bis_sig_en = val; + if (*t != ',') + return t; + if ((val = parse_num(&t, 255)) < 0) + return NULL; + s->v8bis_msg_en = val; + if (*t != ',') + return t; + if ((val = parse_num(&t, 255)) < 0) + return NULL; + s->v8bis_supp_delay = val; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_ASTO(at_state_t *s, const char *t) +{ + /* V.250 6.3.15 - Store telephone number */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+ASTO:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CAAP(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.25 - Automatic answer for eMLPP Service */ + /* TODO: */ + t += 5; + if (!parse_2_out(s, &t, NULL, 65535, NULL, 65535, "+CAAP:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CACM(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.25 - Accumulated call meter */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CACM:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CACSP(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 11.1.7 - Voice Group or Voice Broadcast Call State Attribute Presentation */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+CACSP:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CAD(at_state_t *s, const char *t) +{ + /* IS-99 5.6.3 - Query analogue or digital service */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CAEMLPP(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.22 - eMLPP Priority Registration and Interrogation */ + /* TODO: */ + t += 8; + if (!parse_out(s, &t, NULL, 1, "+CAEMLPP:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CAHLD(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 11.1.3 - Leave an ongoing Voice Group or Voice Broadcast Call */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+CAHLD:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CAJOIN(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 11.1.1 - Accept an incoming Voice Group or Voice Broadcast Call */ + /* TODO: */ + t += 7; + if (!parse_out(s, &t, NULL, 1, "+CAJOIN:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CALA(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.16 - Alarm */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CALA:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CALCC(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 11.1.6 - List current Voice Group and Voice Broadcast Calls */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+CALCC:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CALD(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.38 - Delete alarm */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CALD:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CALM(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.20 - Alert sound mode */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CALM:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CAMM(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.26 - Accumulated call meter maximum */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CAMM:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CANCHEV(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 11.1.8 - NCH Support Indication */ + /* TODO: */ + t += 8; + if (!parse_out(s, &t, NULL, 1, "+CANCHEV:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CAOC(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.16 - Advice of Charge */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CAOC:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CAPD(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.39 - Postpone or dismiss an alarm */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CAPD:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CAPTT(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 11.1.4 - Talker Access for Voice Group Call */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+CAPTT:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CAREJ(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 11.1.2 - Reject an incoming Voice Group or Voice Broadcast Call */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+CAREJ:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CAULEV(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 11.1.5 - Voice Group Call Uplink Status Presentation */ + /* TODO: */ + t += 7; + if (!parse_out(s, &t, NULL, 1, "+CAULEV:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CBC(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.4 - Battery charge */ + /* TODO: */ + t += 4; + if (!parse_out(s, &t, NULL, 1, "+CBC:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CBCS(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 11.3.2 - VBS subscriptions and GId status */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CBCS:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CBIP(at_state_t *s, const char *t) +{ + /* IS-99 5.6 - Base station IP address */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CBST(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 6.7 - Select bearer service type */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CBST:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CCFC(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.11 - Call forwarding number and conditions */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CCFC:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CCLK(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.15 - Clock */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CCLK:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CCS(at_state_t *s, const char *t) +{ + /* IS-135 4.1.22 - Compression status */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CCUG(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.10 - Closed user group */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CCUG:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CCWA(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.12 - Call waiting */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CCWA:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CCWE(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.28 - Call Meter maximum event */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CCWE:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CDIP(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.9 - Called line identification presentation */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CDIP:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CDIS(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.8 - Display control */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CDIS:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CDV(at_state_t *s, const char *t) +{ + /* IS-99 5.6 - Dial command for voice call */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CEER(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 6.10 - Extended error report */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CEER:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CESP(at_state_t *s, const char *t) +{ + /* GSM07.05 3.2.4 - Enter SMS block mode protocol */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CFCS(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.24 - Fast call setup conditions */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CFCS:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CFG(at_state_t *s, const char *t) +{ + /* IS-99 5.6 - Configuration string */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CFUN(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.2 - Set phone functionality */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CFUN:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGACT(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 10.1.10 - PDP context activate or deactivate */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+CGACT:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGANS(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 10.1.16 - Manual response to a network request for PDP context activation */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+CGANS:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGATT(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 10.1.9 - PS attach or detach */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+CGATT:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGAUTO(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 10.1.15 - Automatic response to a network request for PDP context activation */ + /* TODO: */ + t += 7; + if (!parse_out(s, &t, NULL, 1, "+CGAUTO:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGCAP(at_state_t *s, const char *t) +{ + /* IS-99 5.6 - Request complete capabilities list */ + /* TODO: */ + t += 6; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGCLASS(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 10.1.17 - GPRS mobile station class (GPRS only) */ + /* TODO: */ + t += 8; + if (!parse_out(s, &t, NULL, 1, "+CGCLASS:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGCLOSP(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 10.1.13 - Configure local Octet Stream PAD parameters (Obsolete) */ + /* TODO: */ + t += 8; + if (!parse_out(s, &t, NULL, 1, "+CGCLOSP:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGCLPAD(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 10.1.12 - Configure local triple-X PAD parameters (GPRS only) (Obsolete) */ + /* TODO: */ + t += 8; + if (!parse_out(s, &t, NULL, 1, "+CGCLPAD:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGCMOD(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 10.1.11 - PDP Context Modify */ + /* TODO: */ + t += 7; + if (!parse_out(s, &t, NULL, 1, "+CGCMOD:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGCS(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 11.3.1 - VGCS subscriptions and GId status */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CGCS:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGDATA(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 10.1.12 - Enter data state */ + /* TODO: */ + t += 7; + if (!parse_out(s, &t, NULL, 1, "+CGDATA:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGDCONT(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 10.1.1 - Define PDP Context */ + /* TODO: */ + t += 8; + if (!parse_out(s, &t, NULL, 1, "+CGDCONT:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGDSCONT(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 10.1.2 - Define Secondary PDP Context */ + /* TODO: */ + t += 9; + if (!parse_out(s, &t, NULL, 1, "+CGDSCONT:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGEQMIN(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 10.1.7 - 3G Quality of Service Profile (Minimum acceptable) */ + /* TODO: */ + t += 8; + if (!parse_out(s, &t, NULL, 1, "+CGEQMIN:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGEQNEG(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 10.1.8 - 3G Quality of Service Profile (Negotiated) */ + /* TODO: */ + t += 8; + if (!parse_out(s, &t, NULL, 1, "+CGEQNEG:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGEQREQ(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 10.1.6 - 3G Quality of Service Profile (Requested) */ + /* TODO: */ + t += 8; + if (!parse_out(s, &t, NULL, 1, "+CGEQREQ:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGEREP(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 10.1.18 - Packet Domain event reporting */ + /* TODO: */ + t += 7; + if (!parse_out(s, &t, NULL, 1, "+CGEREP:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGMI(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 5.1 - Request manufacturer identification */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CGMI:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGMM(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 5.2 - Request model identification */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CGMM:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGMR(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 5.3 - Request revision identification */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CGMR:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGOI(at_state_t *s, const char *t) +{ + /* IS-99 5.6 - Request global object identification */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGPADDR(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 10.1.14 - Show PDP address */ + /* TODO: */ + t += 8; + if (!parse_out(s, &t, NULL, 1, "+CGPADDR:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGQMIN(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 10.1.5 - Quality of Service Profile (Minimum acceptable) */ + /* TODO: */ + t += 7; + if (!parse_out(s, &t, NULL, 1, "+CGQMIN:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGQREQ(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 10.1.4 - Quality of Service Profile (Requested) */ + /* TODO: */ + t += 7; + if (!parse_out(s, &t, NULL, 1, "+CGQREQ:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGREG(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 10.1.19 - GPRS network registration status */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+CGREG:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGSMS(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 10.1.20 - Select service for MO SMS messages */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+CGSMS:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGSN(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 5.4 - Request product serial number identification */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CGSN:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CGTFT(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 10.1.3 - Traffic Flow Template */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+CGTFT:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CHLD(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.13 - Call related supplementary services */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CHLD:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CHSA(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 6.18 - HSCSD non-transparent asymmetry configuration */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CHSA:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CHSC(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 6.15 - HSCSD current call parameters */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CHSC:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CHSD(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 6.12 - HSCSD device parameters */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CHSD:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CHSN(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 6.14 - HSCSD non-transparent call configuration */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CHSN:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CHSR(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 6.16 - HSCSD parameters report */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CHSR:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CHST(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 6.13 - HSCSD transparent call configuration */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CHST:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CHSU(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 6.17 - HSCSD automatic user initiated upgrading */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CHSU:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CHUP(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 6.5 - Hangup call */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CHUP:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CHV(at_state_t *s, const char *t) +{ + /* IS-99 5.6 - Hang-up voice */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CIMI(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 5.6 - Request international mobile subscriber identity */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CIMI:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CIND(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.9 - Indicator control */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CIND:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CIT(at_state_t *s, const char *t) +{ + /* IS-99 5.6 - Command state inactivity timer */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CKPD(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.7 - Keypad control */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CKPD:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CLAC(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.37 - List all available AT commands */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CLAC:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CLAE(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.31 - Language Event */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CLAE:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CLAN(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.30 - Set Language */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CLAN:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CLCC(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.18 - List current calls */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CLCC:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CLCK(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.4 - Facility lock */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CLCK:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CLIP(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.6 - Calling line identification presentation */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CLIP:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CLIR(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.7 - Calling line identification restriction */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CLIR:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CLVL(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.23 - Loudspeaker volume level */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CLVL:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CMAR(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.36 - Master Reset */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CMAR:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CMEC(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.6 - Mobile Termination control mode */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CMEC:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CMEE(at_state_t *s, const char *t) +{ + /* GSM07.07 9.1 - Report mobile equipment error */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CMER(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.10 - Mobile Termination event reporting */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CMER:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CMGC(at_state_t *s, const char *t) +{ + /* GSM07.05 3.5.5/4.5 - Send command */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CMGD(at_state_t *s, const char *t) +{ + /* GSM07.05 3.5.4 - Delete message */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CMGF(at_state_t *s, const char *t) +{ + /* GSM07.05 3.2.3 - Message Format */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CMGL(at_state_t *s, const char *t) +{ + /* GSM07.05 3.4.2/4.1 - List messages */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CMGR(at_state_t *s, const char *t) +{ + /* GSM07.05 3.4.3/4.2 - Read message */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CMGS(at_state_t *s, const char *t) +{ + /* GSM07.05 3.5.1/4.3 - Send message */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CMGW(at_state_t *s, const char *t) +{ + /* GSM07.05 3.5.3/4.4 - Write message to memory */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CMIP(at_state_t *s, const char *t) +{ + /* IS-99 5.6 - Mobile station IP address */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CMM(at_state_t *s, const char *t) +{ + /* IS-135 4.1.23 - Menu map */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CMMS(at_state_t *s, const char *t) +{ + /* GSM07.05 3.5.6 - More messages to send */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CMOD(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 6.4 - Call mode */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CMOD:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CMSS(at_state_t *s, const char *t) +{ + /* GSM07.05 3.5.2/4.7 - Send message from storage */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CMUT(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.24 - Mute control */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CMUT:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CNMA(at_state_t *s, const char *t) +{ + /* GSM07.05 3.4.4/4.6 - New message acknowledgement to terminal adapter */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CNMI(at_state_t *s, const char *t) +{ + /* GSM07.05 3.4.1 - New message indications to terminal equipment */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CMUX(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 5.7 - Multiplexing mode */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CMUX:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CNUM(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.1 - Subscriber number */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CNUM:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_COLP(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.8 - Connected line identification presentation */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+COLP:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_COPN(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.21 - Read operator names */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+COPN:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_COPS(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.3 - PLMN selection */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+COPS:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_COS(at_state_t *s, const char *t) +{ + /* IS-135 4.1.24 - Originating service */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_COTDI(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 11.1.9 - Originator to Dispatcher Information */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+COTDI:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CPAS(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.1 - Phone activity status */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CPAS:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CPBF(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.13 - Find phonebook entries */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CPBF:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CPBR(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.12 - Read phonebook entries */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CPBR:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CPBS(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.11 - Select phonebook memory storage */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CPBS:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CPBW(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.14 - Write phonebook entry */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CPBW:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CPIN(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.3 - Enter PIN */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CPIN:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CPLS(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.20 - Selection of preferred PLMN list */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CPLS:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CPMS(at_state_t *s, const char *t) +{ + /* GSM07.05 3.2.2 - Preferred message storage */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CPOL(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.19 - Preferred PLMN list */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CPOL:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CPPS(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.23 - eMLPP subscriptions */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CPPS:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CPROT(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.42 - Enter protocol mode */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+CPROT:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CPUC(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.27 - Price per unit and currency table */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CPUC:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CPWC(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.29 - Power class */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CPWC:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CPWD(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.5 - Change password */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CPWD:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CQD(at_state_t *s, const char *t) +{ + /* IS-135 4.1.25 - Query disconnect timer */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CR(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 6.9 - Service reporting control */ + /* TODO: */ + t += 3; + if (!parse_out(s, &t, NULL, 1, "+CR:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CRC(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 6.11 - Cellular result codes */ + /* TODO: */ + t += 4; + if (!parse_out(s, &t, NULL, 1, "+CRC:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CREG(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.2 - Network registration */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CREG:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CRES(at_state_t *s, const char *t) +{ + /* GSM07.05 3.3.6 - Restore Settings */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CRLP:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CRLP(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 6.8 - Radio link protocol */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CRLP:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CRM(at_state_t *s, const char *t) +{ + /* IS-99 5.6 - Set rm interface protocol */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CRMC(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.34 - Ring Melody Control */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CRMC:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CRMP(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.35 - Ring Melody Playback */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CRMP:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CRSL(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.21 - Ringer sound level */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CRSL:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CRSM(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.18 - Restricted SIM access */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CRSM:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CSAS(at_state_t *s, const char *t) +{ + /* GSM07.05 3.3.5 - Save settings */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CSCA(at_state_t *s, const char *t) +{ + /* GSM07.05 3.3.1 - Service centre address */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CSCB(at_state_t *s, const char *t) +{ + /* GSM07.05 3.3.4 - Select cell broadcast message types */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CSCC(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.19 - Secure control command */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CSCC:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CSCS(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 5.5 - Select TE character set */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CSCS:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CSDF(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 6.22 - Settings date format */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CSDF:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CSDH(at_state_t *s, const char *t) +{ + /* GSM07.05 3.3.3 - Show text mode parameters */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CSGT(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.32 - Set Greeting Text */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CSGT:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CSIL(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 6.23 - Silence Command */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CSIL:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CSIM(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.17 - Generic SIM access */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CSIM:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CSMP(at_state_t *s, const char *t) +{ + /* GSM07.05 3.3.2 - Set text mode parameters */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CSMS(at_state_t *s, const char *t) +{ + /* GSM07.05 3.2.1 - Select Message Service */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CSNS(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 6.19 - Single numbering scheme */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CSNS:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CSQ(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.5 - Signal quality */ + /* TODO: */ + t += 4; + if (!parse_out(s, &t, NULL, 1, "+CSQ:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CSS(at_state_t *s, const char *t) +{ + /* IS-135 4.1.28 - Serving system identification */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CSSN(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.17 - Supplementary service notifications */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CSSN:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CSTA(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 6.1 - Select type of address */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CSTA:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CSTF(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 6.24 - Settings time format */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CSTF:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CSVM(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.33 - Set Voice Mail Number */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CSVM:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CTA(at_state_t *s, const char *t) +{ + /* IS-135 4.1.29 - MT-Terminated async. Data calls */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CTF(at_state_t *s, const char *t) +{ + /* IS-135 4.1.30 - MT-Terminated FAX calls */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CTFR(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.14 - Call deflection */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CTFR:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CTZR(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.41 - Time Zone Reporting */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CTZR:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CTZU(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.40 - Automatic Time Zone Update */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CTZU:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CUSD(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.15 - Unstructured supplementary service data */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CUSD:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CUUS1(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 7.26 - User to User Signalling Service 1 */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+CUUS1:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CV120(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 6.21 - V.120 rate adaption protocol */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+CV120:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CVHU(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 6.20 - Voice Hangup Control */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CVHU:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CVIB(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 8.22 - Vibrator mode */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+CVIB:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_CXT(at_state_t *s, const char *t) +{ + /* IS-99 5.6 - Cellular extension */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_DR(at_state_t *s, const char *t) +{ + /* V.250 6.6.2 - Data compression reporting */ + /* TODO: */ + t += 3; + if (!parse_out(s, &t, NULL, 1, "+DR:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_DS(at_state_t *s, const char *t) +{ + /* V.250 6.6.1 - Data compression */ + /* TODO: */ + t += 3; + if (!parse_out(s, &t, NULL, 1, "+DS:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_DS44(at_state_t *s, const char *t) +{ + /* V.250 6.6.2 - V.44 data compression */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_EB(at_state_t *s, const char *t) +{ + /* V.250 6.5.2 - Break handling in error control operation */ + /* TODO: */ + t += 3; + if (!parse_out(s, &t, NULL, 1, "+EB:", "")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_EFCS(at_state_t *s, const char *t) +{ + /* V.250 6.5.4 - 32-bit frame check sequence */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 2, "+EFCS:", "(0-2)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_EFRAM(at_state_t *s, const char *t) +{ + /* V.250 6.5.8 - Frame length */ + /* TODO: */ + t += 6; + if (!parse_2_out(s, &t, NULL, 65535, NULL, 65535, "+EFRAM:", "(1-65535),(1-65535)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_ER(at_state_t *s, const char *t) +{ + /* V.250 6.5.5 - Error control reporting */ + /* 0 Error control reporting disabled (no +ER intermediate result code transmitted) + 1 Error control reporting enabled (+ER intermediate result code transmitted) */ + /* TODO: */ + t += 3; + if (!parse_out(s, &t, NULL, 1, "+ER:", "(0,1)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_ES(at_state_t *s, const char *t) +{ + static const int maxes[3] = + { + 7, 4, 9 + }; + int *locations[3]; + + /* V.250 6.5.1 - Error control selection */ + + /* orig_rqst + 0: Direct mode + 1: Initiate call with Buffered mode only + 2: Initiate V.42 without Detection Phase. If Rec. V.8 is in use, this is a request to disable V.42 Detection Phase + 3: Initiate V.42 with Detection Phase + 4: Initiate Altemative Protocol + 5: Initiate Synchronous Mode when connection is completed, immediately after the entire CONNECT result code + is delivered. V.24 circuits 113 and 115 are activated when Data State is entered + 6: Initiate Synchronous Access Mode when connection is completed, and Data State is entered + 7: Initiate Frame Tunnelling Mode when connection is completed, and Data State is entered + + orig_fbk + 0: Error control optional (either LAPM or Alternative acceptable); if error control not established, maintain + DTE-DCE data rate and use V.14 buffered mode with flow control during non-error-control operation + 1: Error control optional (either LAPM or Alternative acceptable); if error control not established, change + DTE-DCE data rate to match line rate and use Direct mode + 2: Error control required (either LAPM or Alternative acceptable); if error control not established, disconnect + 3: Error control required (only LAPM acceptable); if error control not established, disconnect + 4: Error control required (only Altemative protocol acceptable); if error control not established, disconnect + + ans_fbk + 0: Direct mode + 1: Error control disabled, use Buffered mode + 2: Error control optional (either LAPM or Alternative acceptable); if error control not established, maintain + DTE-DCE data rate and use local buffering and flow control during non-error-control operation + 3: Error control optional (either LAPM or Alternative acceptable); if error control not established, change + DTE-DCE data rate to match line rate and use Direct mode + 4: Error control required (either LAPM or Alternative acceptable); if error control not established, disconnect + 5: Error control required (only LAPM acceptable); if error control not established, disconnect + 6: Error control required (only Alternative protocol acceptable); if error control not established, disconnect + 7: Initiate Synchronous Mode when connection is completed, immediately after the entire CONNECT result code + is delivered. V.24 cicuits 113 and 115 are activated when Data State is entered + 8: Initiate Synchronous Access Mode when connection is completed, and Data State is entered + 9: Initiate Frame Tunnelling Mode when connection is completed, and Data State is entered */ + + /* TODO: */ + t += 3; + locations[0] = NULL; + locations[1] = NULL; + locations[2] = NULL; + if (!parse_n_out(s, &t, locations, maxes, 3, "+ES:", "(0-7),(0-4),(0-9)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_ESA(at_state_t *s, const char *t) +{ + static const int maxes[8] = + { + 2, 1, 1, 1, 2, 1, 255, 255 + }; + int *locations[8]; + int i; + + /* V.80 8.2 - Synchronous access mode configuration */ + /* TODO: */ + t += 4; + for (i = 0; i < 8; i++) + locations[i] = NULL; + if (!parse_n_out(s, &t, locations, maxes, 8, "+ESA:", "(0-2),(0-1),(0-1),(0-1),(0-2),(0-1),(0-255),(0-255)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_ESR(at_state_t *s, const char *t) +{ + /* V.250 6.5.3 - Selective repeat */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_ETBM(at_state_t *s, const char *t) +{ + /* V.250 6.5.6 - Call termination buffer management */ + /* TODO: */ + t += 5; + if (!parse_2_out(s, &t, NULL, 2, NULL, 2, "+ETBM:", "(0-2),(0-2),(0-30)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_EWIND(at_state_t *s, const char *t) +{ + /* V.250 6.5.7 - Window size */ + /* TODO: */ + t += 6; + if (!parse_2_out(s, &t, &s->rx_window, 127, &s->tx_window, 127, "+EWIND:", "(1-127),(1-127)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_F34(at_state_t *s, const char *t) +{ + static const int maxes[5] = + { + 14, 14, 2, 14, 14 + }; + int *locations[5]; + int i; + + /* T.31 B.6.1 - Initial V.34 rate controls for FAX */ + /* Syntax: +F34=[][,[][,][,][,p.adaptive_receive, 1, NULL, "0,1")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FBO(at_state_t *s, const char *t) +{ + /* T.32 8.5.3.4 - Phase C data bit order */ + /* TODO */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FBS(at_state_t *s, const char *t) +{ + /* T.32 8.5.3.2 - Buffer Size, read only parameter */ + /* TODO */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FBU(at_state_t *s, const char *t) +{ + /* T.32 8.5.1.10 - HDLC Frame Reporting parameter */ + /* TODO */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FCC(at_state_t *s, const char *t) +{ + /* T.32 8.5.1.1 - DCE capabilities parameters */ + /* TODO */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FCL(at_state_t *s, const char *t) +{ + /* T.31 8.5.2 - Carrier loss timeout */ + t += 4; + if (!parse_out(s, &t, &s->carrier_loss_timeout, 255, NULL, "(0-255)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FCLASS(at_state_t *s, const char *t) +{ + /* T.31 8.2 - Capabilities identification and control */ + t += 7; + /* T.31 says the reply string should be "0,1.0", however making + it "0,1,1.0" makes things compatible with a lot more software + that may be expecting a pre-T.31 modem. */ + if (!parse_string_list_out(s, &t, &s->fclass_mode, 1, NULL, "0,1,1.0")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FCQ(at_state_t *s, const char *t) +{ + /* T.32 8.5.2.3 - Copy quality checking parameter */ + /* TODO */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FCR(at_state_t *s, const char *t) +{ + /* T.32 8.5.1.9 - Capability to receive parameter */ + /* TODO */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FCS(at_state_t *s, const char *t) +{ + /* T.32 8.5.1.3 - Current Session Results parameters */ + /* TODO */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FCT(at_state_t *s, const char *t) +{ + /* T.32 8.5.2.6 - DTE phase C timeout parameter */ + /* TODO */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FDD(at_state_t *s, const char *t) +{ + /* T.31 8.5.3 - Double escape character replacement */ + t += 4; + if (!parse_out(s, &t, &s->p.double_escape, 1, NULL, "(0,1)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FDR(at_state_t *s, const char *t) +{ + /* T.32 8.3.4 - Data reception command */ + /* TODO */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FDT(at_state_t *s, const char *t) +{ + /* T.32 8.3.3 - Data transmission command */ + /* TODO */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FEA(at_state_t *s, const char *t) +{ + /* T.32 8.5.3.5 - Phase C received EOL alignment parameter */ + /* TODO */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FFC(at_state_t *s, const char *t) +{ + /* T.32 8.5.3.6 - Format conversion parameter */ + /* TODO */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FFD(at_state_t *s, const char *t) +{ + /* T.32 8.5.1.14 - File diagnostic message parameter */ + /* TODO */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FHS(at_state_t *s, const char *t) +{ + /* T.32 8.5.2.7 - Call termination status parameter */ + /* TODO */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FIE(at_state_t *s, const char *t) +{ + /* T.32 8.5.2.1 - Procedure interrupt enable parameter */ + /* TODO */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FIP(at_state_t *s, const char *t) +{ + /* T.32 8.3.6 - Initialize Facsimile Parameters */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FIS(at_state_t *s, const char *t) +{ + /* T.32 8.5.1.2 - Current session parameters */ + /* TODO */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FIT(at_state_t *s, const char *t) +{ + /* T.31 8.5.4 - DTE inactivity timeout */ + t += 4; + if (!parse_2_out(s, &t, &s->dte_inactivity_timeout, 255, &s->dte_inactivity_action, 1, "+FIT:", "(0-255),(0-1)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FKS(at_state_t *s, const char *t) +{ + /* T.32 8.3.5 - Session termination command */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FLI(at_state_t *s, const char *t) +{ + /* T.32 8.5.1.5 - Local ID string parameter, TSI or CSI */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FLO(at_state_t *s, const char *t) +{ + /* T.31 Annex A */ + /* Implement something similar to the V.250 +IFC command */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FLP(at_state_t *s, const char *t) +{ + /* T.32 8.5.1.7 - Indicate document to poll parameter */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FMI(at_state_t *s, const char *t) +{ + /* T.31 says to duplicate +GMI */ + t += 4; + if (t[0] == '?') + { + at_put_response(s, manufacturer); + t += 1; + } + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FMM(at_state_t *s, const char *t) +{ + /* T.31 says to duplicate +GMM */ + t += 4; + if (t[0] == '?') + { + at_put_response(s, model); + t += 1; + } + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FMR(at_state_t *s, const char *t) +{ + /* T.31 says to duplicate +GMR */ + t += 4; + if (t[0] == '?') + { + at_put_response(s, revision); + t += 1; + } + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FMS(at_state_t *s, const char *t) +{ + /* T.32 8.5.2.9 - Minimum phase C speed parameter */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FND(at_state_t *s, const char *t) +{ + /* T.32 8.5.2.10 - Non-Standard Message Data Indication parameter */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FNR(at_state_t *s, const char *t) +{ + /* T.32 8.5.1.11 - Negotiation message reporting control parameters */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FNS(at_state_t *s, const char *t) +{ + /* T.32 8.5.1.6 - Non-Standard Frame FIF parameter */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FPA(at_state_t *s, const char *t) +{ + /* T.32 8.5.1.13 - Selective polling address parameter */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FPI(at_state_t *s, const char *t) +{ + /* T.32 8.5.1.5 - Local Polling ID String parameter */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FPP(at_state_t *s, const char *t) +{ + /* T.32 8.5.3 - Facsimile packet protocol */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FPR(at_state_t *s, const char *t) +{ + /* T.31 Annex A */ + /* Implement something similar to the V.250 +IPR command */ + t += 4; + if (!parse_out(s, &t, &s->dte_rate, 115200, NULL, "115200")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FPS(at_state_t *s, const char *t) +{ + /* T.32 8.5.2.2 - Page Status parameter */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FPW(at_state_t *s, const char *t) +{ + /* T.32 8.5.1.13 - PassWord parameter (Sending or Polling) */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FRH(at_state_t *s, const char *t) +{ + /* T.31 8.3.6 - HDLC receive */ + if (!process_class1_cmd(s, &t)) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FRM(at_state_t *s, const char *t) +{ + /* T.31 8.3.4 - Facsimile receive */ + if (!process_class1_cmd(s, &t)) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FRQ(at_state_t *s, const char *t) +{ + /* T.32 8.5.2.4 - Receive Quality Thresholds parameters */ + /* TODO */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FRS(at_state_t *s, const char *t) +{ + /* T.31 8.3.2 - Receive silence */ + if (!process_class1_cmd(s, &t)) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FRY(at_state_t *s, const char *t) +{ + /* T.32 8.5.2.8 - ECM Retry Value parameter */ + /* TODO */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FSA(at_state_t *s, const char *t) +{ + /* T.32 8.5.1.13 - Subaddress parameter */ + /* TODO */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FSP(at_state_t *s, const char *t) +{ + /* T.32 8.5.1.8 - Request to poll parameter */ + /* TODO */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FTH(at_state_t *s, const char *t) +{ + /* T.31 8.3.5 - HDLC transmit */ + if (!process_class1_cmd(s, &t)) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FTM(at_state_t *s, const char *t) +{ + /* T.31 8.3.3 - Facsimile transmit */ + if (!process_class1_cmd(s, &t)) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_FTS(at_state_t *s, const char *t) +{ + /* T.31 8.3.1 - Transmit silence */ + if (!process_class1_cmd(s, &t)) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_GCAP(at_state_t *s, const char *t) +{ + /* V.250 6.1.9 - Request complete capabilities list */ + t += 5; + /* Response elements + +FCLASS +F (FAX) commands + +MS +M (modulation control) commands +MS and +MR + +MV18S +M (modulation control) commands +MV18S and +MV18R + +ES +E (error control) commands +ES, +EB, +ER, +EFCS, and +ETBM + +DS +D (data compression) commands +DS and +DR */ + /* TODO: make this adapt to the configuration we really have. */ + if (t[0] == '?') + { + at_put_response(s, "+GCAP:+FCLASS"); + t += 1; + } + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_GCI(at_state_t *s, const char *t) +{ + /* V.250 6.1.10 - Country of installation, */ + t += 4; + if (!parse_hex_out(s, &t, &s->country_of_installation, 255, "+GCI:", "(00-FF)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_GMI(at_state_t *s, const char *t) +{ + /* V.250 6.1.4 - Request manufacturer identification */ + t += 4; + if (t[0] == '?') + { + at_put_response(s, manufacturer); + t += 1; + } + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_GMM(at_state_t *s, const char *t) +{ + /* V.250 6.1.5 - Request model identification */ + t += 4; + if (t[0] == '?') + { + at_put_response(s, model); + t += 1; + } + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_GMR(at_state_t *s, const char *t) +{ + /* V.250 6.1.6 - Request revision identification */ + t += 4; + if (t[0] == '?') + { + at_put_response(s, revision); + t += 1; + } + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_GOI(at_state_t *s, const char *t) +{ + /* V.250 6.1.8 - Request global object identification */ + /* TODO: */ + t += 4; + if (t[0] == '?') + { + at_put_response(s, GLOBAL_OBJECT_IDENTITY); + t += 1; + } + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_GSN(at_state_t *s, const char *t) +{ + /* V.250 6.1.7 - Request product serial number identification */ + /* TODO: */ + t += 4; + if (t[0] == '?') + { + at_put_response(s, SERIAL_NUMBER); + t += 1; + } + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_IBC(at_state_t *s, const char *t) +{ + static const int maxes[13] = + { + 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; + int *locations[13]; + int i; + + /* V.80 7.9 - Control of in-band control */ + /* TODO: */ + t += 4; + /* 0: In-band control service disabled + 1: In-band control service enabled, 7-bit codes allowed, and top bit insignificant + 2; In-band control service enabled, 7-bit codes allowed, and 8-bit codes available + + Circuits 105, 106, 107, 108, 109, 110, 125, 132, 133, 135, 142 in that order. For each one: + 0: disabled + 1: enabled + + DCE line connect status reports: + 0: disabled + 1: enabled */ + for (i = 0; i < 13; i++) + locations[i] = NULL; + if (!parse_n_out(s, &t, locations, maxes, 13, "+IBC:", "(0-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)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_IBM(at_state_t *s, const char *t) +{ + static const int maxes[3] = + { + 7, 255, 255 + }; + int *locations[3]; + + /* V.80 7.10 - In-band MARK idle reporting control */ + /* TODO: */ + t += 4; + /* Report control + 0: No reports + 1: Report only once when expires + 2: Report each time expires + 3: Report once when expires, and then each time expires + 4: Report only when the Mark-ldle Period ends; T3 = the entire interval + 5: Report the first time when is exceeded, and then once more when the mark idle period ends + 6: Report each time when is exceeded, and then once more when the mark idle period ends; + T3 = entire interval -- N*T2 + 7: report the first time when is exceeded, and then each time is exceeded, and then once + more when the mark idle period ends; T3 = entire mark idle period -- N*T2 - T1 + + T1 in units of 10ms + + T2 in units of 10ms */ + locations[0] = NULL; + locations[1] = NULL; + locations[2] = NULL; + if (!parse_n_out(s, &t, locations, maxes, 3, "+IBM:", "(0-7),(0-255),(0-255)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_ICF(at_state_t *s, const char *t) +{ + /* V.250 6.2.11 - DTE-DCE character framing */ + t += 4; + /* Character format + 0: auto detect + 1: 8 data 2 stop + 2: 8 data 1 parity 1 stop + 3: 8 data 1 stop + 4: 7 data 2 stop + 5: 7 data 1 parity 1 stop + 6: 7 data 1 stop + + Parity + 0: Odd + 1: Even + 2: Mark + 3: Space */ + if (!parse_2_out(s, &t, &s->dte_char_format, 6, &s->dte_parity, 3, "+ICF:", "(0-6),(0-3)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_ICLOK(at_state_t *s, const char *t) +{ + /* V.250 6.2.14 - Select sync transmit clock source */ + t += 6; + if (!parse_out(s, &t, &s->sync_tx_clock_source, 2, "+ICLOK:", "(0-2)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_IDSR(at_state_t *s, const char *t) +{ + /* V.250 6.2.16 - Select data set ready option */ + t += 5; + if (!parse_out(s, &t, &s->dsr_option, 2, "+IDSR:", "(0-2)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_IFC(at_state_t *s, const char *t) +{ + /* V.250 6.2.12 - DTE-DCE local flow control */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_ILRR(at_state_t *s, const char *t) +{ + /* V.250 6.2.13 - DTE-DCE local rate reporting */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_ILSD(at_state_t *s, const char *t) +{ + /* V.250 6.2.15 - Select long space disconnect option */ + t += 5; + if (!parse_out(s, &t, &s->long_space_disconnect_option, 2, "+ILSD:", "(0,1)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_IPR(at_state_t *s, const char *t) +{ + /* V.250 6.2.10 - Fixed DTE rate */ + /* TODO: */ + t += 4; + if (!parse_out(s, &t, &s->dte_rate, 115200, "+IPR:", "(115200),(115200)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_IRTS(at_state_t *s, const char *t) +{ + /* V.250 6.2.17 - Select synchronous mode RTS option */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+IRTS:", "(0,1)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_ITF(at_state_t *s, const char *t) +{ + /* V.80 8.4 - Transmit flow control thresholds */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_MA(at_state_t *s, const char *t) +{ + /* V.250 6.4.2 - Modulation automode control */ + /* TODO: */ + t += 3; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_MR(at_state_t *s, const char *t) +{ + /* V.250 6.4.3 - Modulation reporting control */ + /* 0 Disables reporting of modulation connection (+MCR: and +MRR: are not transmitted) + 1 Enables reporting of modulation connection (+MCR: and +MRR: are transmitted) */ + /* TODO: */ + t += 3; + if (!parse_out(s, &t, NULL, 1, "+MR:", "(0,1)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_MS(at_state_t *s, const char *t) +{ + /* V.250 6.4.1 - Modulation selection */ + /* TODO: */ + t += 3; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_MSC(at_state_t *s, const char *t) +{ + /* V.250 6.4.8 - Seamless rate change enable */ + /* 0 Disables V.34 seamless rate change + 1 Enables V.34 seamless rate change */ + /* TODO: */ + t += 4; + if (!parse_out(s, &t, NULL, 1, "+MSC:", "(0,1)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_MV18AM(at_state_t *s, const char *t) +{ + /* V.250 6.4.6 - V.18 answering message editing */ + /* TODO: */ + t += 7; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_MV18P(at_state_t *s, const char *t) +{ + /* V.250 6.4.7 - Order of probes */ + /* 2 Send probe message in 5-bit (Baudot) mode + 3 Send probe message in DTMF mode + 4 Send probe message in EDT mode + 5 Send Rec. V.21 carrier as a probe + 6 Send Rec. V.23 carrier as a probe + 7 Send Bell 103 carrier as a probe */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 7, "+MV18P:", "(2-7)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_MV18R(at_state_t *s, const char *t) +{ + /* V.250 6.4.5 - V.18 reporting control */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+MV18R:", "(0,1)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_MV18S(at_state_t *s, const char *t) +{ + /* V.250 6.4.4 - V.18 selection */ + /* mode: + 0 Disables V.18 operation + 1 V.18 operation, auto detect mode + 2 V.18 operation, connect in 5-bit (Baudot) mode + 3 V.18 operation, connect in DTMF mode + 4 V.18 operation, connect in EDT mode + 5 V.18 operation, connect in V.21 mode + 6 V.18 operation, connect in V.23 mode + 7 V.18 operation, connect in Bell 103-type mode + + dflt_ans_mode: + 0 Disables V.18 answer operation + 1 No default specified (auto detect) + 2 V.18 operation connect in 5-bit (Baudot) mode + 3 V.18 operation connect in DTMF mode + 4 V.18 operation connect in EDT mode + + fbk_time_enable: + 0 Disable + 1 Enable + + ans_msg_enable + 0 Disable + 1 Enable + + probing_en + 0 Disable probing + 1 Enable probing + 2 Initiate probing */ + /* TODO: */ + t += 6; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_PCW(at_state_t *s, const char *t) +{ + /* V.250 6.8.1 - Call waiting enable (V.92 DCE) */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_PIG(at_state_t *s, const char *t) +{ + /* V.250 6.8.5 - PCM upstream ignore */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_PMH(at_state_t *s, const char *t) +{ + /* V.250 6.8.2 - Modem on hold enable */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_PMHF(at_state_t *s, const char *t) +{ + /* V.250 6.8.6 - V.92 Modem on hold hook flash */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_PMHR(at_state_t *s, const char *t) +{ + /* V.250 6.8.4 - Initiate modem on hold */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_PMHT(at_state_t *s, const char *t) +{ + /* V.250 6.8.3 - Modem on hold timer */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_PQC(at_state_t *s, const char *t) +{ + /* V.250 6.8.7 - V.92 Phase 1 and Phase 2 Control */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_PSS(at_state_t *s, const char *t) +{ + /* V.250 6.8.8 - V.92 Use Short Sequence */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_SAC(at_state_t *s, const char *t) +{ + /* V.252 3.4 - Audio transmit configuration */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_SAM(at_state_t *s, const char *t) +{ + /* V.252 3.5 - Audio receive mode */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_SAR(at_state_t *s, const char *t) +{ + /* V.252 5.3 - Audio receive channel indication */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_SARR(at_state_t *s, const char *t) +{ + /* V.252 3.9 - Audio indication reporting */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_SAT(at_state_t *s, const char *t) +{ + /* V.252 5.4 - Audio transmit channel indication */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_SCRR(at_state_t *s, const char *t) +{ + /* V.252 3.11 - Capabilities indication reporting */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_SDC(at_state_t *s, const char *t) +{ + /* V.252 3.3 - Data configuration */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_SDI(at_state_t *s, const char *t) +{ + /* V.252 5.2 - Data channel identification */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_SDR(at_state_t *s, const char *t) +{ + /* V.252 3.8 - Data indication reporting */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_SRSC(at_state_t *s, const char *t) +{ + /* V.252 5.1.2 - Remote terminal simultaneous capability indication */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_STC(at_state_t *s, const char *t) +{ + /* V.252 3.1 - Terminal configuration */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_STH(at_state_t *s, const char *t) +{ + /* V.252 3.2 - Close logical channel */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_SVC(at_state_t *s, const char *t) +{ + /* V.252 3.6 - Video transmit configuration */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_SVM(at_state_t *s, const char *t) +{ + /* V.252 3.7 - Video receive mode */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_SVR(at_state_t *s, const char *t) +{ + /* V.252 5.5 - Video receive channel indication */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_SVRR(at_state_t *s, const char *t) +{ + /* V.252 3.10 - Video indication reporting */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_SVT(at_state_t *s, const char *t) +{ + /* V.252 5.6 - Video transmit channel indication */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_TADR(at_state_t *s, const char *t) +{ + /* V.250 6.7.2.9 - Local V.54 address */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_TAL(at_state_t *s, const char *t) +{ + /* V.250 6.7.2.15 - Local analogue loop */ + /* Action + 0 Disable analogue loop + 1 Enable analogue loop + Band + 0 Low frequency band + 1 High frequency band */ + /* TODO: */ + t += 4; + if (!parse_2_out(s, &t, NULL, 1, NULL, 1, "+TAL:", "(0,1),(0,1)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_TALS(at_state_t *s, const char *t) +{ + /* V.250 6.7.2.6 - Analogue loop status */ + /* 0 Inactive + 1 V.24 circuit 141 invoked + 2 Front panel invoked + 3 Network management system invoked */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 3, "+TALS:", "(0-3)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_TDLS(at_state_t *s, const char *t) +{ + /* V.250 6.7.2.7 - Local digital loop status */ + /* 0 Disabled + 1 Enabled, inactive + 2 Front panel invoked + 3 Network management system invoked + 4 Remote invoked */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 3, "+TDLS:", "(0-4)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_TE140(at_state_t *s, const char *t) +{ + /* V.250 6.7.2.1 - Enable ckt 140 */ + /* 0 Disabled + 1 Enabled */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+TE140:", "(0,1)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_TE141(at_state_t *s, const char *t) +{ + /* V.250 6.7.2.2 - Enable ckt 141 */ + /* 0 Response is disabled + 1 Response is enabled */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+TE141:", "(0,1)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_TEPAL(at_state_t *s, const char *t) +{ + /* V.250 6.7.2.5 - Enable front panel analogue loop */ + /* 0 Disabled + 1 Enabled */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+TEPAL:", "(0,1)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_TEPDL(at_state_t *s, const char *t) +{ + /* V.250 6.7.2.4 - Enable front panel RDL */ + /* 0 Disabled + 1 Enabled */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+TEPDL:", "(0,1)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_TERDL(at_state_t *s, const char *t) +{ + /* V.250 6.7.2.3 - Enable RDL from remote */ + /* 0 Local DCE will ignore command from remote + 1 Local DCE will obey command from remote */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+TERDL:", "(0,1)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_TLDL(at_state_t *s, const char *t) +{ + /* V.250 6.7.2.13 - Local digital loop */ + /* 0 Stop test + 1 Start test */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+TLDL:", "(0,1)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_TMO(at_state_t *s, const char *t) +{ + /* V.250 6.9 - V.59 command */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_TMODE(at_state_t *s, const char *t) +{ + /* V.250 6.7.2.10 - Set V.54 mode */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+TMODE:", "(0,1)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_TNUM(at_state_t *s, const char *t) +{ + /* V.250 6.7.2.12 - Errored bit and block counts */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_TRDL(at_state_t *s, const char *t) +{ + /* V.250 6.7.2.14 - Request remote digital loop */ + /* 0 Stop RDL + 1 Start RDL */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+TRDL:", "(0,1)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_TRDLS(at_state_t *s, const char *t) +{ + /* V.250 6.7.2.8 - Remote digital loop status */ + /* TODO: */ + t += 6; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_TRES(at_state_t *s, const char *t) +{ + /* V.250 6.7.2.17 - Self test result */ + /* 0 No test + 1 Pass + 2 Fail */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, NULL, 1, "+TRES:", "(0-2)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_TSELF(at_state_t *s, const char *t) +{ + /* V.250 6.7.2.16 - Self test */ + /* 0 Intrusive full test + 1 Safe partial test */ + /* TODO: */ + t += 6; + if (!parse_out(s, &t, NULL, 1, "+TSELF:", "(0,1)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_TTER(at_state_t *s, const char *t) +{ + /* V.250 6.7.2.11 - Test error rate */ + /* TODO: */ + t += 5; + if (!parse_2_out(s, &t, NULL, 65535, NULL, 65535, "+TTER:", "(0-65535),(0-65535)")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VAC(at_state_t *s, const char *t) +{ + /* V.252 4.1 - Set audio code */ + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VACR(at_state_t *s, const char *t) +{ + /* V.252 6.1 - Audio code report */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VBT(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 C.2.2 - Buffer threshold setting */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VCID(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 C.2.3 - Calling number ID presentation */ + /* TODO: */ + t += 5; + if (!parse_out(s, &t, &s->display_call_info, 1, NULL, "0,1")) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VCIDR(at_state_t *s, const char *t) +{ + /* V.252 6.2 - Caller ID report */ + /* TODO: */ + t += 6; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VDID(at_state_t *s, const char *t) +{ + /* V.253 9.2.4 - DID service */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VDIDR(at_state_t *s, const char *t) +{ + /* V.252 6.2 - DID report */ + /* TODO: */ + t += 6; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VDR(at_state_t *s, const char *t) +{ + /* V.253 10.3.1 - Distinctive ring (ring cadence reporting) */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VDT(at_state_t *s, const char *t) +{ + /* V.253 10.3.2 - Control tone cadence reporting */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VDX(at_state_t *s, const char *t) +{ + /* V.253 10.5.6 - Speakerphone duplex mode */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VEM(at_state_t *s, const char *t) +{ + /* V.253 10.5.7 - Deliver event reports */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VGM(at_state_t *s, const char *t) +{ + /* V.253 10.5.2 - Microphone gain */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VGR(at_state_t *s, const char *t) +{ + /* V.253 10.2.1 - Receive gain selection */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VGS(at_state_t *s, const char *t) +{ + /* V.253 10.5.3 - Speaker gain */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VGT(at_state_t *s, const char *t) +{ + /* V.253 10.2.2 - Volume selection */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VHC(at_state_t *s, const char *t) +{ + /* V.252 4.12 - Telephony port hook control */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VIP(at_state_t *s, const char *t) +{ + /* V.253 10.1.1 - Initialize voice parameters */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VIT(at_state_t *s, const char *t) +{ + /* V.253 10.2.3 - DTE/DCE inactivity timer */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VLS(at_state_t *s, const char *t) +{ + /* V.253 10.2.4 - Analogue source/destination selection */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VNH(at_state_t *s, const char *t) +{ + /* V.253 9.2.5 - Automatic hangup control */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VPH(at_state_t *s, const char *t) +{ + /* V.252 4.11 - Phone hookswitch status */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VPP(at_state_t *s, const char *t) +{ + /* V.253 10.4.2 - Voice packet protocol */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VPR(at_state_t *s, const char *t) +{ + /* IS-101 10.4.3 - Select DTE/DCE interface rate */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VRA(at_state_t *s, const char *t) +{ + /* V.253 10.2.5 - Ringing tone goes away timer */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VRID(at_state_t *s, const char *t) +{ + int val; + + /* Extension of V.253 +VCID, Calling number ID report/repeat */ + t += 5; + val = 0; + if (!parse_out(s, &t, &val, 1, NULL, "0,1")) + return NULL; + if (val == 1) + at_display_call_info(s); + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VRL(at_state_t *s, const char *t) +{ + /* V.253 10.1.2 - Ring local phone */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VRN(at_state_t *s, const char *t) +{ + /* V.253 10.2.6 - Ringing tone never appeared timer */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VRX(at_state_t *s, const char *t) +{ + /* V.253 10.1.3 - Voice receive state */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VSD(at_state_t *s, const char *t) +{ + /* V.253 10.2.7 - Silence detection (QUIET and SILENCE) */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VSID(at_state_t *s, const char *t) +{ + /* Extension of V.253 +VCID, Set calling number ID */ + t += 5; + if (!parse_string_out(s, &t, &s->local_id, NULL)) + return NULL; + if (at_modem_control(s, AT_MODEM_CONTROL_SETID, s->local_id) < 0) + return NULL; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VSM(at_state_t *s, const char *t) +{ + /* V.253 10.2.8 - Compression method selection */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VSP(at_state_t *s, const char *t) +{ + /* V.253 10.5.1 - Voice speakerphone state */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VTA(at_state_t *s, const char *t) +{ + /* V.253 10.5.4 - Train acoustic echo-canceller */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VTD(at_state_t *s, const char *t) +{ + /* V.253 10.2.9 - Beep tone duration timer */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VTER(at_state_t *s, const char *t) +{ + /* V.252 6.4 - Simple telephony event report */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VTH(at_state_t *s, const char *t) +{ + /* V.253 10.5.5 - Train line echo-canceller */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VTR(at_state_t *s, const char *t) +{ + /* V.253 10.1.4 - Voice duplex state */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VTS(at_state_t *s, const char *t) +{ + /* V.253 10.1.5 - DTMF and tone generation in voice */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VTX(at_state_t *s, const char *t) +{ + /* V.253 10.1.6 - Transmit data state */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_VXT(at_state_t *s, const char *t) +{ + /* IS-101 10.1.5 - Translate voice data */ + /* TODO: */ + t += 4; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_W(at_state_t *s, const char *t) +{ + /* TIA-678 5.2.4.1 - Compliance indication */ + /* TODO: */ + t += 2; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WBAG(at_state_t *s, const char *t) +{ + /* TIA-678 C.5.6 Bias Modem Audio Gain */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WCDA(at_state_t *s, const char *t) +{ + /* TIA-678 B.3.2.5 Display Data Link Address */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WCHG(at_state_t *s, const char *t) +{ + /* TIA-678 B.3.2.4 Display Battery Charging Status */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WCID(at_state_t *s, const char *t) +{ + /* TIA-678 B.3.2.1 Display System ID (operator) */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WCLK(at_state_t *s, const char *t) +{ + /* TIA-678 B.3.2.3 Lock/Unlock DCE */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WCPN(at_state_t *s, const char *t) +{ + /* TIA-678 B.3.2.2 Set Personal Identification Number */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WCXF(at_state_t *s, const char *t) +{ + /* TIA-678 B.3.2.6 Display Supported Annex B commands */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WDAC(at_state_t *s, const char *t) +{ + /* TIA-678 C.5.1 Data over Analogue Cellular Command Query */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WDIR(at_state_t *s, const char *t) +{ + /* TIA-678 C.5.8 Phone Number Directory Selection */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WECR(at_state_t *s, const char *t) +{ + /* TIA-678 C.5.3 Enable Cellular Result Codes */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WFON(at_state_t *s, const char *t) +{ + /* TIA-678 C.5.5 Phone Specification */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WKPD(at_state_t *s, const char *t) +{ + /* TIA-678 C.5.7 Keypad Emulation */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WPBA(at_state_t *s, const char *t) +{ + /* TIA-678 C.5.9 Phone Battery Query */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WPTH(at_state_t *s, const char *t) +{ + /* TIA-678 C.5.10 Call Path */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WRLK(at_state_t *s, const char *t) +{ + /* TIA-678 C.5.4 Roam Lockout */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WS45(at_state_t *s, const char *t) +{ + /* TIA-678 5.2.4.2 DTE-side stack selection */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WS46(at_state_t *s, const char *t) +{ + /* 3GPP TS 27.007 5.9 - PCCA STD-101 [17] select wireless network */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WS50(at_state_t *s, const char *t) +{ + /* TIA-678 B.3.1.1 Normalized Signal Strength */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WS51(at_state_t *s, const char *t) +{ + /* TIA-678 B.3.1.2 Carrier Detect Signal Threshold */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WS52(at_state_t *s, const char *t) +{ + /* TIA-678 B.3.1.3 Normalized Battery Level */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WS53(at_state_t *s, const char *t) +{ + /* TIA-678 B.3.1.4 Normalized Channel Quality */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WS54(at_state_t *s, const char *t) +{ + /* TIA-678 B.3.1.5 Carrier Detect Channel Quality Threshold */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WS57(at_state_t *s, const char *t) +{ + /* TIA-678 B.3.1.7 Antenna Preference */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WS58(at_state_t *s, const char *t) +{ + /* TIA-678 B.3.1.8 Idle Time-out Value */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +static const char *at_cmd_plus_WSTL(at_state_t *s, const char *t) +{ + /* TIA-678 C.5.2 Call Session Time Limit */ + /* TODO: */ + t += 5; + return t; +} +/*- End of function --------------------------------------------------------*/ + +/* + AT command group prefixes: + + +A Call control (network addressing) issues, common, PSTN, ISDN, Rec. X.25, switched digital + +C Digital cellular extensions + +D Data compression, Rec. V.42bis + +E Error control, Rec. V.42 + +F Facsimile, Rec. T.30, etc. + +G Generic issues such as identity and capabilities + +I DTE-DCE interface issues, Rec. V.24, etc. + +M Modulation, Rec. V.32bis, etc. + +S Switched or simultaneous data types + +T Test issues + +V Voice extensions + +W Wireless extensions +*/ + +#include "at_interpreter_dictionary.h" + +static int command_search(const char *u, int len, int *matched) +{ + int i; + int index; + int first; + int last; + int entry; + int ptr; + + entry = 0; + /* Loop over the length of the string to search the trie... */ + for (i = 0, ptr = 0; ptr < COMMAND_TRIE_LEN; i++) + { + /* The character in u we are processing... */ + /* V.250 5.4.1 says upper and lower case are equivalent in commands */ + index = (unsigned char) toupper(u[i]); + /* Is there a child node for this character? */ + /* Note: First and last could have been packed into one uint16_t, + but space is not that critical, so the other packing is good + enough to make the table reasonable. */ + first = command_trie[ptr++]; + last = command_trie[ptr++]; + entry = command_trie[ptr++]; + if (index < first || index > last) + break; + if ((ptr = command_trie[ptr + index - first]) == 0) + break; + ptr--; + } + *matched = i; + return entry; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) at_modem_control(at_state_t *s, int op, const char *num) +{ + switch (op) + { + case AT_MODEM_CONTROL_ANSWER: + break; + case AT_MODEM_CONTROL_CALL: + break; + case AT_MODEM_CONTROL_HANGUP: + break; + case AT_MODEM_CONTROL_OFFHOOK: + break; + case AT_MODEM_CONTROL_DTR: + break; + case AT_MODEM_CONTROL_RTS: + break; + case AT_MODEM_CONTROL_CTS: + break; + case AT_MODEM_CONTROL_CAR: + break; + case AT_MODEM_CONTROL_RNG: + break; + case AT_MODEM_CONTROL_DSR: + break; + case AT_MODEM_CONTROL_RESTART: + break; + default: + break; + } + /*endswitch*/ + return s->modem_control_handler(s, s->modem_control_user_data, op, num); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) at_interpreter(at_state_t *s, const char *cmd, int len) +{ + int i; + int c; + int entry; + int matched; + const char *t; + + if (s->p.echo) + s->at_tx_handler(s, s->at_tx_user_data, (uint8_t *) cmd, len); + + for (i = 0; i < len; i++) + { + /* The spec says the top bit should be ignored */ + c = *cmd++ & 0x7F; + /* Handle incoming character */ + if (s->line_ptr < 2) + { + /* Look for the initial "at", "AT", "a/" or "A/", and ignore anything before it */ + /* V.250 5.2.1 only shows "at" and "AT" as command prefixes. "At" and "aT" are + not specified, despite 5.4.1 saying upper and lower case are equivalent in + commands. Let's be tolerant and accept them. */ + if (tolower(c) == 'a') + { + s->line_ptr = 0; + s->line[s->line_ptr++] = (char) toupper(c); + } + else if (s->line_ptr == 1) + { + if (tolower(c) == 't') + { + /* We have an "AT" command */ + s->line[s->line_ptr++] = (char) toupper(c); + } + else if (c == '/') + { + /* We have an "A/" command */ + /* TODO: implement "A/" command repeat */ + s->line[s->line_ptr++] = (char) c; + } + else + { + s->line_ptr = 0; + } + } + } + else + { + /* We are beyond the initial AT */ + if (c >= 0x20 && c <= 0x7E) + { + /* Add a new char */ + if (s->line_ptr < (int) (sizeof(s->line) - 1)) + s->line[s->line_ptr++] = (char) toupper(c); + } + else if (c == s->p.s_regs[3]) + { + /* End of command line. Do line validation */ + s->line[s->line_ptr] = '\0'; + if (s->line_ptr > 2) + { + /* The spec says the commands within a command line are executed in order, until + an error is found, or the end of the command line is reached. */ + t = s->line + 2; + while (t && *t) + { + if ((entry = command_search(t, 15, &matched)) <= 0) + break; + if ((t = at_commands[entry - 1](s, t)) == NULL) + break; + if (t == (const char *) -1) + break; + } + if (t != (const char *) -1) + { + if (t == NULL) + at_put_response_code(s, AT_RESPONSE_CODE_ERROR); + else + at_put_response_code(s, AT_RESPONSE_CODE_OK); + } + } + else if (s->line_ptr == 2) + { + /* It's just an empty "AT" command, return OK. */ + at_put_response_code(s, AT_RESPONSE_CODE_OK); + } + s->line_ptr = 0; + } + else if (c == s->p.s_regs[5]) + { + /* Command line editing character (backspace) */ + if (s->line_ptr > 0) + s->line_ptr--; + } + else + { + /* The spec says control characters, other than those + explicitly handled, should be ignored, and so this + invalid character causes everything buffered + before it to also be ignored. */ + s->line_ptr = 0; + } + } + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) at_set_class1_handler(at_state_t *s, at_class1_handler_t handler, void *user_data) +{ + s->class1_handler = handler; + s->class1_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(at_state_t *) at_init(at_state_t *s, + at_tx_handler_t *at_tx_handler, + void *at_tx_user_data, + at_modem_control_handler_t *modem_control_handler, + void *modem_control_user_data) +{ + if (s == NULL) + { + if ((s = (at_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, '\0', sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "AT"); + s->modem_control_handler = modem_control_handler; + s->modem_control_user_data = modem_control_user_data; + s->at_tx_handler = at_tx_handler; + s->at_tx_user_data = at_tx_user_data; + s->call_id = NULL; + s->local_id = NULL; + s->display_call_info = 0; + at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND); + s->p = profiles[0]; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) at_release(at_state_t *s) +{ + at_reset_call_info(s); + if (s->local_id) + free(s->local_id); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) at_free(at_state_t *s) +{ + int ret; + + ret = at_release(s); + free(s); + return ret; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/awgn.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/awgn.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,180 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * awgn.c - An additive Gaussian white noise generator + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: awgn.c,v 1.22 2009/02/10 13:06:46 steveu Exp $ + */ + +/*! \file */ + +/* This code is based on some demonstration code in a research + paper somewhere. I can't track down where I got the original from, + so that due recognition can be given. The original had no explicit + copyright notice, and I hope nobody objects to its use here. + + Having a reasonable Gaussian noise generator is pretty important for + telephony testing (in fact, pretty much any DSP testing), and this + one seems to have served me OK. Since the generation of Gaussian + noise is only for test purposes, and not a core system component, + I don't intend to worry excessively about copyright issues, unless + someone worries me. + + The non-core nature of this code also explains why it is unlikely + to ever be optimised. */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/saturated.h" +#include "spandsp/awgn.h" + +#include "spandsp/private/awgn.h" + +/* Gaussian noise generator constants */ +#define M1 259200 +#define IA1 7141 +#define IC1 54773 +#define RM1 (1.0/M1) +#define M2 134456 +#define IA2 8121 +#define IC2 28411 +#define RM2 (1.0/M2) +#define M3 243000 +#define IA3 4561 +#define IC3 51349 + +static double ran1(awgn_state_t *s) +{ + double temp; + int j; + + s->ix1 = (IA1*s->ix1 + IC1)%M1; + s->ix2 = (IA2*s->ix2 + IC2)%M2; + s->ix3 = (IA3*s->ix3 + IC3)%M3; + j = 1 + ((97*s->ix3)/M3); + if (j > 97 || j < 1) + { + /* Error */ + return -1; + } + temp = s->r[j]; + s->r[j] = (s->ix1 + s->ix2*RM2)*RM1; + return temp; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(awgn_state_t *) awgn_init_dbov(awgn_state_t *s, int idum, float level) +{ + int j; + + if (s == NULL) + { + if ((s = (awgn_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + if (idum < 0) + idum = -idum; + + s->rms = pow(10.0, level/20.0)*32768.0; + + s->ix1 = (IC1 + idum)%M1; + s->ix1 = (IA1*s->ix1 + IC1)%M1; + s->ix2 = s->ix1%M2; + s->ix1 = (IA1*s->ix1 + IC1)%M1; + s->ix3 = s->ix1%M3; + s->r[0] = 0.0; + for (j = 1; j <= 97; j++) + { + s->ix1 = (IA1*s->ix1 + IC1)%M1; + s->ix2 = (IA2*s->ix2 + IC2)%M2; + s->r[j] = (s->ix1 + s->ix2*RM2)*RM1; + } + s->gset = 0.0; + s->iset = 0; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(awgn_state_t *) awgn_init_dbm0(awgn_state_t *s, int idum, float level) +{ + return awgn_init_dbov(s, idum, level - DBM0_MAX_POWER); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) awgn_release(awgn_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) awgn_free(awgn_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int16_t) awgn(awgn_state_t *s) +{ + double fac; + double r; + double v1; + double v2; + double amp; + + if (s->iset == 0) + { + do + { + v1 = 2.0*ran1(s) - 1.0; + v2 = 2.0*ran1(s) - 1.0; + r = v1*v1 + v2*v2; + } + while (r >= 1.0); + fac = sqrt(-2.0*log(r)/r); + s->gset = v1*fac; + s->iset = 1; + amp = v2*fac*s->rms; + } + else + { + s->iset = 0; + amp = s->gset*s->rms; + } + return fsaturate(amp); +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/bell_r2_mf.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/bell_r2_mf.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,863 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * bell_r2_mf.c - Bell MF and MFC/R2 tone generation and detection. + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: bell_r2_mf.c,v 1.39.4.1 2009/12/23 14:23:48 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/queue.h" +#include "spandsp/dc_restore.h" +#include "spandsp/complex.h" +#include "spandsp/dds.h" +#include "spandsp/tone_detect.h" +#include "spandsp/tone_generate.h" +#include "spandsp/super_tone_rx.h" +#include "spandsp/dtmf.h" +#include "spandsp/bell_r2_mf.h" + +#include "spandsp/private/queue.h" +#include "spandsp/private/tone_generate.h" +#include "spandsp/private/bell_r2_mf.h" + +#if !defined(M_PI) +/* C99 systems may not define M_PI */ +#define M_PI 3.14159265358979323846264338327 +#endif + +/*! + MF tone descriptor. +*/ +typedef struct +{ + int f1; /* First freq */ + int f2; /* Second freq */ + int8_t level1; /* Level of the first freq (dB) */ + int8_t level2; /* Level of the second freq (dB) */ + uint8_t on_time; /* Tone on time (ms) */ + uint8_t off_time; /* Minimum post tone silence (ms) */ +} mf_digit_tones_t; + +int bell_mf_gen_inited = FALSE; +tone_gen_descriptor_t bell_mf_digit_tones[15]; + +int r2_mf_gen_inited = FALSE; +tone_gen_descriptor_t r2_mf_fwd_digit_tones[15]; +tone_gen_descriptor_t r2_mf_back_digit_tones[15]; + +#if 0 +tone_gen_descriptor_t socotel_mf_digit_tones[18]; +#endif + +/* Bell R1 tone generation specs. + * Power: -7dBm +- 1dB + * Frequency: within +-1.5% + * Mismatch between the start time of a pair of tones: <=6ms. + * Mismatch between the end time of a pair of tones: <=6ms. + * Tone duration: 68+-7ms, except KP which is 100+-7ms. + * Inter-tone gap: 68+-7ms. + */ +static const mf_digit_tones_t bell_mf_tones[] = +{ + { 700, 900, -7, -7, 68, 68}, + { 700, 1100, -7, -7, 68, 68}, + { 900, 1100, -7, -7, 68, 68}, + { 700, 1300, -7, -7, 68, 68}, + { 900, 1300, -7, -7, 68, 68}, + {1100, 1300, -7, -7, 68, 68}, + { 700, 1500, -7, -7, 68, 68}, + { 900, 1500, -7, -7, 68, 68}, + {1100, 1500, -7, -7, 68, 68}, + {1300, 1500, -7, -7, 68, 68}, + { 700, 1700, -7, -7, 68, 68}, /* ST''' - use 'C' */ + { 900, 1700, -7, -7, 68, 68}, /* ST' - use 'A' */ + {1100, 1700, -7, -7, 100, 68}, /* KP - use '*' */ + {1300, 1700, -7, -7, 68, 68}, /* ST'' - use 'B' */ + {1500, 1700, -7, -7, 68, 68}, /* ST - use '#' */ + {0, 0, 0, 0, 0, 0} +}; + +/* The order of the digits here must match the list above */ +static const char bell_mf_tone_codes[] = "1234567890CA*B#"; + +/* R2 tone generation specs. + * Power: -11.5dBm +- 1dB + * Frequency: within +-4Hz + * Mismatch between the start time of a pair of tones: <=1ms. + * Mismatch between the end time of a pair of tones: <=1ms. + */ +static const mf_digit_tones_t r2_mf_fwd_tones[] = +{ + {1380, 1500, -11, -11, 1, 0}, + {1380, 1620, -11, -11, 1, 0}, + {1500, 1620, -11, -11, 1, 0}, + {1380, 1740, -11, -11, 1, 0}, + {1500, 1740, -11, -11, 1, 0}, + {1620, 1740, -11, -11, 1, 0}, + {1380, 1860, -11, -11, 1, 0}, + {1500, 1860, -11, -11, 1, 0}, + {1620, 1860, -11, -11, 1, 0}, + {1740, 1860, -11, -11, 1, 0}, + {1380, 1980, -11, -11, 1, 0}, + {1500, 1980, -11, -11, 1, 0}, + {1620, 1980, -11, -11, 1, 0}, + {1740, 1980, -11, -11, 1, 0}, + {1860, 1980, -11, -11, 1, 0}, + {0, 0, 0, 0, 0, 0} +}; + +static const mf_digit_tones_t r2_mf_back_tones[] = +{ + {1140, 1020, -11, -11, 1, 0}, + {1140, 900, -11, -11, 1, 0}, + {1020, 900, -11, -11, 1, 0}, + {1140, 780, -11, -11, 1, 0}, + {1020, 780, -11, -11, 1, 0}, + { 900, 780, -11, -11, 1, 0}, + {1140, 660, -11, -11, 1, 0}, + {1020, 660, -11, -11, 1, 0}, + { 900, 660, -11, -11, 1, 0}, + { 780, 660, -11, -11, 1, 0}, + {1140, 540, -11, -11, 1, 0}, + {1020, 540, -11, -11, 1, 0}, + { 900, 540, -11, -11, 1, 0}, + { 780, 540, -11, -11, 1, 0}, + { 660, 540, -11, -11, 1, 0}, + {0, 0, 0, 0, 0, 0} +}; + +/* The order of the digits here must match the lists above */ +static const char r2_mf_tone_codes[] = "1234567890BCDEF"; + +#if 0 +static const mf_digit_tones_t socotel_tones[] = +{ + { 700, 900, -11, -11, 1, 0}, + { 700, 1100, -11, -11, 1, 0}, + { 900, 1100, -11, -11, 1, 0}, + { 700, 1300, -11, -11, 1, 0}, + { 900, 1300, -11, -11, 1, 0}, + {1100, 1300, -11, -11, 1, 0}, + { 700, 1500, -11, -11, 1, 0}, + { 900, 1500, -11, -11, 1, 0}, + {1100, 1500, -11, -11, 1, 0}, + {1300, 1500, -11, -11, 1, 0}, + {1500, 1700, -11, -11, 1, 0}, + { 700, 1700, -11, -11, 1, 0}, + { 900, 1700, -11, -11, 1, 0}, + {1300, 1700, -11, -11, 1, 0}, + {1100, 1700, -11, -11, 1, 0}, + {1700, 0, -11, -11, 1, 0}, /* Use 'F' */ + {1900, 0, -11, -11, 1, 0}, /* Use 'G' */ + {0, 0, 0, 0, 0, 0} +}; + +/* The order of the digits here must match the list above */ +static char socotel_mf_tone_codes[] = "1234567890ABCDEFG"; +#endif + +#if defined(SPANDSP_USE_FIXED_POINT) +#define BELL_MF_THRESHOLD 204089 /* -30.5dBm0 */ +#define BELL_MF_TWIST 3.981f /* 6dB */ +#define BELL_MF_RELATIVE_PEAK 12.589f /* 11dB */ +#define BELL_MF_SAMPLES_PER_BLOCK 120 + +#define R2_MF_THRESHOLD 62974 /* -36.5dBm0 */ +#define R2_MF_TWIST 5.012f /* 7dB */ +#define R2_MF_RELATIVE_PEAK 12.589f /* 11dB */ +#define R2_MF_SAMPLES_PER_BLOCK 133 +#else +#define BELL_MF_THRESHOLD 3343803100.0f /* -30.5dBm0 [((120.0*32768.0/1.4142)*10^((-30.5 - DBM0_MAX_SINE_POWER)/20.0))^2 => 3343803100.0] */ +#define BELL_MF_TWIST 3.981f /* 6dB [10^(6/10) => 3.981] */ +#define BELL_MF_RELATIVE_PEAK 12.589f /* 11dB */ +#define BELL_MF_SAMPLES_PER_BLOCK 120 + +#define R2_MF_THRESHOLD 1031766650.0f /* -36.5dBm0 [((133.0*32768.0/1.4142)*10^((-36.5 - DBM0_MAX_SINE_POWER)/20.0))^2 => 1031766650.0] */ +#define R2_MF_TWIST 5.012f /* 7dB */ +#define R2_MF_RELATIVE_PEAK 12.589f /* 11dB */ +#define R2_MF_SAMPLES_PER_BLOCK 133 +#endif + +static goertzel_descriptor_t bell_mf_detect_desc[6]; + +static goertzel_descriptor_t mf_fwd_detect_desc[6]; +static goertzel_descriptor_t mf_back_detect_desc[6]; + +static const int bell_mf_frequencies[] = +{ + 700, 900, 1100, 1300, 1500, 1700 +}; + +/* Use the follow characters for the Bell MF special signals: + KP - use '*' + ST - use '#' + ST' - use 'A' + ST'' - use 'B' + ST''' - use 'C' */ +static const char bell_mf_positions[] = "1247C-358A--69*---0B----#"; + +static const int r2_mf_fwd_frequencies[] = +{ + 1380, 1500, 1620, 1740, 1860, 1980 +}; + +static const int r2_mf_back_frequencies[] = +{ + 1140, 1020, 900, 780, 660, 540 +}; + +/* Use codes '1' to 'F' for the R2 signals 1 to 15, except for signal 'A'. + Use '0' for this, so the codes match the digits 0-9. */ +static const char r2_mf_positions[] = "1247B-358C--69D---0E----F"; + +static void bell_mf_gen_init(void) +{ + int i; + const mf_digit_tones_t *tones; + + if (bell_mf_gen_inited) + return; + i = 0; + tones = bell_mf_tones; + while (tones->on_time) + { + /* Note: The duration of KP is longer than the other signals. */ + make_tone_gen_descriptor(&bell_mf_digit_tones[i++], + tones->f1, + tones->level1, + tones->f2, + tones->level2, + tones->on_time, + tones->off_time, + 0, + 0, + FALSE); + tones++; + } + bell_mf_gen_inited = TRUE; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) bell_mf_tx(bell_mf_tx_state_t *s, int16_t amp[], int max_samples) +{ + int len; + const char *cp; + int digit; + + len = 0; + if (s->tones.current_section >= 0) + { + /* Deal with the fragment left over from last time */ + len = tone_gen(&(s->tones), amp, max_samples); + } + while (len < max_samples && (digit = queue_read_byte(&s->queue.queue)) >= 0) + { + /* Step to the next digit */ + if ((cp = strchr(bell_mf_tone_codes, digit)) == NULL) + continue; + tone_gen_init(&(s->tones), &bell_mf_digit_tones[cp - bell_mf_tone_codes]); + len += tone_gen(&(s->tones), amp + len, max_samples - len); + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) bell_mf_tx_put(bell_mf_tx_state_t *s, const char *digits, int len) +{ + size_t space; + + /* This returns the number of characters that would not fit in the buffer. + The buffer will only be loaded if the whole string of digits will fit, + in which case zero is returned. */ + if (len < 0) + { + if ((len = strlen(digits)) == 0) + return 0; + } + if ((space = queue_free_space(&s->queue.queue)) < (size_t) len) + return len - (int) space; + if (queue_write(&s->queue.queue, (const uint8_t *) digits, len) >= 0) + return 0; + return -1; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(bell_mf_tx_state_t *) bell_mf_tx_init(bell_mf_tx_state_t *s) +{ + if (s == NULL) + { + if ((s = (bell_mf_tx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + + if (!bell_mf_gen_inited) + bell_mf_gen_init(); + tone_gen_init(&(s->tones), &bell_mf_digit_tones[0]); + s->current_sample = 0; + queue_init(&s->queue.queue, MAX_BELL_MF_DIGITS, QUEUE_READ_ATOMIC | QUEUE_WRITE_ATOMIC); + s->tones.current_section = -1; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) bell_mf_tx_release(bell_mf_tx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) bell_mf_tx_free(bell_mf_tx_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) r2_mf_tx(r2_mf_tx_state_t *s, int16_t amp[], int samples) +{ + int len; + + if (s->digit == 0) + { + len = samples; + memset(amp, 0, len*sizeof(int16_t)); + } + else + { + len = tone_gen(&s->tone, amp, samples); + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) r2_mf_tx_put(r2_mf_tx_state_t *s, char digit) +{ + char *cp; + + if (digit && (cp = strchr(r2_mf_tone_codes, digit))) + { + if (s->fwd) + tone_gen_init(&s->tone, &r2_mf_fwd_digit_tones[cp - r2_mf_tone_codes]); + else + tone_gen_init(&s->tone, &r2_mf_back_digit_tones[cp - r2_mf_tone_codes]); + s->digit = digit; + } + else + { + s->digit = 0; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(r2_mf_tx_state_t *) r2_mf_tx_init(r2_mf_tx_state_t *s, int fwd) +{ + int i; + const mf_digit_tones_t *tones; + + if (s == NULL) + { + if ((s = (r2_mf_tx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + + if (!r2_mf_gen_inited) + { + i = 0; + tones = r2_mf_fwd_tones; + while (tones->on_time) + { + make_tone_gen_descriptor(&r2_mf_fwd_digit_tones[i++], + tones->f1, + tones->level1, + tones->f2, + tones->level2, + tones->on_time, + tones->off_time, + 0, + 0, + (tones->off_time == 0)); + tones++; + } + i = 0; + tones = r2_mf_back_tones; + while (tones->on_time) + { + make_tone_gen_descriptor(&r2_mf_back_digit_tones[i++], + tones->f1, + tones->level1, + tones->f2, + tones->level2, + tones->on_time, + tones->off_time, + 0, + 0, + (tones->off_time == 0)); + tones++; + } + r2_mf_gen_inited = TRUE; + } + s->fwd = fwd; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) r2_mf_tx_release(r2_mf_tx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) r2_mf_tx_free(r2_mf_tx_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) bell_mf_rx(bell_mf_rx_state_t *s, const int16_t amp[], int samples) +{ +#if defined(SPANDSP_USE_FIXED_POINT) + int32_t energy[6]; + int16_t xamp; +#else + float energy[6]; + float xamp; +#endif + int i; + int j; + int sample; + int best; + int second_best; + int limit; + uint8_t hit; + + hit = 0; + for (sample = 0; sample < samples; sample = limit) + { + if ((samples - sample) >= (BELL_MF_SAMPLES_PER_BLOCK - s->current_sample)) + limit = sample + (BELL_MF_SAMPLES_PER_BLOCK - s->current_sample); + else + limit = samples; + for (j = sample; j < limit; j++) + { + xamp = goertzel_preadjust_amp(amp[j]); + goertzel_samplex(&s->out[0], xamp); + goertzel_samplex(&s->out[1], xamp); + goertzel_samplex(&s->out[2], xamp); + goertzel_samplex(&s->out[3], xamp); + goertzel_samplex(&s->out[4], xamp); + goertzel_samplex(&s->out[5], xamp); + } + s->current_sample += (limit - sample); + if (s->current_sample < BELL_MF_SAMPLES_PER_BLOCK) + continue; + + /* We are at the end of an MF detection block */ + /* Find the two highest energies. The spec says to look for + two tones and two tones only. Taking this literally -ie + only two tones pass the minimum threshold - doesn't work + well. The sinc function mess, due to rectangular windowing + ensure that! Find the two highest energies and ensure they + are considerably stronger than any of the others. */ + energy[0] = goertzel_result(&s->out[0]); + energy[1] = goertzel_result(&s->out[1]); + if (energy[0] > energy[1]) + { + best = 0; + second_best = 1; + } + else + { + best = 1; + second_best = 0; + } + for (i = 2; i < 6; i++) + { + energy[i] = goertzel_result(&s->out[i]); + if (energy[i] >= energy[best]) + { + second_best = best; + best = i; + } + else if (energy[i] >= energy[second_best]) + { + second_best = i; + } + } + /* Basic signal level and twist tests */ + hit = 0; + if (energy[best] >= BELL_MF_THRESHOLD + && + energy[second_best] >= BELL_MF_THRESHOLD + && + energy[best] < energy[second_best]*BELL_MF_TWIST + && + energy[best]*BELL_MF_TWIST > energy[second_best]) + { + /* Relative peak test */ + hit = 'X'; + for (i = 0; i < 6; i++) + { + if (i != best && i != second_best) + { + if (energy[i]*BELL_MF_RELATIVE_PEAK >= energy[second_best]) + { + /* The best two are not clearly the best */ + hit = 0; + break; + } + } + } + } + if (hit) + { + /* Get the values into ascending order */ + if (second_best < best) + { + i = best; + best = second_best; + second_best = i; + } + best = best*5 + second_best - 1; + hit = bell_mf_positions[best]; + /* Look for two successive similar results */ + /* The logic in the next test is: + For KP we need 4 successive identical clean detects, with + two blocks of something different preceeding it. For anything + else we need two successive identical clean detects, with + two blocks of something different preceeding it. */ + if (hit == s->hits[4] + && + hit == s->hits[3] + && + ((hit != '*' && hit != s->hits[2] && hit != s->hits[1]) + || + (hit == '*' && hit == s->hits[2] && hit != s->hits[1] && hit != s->hits[0]))) + { + if (s->current_digits < MAX_BELL_MF_DIGITS) + { + s->digits[s->current_digits++] = (char) hit; + s->digits[s->current_digits] = '\0'; + if (s->digits_callback) + { + s->digits_callback(s->digits_callback_data, s->digits, s->current_digits); + s->current_digits = 0; + } + } + else + { + s->lost_digits++; + } + } + } + s->hits[0] = s->hits[1]; + s->hits[1] = s->hits[2]; + s->hits[2] = s->hits[3]; + s->hits[3] = s->hits[4]; + s->hits[4] = hit; + s->current_sample = 0; + } + if (s->current_digits && s->digits_callback) + { + s->digits_callback(s->digits_callback_data, s->digits, s->current_digits); + s->digits[0] = '\0'; + s->current_digits = 0; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(size_t) bell_mf_rx_get(bell_mf_rx_state_t *s, char *buf, int max) +{ + if (max > s->current_digits) + max = s->current_digits; + if (max > 0) + { + memcpy(buf, s->digits, max); + memmove(s->digits, s->digits + max, s->current_digits - max); + s->current_digits -= max; + } + buf[max] = '\0'; + return max; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(bell_mf_rx_state_t *) bell_mf_rx_init(bell_mf_rx_state_t *s, + digits_rx_callback_t callback, + void *user_data) +{ + int i; + static int initialised = FALSE; + + if (s == NULL) + { + if ((s = (bell_mf_rx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + + if (!initialised) + { + for (i = 0; i < 6; i++) + make_goertzel_descriptor(&bell_mf_detect_desc[i], (float) bell_mf_frequencies[i], BELL_MF_SAMPLES_PER_BLOCK); + initialised = TRUE; + } + s->digits_callback = callback; + s->digits_callback_data = user_data; + + s->hits[0] = + s->hits[1] = + s->hits[2] = + s->hits[3] = + s->hits[4] = 0; + + for (i = 0; i < 6; i++) + goertzel_init(&s->out[i], &bell_mf_detect_desc[i]); + s->current_sample = 0; + s->lost_digits = 0; + s->current_digits = 0; + s->digits[0] = '\0'; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) bell_mf_rx_release(bell_mf_rx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) bell_mf_rx_free(bell_mf_rx_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) r2_mf_rx(r2_mf_rx_state_t *s, const int16_t amp[], int samples) +{ +#if defined(SPANDSP_USE_FIXED_POINT) + int32_t energy[6]; + int16_t xamp; +#else + float energy[6]; + float xamp; +#endif + int i; + int j; + int sample; + int best; + int second_best; + int hit; + int hit_digit; + int limit; + + hit = 0; + hit_digit = 0; + for (sample = 0; sample < samples; sample = limit) + { + if ((samples - sample) >= (R2_MF_SAMPLES_PER_BLOCK - s->current_sample)) + limit = sample + (R2_MF_SAMPLES_PER_BLOCK - s->current_sample); + else + limit = samples; + for (j = sample; j < limit; j++) + { + xamp = goertzel_preadjust_amp(amp[j]); + goertzel_samplex(&s->out[0], xamp); + goertzel_samplex(&s->out[1], xamp); + goertzel_samplex(&s->out[2], xamp); + goertzel_samplex(&s->out[3], xamp); + goertzel_samplex(&s->out[4], xamp); + goertzel_samplex(&s->out[5], xamp); + } + s->current_sample += (limit - sample); + if (s->current_sample < R2_MF_SAMPLES_PER_BLOCK) + continue; + + /* We are at the end of an MF detection block */ + /* Find the two highest energies */ + energy[0] = goertzel_result(&s->out[0]); + energy[1] = goertzel_result(&s->out[1]); + if (energy[0] > energy[1]) + { + best = 0; + second_best = 1; + } + else + { + best = 1; + second_best = 0; + } + + for (i = 2; i < 6; i++) + { + energy[i] = goertzel_result(&s->out[i]); + if (energy[i] >= energy[best]) + { + second_best = best; + best = i; + } + else if (energy[i] >= energy[second_best]) + { + second_best = i; + } + } + /* Basic signal level and twist tests */ + hit = FALSE; + if (energy[best] >= R2_MF_THRESHOLD + && + energy[second_best] >= R2_MF_THRESHOLD + && + energy[best] < energy[second_best]*R2_MF_TWIST + && + energy[best]*R2_MF_TWIST > energy[second_best]) + { + /* Relative peak test */ + hit = TRUE; + for (i = 0; i < 6; i++) + { + if (i != best && i != second_best) + { + if (energy[i]*R2_MF_RELATIVE_PEAK >= energy[second_best]) + { + /* The best two are not clearly the best */ + hit = FALSE; + break; + } + } + } + } + if (hit) + { + /* Get the values into ascending order */ + if (second_best < best) + { + i = best; + best = second_best; + second_best = i; + } + best = best*5 + second_best - 1; + hit_digit = r2_mf_positions[best]; + } + else + { + hit_digit = 0; + } + if (s->current_digit != hit_digit && s->callback) + { + i = (hit_digit) ? -99 : -10; + s->callback(s->callback_data, hit_digit, i, 0); + } + s->current_digit = hit_digit; + s->current_sample = 0; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) r2_mf_rx_get(r2_mf_rx_state_t *s) +{ + return s->current_digit; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(r2_mf_rx_state_t *) r2_mf_rx_init(r2_mf_rx_state_t *s, + int fwd, + tone_report_func_t callback, + void *user_data) +{ + int i; + static int initialised = FALSE; + + if (s == NULL) + { + if ((s = (r2_mf_rx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + + s->fwd = fwd; + + if (!initialised) + { + for (i = 0; i < 6; i++) + { + make_goertzel_descriptor(&mf_fwd_detect_desc[i], (float) r2_mf_fwd_frequencies[i], R2_MF_SAMPLES_PER_BLOCK); + make_goertzel_descriptor(&mf_back_detect_desc[i], (float) r2_mf_back_frequencies[i], R2_MF_SAMPLES_PER_BLOCK); + } + initialised = TRUE; + } + if (fwd) + { + for (i = 0; i < 6; i++) + goertzel_init(&s->out[i], &mf_fwd_detect_desc[i]); + } + else + { + for (i = 0; i < 6; i++) + goertzel_init(&s->out[i], &mf_back_detect_desc[i]); + } + s->callback = callback; + s->callback_data = user_data; + s->current_digit = 0; + s->current_sample = 0; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) r2_mf_rx_release(r2_mf_rx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) r2_mf_rx_free(r2_mf_rx_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/bert.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/bert.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,512 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * bert.c - Bit error rate tests. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: bert.c,v 1.33 2009/04/14 16:04:53 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/async.h" +#include "spandsp/bert.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/bert.h" + +#define MEASUREMENT_STEP 100 + +static const char *qbf = "VoyeZ Le BricK GeanT QuE J'ExaminE PreS Du WharF 123 456 7890 + - * : = $ % ( )" + "ThE QuicK BrowN FoX JumpS OveR ThE LazY DoG 123 456 7890 + - * : = $ % ( )"; + +SPAN_DECLARE(const char *) bert_event_to_str(int event) +{ + switch (event) + { + case BERT_REPORT_SYNCED: + return "synced"; + case BERT_REPORT_UNSYNCED: + return "unsync'ed"; + case BERT_REPORT_REGULAR: + return "regular"; + case BERT_REPORT_GT_10_2: + return "error rate > 1 in 10^2"; + case BERT_REPORT_LT_10_2: + return "error rate < 1 in 10^2"; + case BERT_REPORT_LT_10_3: + return "error rate < 1 in 10^3"; + case BERT_REPORT_LT_10_4: + return "error rate < 1 in 10^4"; + case BERT_REPORT_LT_10_5: + return "error rate < 1 in 10^5"; + case BERT_REPORT_LT_10_6: + return "error rate < 1 in 10^6"; + case BERT_REPORT_LT_10_7: + return "error rate < 1 in 10^7"; + } + return "???"; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) bert_get_bit(bert_state_t *s) +{ + int bit; + + if (s->limit && s->tx.bits >= s->limit) + return SIG_STATUS_END_OF_DATA; + bit = 0; + switch (s->pattern_class) + { + case 0: + bit = s->tx.reg & 1; + s->tx.reg = (s->tx.reg >> 1) | ((s->tx.reg & 1) << s->shift2); + break; + case 1: + bit = s->tx.reg & 1; + s->tx.reg = (s->tx.reg >> 1) | (((s->tx.reg ^ (s->tx.reg >> s->shift)) & 1) << s->shift2); + if (s->max_zeros) + { + /* This generator suppresses runs >s->max_zeros */ + if (bit) + { + if (++s->tx.zeros > s->max_zeros) + { + s->tx.zeros = 0; + bit ^= 1; + } + } + else + { + s->tx.zeros = 0; + } + } + bit ^= s->invert; + break; + case 2: + if (s->tx.step_bit == 0) + { + s->tx.step_bit = 7; + s->tx.reg = qbf[s->tx.step++]; + if (s->tx.reg == 0) + { + s->tx.reg = 'V'; + s->tx.step = 1; + } + } + bit = s->tx.reg & 1; + s->tx.reg >>= 1; + s->tx.step_bit--; + break; + } + s->tx.bits++; + return bit; +} +/*- End of function --------------------------------------------------------*/ + +static void assess_error_rate(bert_state_t *s) +{ + int i; + int j; + int sum; + int test; + + /* We assess the error rate in decadic steps. For each decade we assess the error over 10 times + the number of bits, to smooth the result. This means we assess the 1 in 100 rate based on 1000 bits + (i.e. we look for >=10 errors in 1000 bits). We make an assessment every 100 bits, using a sliding + window over the last 1000 bits. We assess the 1 in 1000 rate over 10000 bits in a similar way, and + so on for the lower error rates. */ + test = TRUE; + for (i = 2; i <= 7; i++) + { + if (++s->decade_ptr[i] < 10) + break; + /* This decade has reached 10 snapshots, so we need to touch the next decade */ + s->decade_ptr[i] = 0; + /* Sum the last 10 snapshots from this decade, to see if we overflow into the next decade */ + for (sum = 0, j = 0; j < 10; j++) + sum += s->decade_bad[i][j]; + if (test && sum > 10) + { + /* We overflow into the next decade */ + test = FALSE; + if (s->error_rate != i && s->reporter) + s->reporter(s->user_data, BERT_REPORT_GT_10_2 + i - 2, &s->results); + s->error_rate = i; + } + s->decade_bad[i][0] = 0; + if (i < 7) + s->decade_bad[i + 1][s->decade_ptr[i + 1]] = sum; + } + if (i > 7) + { + if (s->decade_ptr[i] >= 10) + s->decade_ptr[i] = 0; + if (test) + { + if (s->error_rate != i && s->reporter) + s->reporter(s->user_data, BERT_REPORT_GT_10_2 + i - 2, &s->results); + s->error_rate = i; + } + } + else + { + s->decade_bad[i][s->decade_ptr[i]] = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) bert_put_bit(bert_state_t *s, int bit) +{ + if (bit < 0) + { + /* Special conditions */ + printf("Status is %s (%d)\n", signal_status_to_str(bit), bit); + return; + } + bit = (bit & 1) ^ s->invert; + s->rx.bits++; + switch (s->pattern_class) + { + case 0: + if (s->rx.resync) + { + s->rx.reg = (s->rx.reg >> 1) | (bit << s->shift2); + s->rx.ref_reg = (s->rx.ref_reg >> 1) | ((s->rx.ref_reg & 1) << s->shift2); + if (s->rx.reg == s->rx.ref_reg) + { + if (++s->rx.resync > s->resync_time) + { + s->rx.resync = 0; + if (s->reporter) + s->reporter(s->user_data, BERT_REPORT_SYNCED, &s->results); + } + } + else + { + s->rx.resync = 2; + s->rx.ref_reg = s->rx.master_reg; + } + } + else + { + s->results.total_bits++; + if ((bit ^ s->rx.ref_reg) & 1) + s->results.bad_bits++; + s->rx.ref_reg = (s->rx.ref_reg >> 1) | ((s->rx.ref_reg & 1) << s->shift2); + } + break; + case 1: + if (s->rx.resync) + { + /* If we get a reasonable period for which we correctly predict the + next bit, we must be in sync. */ + /* Don't worry about max. zeros tests when resyncing. + It might just extend the resync time a little. Trying + to include the test might affect robustness. */ + if (bit == (int) ((s->rx.reg >> s->shift) & 1)) + { + if (++s->rx.resync > s->resync_time) + { + s->rx.resync = 0; + if (s->reporter) + s->reporter(s->user_data, BERT_REPORT_SYNCED, &s->results); + } + } + else + { + s->rx.resync = 2; + s->rx.reg ^= s->mask; + } + } + else + { + s->results.total_bits++; + if (s->max_zeros) + { + /* This generator suppresses runs >s->max_zeros */ + if ((s->rx.reg & s->mask)) + { + if (++s->rx.zeros > s->max_zeros) + { + s->rx.zeros = 0; + bit ^= 1; + } + } + else + { + s->rx.zeros = 0; + } + } + if (bit != (int) ((s->rx.reg >> s->shift) & 1)) + { + s->results.bad_bits++; + s->rx.resync_bad_bits++; + s->decade_bad[2][s->decade_ptr[2]]++; + } + if (--s->rx.measurement_step <= 0) + { + /* Every hundred bits we need to do the error rate measurement */ + s->rx.measurement_step = MEASUREMENT_STEP; + assess_error_rate(s); + } + if (--s->rx.resync_cnt <= 0) + { + /* Check if there were enough bad bits during this period to + justify a resync. */ + if (s->rx.resync_bad_bits >= (s->rx.resync_len*s->rx.resync_percent)/100) + { + s->rx.resync = 1; + s->results.resyncs++; + if (s->reporter) + s->reporter(s->user_data, BERT_REPORT_UNSYNCED, &s->results); + } + s->rx.resync_cnt = s->rx.resync_len; + s->rx.resync_bad_bits = 0; + } + } + s->rx.reg = (s->rx.reg >> 1) | (((s->rx.reg ^ (s->rx.reg >> s->shift)) & 1) << s->shift2); + break; + case 2: + s->rx.reg = (s->rx.reg >> 1) | (bit << 6); + /* TODO: There is no mechanism for synching yet. This only works if things start in sync. */ + if (++s->rx.step_bit == 7) + { + s->rx.step_bit = 0; + if ((int) s->rx.reg != qbf[s->rx.step]) + { + /* We need to work out the number of actual bad bits here. We need to look at the + error rate, and see it a resync is needed. etc. */ + s->results.bad_bits++; + } + if (qbf[++s->rx.step] == '\0') + s->rx.step = 0; + } + s->results.total_bits++; + break; + } + if (s->report_frequency > 0) + { + if (--s->rx.report_countdown <= 0) + { + if (s->reporter) + s->reporter(s->user_data, BERT_REPORT_REGULAR, &s->results); + s->rx.report_countdown = s->report_frequency; + } + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) bert_result(bert_state_t *s, bert_results_t *results) +{ + results->total_bits = s->results.total_bits; + results->bad_bits = s->results.bad_bits; + results->resyncs = s->results.resyncs; + return sizeof(*results); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) bert_set_report(bert_state_t *s, int freq, bert_report_func_t reporter, void *user_data) +{ + s->report_frequency = freq; + s->reporter = reporter; + s->user_data = user_data; + + s->rx.report_countdown = s->report_frequency; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(bert_state_t *) bert_init(bert_state_t *s, int limit, int pattern, int resync_len, int resync_percent) +{ + int i; + int j; + + if (s == NULL) + { + if ((s = (bert_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + + s->pattern = pattern; + s->limit = limit; + s->reporter = NULL; + s->user_data = NULL; + s->report_frequency = 0; + + s->resync_time = 72; + s->invert = 0; + switch (s->pattern) + { + case BERT_PATTERN_ZEROS: + s->tx.reg = 0; + s->shift2 = 31; + s->pattern_class = 0; + break; + case BERT_PATTERN_ONES: + s->tx.reg = ~((uint32_t) 0); + s->shift2 = 31; + s->pattern_class = 0; + break; + case BERT_PATTERN_7_TO_1: + s->tx.reg = 0xFEFEFEFE; + s->shift2 = 31; + s->pattern_class = 0; + break; + case BERT_PATTERN_3_TO_1: + s->tx.reg = 0xEEEEEEEE; + s->shift2 = 31; + s->pattern_class = 0; + break; + case BERT_PATTERN_1_TO_1: + s->tx.reg = 0xAAAAAAAA; + s->shift2 = 31; + s->pattern_class = 0; + break; + case BERT_PATTERN_1_TO_3: + s->tx.reg = 0x11111111; + s->shift2 = 31; + s->pattern_class = 0; + break; + case BERT_PATTERN_1_TO_7: + s->tx.reg = 0x01010101; + s->shift2 = 31; + s->pattern_class = 0; + break; + case BERT_PATTERN_QBF: + s->tx.reg = 0; + s->pattern_class = 2; + break; + case BERT_PATTERN_ITU_O151_23: + s->pattern_class = 1; + s->tx.reg = 0x7FFFFF; + s->mask = 0x20; + s->shift = 5; + s->shift2 = 22; + s->invert = 1; + s->resync_time = 56; + s->max_zeros = 0; + break; + case BERT_PATTERN_ITU_O151_20: + s->pattern_class = 1; + s->tx.reg = 0xFFFFF; + s->mask = 0x8; + s->shift = 3; + s->shift2 = 19; + s->invert = 1; + s->resync_time = 50; + s->max_zeros = 14; + break; + case BERT_PATTERN_ITU_O151_15: + s->pattern_class = 1; + s->tx.reg = 0x7FFF; + s->mask = 0x2; + s->shift = 1; + s->shift2 = 14; + s->invert = 1; + s->resync_time = 40; + s->max_zeros = 0; + break; + case BERT_PATTERN_ITU_O152_11: + s->pattern_class = 1; + s->tx.reg = 0x7FF; + s->mask = 0x4; + s->shift = 2; + s->shift2 = 10; + s->invert = 0; + s->resync_time = 32; + s->max_zeros = 0; + break; + case BERT_PATTERN_ITU_O153_9: + s->pattern_class = 1; + s->tx.reg = 0x1FF; + s->mask = 0x10; + s->shift = 4; + s->shift2 = 8; + s->invert = 0; + s->resync_time = 28; + s->max_zeros = 0; + break; + } + s->tx.bits = 0; + s->tx.step = 0; + s->tx.step_bit = 0; + s->tx.zeros = 0; + + s->rx.reg = s->tx.reg; + s->rx.ref_reg = s->rx.reg; + s->rx.master_reg = s->rx.ref_reg; + s->rx.bits = 0; + s->rx.step = 0; + s->rx.step_bit = 0; + + s->rx.resync = 1; + s->rx.resync_cnt = resync_len; + s->rx.resync_bad_bits = 0; + s->rx.resync_len = resync_len; + s->rx.resync_percent = resync_percent; + + s->results.total_bits = 0; + s->results.bad_bits = 0; + s->results.resyncs = 0; + + s->rx.report_countdown = 0; + + for (i = 0; i < 8; i++) + { + for (j = 0; j < 10; j++) + s->decade_bad[i][j] = 0; + s->decade_ptr[i] = 0; + } + s->error_rate = 8; + s->rx.measurement_step = MEASUREMENT_STEP; + + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "BERT"); + + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) bert_release(bert_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) bert_free(bert_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/bit_operations.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/bit_operations.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,181 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * bit_operations.c - Various bit level operations, such as bit reversal + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: bit_operations.c,v 1.16 2009/02/03 16:28:39 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/bit_operations.h" + +SPAN_DECLARE(uint16_t) bit_reverse16(uint16_t x) +{ + x = (x >> 8) | (x << 8); + x = ((x & 0xF0F0) >> 4) | ((x & 0x0F0F) << 4); + x = ((x & 0xCCCC) >> 2) | ((x & 0x3333) << 2); + return ((x & 0xAAAA) >> 1) | ((x & 0x5555) << 1); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(uint32_t) bit_reverse32(uint32_t x) +{ + x = (x >> 16) | (x << 16); + x = ((x & 0xFF00FF00) >> 8) | ((x & 0x00FF00FF) << 8); + x = ((x & 0xF0F0F0F0) >> 4) | ((x & 0x0F0F0F0F) << 4); + x = ((x & 0xCCCCCCCC) >> 2) | ((x & 0x33333333) << 2); + return ((x & 0xAAAAAAAA) >> 1) | ((x & 0x55555555) << 1); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(uint32_t) bit_reverse_4bytes(uint32_t x) +{ + x = ((x & 0xF0F0F0F0) >> 4) | ((x & 0x0F0F0F0F) << 4); + x = ((x & 0xCCCCCCCC) >> 2) | ((x & 0x33333333) << 2); + return ((x & 0xAAAAAAAA) >> 1) | ((x & 0x55555555) << 1); +} +/*- End of function --------------------------------------------------------*/ + +#if defined(__x86_64__) +SPAN_DECLARE(uint64_t) bit_reverse_8bytes(uint64_t x) +{ + x = ((x & 0xF0F0F0F0F0F0F0F0LLU) >> 4) | ((x & 0x0F0F0F0F0F0F0F0FLLU) << 4); + x = ((x & 0xCCCCCCCCCCCCCCCCLLU) >> 2) | ((x & 0x3333333333333333LLU) << 2); + return ((x & 0xAAAAAAAAAAAAAAAALLU) >> 1) | ((x & 0x5555555555555555LLU) << 1); +} +/*- End of function --------------------------------------------------------*/ +#endif + +SPAN_DECLARE(void) bit_reverse(uint8_t to[], const uint8_t from[], int len) +{ +#if defined(SPANDSP_MISALIGNED_ACCESS_FAILS) + int i; +#else + const uint8_t *y1; + uint8_t *z1; + const uint32_t *y4; + uint32_t *z4; + uint32_t x4; +#if defined(__x86_64__) + const uint64_t *y8; + uint64_t *z8; + uint64_t x8; +#endif +#endif + +#if defined(SPANDSP_MISALIGNED_ACCESS_FAILS) + /* This code works byte by byte, so it works on machines where misalignment + is either desperately slow (its a bit slow on practically any machine, but + some machines make it desparately slow) or fails. */ + for (i = 0; i < len; i++) + to[i] = bit_reverse8(from[i]); +#else + /* This code is this is based on the woolly assumption that the start of the buffers + is memory aligned. If it isn't, the routine will be less efficient on some machines, + but might not work at all on others. */ +#if defined(__x86_64__) + y8 = (const uint64_t *) from; + z8 = (uint64_t *) to; + while (len >= sizeof(uint64_t)) + { + x8 = *y8++; + x8 = ((x8 & 0xF0F0F0F0F0F0F0F0LLU) >> 4) | ((x8 & 0x0F0F0F0F0F0F0F0FLLU) << 4); + x8 = ((x8 & 0xCCCCCCCCCCCCCCCCLLU) >> 2) | ((x8 & 0x3333333333333333LLU) << 2); + *z8++ = ((x8 & 0xAAAAAAAAAAAAAAAALLU) >> 1) | ((x8 & 0x5555555555555555LLU) << 1); + len -= sizeof(uint64_t); + } + y4 = (const uint32_t *) y8; + z4 = (uint32_t *) z8; +#else + y4 = (const uint32_t *) from; + z4 = (uint32_t *) to; +#endif + while (len >= sizeof(uint32_t)) + { + x4 = *y4++; + x4 = ((x4 & 0xF0F0F0F0) >> 4) | ((x4 & 0x0F0F0F0F) << 4); + x4 = ((x4 & 0xCCCCCCCC) >> 2) | ((x4 & 0x33333333) << 2); + *z4++ = ((x4 & 0xAAAAAAAA) >> 1) | ((x4 & 0x55555555) << 1); + len -= sizeof(uint32_t); + } + y1 = (const uint8_t *) y4; + z1 = (uint8_t *) z4; + while (len-- > 0) + *z1++ = bit_reverse8(*y1++); +#endif +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) one_bits32(uint32_t x) +{ + x = x - ((x >> 1) & 0x55555555); + /* We now have 16 2-bit counts */ + x = (x & 0x33333333) + ((x >> 2) & 0x33333333); + /* We now have 8 4-bit counts */ + x = (x + (x >> 4)) & 0x0F0F0F0F; + /* We now have 4 8-bit counts */ +#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__powerpc__) + /* If multiply is fast */ + return (x*0x01010101) >> 24; +#else + /* If multiply is slow */ + x += (x >> 8); + x += (x >> 16); + return (x & 0x0000003F); +#endif +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(uint32_t) make_mask32(uint32_t x) +{ + x |= (x >> 1); + x |= (x >> 2); + x |= (x >> 4); + x |= (x >> 8); + x |= (x >> 16); + return x; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(uint16_t) make_mask16(uint16_t x) +{ + x |= (x >> 1); + x |= (x >> 2); + x |= (x >> 4); + x |= (x >> 8); + return x; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/bitstream.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/bitstream.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,148 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * bitstream.c - Bitstream composition and decomposition routines. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: bitstream.c,v 1.18.4.1 2009/12/28 12:20:46 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/bitstream.h" + +#include "spandsp/private/bitstream.h" + +SPAN_DECLARE(void) bitstream_put(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits) +{ + value &= ((1 << bits) - 1); + if (s->lsb_first) + { + if (s->residue + bits <= 32) + { + s->bitstream |= (value << s->residue); + s->residue += bits; + } + while (s->residue >= 8) + { + s->residue -= 8; + *(*c)++ = (uint8_t) (s->bitstream & 0xFF); + s->bitstream >>= 8; + } + } + else + { + if (s->residue + bits <= 32) + { + s->bitstream = (s->bitstream << bits) | value; + s->residue += bits; + } + while (s->residue >= 8) + { + s->residue -= 8; + *(*c)++ = (uint8_t) ((s->bitstream >> s->residue) & 0xFF); + } + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) bitstream_flush(bitstream_state_t *s, uint8_t **c) +{ + if (s->residue > 0) + { + s->bitstream &= ((1 << s->residue) - 1); + if (s->lsb_first) + *(*c)++ = (uint8_t) s->bitstream; + else + *(*c)++ = (uint8_t) (s->bitstream << (8 - s->residue)); + s->residue = 0; + } + s->bitstream = 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(uint32_t) bitstream_get(bitstream_state_t *s, const uint8_t **c, int bits) +{ + uint32_t x; + + if (s->lsb_first) + { + while (s->residue < bits) + { + s->bitstream |= (((uint32_t) *(*c)++) << s->residue); + s->residue += 8; + } + s->residue -= bits; + x = s->bitstream & ((1 << bits) - 1); + s->bitstream >>= bits; + } + else + { + while (s->residue < bits) + { + s->bitstream = (s->bitstream << 8) | ((uint32_t) *(*c)++); + s->residue += 8; + } + s->residue -= bits; + x = (s->bitstream >> s->residue) & ((1 << bits) - 1); + } + return x; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s, int lsb_first) +{ + if (s == NULL) + { + if ((s = (bitstream_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + s->bitstream = 0; + s->residue = 0; + s->lsb_first = lsb_first; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) bitstream_release(bitstream_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) bitstream_free(bitstream_state_t *s) +{ + if (s) + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/complex_filters.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/complex_filters.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,112 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * complex_filters.c + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: complex_filters.c,v 1.16 2009/02/03 16:28:39 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/complex.h" +#include "spandsp/complex_filters.h" + +SPAN_DECLARE(filter_t *) filter_create(fspec_t *fs) +{ + int i; + filter_t *fi; + + if ((fi = (filter_t *) malloc(sizeof(*fi) + sizeof(float)*(fs->np + 1)))) + { + fi->fs = fs; + fi->sum = 0.0; + /* Moving average filters only */ + fi->ptr = 0; + for (i = 0; i <= fi->fs->np; i++) + fi->v[i] = 0.0; + } + return fi; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) filter_delete(filter_t *fi) +{ + if (fi) + free(fi); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) filter_step(filter_t *fi, float x) +{ + return fi->fs->fsf(fi, x); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(cfilter_t *) cfilter_create(fspec_t *fs) +{ + cfilter_t *cfi; + + if ((cfi = (cfilter_t *) malloc(sizeof(*cfi)))) + { + if ((cfi->ref = filter_create(fs)) == NULL) + { + free(cfi); + return NULL; + } + if ((cfi->imf = filter_create(fs)) == NULL) + { + free(cfi->ref); + free(cfi); + return NULL; + } + } + return cfi; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) cfilter_delete(cfilter_t *cfi) +{ + if (cfi) + { + filter_delete(cfi->ref); + filter_delete(cfi->imf); + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(complexf_t) cfilter_step(cfilter_t *cfi, const complexf_t *z) +{ + complexf_t cc; + + cc.re = filter_step(cfi->ref, z->re); + cc.im = filter_step(cfi->imf, z->im); + return cc; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/complex_vector_float.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/complex_vector_float.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,208 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * complex_vector_float.c - Floating complex vector arithmetic routines. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: complex_vector_float.c,v 1.16 2009/07/12 09:23:09 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include + +#include "floating_fudge.h" +#include "mmx_sse_decs.h" + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/complex.h" +#include "spandsp/vector_float.h" +#include "spandsp/complex_vector_float.h" + +#if defined(__GNUC__) && defined(SPANDSP_USE_SSE3) +SPAN_DECLARE(void) cvec_mulf(complexf_t z[], const complexf_t x[], const complexf_t y[], int n) +{ + int i; + __m128 n0; + __m128 n1; + __m128 n2; + __m128 n3; + + if ((i = n & ~1)) + { + i <<= 1; + for (i -= 4; i >= 0; i -= 4) + { + n3 = _mm_loadu_ps((float *) x + i); + n0 = _mm_moveldup_ps(n3); + n1 = _mm_loadu_ps((float *) y + i); + n0 = _mm_mul_ps(n0, n1); + n1 = _mm_shuffle_ps(n1, n1, 0xB1); + n2 = _mm_movehdup_ps(n3); + n2 = _mm_mul_ps(n2, n1); + n0 = _mm_addsub_ps(n0, n2); + _mm_storeu_ps((float *) z + i, n0); + } + } + /* Now deal with the last element, which doesn't fill an SSE2 register */ + switch (n & 1) + { + case 1: + z[n - 1].re = x[n - 1].re*y[n - 1].re - x[n - 1].im*y[n - 1].im; + z[n - 1].im = x[n - 1].re*y[n - 1].im + x[n - 1].im*y[n - 1].re; + } +} +#else +SPAN_DECLARE(void) cvec_mulf(complexf_t z[], const complexf_t x[], const complexf_t y[], int n) +{ + int i; + + for (i = 0; i < n; i++) + { + z[i].re = x[i].re*y[i].re - x[i].im*y[i].im; + z[i].im = x[i].re*y[i].im + x[i].im*y[i].re; + } +} +#endif +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) cvec_mul(complex_t z[], const complex_t x[], const complex_t y[], int n) +{ + int i; + + for (i = 0; i < n; i++) + { + z[i].re = x[i].re*y[i].re - x[i].im*y[i].im; + z[i].im = x[i].re*y[i].im + x[i].im*y[i].re; + } +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) cvec_mull(complexl_t z[], const complexl_t x[], const complexl_t y[], int n) +{ + int i; + + for (i = 0; i < n; i++) + { + z[i].re = x[i].re*y[i].re - x[i].im*y[i].im; + z[i].im = x[i].re*y[i].im + x[i].im*y[i].re; + } +} +/*- End of function --------------------------------------------------------*/ +#endif + +SPAN_DECLARE(complexf_t) cvec_dot_prodf(const complexf_t x[], const complexf_t y[], int n) +{ + int i; + complexf_t z; + + z = complex_setf(0.0f, 0.0f); + for (i = 0; i < n; i++) + { + z.re += (x[i].re*y[i].re - x[i].im*y[i].im); + z.im += (x[i].re*y[i].im + x[i].im*y[i].re); + } + return z; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(complex_t) cvec_dot_prod(const complex_t x[], const complex_t y[], int n) +{ + int i; + complex_t z; + + z = complex_set(0.0, 0.0); + for (i = 0; i < n; i++) + { + z.re += (x[i].re*y[i].re - x[i].im*y[i].im); + z.im += (x[i].re*y[i].im + x[i].im*y[i].re); + } + return z; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(complexl_t) cvec_dot_prodl(const complexl_t x[], const complexl_t y[], int n) +{ + int i; + complexl_t z; + + z = complex_setl(0.0L, 0.0L); + for (i = 0; i < n; i++) + { + z.re += (x[i].re*y[i].re - x[i].im*y[i].im); + z.im += (x[i].re*y[i].im + x[i].im*y[i].re); + } + return z; +} +/*- End of function --------------------------------------------------------*/ +#endif + +SPAN_DECLARE(complexf_t) cvec_circular_dot_prodf(const complexf_t x[], const complexf_t y[], int n, int pos) +{ + complexf_t z; + complexf_t z1; + + z = cvec_dot_prodf(&x[pos], &y[0], n - pos); + z1 = cvec_dot_prodf(&x[0], &y[n - pos], pos); + z = complex_addf(&z, &z1); + return z; +} +/*- End of function --------------------------------------------------------*/ + +#define LMS_LEAK_RATE 0.9999f + +SPAN_DECLARE(void) cvec_lmsf(const complexf_t x[], complexf_t y[], int n, const complexf_t *error) +{ + int i; + + for (i = 0; i < n; i++) + { + /* Leak a little to tame uncontrolled wandering */ + y[i].re = y[i].re*LMS_LEAK_RATE + (x[i].im*error->im + x[i].re*error->re); + y[i].im = y[i].im*LMS_LEAK_RATE + (x[i].re*error->im - x[i].im*error->re); + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) cvec_circular_lmsf(const complexf_t x[], complexf_t y[], int n, int pos, const complexf_t *error) +{ + cvec_lmsf(&x[pos], &y[0], n - pos, error); + cvec_lmsf(&x[0], &y[n - pos], pos, error); +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/complex_vector_int.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/complex_vector_int.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,115 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * complex_vector_int.c - Integer complex vector arithmetic routines. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: complex_vector_int.c,v 1.9 2009/07/12 09:23:09 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include + +#include "floating_fudge.h" +#include "mmx_sse_decs.h" + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/complex.h" +#include "spandsp/vector_int.h" +#include "spandsp/complex_vector_int.h" + +SPAN_DECLARE(complexi32_t) cvec_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n) +{ + int i; + complexi32_t z; + + z = complex_seti32(0, 0); + for (i = 0; i < n; i++) + { + z.re += ((int32_t) x[i].re*(int32_t) y[i].re - (int32_t) x[i].im*(int32_t) y[i].im); + z.im += ((int32_t) x[i].re*(int32_t) y[i].im + (int32_t) x[i].im*(int32_t) y[i].re); + } + return z; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(complexi32_t) cvec_dot_prodi32(const complexi32_t x[], const complexi32_t y[], int n) +{ + int i; + complexi32_t z; + + z = complex_seti32(0, 0); + for (i = 0; i < n; i++) + { + z.re += (x[i].re*y[i].re - x[i].im*y[i].im); + z.im += (x[i].re*y[i].im + x[i].im*y[i].re); + } + return z; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(complexi32_t) cvec_circular_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n, int pos) +{ + complexi32_t z; + complexi32_t z1; + + z = cvec_dot_prodi16(&x[pos], &y[0], n - pos); + z1 = cvec_dot_prodi16(&x[0], &y[n - pos], pos); + z = complex_addi32(&z, &z1); + return z; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) cvec_lmsi16(const complexi16_t x[], complexi16_t y[], int n, const complexi16_t *error) +{ + int i; + + for (i = 0; i < n; i++) + { + y[i].re += (int16_t) (((int32_t) x[i].im*(int32_t) error->im + (int32_t) x[i].re*(int32_t) error->re) >> 12); + y[i].im += (int16_t) (((int32_t) x[i].re*(int32_t) error->im - (int32_t) x[i].im*(int32_t) error->re) >> 12); + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) cvec_circular_lmsi16(const complexi16_t x[], complexi16_t y[], int n, int pos, const complexi16_t *error) +{ + cvec_lmsi16(&x[pos], &y[0], n - pos, error); + cvec_lmsi16(&x[0], &y[n - pos], pos, error); +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/crc.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/crc.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,225 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * crc.c + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: crc.c,v 1.6 2009/02/03 16:28:39 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/crc.h" +#include "spandsp/bit_operations.h" + +static const uint32_t crc_itu32_table[] = +{ + 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 +}; + +SPAN_DECLARE(uint32_t) crc_itu32_calc(const uint8_t *buf, int len, uint32_t crc) +{ + int i; + + for (i = 0; i < len; i++) + crc = ((crc >> 8) & 0x00FFFFFF) ^ crc_itu32_table[(crc ^ buf[i]) & 0xFF]; + return crc; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) crc_itu32_append(uint8_t *buf, int len) +{ + uint32_t crc; + int new_len; + int i; + + crc = 0xFFFFFFFF; + new_len = len + 4; + for (i = 0; i < len; i++) + crc = ((crc >> 8) & 0x00FFFFFF) ^ crc_itu32_table[(crc ^ buf[i]) & 0xFF]; + crc ^= 0xFFFFFFFF; + buf[i++] = (uint8_t) crc; + buf[i++] = (uint8_t) (crc >> 8); + buf[i++] = (uint8_t) (crc >> 16); + buf[i++] = (uint8_t) (crc >> 24); + return new_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) crc_itu32_check(const uint8_t *buf, int len) +{ + uint32_t crc; + int i; + + crc = 0xFFFFFFFF; + for (i = 0; i < len; i++) + crc = ((crc >> 8) & 0x00FFFFFF) ^ crc_itu32_table[(crc ^ buf[i]) & 0xFF]; + return (crc == 0xDEBB20E3); +} +/*- End of function --------------------------------------------------------*/ + +static const uint16_t crc_itu16_table[] = +{ + 0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF, + 0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7, + 0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E, + 0x9CC9, 0x8D40, 0xBFDB, 0xAE52, 0xDAED, 0xCB64, 0xF9FF, 0xE876, + 0x2102, 0x308B, 0x0210, 0x1399, 0x6726, 0x76AF, 0x4434, 0x55BD, + 0xAD4A, 0xBCC3, 0x8E58, 0x9FD1, 0xEB6E, 0xFAE7, 0xC87C, 0xD9F5, + 0x3183, 0x200A, 0x1291, 0x0318, 0x77A7, 0x662E, 0x54B5, 0x453C, + 0xBDCB, 0xAC42, 0x9ED9, 0x8F50, 0xFBEF, 0xEA66, 0xD8FD, 0xC974, + 0x4204, 0x538D, 0x6116, 0x709F, 0x0420, 0x15A9, 0x2732, 0x36BB, + 0xCE4C, 0xDFC5, 0xED5E, 0xFCD7, 0x8868, 0x99E1, 0xAB7A, 0xBAF3, + 0x5285, 0x430C, 0x7197, 0x601E, 0x14A1, 0x0528, 0x37B3, 0x263A, + 0xDECD, 0xCF44, 0xFDDF, 0xEC56, 0x98E9, 0x8960, 0xBBFB, 0xAA72, + 0x6306, 0x728F, 0x4014, 0x519D, 0x2522, 0x34AB, 0x0630, 0x17B9, + 0xEF4E, 0xFEC7, 0xCC5C, 0xDDD5, 0xA96A, 0xB8E3, 0x8A78, 0x9BF1, + 0x7387, 0x620E, 0x5095, 0x411C, 0x35A3, 0x242A, 0x16B1, 0x0738, + 0xFFCF, 0xEE46, 0xDCDD, 0xCD54, 0xB9EB, 0xA862, 0x9AF9, 0x8B70, + 0x8408, 0x9581, 0xA71A, 0xB693, 0xC22C, 0xD3A5, 0xE13E, 0xF0B7, + 0x0840, 0x19C9, 0x2B52, 0x3ADB, 0x4E64, 0x5FED, 0x6D76, 0x7CFF, + 0x9489, 0x8500, 0xB79B, 0xA612, 0xD2AD, 0xC324, 0xF1BF, 0xE036, + 0x18C1, 0x0948, 0x3BD3, 0x2A5A, 0x5EE5, 0x4F6C, 0x7DF7, 0x6C7E, + 0xA50A, 0xB483, 0x8618, 0x9791, 0xE32E, 0xF2A7, 0xC03C, 0xD1B5, + 0x2942, 0x38CB, 0x0A50, 0x1BD9, 0x6F66, 0x7EEF, 0x4C74, 0x5DFD, + 0xB58B, 0xA402, 0x9699, 0x8710, 0xF3AF, 0xE226, 0xD0BD, 0xC134, + 0x39C3, 0x284A, 0x1AD1, 0x0B58, 0x7FE7, 0x6E6E, 0x5CF5, 0x4D7C, + 0xC60C, 0xD785, 0xE51E, 0xF497, 0x8028, 0x91A1, 0xA33A, 0xB2B3, + 0x4A44, 0x5BCD, 0x6956, 0x78DF, 0x0C60, 0x1DE9, 0x2F72, 0x3EFB, + 0xD68D, 0xC704, 0xF59F, 0xE416, 0x90A9, 0x8120, 0xB3BB, 0xA232, + 0x5AC5, 0x4B4C, 0x79D7, 0x685E, 0x1CE1, 0x0D68, 0x3FF3, 0x2E7A, + 0xE70E, 0xF687, 0xC41C, 0xD595, 0xA12A, 0xB0A3, 0x8238, 0x93B1, + 0x6B46, 0x7ACF, 0x4854, 0x59DD, 0x2D62, 0x3CEB, 0x0E70, 0x1FF9, + 0xF78F, 0xE606, 0xD49D, 0xC514, 0xB1AB, 0xA022, 0x92B9, 0x8330, + 0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78 +}; + +SPAN_DECLARE(uint16_t) crc_itu16_calc(const uint8_t *buf, int len, uint16_t crc) +{ + int i; + + for (i = 0; i < len; i++) + crc = (crc >> 8) ^ crc_itu16_table[(crc ^ buf[i]) & 0xFF]; + return crc; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) crc_itu16_append(uint8_t *buf, int len) +{ + uint16_t crc; + int new_len; + int i; + + crc = 0xFFFF; + new_len = len + 2; + for (i = 0; i < len; i++) + crc = (crc >> 8) ^ crc_itu16_table[(crc ^ buf[i]) & 0xFF]; + crc ^= 0xFFFF; + buf[i++] = (uint8_t) crc; + buf[i++] = (uint8_t) (crc >> 8); + return new_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) crc_itu16_check(const uint8_t *buf, int len) +{ + uint16_t crc; + int i; + + crc = 0xFFFF; + for (i = 0; i < len; i++) + crc = (crc >> 8) ^ crc_itu16_table[(crc ^ buf[i]) & 0xFF]; + return (crc & 0xFFFF) == 0xF0B8; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/dds_float.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/dds_float.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,2189 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * complex_dds.c + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: dds_float.c,v 1.11 2009/02/03 16:28:39 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/complex.h" +#include "spandsp/dds.h" + +#define SLENK 11 +#define SINELEN (1 << SLENK) + +/* Precreating this table allows it to be in const memory, which might + have some performance advantage. */ +static const float sine_table[SINELEN] = +{ + 0.00000000f, + 0.00306796f, + 0.00613588f, + 0.00920375f, + 0.01227154f, + 0.01533921f, + 0.01840673f, + 0.02147408f, + 0.02454123f, + 0.02760815f, + 0.03067480f, + 0.03374117f, + 0.03680722f, + 0.03987293f, + 0.04293826f, + 0.04600318f, + 0.04906767f, + 0.05213170f, + 0.05519524f, + 0.05825826f, + 0.06132074f, + 0.06438263f, + 0.06744392f, + 0.07050457f, + 0.07356456f, + 0.07662386f, + 0.07968244f, + 0.08274026f, + 0.08579731f, + 0.08885355f, + 0.09190896f, + 0.09496350f, + 0.09801714f, + 0.10106986f, + 0.10412163f, + 0.10717242f, + 0.11022221f, + 0.11327095f, + 0.11631863f, + 0.11936521f, + 0.12241068f, + 0.12545498f, + 0.12849811f, + 0.13154003f, + 0.13458071f, + 0.13762012f, + 0.14065824f, + 0.14369503f, + 0.14673047f, + 0.14976453f, + 0.15279719f, + 0.15582840f, + 0.15885814f, + 0.16188639f, + 0.16491312f, + 0.16793829f, + 0.17096189f, + 0.17398387f, + 0.17700422f, + 0.18002290f, + 0.18303989f, + 0.18605515f, + 0.18906866f, + 0.19208040f, + 0.19509032f, + 0.19809841f, + 0.20110463f, + 0.20410897f, + 0.20711138f, + 0.21011184f, + 0.21311032f, + 0.21610680f, + 0.21910124f, + 0.22209362f, + 0.22508391f, + 0.22807208f, + 0.23105811f, + 0.23404196f, + 0.23702361f, + 0.24000302f, + 0.24298018f, + 0.24595505f, + 0.24892761f, + 0.25189782f, + 0.25486566f, + 0.25783110f, + 0.26079412f, + 0.26375468f, + 0.26671276f, + 0.26966833f, + 0.27262136f, + 0.27557182f, + 0.27851969f, + 0.28146494f, + 0.28440754f, + 0.28734746f, + 0.29028468f, + 0.29321916f, + 0.29615089f, + 0.29907983f, + 0.30200595f, + 0.30492923f, + 0.30784964f, + 0.31076715f, + 0.31368174f, + 0.31659338f, + 0.31950203f, + 0.32240768f, + 0.32531029f, + 0.32820984f, + 0.33110631f, + 0.33399965f, + 0.33688985f, + 0.33977688f, + 0.34266072f, + 0.34554132f, + 0.34841868f, + 0.35129276f, + 0.35416353f, + 0.35703096f, + 0.35989504f, + 0.36275572f, + 0.36561300f, + 0.36846683f, + 0.37131719f, + 0.37416406f, + 0.37700741f, + 0.37984721f, + 0.38268343f, + 0.38551605f, + 0.38834505f, + 0.39117038f, + 0.39399204f, + 0.39680999f, + 0.39962420f, + 0.40243465f, + 0.40524131f, + 0.40804416f, + 0.41084317f, + 0.41363831f, + 0.41642956f, + 0.41921689f, + 0.42200027f, + 0.42477968f, + 0.42755509f, + 0.43032648f, + 0.43309382f, + 0.43585708f, + 0.43861624f, + 0.44137127f, + 0.44412214f, + 0.44686884f, + 0.44961133f, + 0.45234959f, + 0.45508359f, + 0.45781330f, + 0.46053871f, + 0.46325978f, + 0.46597650f, + 0.46868882f, + 0.47139674f, + 0.47410021f, + 0.47679923f, + 0.47949376f, + 0.48218377f, + 0.48486925f, + 0.48755016f, + 0.49022648f, + 0.49289819f, + 0.49556526f, + 0.49822767f, + 0.50088538f, + 0.50353838f, + 0.50618665f, + 0.50883014f, + 0.51146885f, + 0.51410274f, + 0.51673180f, + 0.51935599f, + 0.52197529f, + 0.52458968f, + 0.52719913f, + 0.52980362f, + 0.53240313f, + 0.53499762f, + 0.53758708f, + 0.54017147f, + 0.54275078f, + 0.54532499f, + 0.54789406f, + 0.55045797f, + 0.55301671f, + 0.55557023f, + 0.55811853f, + 0.56066158f, + 0.56319934f, + 0.56573181f, + 0.56825895f, + 0.57078075f, + 0.57329717f, + 0.57580819f, + 0.57831380f, + 0.58081396f, + 0.58330865f, + 0.58579786f, + 0.58828155f, + 0.59075970f, + 0.59323230f, + 0.59569930f, + 0.59816071f, + 0.60061648f, + 0.60306660f, + 0.60551104f, + 0.60794978f, + 0.61038281f, + 0.61281008f, + 0.61523159f, + 0.61764731f, + 0.62005721f, + 0.62246128f, + 0.62485949f, + 0.62725182f, + 0.62963824f, + 0.63201874f, + 0.63439328f, + 0.63676186f, + 0.63912444f, + 0.64148101f, + 0.64383154f, + 0.64617601f, + 0.64851440f, + 0.65084668f, + 0.65317284f, + 0.65549285f, + 0.65780669f, + 0.66011434f, + 0.66241578f, + 0.66471098f, + 0.66699992f, + 0.66928259f, + 0.67155895f, + 0.67382900f, + 0.67609270f, + 0.67835004f, + 0.68060100f, + 0.68284555f, + 0.68508367f, + 0.68731534f, + 0.68954054f, + 0.69175926f, + 0.69397146f, + 0.69617713f, + 0.69837625f, + 0.70056879f, + 0.70275474f, + 0.70493408f, + 0.70710678f, + 0.70927283f, + 0.71143220f, + 0.71358487f, + 0.71573083f, + 0.71787005f, + 0.72000251f, + 0.72212819f, + 0.72424708f, + 0.72635916f, + 0.72846439f, + 0.73056277f, + 0.73265427f, + 0.73473888f, + 0.73681657f, + 0.73888732f, + 0.74095113f, + 0.74300795f, + 0.74505779f, + 0.74710061f, + 0.74913639f, + 0.75116513f, + 0.75318680f, + 0.75520138f, + 0.75720885f, + 0.75920919f, + 0.76120239f, + 0.76318842f, + 0.76516727f, + 0.76713891f, + 0.76910334f, + 0.77106052f, + 0.77301045f, + 0.77495311f, + 0.77688847f, + 0.77881651f, + 0.78073723f, + 0.78265060f, + 0.78455660f, + 0.78645521f, + 0.78834643f, + 0.79023022f, + 0.79210658f, + 0.79397548f, + 0.79583690f, + 0.79769084f, + 0.79953727f, + 0.80137617f, + 0.80320753f, + 0.80503133f, + 0.80684755f, + 0.80865618f, + 0.81045720f, + 0.81225059f, + 0.81403633f, + 0.81581441f, + 0.81758481f, + 0.81934752f, + 0.82110251f, + 0.82284978f, + 0.82458930f, + 0.82632106f, + 0.82804505f, + 0.82976123f, + 0.83146961f, + 0.83317016f, + 0.83486287f, + 0.83654773f, + 0.83822471f, + 0.83989379f, + 0.84155498f, + 0.84320824f, + 0.84485357f, + 0.84649094f, + 0.84812034f, + 0.84974177f, + 0.85135519f, + 0.85296060f, + 0.85455799f, + 0.85614733f, + 0.85772861f, + 0.85930182f, + 0.86086694f, + 0.86242396f, + 0.86397286f, + 0.86551362f, + 0.86704625f, + 0.86857071f, + 0.87008699f, + 0.87159509f, + 0.87309498f, + 0.87458665f, + 0.87607009f, + 0.87754529f, + 0.87901223f, + 0.88047089f, + 0.88192126f, + 0.88336334f, + 0.88479710f, + 0.88622253f, + 0.88763962f, + 0.88904836f, + 0.89044872f, + 0.89184071f, + 0.89322430f, + 0.89459949f, + 0.89596625f, + 0.89732458f, + 0.89867447f, + 0.90001589f, + 0.90134885f, + 0.90267332f, + 0.90398929f, + 0.90529676f, + 0.90659570f, + 0.90788612f, + 0.90916798f, + 0.91044129f, + 0.91170603f, + 0.91296219f, + 0.91420976f, + 0.91544872f, + 0.91667906f, + 0.91790078f, + 0.91911385f, + 0.92031828f, + 0.92151404f, + 0.92270113f, + 0.92387953f, + 0.92504924f, + 0.92621024f, + 0.92736253f, + 0.92850608f, + 0.92964090f, + 0.93076696f, + 0.93188427f, + 0.93299280f, + 0.93409255f, + 0.93518351f, + 0.93626567f, + 0.93733901f, + 0.93840353f, + 0.93945922f, + 0.94050607f, + 0.94154407f, + 0.94257320f, + 0.94359346f, + 0.94460484f, + 0.94560733f, + 0.94660091f, + 0.94758559f, + 0.94856135f, + 0.94952818f, + 0.95048607f, + 0.95143502f, + 0.95237501f, + 0.95330604f, + 0.95422810f, + 0.95514117f, + 0.95604525f, + 0.95694034f, + 0.95782641f, + 0.95870347f, + 0.95957151f, + 0.96043052f, + 0.96128049f, + 0.96212140f, + 0.96295327f, + 0.96377607f, + 0.96458979f, + 0.96539444f, + 0.96619000f, + 0.96697647f, + 0.96775384f, + 0.96852209f, + 0.96928124f, + 0.97003125f, + 0.97077214f, + 0.97150389f, + 0.97222650f, + 0.97293995f, + 0.97364425f, + 0.97433938f, + 0.97502535f, + 0.97570213f, + 0.97636973f, + 0.97702814f, + 0.97767736f, + 0.97831737f, + 0.97894818f, + 0.97956977f, + 0.98018214f, + 0.98078528f, + 0.98137919f, + 0.98196387f, + 0.98253930f, + 0.98310549f, + 0.98366242f, + 0.98421009f, + 0.98474850f, + 0.98527764f, + 0.98579751f, + 0.98630810f, + 0.98680940f, + 0.98730142f, + 0.98778414f, + 0.98825757f, + 0.98872169f, + 0.98917651f, + 0.98962202f, + 0.99005821f, + 0.99048508f, + 0.99090264f, + 0.99131086f, + 0.99170975f, + 0.99209931f, + 0.99247953f, + 0.99285041f, + 0.99321195f, + 0.99356414f, + 0.99390697f, + 0.99424045f, + 0.99456457f, + 0.99487933f, + 0.99518473f, + 0.99548076f, + 0.99576741f, + 0.99604470f, + 0.99631261f, + 0.99657115f, + 0.99682030f, + 0.99706007f, + 0.99729046f, + 0.99751146f, + 0.99772307f, + 0.99792529f, + 0.99811811f, + 0.99830154f, + 0.99847558f, + 0.99864022f, + 0.99879546f, + 0.99894129f, + 0.99907773f, + 0.99920476f, + 0.99932238f, + 0.99943060f, + 0.99952942f, + 0.99961882f, + 0.99969882f, + 0.99976941f, + 0.99983058f, + 0.99988235f, + 0.99992470f, + 0.99995764f, + 0.99998118f, + 0.99999529f, + 1.00000000f, + 0.99999529f, + 0.99998118f, + 0.99995764f, + 0.99992470f, + 0.99988235f, + 0.99983058f, + 0.99976941f, + 0.99969882f, + 0.99961882f, + 0.99952942f, + 0.99943060f, + 0.99932238f, + 0.99920476f, + 0.99907773f, + 0.99894129f, + 0.99879546f, + 0.99864022f, + 0.99847558f, + 0.99830154f, + 0.99811811f, + 0.99792529f, + 0.99772307f, + 0.99751146f, + 0.99729046f, + 0.99706007f, + 0.99682030f, + 0.99657115f, + 0.99631261f, + 0.99604470f, + 0.99576741f, + 0.99548076f, + 0.99518473f, + 0.99487933f, + 0.99456457f, + 0.99424045f, + 0.99390697f, + 0.99356414f, + 0.99321195f, + 0.99285041f, + 0.99247953f, + 0.99209931f, + 0.99170975f, + 0.99131086f, + 0.99090264f, + 0.99048508f, + 0.99005821f, + 0.98962202f, + 0.98917651f, + 0.98872169f, + 0.98825757f, + 0.98778414f, + 0.98730142f, + 0.98680940f, + 0.98630810f, + 0.98579751f, + 0.98527764f, + 0.98474850f, + 0.98421009f, + 0.98366242f, + 0.98310549f, + 0.98253930f, + 0.98196387f, + 0.98137919f, + 0.98078528f, + 0.98018214f, + 0.97956977f, + 0.97894818f, + 0.97831737f, + 0.97767736f, + 0.97702814f, + 0.97636973f, + 0.97570213f, + 0.97502535f, + 0.97433938f, + 0.97364425f, + 0.97293995f, + 0.97222650f, + 0.97150389f, + 0.97077214f, + 0.97003125f, + 0.96928124f, + 0.96852209f, + 0.96775384f, + 0.96697647f, + 0.96619000f, + 0.96539444f, + 0.96458979f, + 0.96377607f, + 0.96295327f, + 0.96212140f, + 0.96128049f, + 0.96043052f, + 0.95957151f, + 0.95870347f, + 0.95782641f, + 0.95694034f, + 0.95604525f, + 0.95514117f, + 0.95422810f, + 0.95330604f, + 0.95237501f, + 0.95143502f, + 0.95048607f, + 0.94952818f, + 0.94856135f, + 0.94758559f, + 0.94660091f, + 0.94560733f, + 0.94460484f, + 0.94359346f, + 0.94257320f, + 0.94154407f, + 0.94050607f, + 0.93945922f, + 0.93840353f, + 0.93733901f, + 0.93626567f, + 0.93518351f, + 0.93409255f, + 0.93299280f, + 0.93188427f, + 0.93076696f, + 0.92964090f, + 0.92850608f, + 0.92736253f, + 0.92621024f, + 0.92504924f, + 0.92387953f, + 0.92270113f, + 0.92151404f, + 0.92031828f, + 0.91911385f, + 0.91790078f, + 0.91667906f, + 0.91544872f, + 0.91420976f, + 0.91296219f, + 0.91170603f, + 0.91044129f, + 0.90916798f, + 0.90788612f, + 0.90659570f, + 0.90529676f, + 0.90398929f, + 0.90267332f, + 0.90134885f, + 0.90001589f, + 0.89867447f, + 0.89732458f, + 0.89596625f, + 0.89459949f, + 0.89322430f, + 0.89184071f, + 0.89044872f, + 0.88904836f, + 0.88763962f, + 0.88622253f, + 0.88479710f, + 0.88336334f, + 0.88192126f, + 0.88047089f, + 0.87901223f, + 0.87754529f, + 0.87607009f, + 0.87458665f, + 0.87309498f, + 0.87159509f, + 0.87008699f, + 0.86857071f, + 0.86704625f, + 0.86551362f, + 0.86397286f, + 0.86242396f, + 0.86086694f, + 0.85930182f, + 0.85772861f, + 0.85614733f, + 0.85455799f, + 0.85296060f, + 0.85135519f, + 0.84974177f, + 0.84812034f, + 0.84649094f, + 0.84485357f, + 0.84320824f, + 0.84155498f, + 0.83989379f, + 0.83822471f, + 0.83654773f, + 0.83486287f, + 0.83317016f, + 0.83146961f, + 0.82976123f, + 0.82804505f, + 0.82632106f, + 0.82458930f, + 0.82284978f, + 0.82110251f, + 0.81934752f, + 0.81758481f, + 0.81581441f, + 0.81403633f, + 0.81225059f, + 0.81045720f, + 0.80865618f, + 0.80684755f, + 0.80503133f, + 0.80320753f, + 0.80137617f, + 0.79953727f, + 0.79769084f, + 0.79583690f, + 0.79397548f, + 0.79210658f, + 0.79023022f, + 0.78834643f, + 0.78645521f, + 0.78455660f, + 0.78265060f, + 0.78073723f, + 0.77881651f, + 0.77688847f, + 0.77495311f, + 0.77301045f, + 0.77106052f, + 0.76910334f, + 0.76713891f, + 0.76516727f, + 0.76318842f, + 0.76120239f, + 0.75920919f, + 0.75720885f, + 0.75520138f, + 0.75318680f, + 0.75116513f, + 0.74913639f, + 0.74710061f, + 0.74505779f, + 0.74300795f, + 0.74095113f, + 0.73888732f, + 0.73681657f, + 0.73473888f, + 0.73265427f, + 0.73056277f, + 0.72846439f, + 0.72635916f, + 0.72424708f, + 0.72212819f, + 0.72000251f, + 0.71787005f, + 0.71573083f, + 0.71358487f, + 0.71143220f, + 0.70927283f, + 0.70710678f, + 0.70493408f, + 0.70275474f, + 0.70056879f, + 0.69837625f, + 0.69617713f, + 0.69397146f, + 0.69175926f, + 0.68954054f, + 0.68731534f, + 0.68508367f, + 0.68284555f, + 0.68060100f, + 0.67835004f, + 0.67609270f, + 0.67382900f, + 0.67155895f, + 0.66928259f, + 0.66699992f, + 0.66471098f, + 0.66241578f, + 0.66011434f, + 0.65780669f, + 0.65549285f, + 0.65317284f, + 0.65084668f, + 0.64851440f, + 0.64617601f, + 0.64383154f, + 0.64148101f, + 0.63912444f, + 0.63676186f, + 0.63439328f, + 0.63201874f, + 0.62963824f, + 0.62725182f, + 0.62485949f, + 0.62246128f, + 0.62005721f, + 0.61764731f, + 0.61523159f, + 0.61281008f, + 0.61038281f, + 0.60794978f, + 0.60551104f, + 0.60306660f, + 0.60061648f, + 0.59816071f, + 0.59569930f, + 0.59323230f, + 0.59075970f, + 0.58828155f, + 0.58579786f, + 0.58330865f, + 0.58081396f, + 0.57831380f, + 0.57580819f, + 0.57329717f, + 0.57078075f, + 0.56825895f, + 0.56573181f, + 0.56319934f, + 0.56066158f, + 0.55811853f, + 0.55557023f, + 0.55301671f, + 0.55045797f, + 0.54789406f, + 0.54532499f, + 0.54275078f, + 0.54017147f, + 0.53758708f, + 0.53499762f, + 0.53240313f, + 0.52980362f, + 0.52719913f, + 0.52458968f, + 0.52197529f, + 0.51935599f, + 0.51673180f, + 0.51410274f, + 0.51146885f, + 0.50883014f, + 0.50618665f, + 0.50353838f, + 0.50088538f, + 0.49822767f, + 0.49556526f, + 0.49289819f, + 0.49022648f, + 0.48755016f, + 0.48486925f, + 0.48218377f, + 0.47949376f, + 0.47679923f, + 0.47410021f, + 0.47139674f, + 0.46868882f, + 0.46597650f, + 0.46325978f, + 0.46053871f, + 0.45781330f, + 0.45508359f, + 0.45234959f, + 0.44961133f, + 0.44686884f, + 0.44412214f, + 0.44137127f, + 0.43861624f, + 0.43585708f, + 0.43309382f, + 0.43032648f, + 0.42755509f, + 0.42477968f, + 0.42200027f, + 0.41921689f, + 0.41642956f, + 0.41363831f, + 0.41084317f, + 0.40804416f, + 0.40524131f, + 0.40243465f, + 0.39962420f, + 0.39680999f, + 0.39399204f, + 0.39117038f, + 0.38834505f, + 0.38551605f, + 0.38268343f, + 0.37984721f, + 0.37700741f, + 0.37416406f, + 0.37131719f, + 0.36846683f, + 0.36561300f, + 0.36275572f, + 0.35989504f, + 0.35703096f, + 0.35416353f, + 0.35129276f, + 0.34841868f, + 0.34554132f, + 0.34266072f, + 0.33977688f, + 0.33688985f, + 0.33399965f, + 0.33110631f, + 0.32820984f, + 0.32531029f, + 0.32240768f, + 0.31950203f, + 0.31659338f, + 0.31368174f, + 0.31076715f, + 0.30784964f, + 0.30492923f, + 0.30200595f, + 0.29907983f, + 0.29615089f, + 0.29321916f, + 0.29028468f, + 0.28734746f, + 0.28440754f, + 0.28146494f, + 0.27851969f, + 0.27557182f, + 0.27262136f, + 0.26966833f, + 0.26671276f, + 0.26375468f, + 0.26079412f, + 0.25783110f, + 0.25486566f, + 0.25189782f, + 0.24892761f, + 0.24595505f, + 0.24298018f, + 0.24000302f, + 0.23702361f, + 0.23404196f, + 0.23105811f, + 0.22807208f, + 0.22508391f, + 0.22209362f, + 0.21910124f, + 0.21610680f, + 0.21311032f, + 0.21011184f, + 0.20711138f, + 0.20410897f, + 0.20110463f, + 0.19809841f, + 0.19509032f, + 0.19208040f, + 0.18906866f, + 0.18605515f, + 0.18303989f, + 0.18002290f, + 0.17700422f, + 0.17398387f, + 0.17096189f, + 0.16793829f, + 0.16491312f, + 0.16188639f, + 0.15885814f, + 0.15582840f, + 0.15279719f, + 0.14976453f, + 0.14673047f, + 0.14369503f, + 0.14065824f, + 0.13762012f, + 0.13458071f, + 0.13154003f, + 0.12849811f, + 0.12545498f, + 0.12241068f, + 0.11936521f, + 0.11631863f, + 0.11327095f, + 0.11022221f, + 0.10717242f, + 0.10412163f, + 0.10106986f, + 0.09801714f, + 0.09496350f, + 0.09190896f, + 0.08885355f, + 0.08579731f, + 0.08274026f, + 0.07968244f, + 0.07662386f, + 0.07356456f, + 0.07050457f, + 0.06744392f, + 0.06438263f, + 0.06132074f, + 0.05825826f, + 0.05519524f, + 0.05213170f, + 0.04906767f, + 0.04600318f, + 0.04293826f, + 0.03987293f, + 0.03680722f, + 0.03374117f, + 0.03067480f, + 0.02760815f, + 0.02454123f, + 0.02147408f, + 0.01840673f, + 0.01533921f, + 0.01227154f, + 0.00920375f, + 0.00613588f, + 0.00306796f, + 0.00000000f, + -0.00306796f, + -0.00613588f, + -0.00920375f, + -0.01227154f, + -0.01533921f, + -0.01840673f, + -0.02147408f, + -0.02454123f, + -0.02760815f, + -0.03067480f, + -0.03374117f, + -0.03680722f, + -0.03987293f, + -0.04293826f, + -0.04600318f, + -0.04906767f, + -0.05213170f, + -0.05519524f, + -0.05825826f, + -0.06132074f, + -0.06438263f, + -0.06744392f, + -0.07050457f, + -0.07356456f, + -0.07662386f, + -0.07968244f, + -0.08274026f, + -0.08579731f, + -0.08885355f, + -0.09190896f, + -0.09496350f, + -0.09801714f, + -0.10106986f, + -0.10412163f, + -0.10717242f, + -0.11022221f, + -0.11327095f, + -0.11631863f, + -0.11936521f, + -0.12241068f, + -0.12545498f, + -0.12849811f, + -0.13154003f, + -0.13458071f, + -0.13762012f, + -0.14065824f, + -0.14369503f, + -0.14673047f, + -0.14976453f, + -0.15279719f, + -0.15582840f, + -0.15885814f, + -0.16188639f, + -0.16491312f, + -0.16793829f, + -0.17096189f, + -0.17398387f, + -0.17700422f, + -0.18002290f, + -0.18303989f, + -0.18605515f, + -0.18906866f, + -0.19208040f, + -0.19509032f, + -0.19809841f, + -0.20110463f, + -0.20410897f, + -0.20711138f, + -0.21011184f, + -0.21311032f, + -0.21610680f, + -0.21910124f, + -0.22209362f, + -0.22508391f, + -0.22807208f, + -0.23105811f, + -0.23404196f, + -0.23702361f, + -0.24000302f, + -0.24298018f, + -0.24595505f, + -0.24892761f, + -0.25189782f, + -0.25486566f, + -0.25783110f, + -0.26079412f, + -0.26375468f, + -0.26671276f, + -0.26966833f, + -0.27262136f, + -0.27557182f, + -0.27851969f, + -0.28146494f, + -0.28440754f, + -0.28734746f, + -0.29028468f, + -0.29321916f, + -0.29615089f, + -0.29907983f, + -0.30200595f, + -0.30492923f, + -0.30784964f, + -0.31076715f, + -0.31368174f, + -0.31659338f, + -0.31950203f, + -0.32240768f, + -0.32531029f, + -0.32820984f, + -0.33110631f, + -0.33399965f, + -0.33688985f, + -0.33977688f, + -0.34266072f, + -0.34554132f, + -0.34841868f, + -0.35129276f, + -0.35416353f, + -0.35703096f, + -0.35989504f, + -0.36275572f, + -0.36561300f, + -0.36846683f, + -0.37131719f, + -0.37416406f, + -0.37700741f, + -0.37984721f, + -0.38268343f, + -0.38551605f, + -0.38834505f, + -0.39117038f, + -0.39399204f, + -0.39680999f, + -0.39962420f, + -0.40243465f, + -0.40524131f, + -0.40804416f, + -0.41084317f, + -0.41363831f, + -0.41642956f, + -0.41921689f, + -0.42200027f, + -0.42477968f, + -0.42755509f, + -0.43032648f, + -0.43309382f, + -0.43585708f, + -0.43861624f, + -0.44137127f, + -0.44412214f, + -0.44686884f, + -0.44961133f, + -0.45234959f, + -0.45508359f, + -0.45781330f, + -0.46053871f, + -0.46325978f, + -0.46597650f, + -0.46868882f, + -0.47139674f, + -0.47410021f, + -0.47679923f, + -0.47949376f, + -0.48218377f, + -0.48486925f, + -0.48755016f, + -0.49022648f, + -0.49289819f, + -0.49556526f, + -0.49822767f, + -0.50088538f, + -0.50353838f, + -0.50618665f, + -0.50883014f, + -0.51146885f, + -0.51410274f, + -0.51673180f, + -0.51935599f, + -0.52197529f, + -0.52458968f, + -0.52719913f, + -0.52980362f, + -0.53240313f, + -0.53499762f, + -0.53758708f, + -0.54017147f, + -0.54275078f, + -0.54532499f, + -0.54789406f, + -0.55045797f, + -0.55301671f, + -0.55557023f, + -0.55811853f, + -0.56066158f, + -0.56319934f, + -0.56573181f, + -0.56825895f, + -0.57078075f, + -0.57329717f, + -0.57580819f, + -0.57831380f, + -0.58081396f, + -0.58330865f, + -0.58579786f, + -0.58828155f, + -0.59075970f, + -0.59323230f, + -0.59569930f, + -0.59816071f, + -0.60061648f, + -0.60306660f, + -0.60551104f, + -0.60794978f, + -0.61038281f, + -0.61281008f, + -0.61523159f, + -0.61764731f, + -0.62005721f, + -0.62246128f, + -0.62485949f, + -0.62725182f, + -0.62963824f, + -0.63201874f, + -0.63439328f, + -0.63676186f, + -0.63912444f, + -0.64148101f, + -0.64383154f, + -0.64617601f, + -0.64851440f, + -0.65084668f, + -0.65317284f, + -0.65549285f, + -0.65780669f, + -0.66011434f, + -0.66241578f, + -0.66471098f, + -0.66699992f, + -0.66928259f, + -0.67155895f, + -0.67382900f, + -0.67609270f, + -0.67835004f, + -0.68060100f, + -0.68284555f, + -0.68508367f, + -0.68731534f, + -0.68954054f, + -0.69175926f, + -0.69397146f, + -0.69617713f, + -0.69837625f, + -0.70056879f, + -0.70275474f, + -0.70493408f, + -0.70710678f, + -0.70927283f, + -0.71143220f, + -0.71358487f, + -0.71573083f, + -0.71787005f, + -0.72000251f, + -0.72212819f, + -0.72424708f, + -0.72635916f, + -0.72846439f, + -0.73056277f, + -0.73265427f, + -0.73473888f, + -0.73681657f, + -0.73888732f, + -0.74095113f, + -0.74300795f, + -0.74505779f, + -0.74710061f, + -0.74913639f, + -0.75116513f, + -0.75318680f, + -0.75520138f, + -0.75720885f, + -0.75920919f, + -0.76120239f, + -0.76318842f, + -0.76516727f, + -0.76713891f, + -0.76910334f, + -0.77106052f, + -0.77301045f, + -0.77495311f, + -0.77688847f, + -0.77881651f, + -0.78073723f, + -0.78265060f, + -0.78455660f, + -0.78645521f, + -0.78834643f, + -0.79023022f, + -0.79210658f, + -0.79397548f, + -0.79583690f, + -0.79769084f, + -0.79953727f, + -0.80137617f, + -0.80320753f, + -0.80503133f, + -0.80684755f, + -0.80865618f, + -0.81045720f, + -0.81225059f, + -0.81403633f, + -0.81581441f, + -0.81758481f, + -0.81934752f, + -0.82110251f, + -0.82284978f, + -0.82458930f, + -0.82632106f, + -0.82804505f, + -0.82976123f, + -0.83146961f, + -0.83317016f, + -0.83486287f, + -0.83654773f, + -0.83822471f, + -0.83989379f, + -0.84155498f, + -0.84320824f, + -0.84485357f, + -0.84649094f, + -0.84812034f, + -0.84974177f, + -0.85135519f, + -0.85296060f, + -0.85455799f, + -0.85614733f, + -0.85772861f, + -0.85930182f, + -0.86086694f, + -0.86242396f, + -0.86397286f, + -0.86551362f, + -0.86704625f, + -0.86857071f, + -0.87008699f, + -0.87159509f, + -0.87309498f, + -0.87458665f, + -0.87607009f, + -0.87754529f, + -0.87901223f, + -0.88047089f, + -0.88192126f, + -0.88336334f, + -0.88479710f, + -0.88622253f, + -0.88763962f, + -0.88904836f, + -0.89044872f, + -0.89184071f, + -0.89322430f, + -0.89459949f, + -0.89596625f, + -0.89732458f, + -0.89867447f, + -0.90001589f, + -0.90134885f, + -0.90267332f, + -0.90398929f, + -0.90529676f, + -0.90659570f, + -0.90788612f, + -0.90916798f, + -0.91044129f, + -0.91170603f, + -0.91296219f, + -0.91420976f, + -0.91544872f, + -0.91667906f, + -0.91790078f, + -0.91911385f, + -0.92031828f, + -0.92151404f, + -0.92270113f, + -0.92387953f, + -0.92504924f, + -0.92621024f, + -0.92736253f, + -0.92850608f, + -0.92964090f, + -0.93076696f, + -0.93188427f, + -0.93299280f, + -0.93409255f, + -0.93518351f, + -0.93626567f, + -0.93733901f, + -0.93840353f, + -0.93945922f, + -0.94050607f, + -0.94154407f, + -0.94257320f, + -0.94359346f, + -0.94460484f, + -0.94560733f, + -0.94660091f, + -0.94758559f, + -0.94856135f, + -0.94952818f, + -0.95048607f, + -0.95143502f, + -0.95237501f, + -0.95330604f, + -0.95422810f, + -0.95514117f, + -0.95604525f, + -0.95694034f, + -0.95782641f, + -0.95870347f, + -0.95957151f, + -0.96043052f, + -0.96128049f, + -0.96212140f, + -0.96295327f, + -0.96377607f, + -0.96458979f, + -0.96539444f, + -0.96619000f, + -0.96697647f, + -0.96775384f, + -0.96852209f, + -0.96928124f, + -0.97003125f, + -0.97077214f, + -0.97150389f, + -0.97222650f, + -0.97293995f, + -0.97364425f, + -0.97433938f, + -0.97502535f, + -0.97570213f, + -0.97636973f, + -0.97702814f, + -0.97767736f, + -0.97831737f, + -0.97894818f, + -0.97956977f, + -0.98018214f, + -0.98078528f, + -0.98137919f, + -0.98196387f, + -0.98253930f, + -0.98310549f, + -0.98366242f, + -0.98421009f, + -0.98474850f, + -0.98527764f, + -0.98579751f, + -0.98630810f, + -0.98680940f, + -0.98730142f, + -0.98778414f, + -0.98825757f, + -0.98872169f, + -0.98917651f, + -0.98962202f, + -0.99005821f, + -0.99048508f, + -0.99090264f, + -0.99131086f, + -0.99170975f, + -0.99209931f, + -0.99247953f, + -0.99285041f, + -0.99321195f, + -0.99356414f, + -0.99390697f, + -0.99424045f, + -0.99456457f, + -0.99487933f, + -0.99518473f, + -0.99548076f, + -0.99576741f, + -0.99604470f, + -0.99631261f, + -0.99657115f, + -0.99682030f, + -0.99706007f, + -0.99729046f, + -0.99751146f, + -0.99772307f, + -0.99792529f, + -0.99811811f, + -0.99830154f, + -0.99847558f, + -0.99864022f, + -0.99879546f, + -0.99894129f, + -0.99907773f, + -0.99920476f, + -0.99932238f, + -0.99943060f, + -0.99952942f, + -0.99961882f, + -0.99969882f, + -0.99976941f, + -0.99983058f, + -0.99988235f, + -0.99992470f, + -0.99995764f, + -0.99998118f, + -0.99999529f, + -1.00000000f, + -0.99999529f, + -0.99998118f, + -0.99995764f, + -0.99992470f, + -0.99988235f, + -0.99983058f, + -0.99976941f, + -0.99969882f, + -0.99961882f, + -0.99952942f, + -0.99943060f, + -0.99932238f, + -0.99920476f, + -0.99907773f, + -0.99894129f, + -0.99879546f, + -0.99864022f, + -0.99847558f, + -0.99830154f, + -0.99811811f, + -0.99792529f, + -0.99772307f, + -0.99751146f, + -0.99729046f, + -0.99706007f, + -0.99682030f, + -0.99657115f, + -0.99631261f, + -0.99604470f, + -0.99576741f, + -0.99548076f, + -0.99518473f, + -0.99487933f, + -0.99456457f, + -0.99424045f, + -0.99390697f, + -0.99356414f, + -0.99321195f, + -0.99285041f, + -0.99247953f, + -0.99209931f, + -0.99170975f, + -0.99131086f, + -0.99090264f, + -0.99048508f, + -0.99005821f, + -0.98962202f, + -0.98917651f, + -0.98872169f, + -0.98825757f, + -0.98778414f, + -0.98730142f, + -0.98680940f, + -0.98630810f, + -0.98579751f, + -0.98527764f, + -0.98474850f, + -0.98421009f, + -0.98366242f, + -0.98310549f, + -0.98253930f, + -0.98196387f, + -0.98137919f, + -0.98078528f, + -0.98018214f, + -0.97956977f, + -0.97894818f, + -0.97831737f, + -0.97767736f, + -0.97702814f, + -0.97636973f, + -0.97570213f, + -0.97502535f, + -0.97433938f, + -0.97364425f, + -0.97293995f, + -0.97222650f, + -0.97150389f, + -0.97077214f, + -0.97003125f, + -0.96928124f, + -0.96852209f, + -0.96775384f, + -0.96697647f, + -0.96619000f, + -0.96539444f, + -0.96458979f, + -0.96377607f, + -0.96295327f, + -0.96212140f, + -0.96128049f, + -0.96043052f, + -0.95957151f, + -0.95870347f, + -0.95782641f, + -0.95694034f, + -0.95604525f, + -0.95514117f, + -0.95422810f, + -0.95330604f, + -0.95237501f, + -0.95143502f, + -0.95048607f, + -0.94952818f, + -0.94856135f, + -0.94758559f, + -0.94660091f, + -0.94560733f, + -0.94460484f, + -0.94359346f, + -0.94257320f, + -0.94154407f, + -0.94050607f, + -0.93945922f, + -0.93840353f, + -0.93733901f, + -0.93626567f, + -0.93518351f, + -0.93409255f, + -0.93299280f, + -0.93188427f, + -0.93076696f, + -0.92964090f, + -0.92850608f, + -0.92736253f, + -0.92621024f, + -0.92504924f, + -0.92387953f, + -0.92270113f, + -0.92151404f, + -0.92031828f, + -0.91911385f, + -0.91790078f, + -0.91667906f, + -0.91544872f, + -0.91420976f, + -0.91296219f, + -0.91170603f, + -0.91044129f, + -0.90916798f, + -0.90788612f, + -0.90659570f, + -0.90529676f, + -0.90398929f, + -0.90267332f, + -0.90134885f, + -0.90001589f, + -0.89867447f, + -0.89732458f, + -0.89596625f, + -0.89459949f, + -0.89322430f, + -0.89184071f, + -0.89044872f, + -0.88904836f, + -0.88763962f, + -0.88622253f, + -0.88479710f, + -0.88336334f, + -0.88192126f, + -0.88047089f, + -0.87901223f, + -0.87754529f, + -0.87607009f, + -0.87458665f, + -0.87309498f, + -0.87159509f, + -0.87008699f, + -0.86857071f, + -0.86704625f, + -0.86551362f, + -0.86397286f, + -0.86242396f, + -0.86086694f, + -0.85930182f, + -0.85772861f, + -0.85614733f, + -0.85455799f, + -0.85296060f, + -0.85135519f, + -0.84974177f, + -0.84812034f, + -0.84649094f, + -0.84485357f, + -0.84320824f, + -0.84155498f, + -0.83989379f, + -0.83822471f, + -0.83654773f, + -0.83486287f, + -0.83317016f, + -0.83146961f, + -0.82976123f, + -0.82804505f, + -0.82632106f, + -0.82458930f, + -0.82284978f, + -0.82110251f, + -0.81934752f, + -0.81758481f, + -0.81581441f, + -0.81403633f, + -0.81225059f, + -0.81045720f, + -0.80865618f, + -0.80684755f, + -0.80503133f, + -0.80320753f, + -0.80137617f, + -0.79953727f, + -0.79769084f, + -0.79583690f, + -0.79397548f, + -0.79210658f, + -0.79023022f, + -0.78834643f, + -0.78645521f, + -0.78455660f, + -0.78265060f, + -0.78073723f, + -0.77881651f, + -0.77688847f, + -0.77495311f, + -0.77301045f, + -0.77106052f, + -0.76910334f, + -0.76713891f, + -0.76516727f, + -0.76318842f, + -0.76120239f, + -0.75920919f, + -0.75720885f, + -0.75520138f, + -0.75318680f, + -0.75116513f, + -0.74913639f, + -0.74710061f, + -0.74505779f, + -0.74300795f, + -0.74095113f, + -0.73888732f, + -0.73681657f, + -0.73473888f, + -0.73265427f, + -0.73056277f, + -0.72846439f, + -0.72635916f, + -0.72424708f, + -0.72212819f, + -0.72000251f, + -0.71787005f, + -0.71573083f, + -0.71358487f, + -0.71143220f, + -0.70927283f, + -0.70710678f, + -0.70493408f, + -0.70275474f, + -0.70056879f, + -0.69837625f, + -0.69617713f, + -0.69397146f, + -0.69175926f, + -0.68954054f, + -0.68731534f, + -0.68508367f, + -0.68284555f, + -0.68060100f, + -0.67835004f, + -0.67609270f, + -0.67382900f, + -0.67155895f, + -0.66928259f, + -0.66699992f, + -0.66471098f, + -0.66241578f, + -0.66011434f, + -0.65780669f, + -0.65549285f, + -0.65317284f, + -0.65084668f, + -0.64851440f, + -0.64617601f, + -0.64383154f, + -0.64148101f, + -0.63912444f, + -0.63676186f, + -0.63439328f, + -0.63201874f, + -0.62963824f, + -0.62725182f, + -0.62485949f, + -0.62246128f, + -0.62005721f, + -0.61764731f, + -0.61523159f, + -0.61281008f, + -0.61038281f, + -0.60794978f, + -0.60551104f, + -0.60306660f, + -0.60061648f, + -0.59816071f, + -0.59569930f, + -0.59323230f, + -0.59075970f, + -0.58828155f, + -0.58579786f, + -0.58330865f, + -0.58081396f, + -0.57831380f, + -0.57580819f, + -0.57329717f, + -0.57078075f, + -0.56825895f, + -0.56573181f, + -0.56319934f, + -0.56066158f, + -0.55811853f, + -0.55557023f, + -0.55301671f, + -0.55045797f, + -0.54789406f, + -0.54532499f, + -0.54275078f, + -0.54017147f, + -0.53758708f, + -0.53499762f, + -0.53240313f, + -0.52980362f, + -0.52719913f, + -0.52458968f, + -0.52197529f, + -0.51935599f, + -0.51673180f, + -0.51410274f, + -0.51146885f, + -0.50883014f, + -0.50618665f, + -0.50353838f, + -0.50088538f, + -0.49822767f, + -0.49556526f, + -0.49289819f, + -0.49022648f, + -0.48755016f, + -0.48486925f, + -0.48218377f, + -0.47949376f, + -0.47679923f, + -0.47410021f, + -0.47139674f, + -0.46868882f, + -0.46597650f, + -0.46325978f, + -0.46053871f, + -0.45781330f, + -0.45508359f, + -0.45234959f, + -0.44961133f, + -0.44686884f, + -0.44412214f, + -0.44137127f, + -0.43861624f, + -0.43585708f, + -0.43309382f, + -0.43032648f, + -0.42755509f, + -0.42477968f, + -0.42200027f, + -0.41921689f, + -0.41642956f, + -0.41363831f, + -0.41084317f, + -0.40804416f, + -0.40524131f, + -0.40243465f, + -0.39962420f, + -0.39680999f, + -0.39399204f, + -0.39117038f, + -0.38834505f, + -0.38551605f, + -0.38268343f, + -0.37984721f, + -0.37700741f, + -0.37416406f, + -0.37131719f, + -0.36846683f, + -0.36561300f, + -0.36275572f, + -0.35989504f, + -0.35703096f, + -0.35416353f, + -0.35129276f, + -0.34841868f, + -0.34554132f, + -0.34266072f, + -0.33977688f, + -0.33688985f, + -0.33399965f, + -0.33110631f, + -0.32820984f, + -0.32531029f, + -0.32240768f, + -0.31950203f, + -0.31659338f, + -0.31368174f, + -0.31076715f, + -0.30784964f, + -0.30492923f, + -0.30200595f, + -0.29907983f, + -0.29615089f, + -0.29321916f, + -0.29028468f, + -0.28734746f, + -0.28440754f, + -0.28146494f, + -0.27851969f, + -0.27557182f, + -0.27262136f, + -0.26966833f, + -0.26671276f, + -0.26375468f, + -0.26079412f, + -0.25783110f, + -0.25486566f, + -0.25189782f, + -0.24892761f, + -0.24595505f, + -0.24298018f, + -0.24000302f, + -0.23702361f, + -0.23404196f, + -0.23105811f, + -0.22807208f, + -0.22508391f, + -0.22209362f, + -0.21910124f, + -0.21610680f, + -0.21311032f, + -0.21011184f, + -0.20711138f, + -0.20410897f, + -0.20110463f, + -0.19809841f, + -0.19509032f, + -0.19208040f, + -0.18906866f, + -0.18605515f, + -0.18303989f, + -0.18002290f, + -0.17700422f, + -0.17398387f, + -0.17096189f, + -0.16793829f, + -0.16491312f, + -0.16188639f, + -0.15885814f, + -0.15582840f, + -0.15279719f, + -0.14976453f, + -0.14673047f, + -0.14369503f, + -0.14065824f, + -0.13762012f, + -0.13458071f, + -0.13154003f, + -0.12849811f, + -0.12545498f, + -0.12241068f, + -0.11936521f, + -0.11631863f, + -0.11327095f, + -0.11022221f, + -0.10717242f, + -0.10412163f, + -0.10106986f, + -0.09801714f, + -0.09496350f, + -0.09190896f, + -0.08885355f, + -0.08579731f, + -0.08274026f, + -0.07968244f, + -0.07662386f, + -0.07356456f, + -0.07050457f, + -0.06744392f, + -0.06438263f, + -0.06132074f, + -0.05825826f, + -0.05519524f, + -0.05213170f, + -0.04906767f, + -0.04600318f, + -0.04293826f, + -0.03987293f, + -0.03680722f, + -0.03374117f, + -0.03067480f, + -0.02760815f, + -0.02454123f, + -0.02147408f, + -0.01840673f, + -0.01533921f, + -0.01227154f, + -0.00920375f, + -0.00613588f, + -0.00306796f +}; + +SPAN_DECLARE(int32_t) dds_phase_ratef(float frequency) +{ + return (int32_t) (frequency*65536.0f*65536.0f/SAMPLE_RATE); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) dds_frequencyf(int32_t phase_rate) +{ + return (float) phase_rate*(float) SAMPLE_RATE/(65536.0f*65536.0f); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) dds_scaling_dbm0f(float level) +{ + return powf(10.0f, (level - DBM0_MAX_SINE_POWER)/20.0f)*32767.0f; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) dds_scaling_dbovf(float level) +{ + return powf(10.0f, (level - DBOV_MAX_SINE_POWER)/20.0f)*32767.0f; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) dds_advancef(uint32_t *phase_acc, int32_t phase_rate) +{ + *phase_acc += phase_rate; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) ddsf(uint32_t *phase_acc, int32_t phase_rate) +{ + float amp; + + amp = sine_table[*phase_acc >> (32 - SLENK)]; + *phase_acc += phase_rate; + return amp; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) dds_lookupf(uint32_t phase) +{ + return sine_table[phase >> (32 - SLENK)]; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) dds_modf(uint32_t *phase_acc, int32_t phase_rate, float scale, int32_t phase) +{ + float amp; + + amp = sine_table[*(phase_acc + phase) >> (32 - SLENK)]*scale; + *phase_acc += phase_rate; + return amp; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(complexf_t) dds_complexf(uint32_t *phase_acc, int32_t phase_rate) +{ + complexf_t amp; + + amp = complex_setf(sine_table[(*phase_acc + (1 << 30)) >> (32 - SLENK)], + sine_table[*phase_acc >> (32 - SLENK)]); + *phase_acc += phase_rate; + return amp; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(complexf_t) dds_lookup_complexf(uint32_t phase) +{ + return complex_setf(sine_table[(phase + (1 << 30)) >> (32 - SLENK)], + sine_table[phase >> (32 - SLENK)]); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(complexf_t) dds_complex_modf(uint32_t *phase_acc, int32_t phase_rate, float scale, int32_t phase) +{ + complexf_t amp; + + amp = complex_setf(sine_table[(*phase_acc + phase + (1 << 30)) >> (32 - SLENK)]*scale, + sine_table[(*phase_acc + phase) >> (32 - SLENK)]*scale); + *phase_acc += phase_rate; + return amp; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/dds_int.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/dds_int.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,345 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * dds.c + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: dds_int.c,v 1.16 2009/02/21 04:27:46 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/complex.h" +#include "spandsp/dds.h" + +#if !defined(M_PI) +# define M_PI 3.14159265358979323846 /* pi */ +#endif + +/* In a A-law or u-law channel, a 128 step sine table is adequate to keep the spectral + mess due to the DDS at a similar level to the spectral mess due to the A-law or u-law + compression. */ +#define SLENK 7 +#define DDS_STEPS (1 << SLENK) +#define DDS_SHIFT (32 - 2 - SLENK) + +/* This is a simple set of direct digital synthesis (DDS) functions to generate sine + waves. This version uses a 128 entry sin/cos table to cover one quadrant. */ + +static const int16_t sine_table[DDS_STEPS] = +{ + 201, + 603, + 1005, + 1407, + 1809, + 2210, + 2611, + 3012, + 3412, + 3812, + 4211, + 4609, + 5007, + 5404, + 5800, + 6195, + 6590, + 6983, + 7376, + 7767, + 8157, + 8546, + 8933, + 9319, + 9704, + 10088, + 10469, + 10850, + 11228, + 11605, + 11980, + 12354, + 12725, + 13095, + 13463, + 13828, + 14192, + 14553, + 14912, + 15269, + 15624, + 15976, + 16326, + 16673, + 17018, + 17361, + 17700, + 18037, + 18372, + 18703, + 19032, + 19358, + 19681, + 20001, + 20318, + 20632, + 20943, + 21251, + 21555, + 21856, + 22154, + 22449, + 22740, + 23028, + 23312, + 23593, + 23870, + 24144, + 24414, + 24680, + 24943, + 25202, + 25457, + 25708, + 25956, + 26199, + 26439, + 26674, + 26906, + 27133, + 27357, + 27576, + 27791, + 28002, + 28209, + 28411, + 28610, + 28803, + 28993, + 29178, + 29359, + 29535, + 29707, + 29875, + 30038, + 30196, + 30350, + 30499, + 30644, + 30784, + 30920, + 31050, + 31177, + 31298, + 31415, + 31527, + 31634, + 31737, + 31834, + 31927, + 32015, + 32099, + 32177, + 32251, + 32319, + 32383, + 32442, + 32496, + 32546, + 32590, + 32629, + 32664, + 32693, + 32718, + 32738, + 32753, + 32762, + 32767, +}; + +SPAN_DECLARE(int32_t) dds_phase_rate(float frequency) +{ + return (int32_t) (frequency*65536.0f*65536.0f/SAMPLE_RATE); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) dds_frequency(int32_t phase_rate) +{ + return (float) phase_rate*(float) SAMPLE_RATE/(65536.0f*65536.0f); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int16_t) dds_scaling_dbm0(float level) +{ + return (int16_t) (powf(10.0f, (level - DBM0_MAX_SINE_POWER)/20.0f)*32767.0f); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int16_t) dds_scaling_dbov(float level) +{ + return (int16_t) (powf(10.0f, (level - DBOV_MAX_SINE_POWER)/20.0f)*32767.0f); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int16_t) dds_lookup(uint32_t phase) +{ + uint32_t step; + int16_t amp; + + phase >>= DDS_SHIFT; + step = phase & (DDS_STEPS - 1); + if ((phase & DDS_STEPS)) + step = (DDS_STEPS - 1) - step; + amp = sine_table[step]; + if ((phase & (2*DDS_STEPS))) + amp = -amp; + return amp; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int16_t) dds_offset(uint32_t phase_acc, int32_t phase_offset) +{ + return dds_lookup(phase_acc + phase_offset); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) dds_advance(uint32_t *phase_acc, int32_t phase_rate) +{ + *phase_acc += phase_rate; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int16_t) dds(uint32_t *phase_acc, int32_t phase_rate) +{ + int16_t amp; + + amp = dds_lookup(*phase_acc); + *phase_acc += phase_rate; + return amp; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int16_t) dds_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase) +{ + int16_t amp; + + amp = (int16_t) (((int32_t) dds_lookup(*phase_acc + phase)*(int32_t) scale) >> 15); + *phase_acc += phase_rate; + return amp; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(complexi_t) dds_lookup_complexi(uint32_t phase) +{ + return complex_seti(dds_lookup(phase + (1 << 30)), dds_lookup(phase)); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(complexi_t) dds_complexi(uint32_t *phase_acc, int32_t phase_rate) +{ + complexi_t amp; + + amp = complex_seti(dds_lookup(*phase_acc + (1 << 30)), dds_lookup(*phase_acc)); + *phase_acc += phase_rate; + return amp; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(complexi_t) dds_complexi_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase) +{ + complexi_t amp; + + amp = complex_seti(((int32_t) dds_lookup(*phase_acc + phase + (1 << 30))*(int32_t) scale) >> 15, + ((int32_t) dds_lookup(*phase_acc + phase)*(int32_t) scale) >> 15); + *phase_acc += phase_rate; + return amp; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(complexi16_t) dds_lookup_complexi16(uint32_t phase) +{ + return complex_seti16(dds_lookup(phase + (1 << 30)), dds_lookup(phase)); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(complexi16_t) dds_complexi16(uint32_t *phase_acc, int32_t phase_rate) +{ + complexi16_t amp; + + amp = complex_seti16(dds_lookup(*phase_acc + (1 << 30)), dds_lookup(*phase_acc)); + *phase_acc += phase_rate; + return amp; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(complexi16_t) dds_complexi16_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase) +{ + complexi16_t amp; + + amp = complex_seti16((int16_t) (((int32_t) dds_lookup(*phase_acc + phase + (1 << 30))*(int32_t) scale) >> 15), + (int16_t) (((int32_t) dds_lookup(*phase_acc + phase)*(int32_t) scale) >> 15)); + *phase_acc += phase_rate; + return amp; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(complexi32_t) dds_lookup_complexi32(uint32_t phase) +{ + return complex_seti32(dds_lookup(phase + (1 << 30)), dds_lookup(phase)); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(complexi32_t) dds_complexi32(uint32_t *phase_acc, int32_t phase_rate) +{ + complexi32_t amp; + + amp = complex_seti32(dds_lookup(*phase_acc + (1 << 30)), dds_lookup(*phase_acc)); + *phase_acc += phase_rate; + return amp; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(complexi32_t) dds_complexi32_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase) +{ + complexi32_t amp; + + amp = complex_seti32(((int32_t) dds_lookup(*phase_acc + phase + (1 << 30))*(int32_t) scale) >> 15, + ((int32_t) dds_lookup(*phase_acc + phase)*(int32_t) scale) >> 15); + *phase_acc += phase_rate; + return amp; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/dtmf.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/dtmf.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,547 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * dtmf.c - DTMF generation and detection. + * + * Written by Steve Underwood + * + * Copyright (C) 2001-2003, 2005, 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: dtmf.c,v 1.53 2009/04/12 09:12:10 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/queue.h" +#include "spandsp/complex.h" +#include "spandsp/dds.h" +#include "spandsp/tone_detect.h" +#include "spandsp/tone_generate.h" +#include "spandsp/super_tone_rx.h" +#include "spandsp/dtmf.h" + +#include "spandsp/private/queue.h" +#include "spandsp/private/tone_generate.h" +#include "spandsp/private/dtmf.h" + +#define DEFAULT_DTMF_TX_LEVEL -10 +#define DEFAULT_DTMF_TX_ON_TIME 50 +#define DEFAULT_DTMF_TX_OFF_TIME 55 + +#if defined(SPANDSP_USE_FIXED_POINT) +#define DTMF_THRESHOLD 10438 /* -42dBm0 */ +#define DTMF_NORMAL_TWIST 6.309f /* 8dB */ +#define DTMF_REVERSE_TWIST 2.512f /* 4dB */ +#define DTMF_RELATIVE_PEAK_ROW 6.309f /* 8dB */ +#define DTMF_RELATIVE_PEAK_COL 6.309f /* 8dB */ +#define DTMF_TO_TOTAL_ENERGY 83.868f /* -0.85dB */ +#define DTMF_POWER_OFFSET 68.251f /* 10*log(256.0*256.0*DTMF_SAMPLES_PER_BLOCK) */ +#define DTMF_SAMPLES_PER_BLOCK 102 +#else +#define DTMF_THRESHOLD 171032462.0f /* -42dBm0 [((DTMF_SAMPLES_PER_BLOCK*32768.0/1.4142)*10^((-42 - DBM0_MAX_SINE_POWER)/20.0))^2 => 171032462.0] */ +#define DTMF_NORMAL_TWIST 6.309f /* 8dB [10^(8/10) => 6.309] */ +#define DTMF_REVERSE_TWIST 2.512f /* 4dB */ +#define DTMF_RELATIVE_PEAK_ROW 6.309f /* 8dB */ +#define DTMF_RELATIVE_PEAK_COL 6.309f /* 8dB */ +#define DTMF_TO_TOTAL_ENERGY 83.868f /* -0.85dB [DTMF_SAMPLES_PER_BLOCK*10^(-0.85/10.0)] */ +#define DTMF_POWER_OFFSET 110.395f /* 10*log(32768.0*32768.0*DTMF_SAMPLES_PER_BLOCK) */ +#define DTMF_SAMPLES_PER_BLOCK 102 +#endif + +static const float dtmf_row[] = +{ + 697.0f, 770.0f, 852.0f, 941.0f +}; +static const float dtmf_col[] = +{ + 1209.0f, 1336.0f, 1477.0f, 1633.0f +}; + +static const char dtmf_positions[] = "123A" "456B" "789C" "*0#D"; + +static goertzel_descriptor_t dtmf_detect_row[4]; +static goertzel_descriptor_t dtmf_detect_col[4]; + +static int dtmf_tx_inited = FALSE; +static tone_gen_descriptor_t dtmf_digit_tones[16]; + +SPAN_DECLARE(int) dtmf_rx(dtmf_rx_state_t *s, const int16_t amp[], int samples) +{ +#if defined(SPANDSP_USE_FIXED_POINT) + int32_t row_energy[4]; + int32_t col_energy[4]; + int16_t xamp; + float famp; +#else + float row_energy[4]; + float col_energy[4]; + float xamp; + float famp; +#endif + float v1; + int i; + int j; + int sample; + int best_row; + int best_col; + int limit; + uint8_t hit; + + hit = 0; + for (sample = 0; sample < samples; sample = limit) + { + /* The block length is optimised to meet the DTMF specs. */ + if ((samples - sample) >= (DTMF_SAMPLES_PER_BLOCK - s->current_sample)) + limit = sample + (DTMF_SAMPLES_PER_BLOCK - s->current_sample); + else + limit = samples; + /* The following unrolled loop takes only 35% (rough estimate) of the + time of a rolled loop on the machine on which it was developed */ + for (j = sample; j < limit; j++) + { + xamp = amp[j]; + if (s->filter_dialtone) + { + famp = xamp; + /* Sharp notches applied at 350Hz and 440Hz - the two common dialtone frequencies. + These are rather high Q, to achieve the required narrowness, without using lots of + sections. */ + v1 = 0.98356f*famp + 1.8954426f*s->z350[0] - 0.9691396f*s->z350[1]; + famp = v1 - 1.9251480f*s->z350[0] + s->z350[1]; + s->z350[1] = s->z350[0]; + s->z350[0] = v1; + + v1 = 0.98456f*famp + 1.8529543f*s->z440[0] - 0.9691396f*s->z440[1]; + famp = v1 - 1.8819938f*s->z440[0] + s->z440[1]; + s->z440[1] = s->z440[0]; + s->z440[0] = v1; + xamp = famp; + } + xamp = goertzel_preadjust_amp(xamp); +#if defined(SPANDSP_USE_FIXED_POINT) + s->energy += ((int32_t) xamp*xamp); +#else + s->energy += xamp*xamp; +#endif + goertzel_samplex(&s->row_out[0], xamp); + goertzel_samplex(&s->col_out[0], xamp); + goertzel_samplex(&s->row_out[1], xamp); + goertzel_samplex(&s->col_out[1], xamp); + goertzel_samplex(&s->row_out[2], xamp); + goertzel_samplex(&s->col_out[2], xamp); + goertzel_samplex(&s->row_out[3], xamp); + goertzel_samplex(&s->col_out[3], xamp); + } + s->current_sample += (limit - sample); + if (s->current_sample < DTMF_SAMPLES_PER_BLOCK) + continue; + + /* We are at the end of a DTMF detection block */ + /* Find the peak row and the peak column */ + row_energy[0] = goertzel_result(&s->row_out[0]); + best_row = 0; + col_energy[0] = goertzel_result(&s->col_out[0]); + best_col = 0; + for (i = 1; i < 4; i++) + { + row_energy[i] = goertzel_result(&s->row_out[i]); + if (row_energy[i] > row_energy[best_row]) + best_row = i; + col_energy[i] = goertzel_result(&s->col_out[i]); + if (col_energy[i] > col_energy[best_col]) + best_col = i; + } + hit = 0; + /* Basic signal level test and the twist test */ + if (row_energy[best_row] >= s->threshold + && + col_energy[best_col] >= s->threshold + && + col_energy[best_col] < row_energy[best_row]*s->reverse_twist + && + col_energy[best_col]*s->normal_twist > row_energy[best_row]) + { + /* Relative peak test ... */ + for (i = 0; i < 4; i++) + { + if ((i != best_col && col_energy[i]*DTMF_RELATIVE_PEAK_COL > col_energy[best_col]) + || + (i != best_row && row_energy[i]*DTMF_RELATIVE_PEAK_ROW > row_energy[best_row])) + { + break; + } + } + /* ... and fraction of total energy test */ + if (i >= 4 + && + (row_energy[best_row] + col_energy[best_col]) > DTMF_TO_TOTAL_ENERGY*s->energy) + { + /* Got a hit */ + hit = dtmf_positions[(best_row << 2) + best_col]; + } + } + /* The logic in the next test should ensure the following for different successive hit patterns: + -----ABB = start of digit B. + ----B-BB = start of digit B + ----A-BB = start of digit B + BBBBBABB = still in digit B. + BBBBBB-- = end of digit B + BBBBBBC- = end of digit B + BBBBACBB = B ends, then B starts again. + BBBBBBCC = B ends, then C starts. + BBBBBCDD = B ends, then D starts. + This can work with: + - Back to back differing digits. Back-to-back digits should + not happen. The spec. says there should be a gap between digits. + However, many real phones do not impose a gap, and rolling across + the keypad can produce little or no gap. + - It tolerates nasty phones that give a very wobbly start to a digit. + - VoIP can give sample slips. The phase jumps that produces will cause + the block it is in to give no detection. This logic will ride over a + single missed block, and not falsely declare a second digit. If the + hiccup happens in the wrong place on a minimum length digit, however + we would still fail to detect that digit. Could anything be done to + deal with that? Packet loss is clearly a no-go zone. + Note this is only relevant to VoIP using A-law, u-law or similar. + Low bit rate codecs scramble DTMF too much for it to be recognised, + and often slip in units larger than a sample. */ + if (hit != s->in_digit) + { + if (s->last_hit != s->in_digit) + { + /* We have two successive indications that something has changed. */ + /* To declare digit on, the hits must agree. Otherwise we declare tone off. */ + hit = (hit && hit == s->last_hit) ? hit : 0; + if (s->realtime_callback) + { + /* Avoid reporting multiple no digit conditions on flaky hits */ + if (s->in_digit || hit) + { + i = (s->in_digit && !hit) ? -99 : lfastrintf(log10f(s->energy)*10.0f - DTMF_POWER_OFFSET + DBM0_MAX_POWER); + s->realtime_callback(s->realtime_callback_data, hit, i, 0); + } + } + else + { + if (hit) + { + if (s->current_digits < MAX_DTMF_DIGITS) + { + s->digits[s->current_digits++] = (char) hit; + s->digits[s->current_digits] = '\0'; + if (s->digits_callback) + { + s->digits_callback(s->digits_callback_data, s->digits, s->current_digits); + s->current_digits = 0; + } + } + else + { + s->lost_digits++; + } + } + } + s->in_digit = hit; + } + } + s->last_hit = hit; +#if defined(SPANDSP_USE_FIXED_POINT) + s->energy = 0; +#else + s->energy = 0.0f; +#endif + s->current_sample = 0; + } + if (s->current_digits && s->digits_callback) + { + s->digits_callback(s->digits_callback_data, s->digits, s->current_digits); + s->digits[0] = '\0'; + s->current_digits = 0; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) dtmf_rx_status(dtmf_rx_state_t *s) +{ + if (s->in_digit) + return s->in_digit; + if (s->last_hit) + return 'x'; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(size_t) dtmf_rx_get(dtmf_rx_state_t *s, char *buf, int max) +{ + if (max > s->current_digits) + max = s->current_digits; + if (max > 0) + { + memcpy(buf, s->digits, max); + memmove(s->digits, s->digits + max, s->current_digits - max); + s->current_digits -= max; + } + buf[max] = '\0'; + return max; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) dtmf_rx_set_realtime_callback(dtmf_rx_state_t *s, + tone_report_func_t callback, + void *user_data) +{ + s->realtime_callback = callback; + s->realtime_callback_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) dtmf_rx_parms(dtmf_rx_state_t *s, + int filter_dialtone, + int twist, + int reverse_twist, + int threshold) +{ + float x; + + if (filter_dialtone >= 0) + { + s->z350[0] = 0.0f; + s->z350[1] = 0.0f; + s->z440[0] = 0.0f; + s->z440[1] = 0.0f; + s->filter_dialtone = filter_dialtone; + } + if (twist >= 0) + s->normal_twist = powf(10.0f, twist/10.0f); + if (reverse_twist >= 0) + s->reverse_twist = powf(10.0f, reverse_twist/10.0f); + if (threshold > -99) + { + x = (DTMF_SAMPLES_PER_BLOCK*32768.0f/1.4142f)*powf(10.0f, (threshold - DBM0_MAX_SINE_POWER)/20.0f); + s->threshold = x*x; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(dtmf_rx_state_t *) dtmf_rx_init(dtmf_rx_state_t *s, + digits_rx_callback_t callback, + void *user_data) +{ + int i; + static int initialised = FALSE; + + if (s == NULL) + { + if ((s = (dtmf_rx_state_t *) malloc(sizeof (*s))) == NULL) + return NULL; + } + s->digits_callback = callback; + s->digits_callback_data = user_data; + s->realtime_callback = NULL; + s->realtime_callback_data = NULL; + s->filter_dialtone = FALSE; + s->normal_twist = DTMF_NORMAL_TWIST; + s->reverse_twist = DTMF_REVERSE_TWIST; + s->threshold = DTMF_THRESHOLD; + + s->in_digit = 0; + s->last_hit = 0; + + if (!initialised) + { + for (i = 0; i < 4; i++) + { + make_goertzel_descriptor(&dtmf_detect_row[i], dtmf_row[i], DTMF_SAMPLES_PER_BLOCK); + make_goertzel_descriptor(&dtmf_detect_col[i], dtmf_col[i], DTMF_SAMPLES_PER_BLOCK); + } + initialised = TRUE; + } + for (i = 0; i < 4; i++) + { + goertzel_init(&s->row_out[i], &dtmf_detect_row[i]); + goertzel_init(&s->col_out[i], &dtmf_detect_col[i]); + } +#if defined(SPANDSP_USE_FIXED_POINT) + s->energy = 0; +#else + s->energy = 0.0f; +#endif + s->current_sample = 0; + s->lost_digits = 0; + s->current_digits = 0; + s->digits[0] = '\0'; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) dtmf_rx_release(dtmf_rx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) dtmf_rx_free(dtmf_rx_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void dtmf_tx_initialise(void) +{ + int row; + int col; + + if (dtmf_tx_inited) + return; + for (row = 0; row < 4; row++) + { + for (col = 0; col < 4; col++) + { + make_tone_gen_descriptor(&dtmf_digit_tones[row*4 + col], + (int) dtmf_row[row], + DEFAULT_DTMF_TX_LEVEL, + (int) dtmf_col[col], + DEFAULT_DTMF_TX_LEVEL, + DEFAULT_DTMF_TX_ON_TIME, + DEFAULT_DTMF_TX_OFF_TIME, + 0, + 0, + FALSE); + } + } + dtmf_tx_inited = TRUE; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) dtmf_tx(dtmf_tx_state_t *s, int16_t amp[], int max_samples) +{ + int len; + const char *cp; + int digit; + + len = 0; + if (s->tones.current_section >= 0) + { + /* Deal with the fragment left over from last time */ + len = tone_gen(&(s->tones), amp, max_samples); + } + while (len < max_samples && (digit = queue_read_byte(&s->queue.queue)) >= 0) + { + /* Step to the next digit */ + if (digit == 0) + continue; + if ((cp = strchr(dtmf_positions, digit)) == NULL) + continue; + tone_gen_init(&(s->tones), &dtmf_digit_tones[cp - dtmf_positions]); + s->tones.tone[0].gain = s->low_level; + s->tones.tone[1].gain = s->high_level; + s->tones.duration[0] = s->on_time; + s->tones.duration[1] = s->off_time; + len += tone_gen(&(s->tones), amp + len, max_samples - len); + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) dtmf_tx_put(dtmf_tx_state_t *s, const char *digits, int len) +{ + size_t space; + + /* This returns the number of characters that would not fit in the buffer. + The buffer will only be loaded if the whole string of digits will fit, + in which case zero is returned. */ + if (len < 0) + { + if ((len = strlen(digits)) == 0) + return 0; + } + if ((space = queue_free_space(&s->queue.queue)) < (size_t) len) + return len - (int) space; + if (queue_write(&s->queue.queue, (const uint8_t *) digits, len) >= 0) + return 0; + return -1; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) dtmf_tx_set_level(dtmf_tx_state_t *s, int level, int twist) +{ + s->low_level = dds_scaling_dbm0f((float) level); + s->high_level = dds_scaling_dbm0f((float) (level + twist)); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) dtmf_tx_set_timing(dtmf_tx_state_t *s, int on_time, int off_time) +{ + s->on_time = ((on_time >= 0) ? on_time : DEFAULT_DTMF_TX_ON_TIME)*SAMPLE_RATE/1000; + s->off_time = ((off_time >= 0) ? off_time : DEFAULT_DTMF_TX_OFF_TIME)*SAMPLE_RATE/1000; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(dtmf_tx_state_t *) dtmf_tx_init(dtmf_tx_state_t *s) +{ + if (s == NULL) + { + if ((s = (dtmf_tx_state_t *) malloc(sizeof (*s))) == NULL) + return NULL; + } + if (!dtmf_tx_inited) + dtmf_tx_initialise(); + tone_gen_init(&(s->tones), &dtmf_digit_tones[0]); + dtmf_tx_set_level(s, DEFAULT_DTMF_TX_LEVEL, 0); + dtmf_tx_set_timing(s, -1, -1); + queue_init(&s->queue.queue, MAX_DTMF_DIGITS, QUEUE_READ_ATOMIC | QUEUE_WRITE_ATOMIC); + s->tones.current_section = -1; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) dtmf_tx_release(dtmf_tx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) dtmf_tx_free(dtmf_tx_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/echo.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/echo.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,623 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * echo.c - An echo cancellor, suitable for electrical and acoustic + * cancellation. This code does not currently comply with + * any relevant standards (e.g. G.164/5/7/8). One day.... + * + * Written by Steve Underwood + * + * Copyright (C) 2001, 2003 Steve Underwood + * + * Based on a bit from here, a bit from there, eye of toad, + * ear of bat, etc - plus, of course, my own 2 cents. + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: echo.c,v 1.33 2009/09/22 13:11:04 steveu Exp $ + */ + +/*! \file */ + +/* TODO: + Finish the echo suppressor option, however nasty suppression may be. + Add an option to reintroduce side tone at -24dB under appropriate conditions. + Improve double talk detector (iterative!) +*/ + +/* We need to differentiate between transmitted energy which will train the echo + canceller well (voice, white noise, and other broadband sources) and energy + which will train it badly (supervisory tones, DTMF, whistles, and other + narrowband sources). There are many ways this might be done. This canceller uses + a method based on the autocorrelation qualities of the transmitted signal. A rather + peaky autocorrelation function is a clear sign of a narrowband signal. We only need + perform the autocorrelation at well spaced intervals, so the compute load is not too + great. Multiple successive autocorrelation functions with a similar peaky shape are a + clear indication of a stationary narrowband signal. Using TKEO, it should be possible to + greatly reduce the compute requirement for narrowband detection. */ + +/* The FIR taps must be adapted as 32 bit values, to get the necessary finesse + in the adaption process. However, they are applied as 16 bit values (bits 30-15 + of the 32 bit values) in the FIR. For the working 16 bit values, we need 4 sets. + + 3 of the 16 bit sets are used on a rotating basis. Normally the canceller steps + round these 3 sets at regular intervals. Any time we detect double talk, we can go + back to the set from two steps ago with reasonable assurance it is a well adapted + set. We cannot just go back one step, as we may have rotated the sets just before + double talk or tone was detected, and that set may already be somewhat corrupted. + + When narrowband energy is detected we need to continue adapting to it, to echo + cancel it. However, the adaption will almost certainly be going astray. Broadband + (or even complex sequences of narrowband) energy will normally lead to a well + trained cancellor, with taps matching the impulse response of the channel. + For stationary narrowband energy, there is usually has an infinite number of + alternative tap sets which will cancel it well. A previously well trained set of + taps will tend to drift amongst the alternatives. When broadband energy resumes, the + taps may be a total mismatch for the signal, and could even amplify rather than + attenuate the echo. The solution is to use a fourth set of 16 bit taps. When we first + detect the narrowband energy we save the oldest of the group of three sets, but do + not change back to an older set. We let the canceller cancel, and it adaption drift + while the narrowband energy is present. When we detect the narrowband energy has ceased, + we switch to using the fourth set of taps which was saved. + + When we revert to an older set of taps, we must replace both the 16 bit and 32 bit + working tap sets. The saved 16 bit values are good enough to also be used as a replacement + for the 32 bit values. We loose the fractions, but they should soon settle down in a + reasonable way. */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/logging.h" +#include "spandsp/saturated.h" +#include "spandsp/dc_restore.h" +#include "spandsp/bit_operations.h" +#include "spandsp/echo.h" + +#include "spandsp/private/echo.h" + +#if !defined(NULL) +#define NULL (void *) 0 +#endif +#if !defined(FALSE) +#define FALSE 0 +#endif +#if !defined(TRUE) +#define TRUE (!FALSE) +#endif + +#define NONUPDATE_DWELL_TIME 600 /* 600 samples, or 75ms */ + +#define MIN_TX_POWER_FOR_ADAPTION 64*64 +#define MIN_RX_POWER_FOR_ADAPTION 64*64 + +static int narrowband_detect(echo_can_state_t *ec) +{ + int k; + int i; + float temp; + float scale; + float sf[128]; + float f_acf[128]; + int32_t acf[28]; + int score; + int len = 32; + int alen = 9; + + k = ec->curr_pos; + for (i = 0; i < len; i++) + { + sf[i] = ec->fir_state.history[k++]; + if (k >= 256) + k = 0; + } + for (k = 0; k < alen; k++) + { + temp = 0; + for (i = k; i < len; i++) + temp += sf[i]*sf[i - k]; + f_acf[k] = temp; + } + scale = 0x1FFFFFFF/f_acf[0]; + for (k = 0; k < alen; k++) + acf[k] = (int32_t) (f_acf[k]*scale); + score = 0; + for (i = 0; i < 9; i++) + { + if (ec->last_acf[i] >= 0 && acf[i] >= 0) + { + if ((ec->last_acf[i] >> 1) < acf[i] && acf[i] < (ec->last_acf[i] << 1)) + score++; + } + else if (ec->last_acf[i] < 0 && acf[i] < 0) + { + if ((ec->last_acf[i] >> 1) > acf[i] && acf[i] > (ec->last_acf[i] << 1)) + score++; + } + } + memcpy(ec->last_acf, acf, alen*sizeof(ec->last_acf[0])); + return score; +} + +static __inline__ void lms_adapt(echo_can_state_t *ec, int factor) +{ + int i; + +#if 0 + mmx_t *mmx_taps; + mmx_t *mmx_coeffs; + mmx_t *mmx_hist; + mmx_t mmx; + + mmx.w[0] = + mmx.w[1] = + mmx.w[2] = + mmx.w[3] = factor; + mmx_hist = (mmx_t *) &fir->history[fir->curr_pos]; + mmx_taps = (mmx_t *) &fir->taps; + mmx_coeffs = (mmx_t *) fir->coeffs; + i = fir->taps; + movq_m2r(mmx, mm0); + while (i > 0) + { + movq_m2r(mmx_hist[0], mm1); + movq_m2r(mmx_taps[0], mm0); + movq_m2r(mmx_taps[1], mm1); + movq_r2r(mm1, mm2); + pmulhw(mm0, mm1); + pmullw(mm0, mm2); + + pmaddwd_r2r(mm1, mm0); + pmaddwd_r2r(mm3, mm2); + paddd_r2r(mm0, mm4); + paddd_r2r(mm2, mm4); + movq_r2m(mm0, mmx_taps[0]); + movq_r2m(mm1, mmx_taps[0]); + movq_r2m(mm2, mmx_coeffs[0]); + mmx_taps += 2; + mmx_coeffs += 1; + mmx_hist += 1; + i -= 4; + ) + emms(); +#elif 0 + /* Update the FIR taps */ + for (i = ec->taps - 1; i >= 0; i--) + { + /* Leak to avoid the coefficients drifting beyond the ability of the + adaption process to bring them back under control. */ + ec->fir_taps32[i] -= (ec->fir_taps32[i] >> 23); + ec->fir_taps32[i] += (ec->fir_state.history[i + ec->curr_pos]*factor); + ec->latest_correction = (ec->fir_state.history[i + ec->curr_pos]*factor); + ec->fir_taps16[ec->tap_set][i] = ec->fir_taps32[i] >> 15; + } +#else + int offset1; + int offset2; + + /* Update the FIR taps */ + offset2 = ec->curr_pos; + offset1 = ec->taps - offset2; + for (i = ec->taps - 1; i >= offset1; i--) + { + ec->fir_taps32[i] += (ec->fir_state.history[i - offset1]*factor); + ec->fir_taps16[ec->tap_set][i] = (int16_t) (ec->fir_taps32[i] >> 15); + } + for ( ; i >= 0; i--) + { + ec->fir_taps32[i] += (ec->fir_state.history[i + offset2]*factor); + ec->fir_taps16[ec->tap_set][i] = (int16_t) (ec->fir_taps32[i] >> 15); + } +#endif +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(echo_can_state_t *) echo_can_init(int len, int adaption_mode) +{ + echo_can_state_t *ec; + int i; + int j; + + if ((ec = (echo_can_state_t *) malloc(sizeof(*ec))) == NULL) + return NULL; + memset(ec, 0, sizeof(*ec)); + ec->taps = len; + ec->curr_pos = ec->taps - 1; + ec->tap_mask = ec->taps - 1; + if ((ec->fir_taps32 = (int32_t *) malloc(ec->taps*sizeof(int32_t))) == NULL) + { + free(ec); + return NULL; + } + memset(ec->fir_taps32, 0, ec->taps*sizeof(int32_t)); + for (i = 0; i < 4; i++) + { + if ((ec->fir_taps16[i] = (int16_t *) malloc(ec->taps*sizeof(int16_t))) == NULL) + { + for (j = 0; j < i; j++) + free(ec->fir_taps16[j]); + free(ec->fir_taps32); + free(ec); + return NULL; + } + memset(ec->fir_taps16[i], 0, ec->taps*sizeof(int16_t)); + } + fir16_create(&ec->fir_state, + ec->fir_taps16[0], + ec->taps); + ec->rx_power_threshold = 10000000; + ec->geigel_max = 0; + ec->geigel_lag = 0; + ec->dtd_onset = FALSE; + ec->tap_set = 0; + ec->tap_rotate_counter = 1600; + ec->cng_level = 1000; + echo_can_adaption_mode(ec, adaption_mode); + return ec; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) echo_can_release(echo_can_state_t *ec) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) echo_can_free(echo_can_state_t *ec) +{ + int i; + + fir16_free(&ec->fir_state); + free(ec->fir_taps32); + for (i = 0; i < 4; i++) + free(ec->fir_taps16[i]); + free(ec); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) echo_can_adaption_mode(echo_can_state_t *ec, int adaption_mode) +{ + ec->adaption_mode = adaption_mode; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) echo_can_flush(echo_can_state_t *ec) +{ + int i; + + for (i = 0; i < 4; i++) + ec->tx_power[i] = 0; + for (i = 0; i < 3; i++) + ec->rx_power[i] = 0; + ec->clean_rx_power = 0; + ec->nonupdate_dwell = 0; + + fir16_flush(&ec->fir_state); + ec->fir_state.curr_pos = ec->taps - 1; + memset(ec->fir_taps32, 0, ec->taps*sizeof(int32_t)); + for (i = 0; i < 4; i++) + memset(ec->fir_taps16[i], 0, ec->taps*sizeof(int16_t)); + + ec->curr_pos = ec->taps - 1; + + ec->supp_test1 = 0; + ec->supp_test2 = 0; + ec->supp1 = 0; + ec->supp2 = 0; + ec->vad = 0; + ec->cng_level = 1000; + ec->cng_filter = 0; + + ec->geigel_max = 0; + ec->geigel_lag = 0; + ec->dtd_onset = FALSE; + ec->tap_set = 0; + ec->tap_rotate_counter = 1600; + + ec->latest_correction = 0; + + memset(ec->last_acf, 0, sizeof(ec->last_acf)); + ec->narrowband_count = 0; + ec->narrowband_score = 0; +} +/*- End of function --------------------------------------------------------*/ + +int sample_no = 0; + +SPAN_DECLARE(void) echo_can_snapshot(echo_can_state_t *ec) +{ + memcpy(ec->snapshot, ec->fir_taps16[0], ec->taps*sizeof(int16_t)); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int16_t echo_can_hpf(int32_t coeff[2], int16_t amp) +{ + int32_t z; + + /* + Filter DC, 3dB point is 160Hz (I think), note 32 bit precision required + otherwise values do not track down to 0. Zero at DC, Pole at (1-Beta) + only real axis. Some chip sets (like Si labs) don't need + this, but something like a $10 X100P card does. Any DC really slows + down convergence. + + Note: removes some low frequency from the signal, this reduces + the speech quality when listening to samples through headphones + but may not be obvious through a telephone handset. + + Note that the 3dB frequency in radians is approx Beta, e.g. for + Beta = 2^(-3) = 0.125, 3dB freq is 0.125 rads = 159Hz. + + This is one of the classic DC removal filters, adjusted to provide sufficient + bass rolloff to meet the above requirement to protect hybrids from things that + upset them. The difference between successive samples produces a lousy HPF, and + then a suitably placed pole flattens things out. The final result is a nicely + rolled off bass end. The filtering is implemented with extended fractional + precision, which noise shapes things, giving very clean DC removal. + + Make sure the gain of the HPF is 1.0. The first can still saturate a little under + impulse conditions, and it might roll to 32768 and need clipping on sustained peak + level signals. However, the scale of such clipping is small, and the error due to + any saturation should not markedly affect the downstream processing. */ + z = amp << 15; + z -= (z >> 4); + coeff[0] += z - (coeff[0] >> 3) - coeff[1]; + coeff[1] = z; + z = coeff[0] >> 15; + + return saturate(z); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int16_t) echo_can_update(echo_can_state_t *ec, int16_t tx, int16_t rx) +{ + int32_t echo_value; + int clean_rx; + int nsuppr; + int score; + int i; + +sample_no++; + if (ec->adaption_mode & ECHO_CAN_USE_RX_HPF) + rx = echo_can_hpf(ec->rx_hpf, rx); + + ec->latest_correction = 0; + /* Evaluate the echo - i.e. apply the FIR filter */ + /* Assume the gain of the FIR does not exceed unity. Exceeding unity + would seem like a rather poor thing for an echo cancellor to do :) + This means we can compute the result with a total disregard for + overflows. 16bits x 16bits -> 31bits, so no overflow can occur in + any multiply. While accumulating we may overflow and underflow the + 32 bit scale often. However, if the gain does not exceed unity, + everything should work itself out, and the final result will be + OK, without any saturation logic. */ + /* Overflow is very much possible here, and we do nothing about it because + of the compute costs */ + /* 16 bit coeffs for the LMS give lousy results (maths good, actual sound + bad!), but 32 bit coeffs require some shifting. On balance 32 bit seems + best */ + echo_value = fir16(&ec->fir_state, tx); + + /* And the answer is..... */ + clean_rx = rx - echo_value; +printf("echo is %" PRId32 "\n", echo_value); + /* That was the easy part. Now we need to adapt! */ + if (ec->nonupdate_dwell > 0) + ec->nonupdate_dwell--; + + /* Calculate short term power levels using very simple single pole IIRs */ + /* TODO: Is the nasty modulus approach the fastest, or would a real + tx*tx power calculation actually be faster? Using the squares + makes the numbers grow a lot! */ + ec->tx_power[3] += ((abs(tx) - ec->tx_power[3]) >> 5); + ec->tx_power[2] += ((tx*tx - ec->tx_power[2]) >> 8); + ec->tx_power[1] += ((tx*tx - ec->tx_power[1]) >> 5); + ec->tx_power[0] += ((tx*tx - ec->tx_power[0]) >> 3); + ec->rx_power[1] += ((rx*rx - ec->rx_power[1]) >> 6); + ec->rx_power[0] += ((rx*rx - ec->rx_power[0]) >> 3); + ec->clean_rx_power += ((clean_rx*clean_rx - ec->clean_rx_power) >> 6); + + score = 0; + /* If there is very little being transmitted, any attempt to train is + futile. We would either be training on the far end's noise or signal, + the channel's own noise, or our noise. Either way, this is hardly good + training, so don't do it (avoid trouble). */ + if (ec->tx_power[0] > MIN_TX_POWER_FOR_ADAPTION) + { + /* If the received power is very low, either we are sending very little or + we are already well adapted. There is little point in trying to improve + the adaption under these circumstances, so don't do it (reduce the + compute load). */ + if (ec->tx_power[1] > ec->rx_power[0]) + { + /* There is no (or little) far-end speech. */ + if (ec->nonupdate_dwell == 0) + { + if (++ec->narrowband_count >= 160) + { + ec->narrowband_count = 0; + score = narrowband_detect(ec); +printf("Do the narrowband test %d at %d\n", score, ec->curr_pos); + if (score > 6) + { + if (ec->narrowband_score == 0) + memcpy(ec->fir_taps16[3], ec->fir_taps16[(ec->tap_set + 1)%3], ec->taps*sizeof(int16_t)); + ec->narrowband_score += score; + } + else + { + if (ec->narrowband_score > 200) + { +printf("Revert to %d at %d\n", (ec->tap_set + 1)%3, sample_no); + memcpy(ec->fir_taps16[ec->tap_set], ec->fir_taps16[3], ec->taps*sizeof(int16_t)); + memcpy(ec->fir_taps16[(ec->tap_set - 1)%3], ec->fir_taps16[3], ec->taps*sizeof(int16_t)); + for (i = 0; i < ec->taps; i++) + ec->fir_taps32[i] = ec->fir_taps16[3][i] << 15; + ec->tap_rotate_counter = 1600; + } + ec->narrowband_score = 0; + } + } + ec->dtd_onset = FALSE; + if (--ec->tap_rotate_counter <= 0) + { +printf("Rotate to %d at %d\n", ec->tap_set, sample_no); + ec->tap_rotate_counter = 1600; + ec->tap_set++; + if (ec->tap_set > 2) + ec->tap_set = 0; + ec->fir_state.coeffs = ec->fir_taps16[ec->tap_set]; + } + /* ... and we are not in the dwell time from previous speech. */ + if ((ec->adaption_mode & ECHO_CAN_USE_ADAPTION) && ec->narrowband_score == 0) + { + //nsuppr = saturate((clean_rx << 16)/ec->tx_power[1]); + //nsuppr = clean_rx/ec->tx_power[1]; + /* If a sudden surge in signal level (e.g. the onset of a tone + burst) cause an abnormally high instantaneous to average + signal power ratio, we could kick the adaption badly in the + wrong direction. This is because the tx_power takes too long + to react and rise. We need to stop too rapid adaption to the + new signal. We normalise to a value derived from the + instantaneous signal if it exceeds the peak by too much. */ + nsuppr = clean_rx; + /* Divide isn't very quick, but the "where is the top bit" and shift + instructions are single cycle. */ + if (tx > 4*ec->tx_power[3]) + i = top_bit(tx) - 8; + else + i = top_bit(ec->tx_power[3]) - 8; + if (i > 0) + nsuppr >>= i; + lms_adapt(ec, nsuppr); + } + } + //printf("%10d %10d %10d %10d %10d\n", rx, clean_rx, nsuppr, ec->tx_power[1], ec->rx_power[1]); + //printf("%.4f\n", (float) ec->rx_power[1]/(float) ec->clean_rx_power); + } + else + { + if (!ec->dtd_onset) + { +printf("Revert to %d at %d\n", (ec->tap_set + 1)%3, sample_no); + memcpy(ec->fir_taps16[ec->tap_set], ec->fir_taps16[(ec->tap_set + 1)%3], ec->taps*sizeof(int16_t)); + memcpy(ec->fir_taps16[(ec->tap_set - 1)%3], ec->fir_taps16[(ec->tap_set + 1)%3], ec->taps*sizeof(int16_t)); + for (i = 0; i < ec->taps; i++) + ec->fir_taps32[i] = ec->fir_taps16[(ec->tap_set + 1)%3][i] << 15; + ec->tap_rotate_counter = 1600; + ec->dtd_onset = TRUE; + } + ec->nonupdate_dwell = NONUPDATE_DWELL_TIME; + } + } + + if (ec->rx_power[1]) + ec->vad = (8000*ec->clean_rx_power)/ec->rx_power[1]; + else + ec->vad = 0; + if (ec->rx_power[1] > 2048*2048 && ec->clean_rx_power > 4*ec->rx_power[1]) + { + /* The EC seems to be making things worse, instead of better. Zap it! */ + memset(ec->fir_taps32, 0, ec->taps*sizeof(int32_t)); + for (i = 0; i < 4; i++) + memset(ec->fir_taps16[i], 0, ec->taps*sizeof(int16_t)); + } + +#if defined(XYZZY) + if ((ec->adaption_mode & ECHO_CAN_USE_SUPPRESSOR)) + { + ec->supp_test1 += (ec->fir_state.history[ec->curr_pos] - ec->fir_state.history[(ec->curr_pos - 7) & ec->tap_mask]); + ec->supp_test2 += (ec->fir_state.history[(ec->curr_pos - 24) & ec->tap_mask] - ec->fir_state.history[(ec->curr_pos - 31) & ec->tap_mask]); + if (ec->supp_test1 > 42 && ec->supp_test2 > 42) + supp_change = 25; + else + supp_change = 50; + supp = supp_change + k1*ec->supp1 + k2*ec->supp2; + ec->supp2 = ec->supp1; + ec->supp1 = supp; + clean_rx *= (1 - supp); + } +#endif + + if ((ec->adaption_mode & ECHO_CAN_USE_NLP)) + { + /* Non-linear processor - a fancy way to say "zap small signals, to avoid + residual echo due to (uLaw/ALaw) non-linearity in the channel.". */ + if (ec->rx_power[1] < 30000000) + { + if (!ec->cng) + { + ec->cng_level = ec->clean_rx_power; + ec->cng = TRUE; + } + if ((ec->adaption_mode & ECHO_CAN_USE_CNG)) + { + /* Very elementary comfort noise generation */ + /* Just random numbers rolled off very vaguely Hoth-like */ + ec->cng_rndnum = 1664525U*ec->cng_rndnum + 1013904223U; + ec->cng_filter = ((ec->cng_rndnum & 0xFFFF) - 32768 + 5*ec->cng_filter) >> 3; + clean_rx = (ec->cng_filter*ec->cng_level) >> 17; + /* TODO: A better CNG, with more accurate (tracking) spectral shaping! */ + } + else + { + clean_rx = 0; + } +//clean_rx = -16000; + } + else + { + ec->cng = FALSE; + } + } + else + { + ec->cng = FALSE; + } + +printf("Narrowband score %4d %5d at %d\n", ec->narrowband_score, score, sample_no); + /* Roll around the rolling buffer */ + if (ec->curr_pos <= 0) + ec->curr_pos = ec->taps; + ec->curr_pos--; + return (int16_t) clean_rx; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int16_t) echo_can_hpf_tx(echo_can_state_t *ec, int16_t tx) +{ + if (ec->adaption_mode & ECHO_CAN_USE_TX_HPF) + tx = echo_can_hpf(ec->tx_hpf, tx); + return tx; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/fax.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/fax.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,656 @@ +//#define LOG_FAX_AUDIO +/* + * SpanDSP - a series of DSP components for telephony + * + * fax.c - Analogue line ITU T.30 FAX transfer processing + * + * Written by Steve Underwood + * + * Copyright (C) 2003, 2005, 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: fax.c,v 1.96.4.1 2009/12/19 10:44:10 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include +#include +#include +#if defined(LOG_FAX_AUDIO) +#include +#endif +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/queue.h" +#include "spandsp/dc_restore.h" +#include "spandsp/power_meter.h" +#include "spandsp/complex.h" +#include "spandsp/tone_detect.h" +#include "spandsp/tone_generate.h" +#include "spandsp/async.h" +#include "spandsp/hdlc.h" +#include "spandsp/silence_gen.h" +#include "spandsp/fsk.h" +#include "spandsp/v29tx.h" +#include "spandsp/v29rx.h" +#include "spandsp/v27ter_tx.h" +#include "spandsp/v27ter_rx.h" +#include "spandsp/v17tx.h" +#include "spandsp/v17rx.h" +#include "spandsp/super_tone_rx.h" +#include "spandsp/modem_connect_tones.h" +#include "spandsp/t4_rx.h" +#include "spandsp/t4_tx.h" + +#include "spandsp/t30_fcf.h" +#include "spandsp/t35.h" +#include "spandsp/t30.h" +#include "spandsp/t30_api.h" +#include "spandsp/t30_logging.h" + +#include "spandsp/fax_modems.h" +#include "spandsp/fax.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/silence_gen.h" +#include "spandsp/private/fsk.h" +#include "spandsp/private/v17tx.h" +#include "spandsp/private/v17rx.h" +#include "spandsp/private/v27ter_tx.h" +#include "spandsp/private/v27ter_rx.h" +#include "spandsp/private/v29tx.h" +#include "spandsp/private/v29rx.h" +#include "spandsp/private/modem_connect_tones.h" +#include "spandsp/private/hdlc.h" +#include "spandsp/private/fax_modems.h" +#include "spandsp/private/t4_rx.h" +#include "spandsp/private/t4_tx.h" +#include "spandsp/private/t30.h" +#include "spandsp/private/fax.h" + +#define HDLC_FRAMING_OK_THRESHOLD 8 + +static void fax_send_hdlc(void *user_data, const uint8_t *msg, int len) +{ + fax_state_t *s; + + s = (fax_state_t *) user_data; + + hdlc_tx_frame(&s->modems.hdlc_tx, msg, len); +} +/*- End of function --------------------------------------------------------*/ + +static void tone_detected(void *user_data, int tone, int level, int delay) +{ + t30_state_t *s; + + s = (t30_state_t *) user_data; + span_log(&s->logging, SPAN_LOG_FLOW, "%s detected (%ddBm0)\n", modem_connect_tone_to_str(tone), level); +} +/*- End of function --------------------------------------------------------*/ + +static void hdlc_underflow_handler(void *user_data) +{ + t30_state_t *s; + + s = (t30_state_t *) user_data; + t30_front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); +} +/*- End of function --------------------------------------------------------*/ + +static void set_rx_handler(fax_state_t *s, + span_rx_handler_t *rx_handler, + span_rx_fillin_handler_t *fillin_handler, + void *user_data) +{ + s->modems.rx_handler = rx_handler; + s->modems.rx_fillin_handler = fillin_handler; + s->modems.rx_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +static void set_tx_handler(fax_state_t *s, span_tx_handler_t *handler, void *user_data) +{ + s->modems.tx_handler = handler; + s->modems.tx_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +static void set_next_tx_handler(fax_state_t *s, span_tx_handler_t *handler, void *user_data) +{ + s->modems.next_tx_handler = handler; + s->modems.next_tx_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +static int v17_v21_rx(void *user_data, const int16_t amp[], int len) +{ + fax_state_t *t; + fax_modems_state_t *s; + + t = (fax_state_t *) user_data; + s = &t->modems; + v17_rx(&s->v17_rx, amp, len); + if (t->t30.rx_trained) + { + /* The fast modem has trained, so we no longer need to run the slow + one in parallel. */ + span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.17 (%.2fdBm0)\n", v17_rx_signal_power(&s->v17_rx)); + set_rx_handler(t, (span_rx_handler_t *) &v17_rx, (span_rx_fillin_handler_t *) &v17_rx_fillin, &s->v17_rx); + } + else + { + fsk_rx(&s->v21_rx, amp, len); + if (t->t30.rx_frame_received) + { + /* We have received something, and the fast modem has not trained. We must + be receiving valid V.21 */ + span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); + set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &s->v21_rx); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int v17_v21_rx_fillin(void *user_data, int len) +{ + fax_state_t *t; + fax_modems_state_t *s; + + t = (fax_state_t *) user_data; + s = &t->modems; + v17_rx_fillin(&s->v17_rx, len); + fsk_rx_fillin(&s->v21_rx, len); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len) +{ + fax_state_t *t; + fax_modems_state_t *s; + + t = (fax_state_t *) user_data; + s = &t->modems; + v27ter_rx(&s->v27ter_rx, amp, len); + if (t->t30.rx_trained) + { + /* The fast modem has trained, so we no longer need to run the slow + one in parallel. */ + span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.27ter (%.2fdBm0)\n", v27ter_rx_signal_power(&s->v27ter_rx)); + set_rx_handler(t, (span_rx_handler_t *) &v27ter_rx, (span_rx_fillin_handler_t *) &v27ter_rx_fillin, &s->v27ter_rx); + } + else + { + fsk_rx(&s->v21_rx, amp, len); + if (t->t30.rx_frame_received) + { + /* We have received something, and the fast modem has not trained. We must + be receiving valid V.21 */ + span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); + set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &s->v21_rx); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int v27ter_v21_rx_fillin(void *user_data, int len) +{ + fax_state_t *t; + fax_modems_state_t *s; + + t = (fax_state_t *) user_data; + s = &t->modems; + v27ter_rx_fillin(&s->v27ter_rx, len); + fsk_rx_fillin(&s->v21_rx, len); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int v29_v21_rx(void *user_data, const int16_t amp[], int len) +{ + fax_state_t *t; + fax_modems_state_t *s; + + t = (fax_state_t *) user_data; + s = &t->modems; + v29_rx(&s->v29_rx, amp, len); + if (t->t30.rx_trained) + { + /* The fast modem has trained, so we no longer need to run the slow + one in parallel. */ + span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.29 (%.2fdBm0)\n", v29_rx_signal_power(&s->v29_rx)); + set_rx_handler(t, (span_rx_handler_t *) &v29_rx, (span_rx_fillin_handler_t *) &v29_rx_fillin, &s->v29_rx); + } + else + { + fsk_rx(&s->v21_rx, amp, len); + if (t->t30.rx_frame_received) + { + /* We have received something, and the fast modem has not trained. We must + be receiving valid V.21 */ + span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); + set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &s->v21_rx); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int v29_v21_rx_fillin(void *user_data, int len) +{ + fax_state_t *t; + fax_modems_state_t *s; + + t = (fax_state_t *) user_data; + s = &t->modems; + v29_rx_fillin(&s->v29_rx, len); + fsk_rx_fillin(&s->v21_rx, len); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) fax_rx(fax_state_t *s, int16_t *amp, int len) +{ + int i; + +#if defined(LOG_FAX_AUDIO) + if (s->modems.audio_rx_log >= 0) + write(s->modems.audio_rx_log, amp, len*sizeof(int16_t)); +#endif + for (i = 0; i < len; i++) + amp[i] = dc_restore(&s->modems.dc_restore, amp[i]); + s->modems.rx_handler(s->modems.rx_user_data, amp, len); + t30_timer_update(&s->t30, len); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) fax_rx_fillin(fax_state_t *s, int len) +{ + /* To mitigate the effect of lost packets on a packet network we should + try to sustain the status quo. If there is no receive modem running, keep + things that way. If there is a receive modem running, try to sustain its + operation, without causing a phase hop, or letting its adaptive functions + diverge. */ +#if defined(LOG_FAX_AUDIO) + if (s->modems.audio_rx_log >= 0) + { + int i; +#if defined(_MSC_VER) + int16_t *amp = (int16_t *) _alloca(sizeof(int16_t)*len); +#else + int16_t amp[len]; +#endif + + vec_zeroi16(amp, len); + write(s->modems.audio_rx_log, amp, len*sizeof(int16_t)); + } +#endif + /* Call the fillin function of the current modem (if there is one). */ + s->modems.rx_fillin_handler(s->modems.rx_user_data, len); + t30_timer_update(&s->t30, len); + return len; +} +/*- End of function --------------------------------------------------------*/ + +static int set_next_tx_type(fax_state_t *s) +{ + fax_modems_state_t *t; + + t = &s->modems; + if (t->next_tx_handler) + { + set_tx_handler(s, t->next_tx_handler, t->next_tx_user_data); + t->next_tx_handler = NULL; + return 0; + } + /* If there is nothing else to change to, so use zero length silence */ + silence_gen_alter(&t->silence_gen, 0); + set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + t->transmit = FALSE; + return -1; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) fax_tx(fax_state_t *s, int16_t *amp, int max_len) +{ + int len; +#if defined(LOG_FAX_AUDIO) + int required_len; + + required_len = max_len; +#endif + len = 0; + if (s->modems.transmit) + { + while ((len += s->modems.tx_handler(s->modems.tx_user_data, amp + len, max_len - len)) < max_len) + { + /* Allow for a change of tx handler within a block */ + if (set_next_tx_type(s) && s->modems.current_tx_type != T30_MODEM_NONE && s->modems.current_tx_type != T30_MODEM_DONE) + t30_front_end_status(&s->t30, T30_FRONT_END_SEND_STEP_COMPLETE); + if (!s->modems.transmit) + { + if (s->modems.transmit_on_idle) + { + /* Pad to the requested length with silence */ + memset(amp + len, 0, (max_len - len)*sizeof(int16_t)); + len = max_len; + } + break; + } + } + } + else + { + if (s->modems.transmit_on_idle) + { + /* Pad to the requested length with silence */ + memset(amp, 0, max_len*sizeof(int16_t)); + len = max_len; + } + } +#if defined(LOG_FAX_AUDIO) + if (s->modems.audio_tx_log >= 0) + { + if (len < required_len) + memset(amp + len, 0, (required_len - len)*sizeof(int16_t)); + write(s->modems.audio_tx_log, amp, required_len*sizeof(int16_t)); + } +#endif + return len; +} +/*- End of function --------------------------------------------------------*/ + +static void fax_set_rx_type(void *user_data, int type, int bit_rate, int short_train, int use_hdlc) +{ + fax_state_t *s; + put_bit_func_t put_bit_func; + void *put_bit_user_data; + fax_modems_state_t *t; + + s = (fax_state_t *) user_data; + t = &s->modems; + span_log(&s->logging, SPAN_LOG_FLOW, "Set rx type %d\n", type); + if (t->current_rx_type == type) + return; + t->current_rx_type = type; + t->rx_bit_rate = bit_rate; + if (use_hdlc) + { + put_bit_func = (put_bit_func_t) hdlc_rx_put_bit; + put_bit_user_data = (void *) &t->hdlc_rx; + hdlc_rx_init(&t->hdlc_rx, FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, t30_hdlc_accept, &s->t30); + } + else + { + put_bit_func = t30_non_ecm_put_bit; + put_bit_user_data = (void *) &s->t30; + } + switch (type) + { + case T30_MODEM_V21: + fsk_rx_init(&t->v21_rx, &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) hdlc_rx_put_bit, put_bit_user_data); + fsk_rx_signal_cutoff(&t->v21_rx, -45.5f); + set_rx_handler(s, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &t->v21_rx); + break; + case T30_MODEM_V27TER: + v27ter_rx_restart(&t->v27ter_rx, bit_rate, FALSE); + v27ter_rx_set_put_bit(&t->v27ter_rx, put_bit_func, put_bit_user_data); + set_rx_handler(s, &v27ter_v21_rx, &v27ter_v21_rx_fillin, s); + break; + case T30_MODEM_V29: + v29_rx_restart(&t->v29_rx, bit_rate, FALSE); + v29_rx_set_put_bit(&t->v29_rx, put_bit_func, put_bit_user_data); + set_rx_handler(s, &v29_v21_rx, &v29_v21_rx_fillin, s); + break; + case T30_MODEM_V17: + v17_rx_restart(&t->v17_rx, bit_rate, short_train); + v17_rx_set_put_bit(&t->v17_rx, put_bit_func, put_bit_user_data); + set_rx_handler(s, &v17_v21_rx, &v17_v21_rx_fillin, s); + break; + case T30_MODEM_DONE: + span_log(&s->logging, SPAN_LOG_FLOW, "FAX exchange complete\n"); + default: + set_rx_handler(s, (span_rx_handler_t *) &span_dummy_rx, (span_rx_fillin_handler_t *) &span_dummy_rx_fillin, s); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_train, int use_hdlc) +{ + fax_state_t *s; + get_bit_func_t get_bit_func; + void *get_bit_user_data; + fax_modems_state_t *t; + int tone; + + s = (fax_state_t *) user_data; + t = &s->modems; + span_log(&s->logging, SPAN_LOG_FLOW, "Set tx type %d\n", type); + if (t->current_tx_type == type) + return; + if (use_hdlc) + { + get_bit_func = (get_bit_func_t) hdlc_tx_get_bit; + get_bit_user_data = (void *) &t->hdlc_tx; + } + else + { + get_bit_func = t30_non_ecm_get_bit; + get_bit_user_data = (void *) &s->t30; + } + switch (type) + { + case T30_MODEM_PAUSE: + silence_gen_alter(&t->silence_gen, ms_to_samples(short_train)); + set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + t->transmit = TRUE; + break; + case T30_MODEM_CED: + case T30_MODEM_CNG: + if (type == T30_MODEM_CED) + tone = MODEM_CONNECT_TONES_FAX_CED; + else + tone = MODEM_CONNECT_TONES_FAX_CNG; + modem_connect_tones_tx_init(&t->connect_tx, tone); + set_tx_handler(s, (span_tx_handler_t *) &modem_connect_tones_tx, &t->connect_tx); + set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + t->transmit = TRUE; + break; + case T30_MODEM_V21: + fsk_tx_init(&t->v21_tx, &preset_fsk_specs[FSK_V21CH2], get_bit_func, get_bit_user_data); + /* The spec says 1s +-15% of preamble. So, the minimum is 32 octets. */ + hdlc_tx_flags(&t->hdlc_tx, 32); + /* Pause before switching from phase C, as per T.30 5.3.2.2. If we omit this, the receiver + might not see the carrier fall between the high speed and low speed sections. In practice, + a 75ms gap before any V.21 transmission is harmless, adds little to the overall length of + a call, and ensures the receiving end is ready. */ + silence_gen_alter(&t->silence_gen, ms_to_samples(75)); + set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t *) &fsk_tx, &t->v21_tx); + t->transmit = TRUE; + break; + case T30_MODEM_V27TER: + silence_gen_alter(&t->silence_gen, ms_to_samples(75)); + /* For any fast modem, set 200ms of preamble flags */ + hdlc_tx_flags(&t->hdlc_tx, bit_rate/(8*5)); + v27ter_tx_restart(&t->v27ter_tx, bit_rate, t->use_tep); + v27ter_tx_set_get_bit(&t->v27ter_tx, get_bit_func, get_bit_user_data); + set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t *) &v27ter_tx, &t->v27ter_tx); + t->transmit = TRUE; + break; + case T30_MODEM_V29: + silence_gen_alter(&t->silence_gen, ms_to_samples(75)); + /* For any fast modem, set 200ms of preamble flags */ + hdlc_tx_flags(&t->hdlc_tx, bit_rate/(8*5)); + v29_tx_restart(&t->v29_tx, bit_rate, t->use_tep); + v29_tx_set_get_bit(&t->v29_tx, get_bit_func, get_bit_user_data); + set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t *) &v29_tx, &t->v29_tx); + t->transmit = TRUE; + break; + case T30_MODEM_V17: + silence_gen_alter(&t->silence_gen, ms_to_samples(75)); + /* For any fast modem, set 200ms of preamble flags */ + hdlc_tx_flags(&t->hdlc_tx, bit_rate/(8*5)); + v17_tx_restart(&t->v17_tx, bit_rate, t->use_tep, short_train); + v17_tx_set_get_bit(&t->v17_tx, get_bit_func, get_bit_user_data); + set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t *) &v17_tx, &t->v17_tx); + t->transmit = TRUE; + break; + case T30_MODEM_DONE: + span_log(&s->logging, SPAN_LOG_FLOW, "FAX exchange complete\n"); + /* Fall through */ + default: + silence_gen_alter(&t->silence_gen, 0); + set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + t->transmit = FALSE; + break; + } + t->tx_bit_rate = bit_rate; + t->current_tx_type = type; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) fax_set_transmit_on_idle(fax_state_t *s, int transmit_on_idle) +{ + s->modems.transmit_on_idle = transmit_on_idle; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) fax_set_tep_mode(fax_state_t *s, int use_tep) +{ + s->modems.use_tep = use_tep; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(t30_state_t *) fax_get_t30_state(fax_state_t *s) +{ + return &s->t30; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(logging_state_t *) fax_get_logging_state(fax_state_t *s) +{ + return &s->logging; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(fax_state_t *) fax_init(fax_state_t *s, int calling_party) +{ + if (s == NULL) + { + if ((s = (fax_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "FAX"); + fax_modems_init(&s->modems, + FALSE, + t30_hdlc_accept, + hdlc_underflow_handler, + t30_non_ecm_put_bit, + t30_non_ecm_get_bit, + tone_detected, + &s->t30); + t30_init(&s->t30, + calling_party, + fax_set_rx_type, + (void *) s, + fax_set_tx_type, + (void *) s, + fax_send_hdlc, + (void *) s); + t30_set_supported_modems(&s->t30, T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17); + t30_restart(&s->t30); +#if defined(LOG_FAX_AUDIO) + { + char buf[100 + 1]; + struct tm *tm; + time_t now; + + time(&now); + tm = localtime(&now); + sprintf(buf, + "/tmp/fax-rx-audio-%p-%02d%02d%02d%02d%02d%02d", + s, + tm->tm_year%100, + tm->tm_mon + 1, + tm->tm_mday, + tm->tm_hour, + tm->tm_min, + tm->tm_sec); + s->modems.audio_rx_log = open(buf, O_CREAT | O_TRUNC | O_WRONLY, 0666); + sprintf(buf, + "/tmp/fax-tx-audio-%p-%02d%02d%02d%02d%02d%02d", + s, + tm->tm_year%100, + tm->tm_mon + 1, + tm->tm_mday, + tm->tm_hour, + tm->tm_min, + tm->tm_sec); + s->modems.audio_tx_log = open(buf, O_CREAT | O_TRUNC | O_WRONLY, 0666); + } +#endif + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) fax_release(fax_state_t *s) +{ + t30_release(&s->t30); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) fax_free(fax_state_t *s) +{ + t30_release(&s->t30); + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/fax_modems.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/fax_modems.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,330 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * fax_modems.c - the analogue modem set for fax processing + * + * Written by Steve Underwood + * + * Copyright (C) 2003, 2005, 2006, 2008 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: fax_modems.c,v 1.8 2009/11/02 13:25:20 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include +#include +#include +#if defined(LOG_FAX_AUDIO) +#include +#endif + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/bit_operations.h" +#include "spandsp/dc_restore.h" +#include "spandsp/queue.h" +#include "spandsp/power_meter.h" +#include "spandsp/complex.h" +#include "spandsp/tone_detect.h" +#include "spandsp/tone_generate.h" +#include "spandsp/async.h" +#include "spandsp/crc.h" +#include "spandsp/hdlc.h" +#include "spandsp/silence_gen.h" +#include "spandsp/fsk.h" +#include "spandsp/v29tx.h" +#include "spandsp/v29rx.h" +#include "spandsp/v27ter_tx.h" +#include "spandsp/v27ter_rx.h" +#include "spandsp/v17tx.h" +#include "spandsp/v17rx.h" +#include "spandsp/super_tone_rx.h" +#include "spandsp/modem_connect_tones.h" +#include "spandsp/fax_modems.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/silence_gen.h" +#include "spandsp/private/fsk.h" +#include "spandsp/private/v17tx.h" +#include "spandsp/private/v17rx.h" +#include "spandsp/private/v27ter_tx.h" +#include "spandsp/private/v27ter_rx.h" +#include "spandsp/private/v29tx.h" +#include "spandsp/private/v29rx.h" +#include "spandsp/private/modem_connect_tones.h" +#include "spandsp/private/hdlc.h" +#include "spandsp/private/fax_modems.h" + +#define HDLC_FRAMING_OK_THRESHOLD 5 + +SPAN_DECLARE(int) fax_modems_v17_v21_rx(void *user_data, const int16_t amp[], int len) +{ + fax_modems_state_t *s; + + s = (fax_modems_state_t *) user_data; + v17_rx(&s->v17_rx, amp, len); + fsk_rx(&s->v21_rx, amp, len); + if (s->rx_frame_received) + { + /* We have received something, and the fast modem has not trained. We must + be receiving valid V.21 */ + span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); + s->rx_handler = (span_rx_handler_t *) &fsk_rx; + s->rx_fillin_handler = (span_rx_fillin_handler_t *) &fsk_rx_fillin; + s->rx_user_data = &s->v21_rx; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) fax_modems_v17_v21_rx_fillin(void *user_data, int len) +{ + fax_modems_state_t *s; + + s = (fax_modems_state_t *) user_data; + v17_rx_fillin(&s->v17_rx, len); + fsk_rx_fillin(&s->v21_rx, len); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) fax_modems_v27ter_v21_rx(void *user_data, const int16_t amp[], int len) +{ + fax_modems_state_t *s; + + s = (fax_modems_state_t *) user_data; + v27ter_rx(&s->v27ter_rx, amp, len); + fsk_rx(&s->v21_rx, amp, len); + if (s->rx_frame_received) + { + /* We have received something, and the fast modem has not trained. We must + be receiving valid V.21 */ + span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); + s->rx_handler = (span_rx_handler_t *) &fsk_rx; + s->rx_fillin_handler = (span_rx_fillin_handler_t *) &fsk_rx_fillin; + s->rx_user_data = &s->v21_rx; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) fax_modems_v27ter_v21_rx_fillin(void *user_data, int len) +{ + fax_modems_state_t *s; + + s = (fax_modems_state_t *) user_data; + v27ter_rx_fillin(&s->v27ter_rx, len); + fsk_rx_fillin(&s->v21_rx, len); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) fax_modems_v29_v21_rx(void *user_data, const int16_t amp[], int len) +{ + fax_modems_state_t *s; + + s = (fax_modems_state_t *) user_data; + v29_rx(&s->v29_rx, amp, len); + fsk_rx(&s->v21_rx, amp, len); + if (s->rx_frame_received) + { + /* We have received something, and the fast modem has not trained. We must + be receiving valid V.21 */ + span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); + s->rx_handler = (span_rx_handler_t *) &fsk_rx; + s->rx_fillin_handler = (span_rx_fillin_handler_t *) &fsk_rx_fillin; + s->rx_user_data = &s->v21_rx; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) fax_modems_v29_v21_rx_fillin(void *user_data, int len) +{ + fax_modems_state_t *s; + + s = (fax_modems_state_t *) user_data; + v29_rx_fillin(&s->v29_rx, len); + fsk_rx_fillin(&s->v21_rx, len); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void v21_rx_status_handler(void *user_data, int status) +{ + fax_modems_state_t *s; + + s = (fax_modems_state_t *) user_data; +} +/*- End of function --------------------------------------------------------*/ + +static void v17_rx_status_handler(void *user_data, int status) +{ + fax_modems_state_t *s; + + s = (fax_modems_state_t *) user_data; + switch (status) + { + case SIG_STATUS_TRAINING_SUCCEEDED: + span_log(&s->logging, SPAN_LOG_FLOW, "Switching to V.17 (%.2fdBm0)\n", v17_rx_signal_power(&s->v17_rx)); + s->rx_handler = (span_rx_handler_t *) &v17_rx; + s->rx_fillin_handler = (span_rx_fillin_handler_t *) &v17_rx_fillin; + s->rx_user_data = &s->v17_rx; + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void v27ter_rx_status_handler(void *user_data, int status) +{ + fax_modems_state_t *s; + + s = (fax_modems_state_t *) user_data; + switch (status) + { + case SIG_STATUS_TRAINING_SUCCEEDED: + span_log(&s->logging, SPAN_LOG_FLOW, "Switching to V.27ter (%.2fdBm0)\n", v27ter_rx_signal_power(&s->v27ter_rx)); + s->rx_handler = (span_rx_handler_t *) &v27ter_rx; + s->rx_fillin_handler = (span_rx_fillin_handler_t *) &v27ter_rx_fillin; + s->rx_user_data = &s->v27ter_rx; + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void v29_rx_status_handler(void *user_data, int status) +{ + fax_modems_state_t *s; + + s = (fax_modems_state_t *) user_data; + switch (status) + { + case SIG_STATUS_TRAINING_SUCCEEDED: + span_log(&s->logging, SPAN_LOG_FLOW, "Switching to V.29 (%.2fdBm0)\n", v29_rx_signal_power(&s->v29_rx)); + s->rx_handler = (span_rx_handler_t *) &v29_rx; + s->rx_fillin_handler = (span_rx_fillin_handler_t *) &v29_rx_fillin; + s->rx_user_data = &s->v29_rx; + break; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) fax_modems_start_rx_modem(fax_modems_state_t *s, int which) +{ + switch (which) + { + case FAX_MODEM_V17_RX: + v17_rx_set_modem_status_handler(&s->v17_rx, v17_rx_status_handler, s); + break; + case FAX_MODEM_V27TER_RX: + v27ter_rx_set_modem_status_handler(&s->v27ter_rx, v27ter_rx_status_handler, s); + break; + case FAX_MODEM_V29_RX: + v29_rx_set_modem_status_handler(&s->v29_rx, v29_rx_status_handler, s); + break; + } + fsk_rx_set_modem_status_handler(&s->v21_rx, v21_rx_status_handler, s); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) fax_modems_set_tep_mode(fax_modems_state_t *s, int use_tep) +{ + s->use_tep = use_tep; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(fax_modems_state_t *) fax_modems_init(fax_modems_state_t *s, + int use_tep, + hdlc_frame_handler_t hdlc_accept, + hdlc_underflow_handler_t hdlc_tx_underflow, + put_bit_func_t non_ecm_put_bit, + get_bit_func_t non_ecm_get_bit, + tone_report_func_t tone_callback, + void *user_data) +{ + if (s == NULL) + { + if ((s = (fax_modems_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + s->use_tep = use_tep; + + hdlc_rx_init(&s->hdlc_rx, FALSE, FALSE, HDLC_FRAMING_OK_THRESHOLD, hdlc_accept, user_data); + hdlc_tx_init(&s->hdlc_tx, FALSE, 2, FALSE, hdlc_tx_underflow, user_data); + fsk_rx_init(&s->v21_rx, &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) hdlc_rx_put_bit, &s->hdlc_rx); + fsk_rx_signal_cutoff(&s->v21_rx, -39.09f); + fsk_tx_init(&s->v21_tx, &preset_fsk_specs[FSK_V21CH2], (get_bit_func_t) hdlc_tx_get_bit, &s->hdlc_tx); + v17_rx_init(&s->v17_rx, 14400, non_ecm_put_bit, user_data); + v17_tx_init(&s->v17_tx, 14400, s->use_tep, non_ecm_get_bit, user_data); + v29_rx_init(&s->v29_rx, 9600, non_ecm_put_bit, user_data); + v29_rx_signal_cutoff(&s->v29_rx, -45.5f); + v29_tx_init(&s->v29_tx, 9600, s->use_tep, non_ecm_get_bit, user_data); + v27ter_rx_init(&s->v27ter_rx, 4800, non_ecm_put_bit, user_data); + v27ter_tx_init(&s->v27ter_tx, 4800, s->use_tep, non_ecm_get_bit, user_data); + silence_gen_init(&s->silence_gen, 0); + modem_connect_tones_tx_init(&s->connect_tx, MODEM_CONNECT_TONES_FAX_CNG); + if (tone_callback) + { + modem_connect_tones_rx_init(&s->connect_rx, + MODEM_CONNECT_TONES_FAX_CNG, + tone_callback, + user_data); + } + dc_restore_init(&s->dc_restore); + + s->rx_signal_present = FALSE; + s->rx_handler = (span_rx_handler_t *) &span_dummy_rx; + s->rx_fillin_handler = (span_rx_fillin_handler_t *) &span_dummy_rx; + s->rx_user_data = NULL; + s->tx_handler = (span_tx_handler_t *) &silence_gen; + s->tx_user_data = &s->silence_gen; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) fax_modems_release(fax_modems_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) fax_modems_free(fax_modems_state_t *s) +{ + if (s) + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/faxfont.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/faxfont.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,4644 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * faxfont.h - a simple fixed pitch font for FAX headers + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: faxfont.h,v 1.6 2008/04/17 14:26:56 steveu Exp $ + */ + +#if !defined(_FAXFONT_H_) +#define _FAXFONT_H_ + +static const uint32_t header_font[256][16] = +{ + { /* 0 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 1 */ + 0x0, + 0x0, + 0x3FFC, + 0xC003, + 0xCC33, + 0xC003, + 0xC003, + 0xCFF3, + 0xC3C3, + 0xC003, + 0xC003, + 0x3FFC, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 2 */ + 0x0, + 0x0, + 0x3FFC, + 0xFFFF, + 0xF3CF, + 0xFFFF, + 0xFFFF, + 0xF00F, + 0xFC3F, + 0xFFFF, + 0xFFFF, + 0x3FFC, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 3 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x1E78, + 0x7FFE, + 0x7FFE, + 0x7FFE, + 0x7FFE, + 0x1FF8, + 0x7E0, + 0x180, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 4 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x180, + 0x7E0, + 0x1FF8, + 0x7FFE, + 0x1FF8, + 0x7E0, + 0x180, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 5 */ + 0x0, + 0x0, + 0x0, + 0x3C0, + 0xFF0, + 0xFF0, + 0x7C3E, + 0x7C3E, + 0x7C3E, + 0x63C6, + 0x3C0, + 0xFF0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 6 */ + 0x0, + 0x0, + 0x0, + 0x180, + 0x7E0, + 0x1FF8, + 0x7FFE, + 0x7FFE, + 0x1FF8, + 0x180, + 0x180, + 0x7E0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 7 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x3C0, + 0xFF0, + 0xFF0, + 0x3C0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 8 */ + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFC3F, + 0xF00F, + 0xF00F, + 0xFC3F, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + }, + { /* 9 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0xFF0, + 0x3C3C, + 0x300C, + 0x300C, + 0x3C3C, + 0xFF0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 10 */ + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xF00F, + 0xC3C3, + 0xCFF3, + 0xCFF3, + 0xC3C3, + 0xF00F, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + }, + { /* 11 */ + 0x0, + 0x0, + 0x1FE, + 0x7E, + 0x1F6, + 0x786, + 0x1FE0, + 0x3870, + 0x3870, + 0x3870, + 0x3870, + 0x1FE0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 12 */ + 0x0, + 0x0, + 0xFF0, + 0x3C3C, + 0x3C3C, + 0x3C3C, + 0x3C3C, + 0xFF0, + 0x3C0, + 0x3FFC, + 0x3C0, + 0x3C0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 13 */ + 0x0, + 0x0, + 0xFFE, + 0xF0E, + 0xFFE, + 0xE00, + 0xE00, + 0xE00, + 0xE00, + 0x3E00, + 0x7E00, + 0x3C00, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 14 */ + 0x0, + 0x0, + 0x1FFE, + 0x1C0E, + 0x1FFE, + 0x1C0E, + 0x1C0E, + 0x1C0E, + 0x1C0E, + 0x1C1E, + 0x3C3E, + 0x7C1C, + 0x3800, + 0x0, + 0x0, + 0x0, + }, + { /* 15 */ + 0x0, + 0x0, + 0x0, + 0x4002, + 0x23C4, + 0x13C8, + 0xE70, + 0x781E, + 0xE70, + 0x13C8, + 0x23C4, + 0x4002, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 16 */ + 0x0, + 0x3000, + 0x3C00, + 0x3F00, + 0x3FC0, + 0x3FF0, + 0x3FF8, + 0x3FF0, + 0x3FC0, + 0x3F00, + 0x3C00, + 0x3000, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 17 */ + 0x0, + 0xC, + 0x3C, + 0xFC, + 0x3FC, + 0xFFC, + 0x1FFC, + 0xFFC, + 0x3FC, + 0xFC, + 0x3C, + 0xC, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 18 */ + 0x0, + 0x180, + 0x3C0, + 0xFF0, + 0x3FFC, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3FFC, + 0xFF0, + 0x3C0, + 0x180, + 0x0, + 0x0, + 0x0, + }, + { /* 19 */ + 0x0, + 0x0, + 0x3C3C, + 0x3C3C, + 0x3C3C, + 0x3C3C, + 0x3C3C, + 0x3C3C, + 0x3C3C, + 0x0, + 0x3C3C, + 0x3C3C, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 20 */ + 0x0, + 0x0, + 0x3FFE, + 0x71CE, + 0x71CE, + 0x71CE, + 0x3FCE, + 0x1CE, + 0x1CE, + 0x1CE, + 0x1CE, + 0x1CE, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 21 */ + 0x0, + 0x3FF0, + 0x7038, + 0x3C18, + 0xFC0, + 0x3CF0, + 0x7038, + 0x7038, + 0x7038, + 0x3CF0, + 0xFC0, + 0x60F0, + 0x7038, + 0x3FF0, + 0x0, + 0x0, + }, + { /* 22 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x3FFC, + 0x3FFC, + 0x3FFC, + 0x3FFC, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 23 */ + 0x0, + 0x180, + 0x3C0, + 0xFF0, + 0x3FFC, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3FFC, + 0xFF0, + 0x3C0, + 0x180, + 0x3FFC, + 0x0, + 0x0, + }, + { /* 24 */ + 0x0, + 0x0, + 0x180, + 0x3C0, + 0xFF0, + 0x3FFC, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x0, + 0x0, + 0x0, + }, + { /* 25 */ + 0x0, + 0x0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3FFC, + 0xFF0, + 0x3C0, + 0x180, + 0x0, + 0x0, + 0x0, + }, + { /* 26 */ + 0x0, + 0x0, + 0x0, + 0x40, + 0x60, + 0x70, + 0x78, + 0x3FFC, + 0x78, + 0x70, + 0x60, + 0x40, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 27 */ + 0x0, + 0x0, + 0x0, + 0x200, + 0x600, + 0xE00, + 0x1E00, + 0x3FFC, + 0x1E00, + 0xE00, + 0x600, + 0x200, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 28 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x3800, + 0x3800, + 0x3800, + 0x3800, + 0x3FFE, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 29 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x420, + 0xC30, + 0x1C38, + 0x3FFC, + 0x1C38, + 0xC30, + 0x420, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 30 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x180, + 0x7E0, + 0x7E0, + 0x1FF8, + 0x1FF8, + 0x7FFE, + 0x7FFE, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 31 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0xFFFC, + 0xFFFC, + 0x3FF0, + 0x3FF0, + 0xFC0, + 0xFC0, + 0x300, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 32 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 33 */ + 0x0, + 0x0, + 0x3C0, + 0x7E0, + 0x7E0, + 0x7E0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x0, + 0x3C0, + 0x3C0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 34 */ + 0x0, + 0x3C3C, + 0x3C3C, + 0x3C3C, + 0xC30, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 35 */ + 0x0, + 0x0, + 0x0, + 0x1C38, + 0x1C38, + 0x7FFE, + 0x1C38, + 0x1C38, + 0x1C38, + 0x7FFE, + 0x1C38, + 0x1C38, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 36 */ + 0x0, + 0x1E0, + 0x1E0, + 0x1FF8, + 0x781E, + 0x7806, + 0x7800, + 0x1FF8, + 0x1E, + 0x601E, + 0x781E, + 0x1FF8, + 0x1E0, + 0x1E0, + 0x0, + 0x0, + }, + { /* 37 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x7806, + 0x781E, + 0x78, + 0x1E0, + 0x780, + 0x1E00, + 0x781E, + 0x601E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 38 */ + 0x0, + 0x0, + 0x7E0, + 0x1E78, + 0x1E78, + 0x7E0, + 0x1F9E, + 0x79F8, + 0x7878, + 0x7878, + 0x7878, + 0x1F9E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 39 */ + 0x0, + 0xF00, + 0xF00, + 0xF00, + 0x3C00, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 40 */ + 0x0, + 0x0, + 0xF0, + 0x3C0, + 0xF00, + 0xF00, + 0xF00, + 0xF00, + 0xF00, + 0xF00, + 0x3C0, + 0xF0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 41 */ + 0x0, + 0x0, + 0xF00, + 0x3C0, + 0xF0, + 0xF0, + 0xF0, + 0xF0, + 0xF0, + 0xF0, + 0x3C0, + 0xF00, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 42 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x3C3C, + 0xFF0, + 0x7FFE, + 0xFF0, + 0x3C3C, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 43 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x3C0, + 0x3C0, + 0x3FFC, + 0x3C0, + 0x3C0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 44 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x3C0, + 0x3C0, + 0x3C0, + 0xF00, + 0x0, + 0x0, + 0x0, + }, + { /* 45 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x3FFC, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 46 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x3C0, + 0x3C0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 47 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x6, + 0x1E, + 0x78, + 0x1E0, + 0x780, + 0x1E00, + 0x7800, + 0x6000, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 48 */ + 0x0, + 0x0, + 0x1FF8, + 0x781E, + 0x781E, + 0x787E, + 0x799E, + 0x799E, + 0x7E1E, + 0x781E, + 0x781E, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 49 */ + 0x0, + 0x0, + 0x3C0, + 0xFC0, + 0x3FC0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3FFC, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 50 */ + 0x0, + 0x0, + 0x1FF8, + 0x781E, + 0x1E, + 0x78, + 0x1E0, + 0x780, + 0x1E00, + 0x7800, + 0x781E, + 0x7FFE, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 51 */ + 0x0, + 0x0, + 0x1FF8, + 0x781E, + 0x1E, + 0x1E, + 0x7F8, + 0x1E, + 0x1E, + 0x1E, + 0x781E, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 52 */ + 0x0, + 0x0, + 0x78, + 0x1F8, + 0x7F8, + 0x1E78, + 0x7878, + 0x7FFE, + 0x78, + 0x78, + 0x78, + 0x1FE, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 53 */ + 0x0, + 0x0, + 0x7FFE, + 0x7800, + 0x7800, + 0x7800, + 0x7FF8, + 0x7E, + 0x1E, + 0x1E, + 0x781E, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 54 */ + 0x0, + 0x0, + 0x7E0, + 0x1E00, + 0x7800, + 0x7800, + 0x7FF8, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 55 */ + 0x0, + 0x0, + 0x7FFE, + 0x781E, + 0x1E, + 0x1E, + 0x78, + 0x1E0, + 0x780, + 0x780, + 0x780, + 0x780, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 56 */ + 0x0, + 0x0, + 0x1FF8, + 0x781E, + 0x781E, + 0x781E, + 0x1FF8, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 57 */ + 0x0, + 0x0, + 0x1FF8, + 0x781E, + 0x781E, + 0x781E, + 0x1FFE, + 0x1E, + 0x1E, + 0x1E, + 0x78, + 0x1FE0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 58 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x3C0, + 0x3C0, + 0x0, + 0x0, + 0x0, + 0x3C0, + 0x3C0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 59 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x3C0, + 0x3C0, + 0x0, + 0x0, + 0x0, + 0x3C0, + 0x3C0, + 0xF00, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 60 */ + 0x0, + 0x0, + 0x0, + 0x3C, + 0xF0, + 0x3C0, + 0xF00, + 0x3C00, + 0xF00, + 0x3C0, + 0xF0, + 0x3C, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 61 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x3FFC, + 0x0, + 0x0, + 0x3FFC, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 62 */ + 0x0, + 0x0, + 0x0, + 0x3C00, + 0xF00, + 0x3C0, + 0xF0, + 0x3C, + 0xF0, + 0x3C0, + 0xF00, + 0x3C00, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 63 */ + 0x0, + 0x0, + 0x1FF8, + 0x781E, + 0x781E, + 0x78, + 0x1E0, + 0x1E0, + 0x1E0, + 0x0, + 0x1E0, + 0x1E0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 64 */ + 0x0, + 0x0, + 0x0, + 0x1FF8, + 0x781E, + 0x781E, + 0x79FE, + 0x79FE, + 0x79FE, + 0x79F8, + 0x7800, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 65 */ + 0x0, + 0x0, + 0x180, + 0x7E0, + 0x1E78, + 0x781E, + 0x781E, + 0x7FFE, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 66 */ + 0x0, + 0x0, + 0x7FF8, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1FF8, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x7FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 67 */ + 0x0, + 0x0, + 0x7F8, + 0x1E1E, + 0x7806, + 0x7800, + 0x7800, + 0x7800, + 0x7800, + 0x7806, + 0x1E1E, + 0x7F8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 68 */ + 0x0, + 0x0, + 0x7FE0, + 0x1E78, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1E78, + 0x7FE0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 69 */ + 0x0, + 0x0, + 0x7FFE, + 0x1E1E, + 0x1E06, + 0x1E60, + 0x1FE0, + 0x1E60, + 0x1E00, + 0x1E06, + 0x1E1E, + 0x7FFE, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 70 */ + 0x0, + 0x0, + 0x7FFE, + 0x1E1E, + 0x1E06, + 0x1E60, + 0x1FE0, + 0x1E60, + 0x1E00, + 0x1E00, + 0x1E00, + 0x7F80, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 71 */ + 0x0, + 0x0, + 0x7F8, + 0x1E1E, + 0x7806, + 0x7800, + 0x7800, + 0x79FE, + 0x781E, + 0x781E, + 0x1E1E, + 0x7E6, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 72 */ + 0x0, + 0x0, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x7FFE, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 73 */ + 0x0, + 0x0, + 0x7F8, + 0x1E0, + 0x1E0, + 0x1E0, + 0x1E0, + 0x1E0, + 0x1E0, + 0x1E0, + 0x1E0, + 0x7F8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 74 */ + 0x0, + 0x0, + 0x1FE, + 0x78, + 0x78, + 0x78, + 0x78, + 0x78, + 0x7878, + 0x7878, + 0x7878, + 0x1FE0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 75 */ + 0x0, + 0x0, + 0x7E1E, + 0x1E1E, + 0x1E78, + 0x1E78, + 0x1FE0, + 0x1FE0, + 0x1E78, + 0x1E1E, + 0x1E1E, + 0x7E1E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 76 */ + 0x0, + 0x0, + 0x7F80, + 0x1E00, + 0x1E00, + 0x1E00, + 0x1E00, + 0x1E00, + 0x1E00, + 0x1E06, + 0x1E1E, + 0x7FFE, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 77 */ + 0x0, + 0x0, + 0x781E, + 0x7E7E, + 0x7FFE, + 0x7FFE, + 0x799E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 78 */ + 0x0, + 0x0, + 0x781E, + 0x7E1E, + 0x7F9E, + 0x7FFE, + 0x79FE, + 0x787E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 79 */ + 0x0, + 0x0, + 0x7E0, + 0x1E78, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x1E78, + 0x7E0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 80 */ + 0x0, + 0x0, + 0x7FF8, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1FF8, + 0x1E00, + 0x1E00, + 0x1E00, + 0x1E00, + 0x7F80, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 81 */ + 0x0, + 0x0, + 0x1FF8, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x799E, + 0x79FE, + 0x1FF8, + 0x78, + 0x7E, + 0x0, + 0x0, + }, + { /* 82 */ + 0x0, + 0x0, + 0x7FF8, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1FF8, + 0x1E78, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x7E1E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 83 */ + 0x0, + 0x0, + 0x1FF8, + 0x781E, + 0x781E, + 0x1E00, + 0x7E0, + 0x78, + 0x1E, + 0x781E, + 0x781E, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 84 */ + 0x0, + 0x0, + 0x1FFE, + 0x1FFE, + 0x19E6, + 0x1E0, + 0x1E0, + 0x1E0, + 0x1E0, + 0x1E0, + 0x1E0, + 0x7F8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 85 */ + 0x0, + 0x0, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 86 */ + 0x0, + 0x0, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x1E78, + 0x7E0, + 0x180, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 87 */ + 0x0, + 0x0, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x799E, + 0x799E, + 0x7FFE, + 0x1E78, + 0x1E78, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 88 */ + 0x0, + 0x0, + 0x781E, + 0x781E, + 0x1E78, + 0x1E78, + 0x7E0, + 0x7E0, + 0x1E78, + 0x1E78, + 0x781E, + 0x781E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 89 */ + 0x0, + 0x0, + 0x3C3C, + 0x3C3C, + 0x3C3C, + 0x3C3C, + 0xFF0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0xFF0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 90 */ + 0x0, + 0x0, + 0x7FFE, + 0x781E, + 0x601E, + 0x78, + 0x1E0, + 0x780, + 0x1E00, + 0x7806, + 0x781E, + 0x7FFE, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 91 */ + 0x0, + 0x0, + 0xFF0, + 0xF00, + 0xF00, + 0xF00, + 0xF00, + 0xF00, + 0xF00, + 0xF00, + 0xF00, + 0xFF0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 92 */ + 0x0, + 0x0, + 0x0, + 0x6000, + 0x7800, + 0x7E00, + 0x1F80, + 0x7E0, + 0x1F8, + 0x7E, + 0x1E, + 0x6, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 93 */ + 0x0, + 0x0, + 0xFF0, + 0xF0, + 0xF0, + 0xF0, + 0xF0, + 0xF0, + 0xF0, + 0xF0, + 0xF0, + 0xFF0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 94 */ + 0x180, + 0x7E0, + 0x1E78, + 0x781E, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 95 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0xFFFF, + 0x0, + 0x0, + }, + { /* 96 */ + 0xF00, + 0xF00, + 0x3C0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 97 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x1FE0, + 0x78, + 0x1FF8, + 0x7878, + 0x7878, + 0x7878, + 0x1F9E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 98 */ + 0x0, + 0x0, + 0x7E00, + 0x1E00, + 0x1E00, + 0x1FE0, + 0x1E78, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x79F8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 99 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x1FF8, + 0x781E, + 0x7800, + 0x7800, + 0x7800, + 0x781E, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 100 */ + 0x0, + 0x0, + 0x1F8, + 0x78, + 0x78, + 0x7F8, + 0x1E78, + 0x7878, + 0x7878, + 0x7878, + 0x7878, + 0x1F9E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 101 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x1FF8, + 0x781E, + 0x7FFE, + 0x7800, + 0x7800, + 0x781E, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 102 */ + 0x0, + 0x0, + 0x7E0, + 0x1E78, + 0x1E18, + 0x1E00, + 0x7F80, + 0x1E00, + 0x1E00, + 0x1E00, + 0x1E00, + 0x7F80, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 103 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x1F9E, + 0x7878, + 0x7878, + 0x7878, + 0x7878, + 0x7878, + 0x1FF8, + 0x78, + 0x7878, + 0x1FE0, + 0x0, + }, + { /* 104 */ + 0x0, + 0x0, + 0x7E00, + 0x1E00, + 0x1E00, + 0x1E78, + 0x1F9E, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x7E1E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 105 */ + 0x0, + 0x0, + 0x1E0, + 0x1E0, + 0x0, + 0x7E0, + 0x1E0, + 0x1E0, + 0x1E0, + 0x1E0, + 0x1E0, + 0x7F8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 106 */ + 0x0, + 0x0, + 0x1E, + 0x1E, + 0x0, + 0x7E, + 0x1E, + 0x1E, + 0x1E, + 0x1E, + 0x1E, + 0x1E, + 0x1E1E, + 0x1E1E, + 0x7F8, + 0x0, + }, + { /* 107 */ + 0x0, + 0x0, + 0x7E00, + 0x1E00, + 0x1E00, + 0x1E1E, + 0x1E78, + 0x1FE0, + 0x1FE0, + 0x1E78, + 0x1E1E, + 0x7E1E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 108 */ + 0x0, + 0x0, + 0x7E0, + 0x1E0, + 0x1E0, + 0x1E0, + 0x1E0, + 0x1E0, + 0x1E0, + 0x1E0, + 0x1E0, + 0x7F8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 109 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x7E78, + 0x7FFE, + 0x799E, + 0x799E, + 0x799E, + 0x799E, + 0x799E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 110 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x79F8, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 111 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x1FF8, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 112 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x79F8, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1FF8, + 0x1E00, + 0x1E00, + 0x7F80, + 0x0, + }, + { /* 113 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x1F9E, + 0x7878, + 0x7878, + 0x7878, + 0x7878, + 0x7878, + 0x1FF8, + 0x78, + 0x78, + 0x1FE, + 0x0, + }, + { /* 114 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x79F8, + 0x1F9E, + 0x1E06, + 0x1E00, + 0x1E00, + 0x1E00, + 0x7F80, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 115 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x1FF8, + 0x781E, + 0x1E00, + 0x7E0, + 0x78, + 0x781E, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 116 */ + 0x0, + 0x0, + 0x180, + 0x780, + 0x780, + 0x7FF8, + 0x780, + 0x780, + 0x780, + 0x780, + 0x79E, + 0x1F8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 117 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x7878, + 0x7878, + 0x7878, + 0x7878, + 0x7878, + 0x7878, + 0x1F9E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 118 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x7F8, + 0x1E0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 119 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x781E, + 0x781E, + 0x781E, + 0x799E, + 0x799E, + 0x7FFE, + 0x1E78, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 120 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x781E, + 0x1E78, + 0x7E0, + 0x7E0, + 0x7E0, + 0x1E78, + 0x781E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 121 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x1FFE, + 0x1E, + 0x78, + 0x7FE0, + 0x0, + }, + { /* 122 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x7FFE, + 0x7878, + 0x1E0, + 0x780, + 0x1E00, + 0x781E, + 0x7FFE, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 123 */ + 0x0, + 0x0, + 0xFC, + 0x3C0, + 0x3C0, + 0x3C0, + 0xF00, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0xFC, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 124 */ + 0x0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x0, + 0x0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x0, + }, + { /* 125 */ + 0x0, + 0x0, + 0x3F00, + 0x3C0, + 0x3C0, + 0x3C0, + 0xF0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3F00, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 126 */ + 0x0, + 0x0, + 0x1F9E, + 0x79F8, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 127 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x180, + 0x7E0, + 0x1E78, + 0x781E, + 0x781E, + 0x781E, + 0x7FFE, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 128 */ + 0x0, + 0x0, + 0x7F8, + 0x1E1E, + 0x7806, + 0x7800, + 0x7800, + 0x7800, + 0x7806, + 0x1E1E, + 0x7F8, + 0x78, + 0x1E, + 0x1FF8, + 0x0, + 0x0, + }, + { /* 129 */ + 0x0, + 0x0, + 0x7878, + 0x7878, + 0x0, + 0x7878, + 0x7878, + 0x7878, + 0x7878, + 0x7878, + 0x7878, + 0x1F9E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 130 */ + 0x0, + 0x78, + 0x1E0, + 0x780, + 0x0, + 0x1FF8, + 0x781E, + 0x7FFE, + 0x7800, + 0x7800, + 0x781E, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 131 */ + 0x0, + 0x180, + 0x7E0, + 0x1E78, + 0x0, + 0x1FE0, + 0x78, + 0x1FF8, + 0x7878, + 0x7878, + 0x7878, + 0x1F9E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 132 */ + 0x0, + 0x0, + 0x7878, + 0x7878, + 0x0, + 0x1FE0, + 0x78, + 0x1FF8, + 0x7878, + 0x7878, + 0x7878, + 0x1F9E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 133 */ + 0x0, + 0x1E00, + 0x780, + 0x1E0, + 0x0, + 0x1FE0, + 0x78, + 0x1FF8, + 0x7878, + 0x7878, + 0x7878, + 0x1F9E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 134 */ + 0x0, + 0x7E0, + 0x1E78, + 0x7E0, + 0x0, + 0x1FE0, + 0x78, + 0x1FF8, + 0x7878, + 0x7878, + 0x7878, + 0x1F9E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 135 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0xFF0, + 0x3C3C, + 0x3C00, + 0x3C00, + 0x3C3C, + 0xFF0, + 0xF0, + 0x3C, + 0xFF0, + 0x0, + 0x0, + 0x0, + }, + { /* 136 */ + 0x0, + 0x180, + 0x7E0, + 0x1E78, + 0x0, + 0x1FF8, + 0x781E, + 0x7FFE, + 0x7800, + 0x7800, + 0x781E, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 137 */ + 0x0, + 0x0, + 0x781E, + 0x781E, + 0x0, + 0x1FF8, + 0x781E, + 0x7FFE, + 0x7800, + 0x7800, + 0x781E, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 138 */ + 0x0, + 0x1E00, + 0x780, + 0x1E0, + 0x0, + 0x1FF8, + 0x781E, + 0x7FFE, + 0x7800, + 0x7800, + 0x781E, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 139 */ + 0x0, + 0x0, + 0x3C3C, + 0x3C3C, + 0x0, + 0xFC0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0xFF0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 140 */ + 0x0, + 0x3C0, + 0xFF0, + 0x3C3C, + 0x0, + 0xFC0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0xFF0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 141 */ + 0x0, + 0x3C00, + 0xF00, + 0x3C0, + 0x0, + 0xFC0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0xFF0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 142 */ + 0x0, + 0x781E, + 0x781E, + 0x180, + 0x7E0, + 0x1E78, + 0x781E, + 0x781E, + 0x7FFE, + 0x781E, + 0x781E, + 0x781E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 143 */ + 0x7E0, + 0x1E78, + 0x7E0, + 0x0, + 0x7E0, + 0x1E78, + 0x781E, + 0x781E, + 0x7FFE, + 0x781E, + 0x781E, + 0x781E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 144 */ + 0x1E0, + 0x780, + 0x1E00, + 0x0, + 0x7FFE, + 0x1E1E, + 0x1E00, + 0x1FF8, + 0x1E00, + 0x1E00, + 0x1E1E, + 0x7FFE, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 145 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x7878, + 0x1F9E, + 0x79E, + 0x1FFE, + 0x79E0, + 0x79E0, + 0x1E7E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 146 */ + 0x0, + 0x0, + 0x7FE, + 0x1E78, + 0x7878, + 0x7878, + 0x7FFE, + 0x7878, + 0x7878, + 0x7878, + 0x7878, + 0x787E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 147 */ + 0x0, + 0x180, + 0x7E0, + 0x1E78, + 0x0, + 0x1FF8, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 148 */ + 0x0, + 0x0, + 0x781E, + 0x781E, + 0x0, + 0x1FF8, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 149 */ + 0x0, + 0x1E00, + 0x780, + 0x1E0, + 0x0, + 0x1FF8, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 150 */ + 0x0, + 0x780, + 0x1FE0, + 0x7878, + 0x0, + 0x7878, + 0x7878, + 0x7878, + 0x7878, + 0x7878, + 0x7878, + 0x1F9E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 151 */ + 0x0, + 0x1E00, + 0x780, + 0x1E0, + 0x0, + 0x7878, + 0x7878, + 0x7878, + 0x7878, + 0x7878, + 0x7878, + 0x1F9E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 152 */ + 0x0, + 0x0, + 0x781E, + 0x781E, + 0x0, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x1FFE, + 0x1E, + 0x78, + 0x1FE0, + 0x0, + }, + { /* 153 */ + 0x0, + 0x781E, + 0x781E, + 0x0, + 0x7E0, + 0x1E78, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x1E78, + 0x7E0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 154 */ + 0x0, + 0x781E, + 0x781E, + 0x0, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 155 */ + 0x0, + 0x3C0, + 0x3C0, + 0xFF0, + 0x3C3C, + 0x3C00, + 0x3C00, + 0x3C00, + 0x3C3C, + 0xFF0, + 0x3C0, + 0x3C0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 156 */ + 0x0, + 0x7E0, + 0x1E78, + 0x1E18, + 0x1E00, + 0x7F80, + 0x1E00, + 0x1E00, + 0x1E00, + 0x1E00, + 0x7E1E, + 0x7FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 157 */ + 0x0, + 0x0, + 0x3C3C, + 0x3C3C, + 0xFF0, + 0x3C0, + 0x3FFC, + 0x3C0, + 0x3FFC, + 0x3C0, + 0x3C0, + 0x3C0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 158 */ + 0x0, + 0x7FE0, + 0x7878, + 0x7878, + 0x7FE0, + 0x7818, + 0x7878, + 0x79FE, + 0x7878, + 0x7878, + 0x7878, + 0x781E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 159 */ + 0x0, + 0xFC, + 0x3CF, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3FFC, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0xF3C0, + 0x3F00, + 0x0, + 0x0, + }, + { /* 160 */ + 0x0, + 0x1E0, + 0x780, + 0x1E00, + 0x0, + 0x1FE0, + 0x78, + 0x1FF8, + 0x7878, + 0x7878, + 0x7878, + 0x1F9E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 161 */ + 0x0, + 0xF0, + 0x3C0, + 0xF00, + 0x0, + 0xFC0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0xFF0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 162 */ + 0x0, + 0x1E0, + 0x780, + 0x1E00, + 0x0, + 0x1FF8, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 163 */ + 0x0, + 0x1E0, + 0x780, + 0x1E00, + 0x0, + 0x7878, + 0x7878, + 0x7878, + 0x7878, + 0x7878, + 0x7878, + 0x1F9E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 164 */ + 0x0, + 0x0, + 0x1F9E, + 0x79F8, + 0x0, + 0x79F8, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 165 */ + 0x1F9E, + 0x79F8, + 0x0, + 0x781E, + 0x7E1E, + 0x7F9E, + 0x7FFE, + 0x79FE, + 0x787E, + 0x781E, + 0x781E, + 0x781E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 166 */ + 0x0, + 0xFF0, + 0x3CF0, + 0x3CF0, + 0xFFC, + 0x0, + 0x3FFC, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 167 */ + 0x0, + 0x7E0, + 0x1E78, + 0x1E78, + 0x7E0, + 0x0, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 168 */ + 0x0, + 0x0, + 0x780, + 0x780, + 0x0, + 0x780, + 0x780, + 0x1E00, + 0x7800, + 0x781E, + 0x781E, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 169 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0xFFFC, + 0xF000, + 0xF000, + 0xF000, + 0xF000, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 170 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0xFFFC, + 0x3C, + 0x3C, + 0x3C, + 0x3C, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 171 */ + 0x0, + 0x7000, + 0x7000, + 0x700C, + 0x703C, + 0x70F0, + 0x3C0, + 0xF00, + 0x3C00, + 0xF0FC, + 0xC30E, + 0x3C, + 0xF0, + 0x3FE, + 0x0, + 0x0, + }, + { /* 172 */ + 0x0, + 0x7000, + 0x7000, + 0x700C, + 0x703C, + 0x70F0, + 0x3C0, + 0xF00, + 0x3C3C, + 0xF0FC, + 0xC38C, + 0x7FE, + 0x3C, + 0xFE, + 0x0, + 0x0, + }, + { /* 173 */ + 0x0, + 0x0, + 0x3C0, + 0x3C0, + 0x0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x7E0, + 0x7E0, + 0x7E0, + 0x3C0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 174 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0xE0E, + 0x3C3C, + 0x7070, + 0x3C3C, + 0xE0E, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 175 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x7070, + 0x3C3C, + 0xE0E, + 0x3C3C, + 0x7070, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 176 */ + 0x303, + 0x3030, + 0x303, + 0x3030, + 0x303, + 0x3030, + 0x303, + 0x3030, + 0x303, + 0x3030, + 0x303, + 0x3030, + 0x303, + 0x3030, + 0x303, + 0x3030, + }, + { /* 177 */ + 0xAAAA, + 0x5555, + 0xAAAA, + 0x5555, + 0xAAAA, + 0x5555, + 0xAAAA, + 0x5555, + 0xAAAA, + 0x5555, + 0xAAAA, + 0x5555, + 0xAAAA, + 0x5555, + 0xAAAA, + 0x5555, + }, + { /* 178 */ + 0xF3F3, + 0x3F3F, + 0xF3F3, + 0x3F3F, + 0xF3F3, + 0x3F3F, + 0xF3F3, + 0x3F3F, + 0xF3F3, + 0x3F3F, + 0xF3F3, + 0x3F3F, + 0xF3F3, + 0x3F3F, + 0xF3F3, + 0x3F3F, + }, + { /* 179 */ + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + }, + { /* 180 */ + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0xFFC0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + }, + { /* 181 */ + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0xFFC0, + 0x3C0, + 0xFFC0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + }, + { /* 182 */ + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xFF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + }, + { /* 183 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0xFFFC, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + }, + { /* 184 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0xFFC0, + 0x3C0, + 0xFFC0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + }, + { /* 185 */ + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xFF3C, + 0x3C, + 0xFF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + }, + { /* 186 */ + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + }, + { /* 187 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0xFFFC, + 0x3C, + 0xFF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + }, + { /* 188 */ + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xFF3C, + 0x3C, + 0xFFFC, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 189 */ + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xFFFC, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 190 */ + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0xFFC0, + 0x3C0, + 0xFFC0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 191 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0xFFC0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + }, + { /* 192 */ + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3FF, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 193 */ + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0xFFFF, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 194 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0xFFFF, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + }, + { /* 195 */ + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3FF, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + }, + { /* 196 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0xFFFF, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 197 */ + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0xFFFF, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + }, + { /* 198 */ + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3FF, + 0x3C0, + 0x3FF, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + }, + { /* 199 */ + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3F, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + }, + { /* 200 */ + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3F, + 0xF00, + 0xFFF, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 201 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0xFFF, + 0xF00, + 0xF3F, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + }, + { /* 202 */ + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xFF3F, + 0x0, + 0xFFFF, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 203 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0xFFFF, + 0x0, + 0xFF3F, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + }, + { /* 204 */ + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3F, + 0xF00, + 0xF3F, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + }, + { /* 205 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0xFFFF, + 0x0, + 0xFFFF, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 206 */ + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xFF3F, + 0x0, + 0xFF3F, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + }, + { /* 207 */ + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0xFFFF, + 0x0, + 0xFFFF, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 208 */ + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xFFFF, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 209 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0xFFFF, + 0x0, + 0xFFFF, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + }, + { /* 210 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0xFFFF, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + }, + { /* 211 */ + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xFFF, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 212 */ + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3FF, + 0x3C0, + 0x3FF, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 213 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x3FF, + 0x3C0, + 0x3FF, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + }, + { /* 214 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0xFFF, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + }, + { /* 215 */ + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xFFFF, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + 0xF3C, + }, + { /* 216 */ + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0xFFFF, + 0x3C0, + 0xFFFF, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + }, + { /* 217 */ + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0xFFC0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 218 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x3FF, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + }, + { /* 219 */ + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + }, + { /* 220 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + }, + { /* 221 */ + 0xFF00, + 0xFF00, + 0xFF00, + 0xFF00, + 0xFF00, + 0xFF00, + 0xFF00, + 0xFF00, + 0xFF00, + 0xFF00, + 0xFF00, + 0xFF00, + 0xFF00, + 0xFF00, + 0xFF00, + 0xFF00, + }, + { /* 222 */ + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + }, + { /* 223 */ + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 224 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x1F9E, + 0x79F8, + 0x79E0, + 0x79E0, + 0x79E0, + 0x79F8, + 0x1F9E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 225 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x7FF8, + 0x781E, + 0x7FF8, + 0x781E, + 0x781E, + 0x7FF8, + 0x7800, + 0x7800, + 0x7800, + 0x0, + 0x0, + }, + { /* 226 */ + 0x0, + 0x0, + 0x7FFE, + 0x781E, + 0x781E, + 0x7800, + 0x7800, + 0x7800, + 0x7800, + 0x7800, + 0x7800, + 0x7800, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 227 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x7FFE, + 0x7FFE, + 0x1E78, + 0x1E78, + 0x1E78, + 0x1E78, + 0x1E78, + 0x1E78, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 228 */ + 0x0, + 0x0, + 0x0, + 0x7FFE, + 0x781E, + 0x1E00, + 0x780, + 0x1E0, + 0x780, + 0x1E00, + 0x781E, + 0x7FFE, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 229 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x1FFE, + 0x79E0, + 0x79E0, + 0x79E0, + 0x79E0, + 0x79E0, + 0x1F80, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 230 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1E1E, + 0x1FF8, + 0x1E00, + 0x1E00, + 0x7800, + 0x0, + 0x0, + 0x0, + }, + { /* 231 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x1F9E, + 0x79F8, + 0x1E0, + 0x1E0, + 0x1E0, + 0x1E0, + 0x1E0, + 0x1E0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 232 */ + 0x0, + 0x0, + 0x0, + 0x3FFC, + 0x3C0, + 0xFF0, + 0x3C3C, + 0x3C3C, + 0x3C3C, + 0xFF0, + 0x3C0, + 0x3FFC, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 233 */ + 0x0, + 0x0, + 0x0, + 0x7E0, + 0x1E78, + 0x781E, + 0x781E, + 0x7FFE, + 0x781E, + 0x781E, + 0x1E78, + 0x7E0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 234 */ + 0x0, + 0x0, + 0x7E0, + 0x1E78, + 0x781E, + 0x781E, + 0x781E, + 0x1E78, + 0x1E78, + 0x1E78, + 0x1E78, + 0x7E7E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 235 */ + 0x0, + 0x0, + 0x3FC, + 0xF00, + 0x3C0, + 0xF0, + 0xFFC, + 0x3C3C, + 0x3C3C, + 0x3C3C, + 0x3C3C, + 0xFF0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 236 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x3E7C, + 0x73CE, + 0x73CE, + 0x73CE, + 0x3E7C, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 237 */ + 0x0, + 0x0, + 0x0, + 0xF, + 0x3C, + 0x3FFC, + 0xF0FF, + 0xF3CF, + 0xFF0F, + 0x3FFC, + 0x3C00, + 0xF000, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 238 */ + 0x0, + 0x0, + 0x3F0, + 0xF00, + 0x1C00, + 0x1C00, + 0x1FF0, + 0x1C00, + 0x1C00, + 0x1C00, + 0xF00, + 0x3F0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 239 */ + 0x0, + 0x0, + 0x0, + 0x1FF8, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x781E, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 240 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x7FFE, + 0x0, + 0x0, + 0x7FFE, + 0x0, + 0x0, + 0x7FFE, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 241 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x3C0, + 0x3C0, + 0x3FFC, + 0x3C0, + 0x3C0, + 0x0, + 0x0, + 0x3FFC, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 242 */ + 0x0, + 0x0, + 0x0, + 0xF00, + 0x3C0, + 0xF0, + 0x38, + 0xF0, + 0x3C0, + 0xF00, + 0x0, + 0xFF8, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 243 */ + 0x0, + 0x0, + 0x0, + 0xF0, + 0x3C0, + 0xF00, + 0x1C00, + 0xF00, + 0x3C0, + 0xF0, + 0x0, + 0x1FF0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 244 */ + 0x0, + 0x0, + 0xFC, + 0x3CF, + 0x3CF, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + }, + { /* 245 */ + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0x3C0, + 0xF3C0, + 0xF3C0, + 0xF3C0, + 0x3F00, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 246 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x3C0, + 0x3C0, + 0x0, + 0x3FFC, + 0x0, + 0x3C0, + 0x3C0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 247 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x1F9E, + 0x79F8, + 0x0, + 0x1F9E, + 0x79F8, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 248 */ + 0x0, + 0x7E0, + 0x1E78, + 0x1E78, + 0x7E0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 249 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x3C0, + 0x3C0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 250 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x3C0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 251 */ + 0x0, + 0xFF, + 0xF0, + 0xF0, + 0xF0, + 0xF0, + 0xF0, + 0x70F0, + 0x38F0, + 0x1CF0, + 0xFF0, + 0x3F0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 252 */ + 0x0, + 0x79E0, + 0x1E78, + 0x1E78, + 0x1E78, + 0x1E78, + 0x1E78, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 253 */ + 0x0, + 0x1F80, + 0x61E0, + 0x780, + 0x1E00, + 0x7860, + 0x7FE0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 254 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x1FF8, + 0x1FF8, + 0x1FF8, + 0x1FF8, + 0x1FF8, + 0x1FF8, + 0x1FF8, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, + { /* 255 */ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + }, +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/filter_tools.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/filter_tools.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,242 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * filter_tools.c - A collection of routines used for filter design. + * + * Written by Steve Underwood + * + * Copyright (C) 2008 Steve Underwood + * + * This includes some elements based on the mkfilter package by + * A.J. Fisher, University of York , November 1996 + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: filter_tools.c,v 1.11 2009/10/05 16:33:25 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/complex.h" +#include "filter_tools.h" + +#if !defined(FALSE) +#define FALSE 0 +#endif +#if !defined(TRUE) +#define TRUE (!FALSE) +#endif + +#define MAXPZ 8192 +#define SEQ_LEN 8192 +#define MAX_FFT_LEN SEQ_LEN + +static complex_t circle[MAX_FFT_LEN/2]; + +static __inline__ complex_t expj(double theta) +{ + return complex_set(cos(theta), sin(theta)); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ double fix(double x) +{ + /* Nearest integer */ + return (x >= 0.0) ? floor(0.5 + x) : -floor(0.5 - x); +} +/*- End of function --------------------------------------------------------*/ + +static void fftx(complex_t data[], complex_t temp[], int n) +{ + int i; + int h; + int p; + int t; + int i2; + complex_t wkt; + + if (n > 1) + { + h = n/2; + for (i = 0; i < h; i++) + { + i2 = i*2; + temp[i] = data[i2]; /* Even */ + temp[h + i] = data[i2 + 1]; /* Odd */ + } + fftx(&temp[0], &data[0], h); + fftx(&temp[h], &data[h], h); + p = 0; + t = MAX_FFT_LEN/n; + for (i = 0; i < h; i++) + { + wkt = complex_mul(&circle[p], &temp[h + i]); + data[i] = complex_add(&temp[i], &wkt); + data[h + i] = complex_sub(&temp[i], &wkt); + p += t; + } + } +} +/*- End of function --------------------------------------------------------*/ + +void ifft(complex_t data[], int len) +{ + int i; + double x; + complex_t temp[MAX_FFT_LEN]; + + /* A very slow and clunky FFT, that's just fine for filter design. */ + for (i = 0; i < MAX_FFT_LEN/2; i++) + { + x = (2.0*3.1415926535*i)/(double) MAX_FFT_LEN; + circle[i] = expj(x); + } + fftx(data, temp, len); +} +/*- End of function --------------------------------------------------------*/ + +void compute_raised_cosine_filter(double coeffs[], + int len, + int root, + int sinc_compensate, + double alpha, + double beta) +{ + double f; + double x; + double f1; + double f2; + double tau; + complex_t vec[SEQ_LEN]; + int i; + int j; + int h; + + f1 = (1.0 - beta)*alpha; + f2 = (1.0 + beta)*alpha; + tau = 0.5/alpha; + /* (Root) raised cosine */ + for (i = 0; i <= SEQ_LEN/2; i++) + { + f = (double) i/(double) SEQ_LEN; + if (f <= f1) + vec[i] = complex_set(1.0, 0.0); + else if (f <= f2) + vec[i] = complex_set(0.5*(1.0 + cos((3.1415926535*tau/beta)*(f - f1))), 0.0); + else + vec[i] = complex_set(0.0, 0.0); + } + if (root) + { + for (i = 0; i <= SEQ_LEN/2; i++) + vec[i].re = sqrt(vec[i].re); + } + if (sinc_compensate) + { + for (i = 1; i <= SEQ_LEN/2; i++) + { + x = 3.1415926535*(double) i/(double) SEQ_LEN; + vec[i].re *= (x/sin(x)); + } + } + for (i = 0; i <= SEQ_LEN/2; i++) + vec[i].re *= tau; + for (i = 1; i < SEQ_LEN/2; i++) + vec[SEQ_LEN - i] = vec[i]; + ifft(vec, SEQ_LEN); + h = (len - 1)/2; + for (i = 0; i < len; i++) + { + j = (SEQ_LEN - h + i)%SEQ_LEN; + coeffs[i] = vec[j].re/(double) SEQ_LEN; + } +} +/*- End of function --------------------------------------------------------*/ + +void compute_hilbert_transform(double coeffs[], int len) +{ + double x; + int i; + int h; + + h = (len - 1)/2; + coeffs[h] = 0.0; + for (i = 1; i <= h; i++) + { + if ((i & 1)) + { + x = 1.0/(double) i; + coeffs[h + i] = -x; + coeffs[h - i] = x; + } + } +} +/*- End of function --------------------------------------------------------*/ + +void apply_hamming_window(double coeffs[], int len) +{ + double w; + int i; + int h; + + h = (len - 1)/2; + for (i = 1; i <= h; i++) + { + w = 0.53836 - 0.46164*cos(2.0*3.1415926535*(double) (h + i)/(double) (len - 1.0)); + coeffs[h + i] *= w; + coeffs[h - i] *= w; + } +} +/*- End of function --------------------------------------------------------*/ + +void truncate_coeffs(double coeffs[], int len, int bits, int hilbert) +{ + double x; + double fac; + double max; + double scale; + int h; + int i; + + fac = pow(2.0, (double) (bits - 1.0)); + h = (len - 1)/2; + max = (hilbert) ? coeffs[h - 1] : coeffs[h]; /* Max coeff */ + scale = (fac - 1.0)/(fac*max); + for (i = 0; i < len; i++) + { + x = coeffs[i]*scale; /* Scale coeffs so max is (fac - 1.0)/fac */ + coeffs[i] = fix(x*fac)/fac; /* Truncate */ + } +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/filter_tools.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/filter_tools.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,59 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * filter_tools.h - A collection of routines used for filter design. + * + * Written by Steve Underwood + * + * Copyright (C) 2008 Steve Underwood + * + * Based on: + * mkshape -- design raised cosine FIR filter + * A.J. Fisher, University of York , November 1996 + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: filter_tools.h,v 1.3 2008/04/17 14:26:56 steveu Exp $ + */ + +#if !defined(_FILTER_TOOLS_H_) +#define _FILTER_TOOLS_H_ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +void ifft(complex_t data[], int len); +void apply_hamming_window(double coeffs[], int len); +void truncate_coeffs(double coeffs[], int len, int bits, int hilbert); + +void compute_raised_cosine_filter(double coeffs[], + int len, + int root, + int sinc_compensate, + double alpha, + double beta); + +void compute_hilbert_transform(double coeffs[], int len); + + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/floating_fudge.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/floating_fudge.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,139 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * floating_fudge.h - A bunch of shims, to use double maths + * functions on platforms which lack the + * float versions with an 'f' at the end, + * and to deal with the vaguaries of lrint(). + * + * Written by Steve Underwood + * + * Copyright (C) 2008 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: floating_fudge.h,v 1.7 2009/02/03 16:28:39 steveu Exp $ + */ + +#if !defined(_FLOATING_FUDGE_H_) +#define _FLOATING_FUDGE_H_ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +#if !defined(HAVE_SINF) +static __inline__ float sinf(float x) +{ + return (float) sin((double) x); +} +#endif + +#if !defined(HAVE_COSF) +static __inline__ float cosf(float x) +{ + return (float) cos((double) x); +} +#endif + +#if !defined(HAVE_TANF) +static __inline__ float tanf(float x) +{ + return (float) tan((double) x); +} +#endif + +#if !defined(HAVE_ASINF) +static __inline__ float asinf(float x) +{ + return (float) asin((double) x); +} +#endif + +#if !defined(HAVE_ACOSF) +static __inline__ float acosf(float x) +{ + return (float) acos((double) x); +} +#endif + +#if !defined(HAVE_ATANF) +static __inline__ float atanf(float x) +{ + return (float) atan((double) x); +} + +#endif + +#if !defined(HAVE_ATAN2F) +static __inline__ float atan2f(float y, float x) +{ + return (float) atan2((double) y, (double) x); +} + +#endif + +#if !defined(HAVE_CEILF) +static __inline__ float ceilf(float x) +{ + return (float) ceil((double) x); +} +#endif + +#if !defined(HAVE_FLOORF) +static __inline__ float floorf(float x) +{ + return (float) floor((double) x); +} + +#endif + +#if !defined(HAVE_POWF) +static __inline__ float powf(float x, float y) +{ + return (float) pow((double) x, (double) y); +} +#endif + +#if !defined(HAVE_EXPF) +static __inline__ float expf(float x) +{ + return (float) expf((double) x); +} +#endif + +#if !defined(HAVE_LOGF) +static __inline__ float logf(float x) +{ + return (float) logf((double) x); +} +#endif + +#if !defined(HAVE_LOG10F) +static __inline__ float log10f(float x) +{ + return (float) log10((double) x); +} +#endif + +#if defined(__cplusplus) +} +#endif + +#endif + +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/fsk.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/fsk.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,578 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * fsk.c - FSK modem transmit and receive parts + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: fsk.c,v 1.60 2009/11/02 13:25:20 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include + +#include "spandsp/telephony.h" +#include "spandsp/complex.h" +#include "spandsp/dds.h" +#include "spandsp/power_meter.h" +#include "spandsp/async.h" +#include "spandsp/fsk.h" + +#include "spandsp/private/fsk.h" + +const fsk_spec_t preset_fsk_specs[] = +{ + { + "V21 ch 1", + 1080 + 100, + 1080 - 100, + -14, + -30, + 300*100 + }, + { + "V21 ch 2", + 1750 + 100, + 1750 - 100, + -14, + -30, + 300*100 + }, + { + "V23 ch 1", + 2100, + 1300, + -14, + -30, + 1200*100 + }, + { + "V23 ch 2", + 450, + 390, + -14, + -30, + 75*100 + }, + { + "Bell103 ch 1", + 2125 - 100, + 2125 + 100, + -14, + -30, + 300*100 + }, + { + "Bell103 ch 2", + 1170 - 100, + 1170 + 100, + -14, + -30, + 300*100 + }, + { + "Bell202", + 2200, + 1200, + -14, + -30, + 1200*100 + }, + { + "Weitbrecht 45.45", /* Used for TDD (Telecoms Device for the Deaf) */ + 1800, + 1400, + -14, + -30, + 4545 + }, + { + "Weitbrecht 50", /* Used for TDD (Telecoms Device for the Deaf) */ + 1800, + 1400, + -14, + -30, + 5000 + } +}; + +SPAN_DECLARE(int) fsk_tx_restart(fsk_tx_state_t *s, const fsk_spec_t *spec) +{ + s->baud_rate = spec->baud_rate; + s->phase_rates[0] = dds_phase_rate((float) spec->freq_zero); + s->phase_rates[1] = dds_phase_rate((float) spec->freq_one); + s->scaling = dds_scaling_dbm0((float) spec->tx_level); + /* Initialise fractional sample baud generation. */ + s->phase_acc = 0; + s->baud_frac = 0; + s->current_phase_rate = s->phase_rates[1]; + + s->shutdown = FALSE; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(fsk_tx_state_t *) fsk_tx_init(fsk_tx_state_t *s, + const fsk_spec_t *spec, + get_bit_func_t get_bit, + void *user_data) +{ + if (s == NULL) + { + if ((s = (fsk_tx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + + s->get_bit = get_bit; + s->get_bit_user_data = user_data; + fsk_tx_restart(s, spec); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) fsk_tx_release(fsk_tx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) fsk_tx_free(fsk_tx_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) fsk_tx(fsk_tx_state_t *s, int16_t amp[], int len) +{ + int sample; + int bit; + + if (s->shutdown) + return 0; + /* Make the transitions between 0 and 1 phase coherent, but instantaneous + jumps. There is currently no interpolation for bauds that end mid-sample. + Mainstream users will not care. Some specialist users might have a problem + with them, if they care about accurate transition timing. */ + for (sample = 0; sample < len; sample++) + { + if ((s->baud_frac += s->baud_rate) >= SAMPLE_RATE*100) + { + s->baud_frac -= SAMPLE_RATE*100; + if ((bit = s->get_bit(s->get_bit_user_data)) == SIG_STATUS_END_OF_DATA) + { + if (s->status_handler) + s->status_handler(s->status_user_data, SIG_STATUS_END_OF_DATA); + if (s->status_handler) + s->status_handler(s->status_user_data, SIG_STATUS_SHUTDOWN_COMPLETE); + s->shutdown = TRUE; + break; + } + s->current_phase_rate = s->phase_rates[bit & 1]; + } + amp[sample] = dds_mod(&(s->phase_acc), s->current_phase_rate, s->scaling, 0); + } + return sample; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) fsk_tx_power(fsk_tx_state_t *s, float power) +{ + s->scaling = dds_scaling_dbm0(power); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) fsk_tx_set_get_bit(fsk_tx_state_t *s, get_bit_func_t get_bit, void *user_data) +{ + s->get_bit = get_bit; + s->get_bit_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) fsk_tx_set_modem_status_handler(fsk_tx_state_t *s, modem_tx_status_func_t handler, void *user_data) +{ + s->status_handler = handler; + s->status_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) fsk_rx_signal_cutoff(fsk_rx_state_t *s, float cutoff) +{ + /* The 6.04 allows for the gain of the DC blocker */ + s->carrier_on_power = (int32_t) (power_meter_level_dbm0(cutoff + 2.5f - 6.04f)); + s->carrier_off_power = (int32_t) (power_meter_level_dbm0(cutoff - 2.5f - 6.04f)); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) fsk_rx_signal_power(fsk_rx_state_t *s) +{ + return power_meter_current_dbm0(&s->power); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) fsk_rx_set_put_bit(fsk_rx_state_t *s, put_bit_func_t put_bit, void *user_data) +{ + s->put_bit = put_bit; + s->put_bit_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) fsk_rx_set_modem_status_handler(fsk_rx_state_t *s, modem_tx_status_func_t handler, void *user_data) +{ + s->status_handler = handler; + s->status_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) fsk_rx_restart(fsk_rx_state_t *s, const fsk_spec_t *spec, int framing_mode) +{ + int chop; + + s->baud_rate = spec->baud_rate; + s->framing_mode = framing_mode; + fsk_rx_signal_cutoff(s, (float) spec->min_level); + + /* Detect by correlating against the tones we want, over a period + of one baud. The correlation must be quadrature. */ + + /* First we need the quadrature tone generators to correlate + against. */ + s->phase_rate[0] = dds_phase_rate((float) spec->freq_zero); + s->phase_rate[1] = dds_phase_rate((float) spec->freq_one); + s->phase_acc[0] = 0; + s->phase_acc[1] = 0; + s->last_sample = 0; + + /* The correlation should be over one baud. */ + s->correlation_span = SAMPLE_RATE*100/spec->baud_rate; + /* But limit it for very slow baud rates, so we do not overflow our + buffer. */ + if (s->correlation_span > FSK_MAX_WINDOW_LEN) + s->correlation_span = FSK_MAX_WINDOW_LEN; + + /* We need to scale, to avoid overflow in the correlation. */ + s->scaling_shift = 0; + chop = s->correlation_span; + while (chop != 0) + { + s->scaling_shift++; + chop >>= 1; + } + + /* Initialise the baud/bit rate tracking. */ + s->baud_phase = 0; + s->frame_state = 0; + s->frame_bits = 0; + s->last_bit = 0; + + /* Initialise a power detector, so sense when a signal is present. */ + power_meter_init(&(s->power), 4); + s->signal_present = 0; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(fsk_rx_state_t *) fsk_rx_init(fsk_rx_state_t *s, + const fsk_spec_t *spec, + int framing_mode, + put_bit_func_t put_bit, + void *user_data) +{ + if (s == NULL) + { + if ((s = (fsk_rx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + + s->put_bit = put_bit; + s->put_bit_user_data = user_data; + fsk_rx_restart(s, spec, framing_mode); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) fsk_rx_release(fsk_rx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) fsk_rx_free(fsk_rx_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void report_status_change(fsk_rx_state_t *s, int status) +{ + if (s->status_handler) + s->status_handler(s->status_user_data, status); + else if (s->put_bit) + s->put_bit(s->put_bit_user_data, status); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) fsk_rx(fsk_rx_state_t *s, const int16_t *amp, int len) +{ + int buf_ptr; + int baudstate; + int i; + int j; + int16_t x; + int32_t dot; + int32_t sum[2]; + int32_t power; + complexi_t ph; + + buf_ptr = s->buf_ptr; + + for (i = 0; i < len; i++) + { + /* The *totally* asynchronous character to character behaviour of these + modems, when carrying async. data, seems to force a sample by sample + approach. */ + for (j = 0; j < 2; j++) + { + s->dot[j].re -= s->window[j][buf_ptr].re; + s->dot[j].im -= s->window[j][buf_ptr].im; + + ph = dds_complexi(&(s->phase_acc[j]), s->phase_rate[j]); + s->window[j][buf_ptr].re = (ph.re*amp[i]) >> s->scaling_shift; + s->window[j][buf_ptr].im = (ph.im*amp[i]) >> s->scaling_shift; + + s->dot[j].re += s->window[j][buf_ptr].re; + s->dot[j].im += s->window[j][buf_ptr].im; + + dot = s->dot[j].re >> 15; + sum[j] = dot*dot; + dot = s->dot[j].im >> 15; + sum[j] += dot*dot; + } + /* If there isn't much signal, don't demodulate - it will only produce + useless junk results. */ + /* There should be no DC in the signal, but sometimes there is. + We need to measure the power with the DC blocked, but not using + a slow to respond DC blocker. Use the most elementary HPF. */ + x = amp[i] >> 1; + power = power_meter_update(&(s->power), x - s->last_sample); + s->last_sample = x; + if (s->signal_present) + { + /* Look for power below turn-off threshold to turn the carrier off */ + if (power < s->carrier_off_power) + { + if (--s->signal_present <= 0) + { + /* Count down a short delay, to ensure we push the last + few bits through the filters before stopping. */ + report_status_change(s, SIG_STATUS_CARRIER_DOWN); + s->baud_phase = 0; + continue; + } + } + } + else + { + /* Look for power exceeding turn-on threshold to turn the carrier on */ + if (power < s->carrier_on_power) + { + s->baud_phase = 0; + continue; + } + if (s->baud_phase < (s->correlation_span >> 1) - 30) + { + s->baud_phase++; + continue; + } + s->signal_present = 1; + /* Initialise the baud/bit rate tracking. */ + s->baud_phase = 0; + s->frame_state = 0; + s->frame_bits = 0; + s->last_bit = 0; + report_status_change(s, SIG_STATUS_CARRIER_UP); + } + /* Non-coherent FSK demodulation by correlation with the target tones + over a one baud interval. The slow V.xx specs. are too open ended + to allow anything fancier to be used. The dot products are calculated + using a sliding window approach, so the compute load is not that great. */ + + baudstate = (sum[0] < sum[1]); + switch (s->framing_mode) + { + case FSK_FRAME_MODE_SYNC: + /* Synchronous serial operation - e.g. for HDLC */ + if (s->last_bit != baudstate) + { + /* On a transition we check our timing */ + s->last_bit = baudstate; + /* For synchronous use (e.g. HDLC channels in FAX modems), nudge + the baud phase gently, trying to keep it centred on the bauds. */ + if (s->baud_phase < (SAMPLE_RATE*50)) + s->baud_phase += (s->baud_rate >> 3); + else + s->baud_phase -= (s->baud_rate >> 3); + } + if ((s->baud_phase += s->baud_rate) >= (SAMPLE_RATE*100)) + { + /* We should be in the middle of a baud now, so report the current + state as the next bit */ + s->baud_phase -= (SAMPLE_RATE*100); + s->put_bit(s->put_bit_user_data, baudstate); + } + break; + case FSK_FRAME_MODE_ASYNC: + /* Fully asynchronous mode */ + if (s->last_bit != baudstate) + { + /* On a transition we check our timing */ + s->last_bit = baudstate; + /* For async. operation, believe transitions completely, and + sample appropriately. This allows instant start on the first + transition. */ + /* We must now be about half way to a sampling point. We do not do + any fractional sample estimation of the transitions, so this is + the most accurate baud alignment we can do. */ + s->baud_phase = SAMPLE_RATE*50; + } + if ((s->baud_phase += s->baud_rate) >= (SAMPLE_RATE*100)) + { + /* We should be in the middle of a baud now, so report the current + state as the next bit */ + s->baud_phase -= (SAMPLE_RATE*100); + s->put_bit(s->put_bit_user_data, baudstate); + } + break; + default: + /* Gather the specified number of bits, with robust checking to ensure reasonable voice immunity. + The first bit should be a start bit (0), and the last bit should be a stop bit (1) */ + if (s->frame_state == 0) + { + /* Looking for the start of a zero bit, which hopefully the start of a start bit */ + if (baudstate == 0) + { + s->baud_phase = SAMPLE_RATE*(100 - 40)/2; + s->frame_state = -1; + s->frame_bits = 0; + s->last_bit = -1; + } + } + else if (s->frame_state == -1) + { + /* Look for a continuous zero from the start of the start bit until + beyond the middle */ + if (baudstate != 0) + { + /* If we aren't looking at a stable start bit, restart */ + s->frame_state = 0; + } + else + { + s->baud_phase += s->baud_rate; + if (s->baud_phase >= SAMPLE_RATE*100) + { + s->frame_state = 1; + s->last_bit = baudstate; + } + } + } + else + { + s->baud_phase += s->baud_rate; + if (s->baud_phase >= SAMPLE_RATE*(100 - 40)) + { + if (s->last_bit < 0) + s->last_bit = baudstate; + /* Look for the bit being consistent over the central 20% of the bit time. */ + if (s->last_bit != baudstate) + { + s->frame_state = 0; + } + else if (s->baud_phase >= SAMPLE_RATE*100) + { + /* We should be in the middle of a baud now, so report the current + state as the next bit */ + if (s->last_bit == baudstate) + { + s->frame_bits |= (baudstate << s->framing_mode); + s->frame_bits >>= 1; + s->baud_phase -= (SAMPLE_RATE*100); + if (++s->frame_state > s->framing_mode) + { + /* Check we have a stop bit */ + if (baudstate == 1) + { + /* Check we have a start bit */ + if ((s->frame_bits & 1) == 0) + { + /* Drop the start bit, and pass the rest back */ + s->frame_bits >>= 1; + s->put_bit(s->put_bit_user_data, s->frame_bits); + } + } + s->frame_state = 0; + } + } + else + { + s->frame_state = 0; + } + s->last_bit = -1; + } + } + } + break; + } + if (++buf_ptr >= s->correlation_span) + buf_ptr = 0; + } + s->buf_ptr = buf_ptr; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) fsk_rx_fillin(fsk_rx_state_t *s, int len) +{ + /* The valid choice here is probably to do nothing. We don't change state + (i.e carrier on<->carrier off), and we'll just output less bits than we + should. */ + /* TODO: Advance the symbol phase the appropriate amount */ + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/g711.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/g711.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,196 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * g711.c - A-law and u-law transcoding routines + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: g711.c,v 1.16 2009/02/10 13:06:46 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/bit_operations.h" +#include "spandsp/g711.h" +#include "spandsp/private/g711.h" + +/* Copied from the CCITT G.711 specification */ +static const uint8_t ulaw_to_alaw_table[256] = +{ + 42, 43, 40, 41, 46, 47, 44, 45, 34, 35, 32, 33, 38, 39, 36, 37, + 58, 59, 56, 57, 62, 63, 60, 61, 50, 51, 48, 49, 54, 55, 52, 53, + 10, 11, 8, 9, 14, 15, 12, 13, 2, 3, 0, 1, 6, 7, 4, 26, + 27, 24, 25, 30, 31, 28, 29, 18, 19, 16, 17, 22, 23, 20, 21, 106, + 104, 105, 110, 111, 108, 109, 98, 99, 96, 97, 102, 103, 100, 101, 122, 120, + 126, 127, 124, 125, 114, 115, 112, 113, 118, 119, 116, 117, 75, 73, 79, 77, + 66, 67, 64, 65, 70, 71, 68, 69, 90, 91, 88, 89, 94, 95, 92, 93, + 82, 82, 83, 83, 80, 80, 81, 81, 86, 86, 87, 87, 84, 84, 85, 85, + 170, 171, 168, 169, 174, 175, 172, 173, 162, 163, 160, 161, 166, 167, 164, 165, + 186, 187, 184, 185, 190, 191, 188, 189, 178, 179, 176, 177, 182, 183, 180, 181, + 138, 139, 136, 137, 142, 143, 140, 141, 130, 131, 128, 129, 134, 135, 132, 154, + 155, 152, 153, 158, 159, 156, 157, 146, 147, 144, 145, 150, 151, 148, 149, 234, + 232, 233, 238, 239, 236, 237, 226, 227, 224, 225, 230, 231, 228, 229, 250, 248, + 254, 255, 252, 253, 242, 243, 240, 241, 246, 247, 244, 245, 203, 201, 207, 205, + 194, 195, 192, 193, 198, 199, 196, 197, 218, 219, 216, 217, 222, 223, 220, 221, + 210, 210, 211, 211, 208, 208, 209, 209, 214, 214, 215, 215, 212, 212, 213, 213 +}; + +/* These transcoding tables are copied from the CCITT G.711 specification. To achieve + optimal results, do not change them. */ + +static const uint8_t alaw_to_ulaw_table[256] = +{ + 42, 43, 40, 41, 46, 47, 44, 45, 34, 35, 32, 33, 38, 39, 36, 37, + 57, 58, 55, 56, 61, 62, 59, 60, 49, 50, 47, 48, 53, 54, 51, 52, + 10, 11, 8, 9, 14, 15, 12, 13, 2, 3, 0, 1, 6, 7, 4, 5, + 26, 27, 24, 25, 30, 31, 28, 29, 18, 19, 16, 17, 22, 23, 20, 21, + 98, 99, 96, 97, 102, 103, 100, 101, 93, 93, 92, 92, 95, 95, 94, 94, + 116, 118, 112, 114, 124, 126, 120, 122, 106, 107, 104, 105, 110, 111, 108, 109, + 72, 73, 70, 71, 76, 77, 74, 75, 64, 65, 63, 63, 68, 69, 66, 67, + 86, 87, 84, 85, 90, 91, 88, 89, 79, 79, 78, 78, 82, 83, 80, 81, + 170, 171, 168, 169, 174, 175, 172, 173, 162, 163, 160, 161, 166, 167, 164, 165, + 185, 186, 183, 184, 189, 190, 187, 188, 177, 178, 175, 176, 181, 182, 179, 180, + 138, 139, 136, 137, 142, 143, 140, 141, 130, 131, 128, 129, 134, 135, 132, 133, + 154, 155, 152, 153, 158, 159, 156, 157, 146, 147, 144, 145, 150, 151, 148, 149, + 226, 227, 224, 225, 230, 231, 228, 229, 221, 221, 220, 220, 223, 223, 222, 222, + 244, 246, 240, 242, 252, 254, 248, 250, 234, 235, 232, 233, 238, 239, 236, 237, + 200, 201, 198, 199, 204, 205, 202, 203, 192, 193, 191, 191, 196, 197, 194, 195, + 214, 215, 212, 213, 218, 219, 216, 217, 207, 207, 206, 206, 210, 211, 208, 209 +}; + +SPAN_DECLARE(uint8_t) alaw_to_ulaw(uint8_t alaw) +{ + return alaw_to_ulaw_table[alaw]; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(uint8_t) ulaw_to_alaw(uint8_t ulaw) +{ + return ulaw_to_alaw_table[ulaw]; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) g711_decode(g711_state_t *s, + int16_t amp[], + const uint8_t g711_data[], + int g711_bytes) +{ + int i; + + if (s->mode == G711_ALAW) + { + for (i = 0; i < g711_bytes; i++) + amp[i] = alaw_to_linear(g711_data[i]); + /*endfor*/ + } + else + { + for (i = 0; i < g711_bytes; i++) + amp[i] = ulaw_to_linear(g711_data[i]); + /*endfor*/ + } + /*endif*/ + return g711_bytes; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) g711_encode(g711_state_t *s, + uint8_t g711_data[], + const int16_t amp[], + int len) +{ + int i; + + if (s->mode == G711_ALAW) + { + for (i = 0; i < len; i++) + g711_data[i] = linear_to_alaw(amp[i]); + /*endfor*/ + } + else + { + for (i = 0; i < len; i++) + g711_data[i] = linear_to_ulaw(amp[i]); + /*endfor*/ + } + /*endif*/ + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) g711_transcode(g711_state_t *s, + uint8_t g711_out[], + const uint8_t g711_in[], + int g711_bytes) +{ + int i; + + if (s->mode == G711_ALAW) + { + for (i = 0; i < g711_bytes; i++) + g711_out[i] = alaw_to_ulaw_table[g711_in[i]]; + /*endfor*/ + } + else + { + for (i = 0; i < g711_bytes; i++) + g711_out[i] = ulaw_to_alaw_table[g711_in[i]]; + /*endfor*/ + } + /*endif*/ + return g711_bytes; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(g711_state_t *) g711_init(g711_state_t *s, int mode) +{ + if (s == NULL) + { + if ((s = (g711_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + s->mode = mode; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) g711_release(g711_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) g711_free(g711_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/g722.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/g722.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,631 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * g722.c - The ITU G.722 codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Based in part on a single channel G.722 codec which is: + * + * Copyright (c) CMU 1993 + * Computer Science, Speech Group + * Chengxiang Lu and Alex Hauptmann + * + * $Id: g722.c,v 1.10 2009/04/22 12:57:40 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/saturated.h" +#include "spandsp/vector_int.h" +#include "spandsp/g722.h" + +#include "spandsp/private/g722.h" + +static const int16_t qmf_coeffs_fwd[12] = +{ + 3, -11, 12, 32, -210, 951, 3876, -805, 362, -156, 53, -11, +}; + +static const int16_t qmf_coeffs_rev[12] = +{ + -11, 53, -156, 362, -805, 3876, 951, -210, 32, 12, -11, 3 +}; + +static const int16_t qm2[4] = +{ + -7408, -1616, 7408, 1616 +}; + +static const int16_t qm4[16] = +{ + 0, -20456, -12896, -8968, + -6288, -4240, -2584, -1200, + 20456, 12896, 8968, 6288, + 4240, 2584, 1200, 0 +}; + +static const int16_t qm5[32] = +{ + -280, -280, -23352, -17560, + -14120, -11664, -9752, -8184, + -6864, -5712, -4696, -3784, + -2960, -2208, -1520, -880, + 23352, 17560, 14120, 11664, + 9752, 8184, 6864, 5712, + 4696, 3784, 2960, 2208, + 1520, 880, 280, -280 +}; + +static const int16_t qm6[64] = +{ + -136, -136, -136, -136, + -24808, -21904, -19008, -16704, + -14984, -13512, -12280, -11192, + -10232, -9360, -8576, -7856, + -7192, -6576, -6000, -5456, + -4944, -4464, -4008, -3576, + -3168, -2776, -2400, -2032, + -1688, -1360, -1040, -728, + 24808, 21904, 19008, 16704, + 14984, 13512, 12280, 11192, + 10232, 9360, 8576, 7856, + 7192, 6576, 6000, 5456, + 4944, 4464, 4008, 3576, + 3168, 2776, 2400, 2032, + 1688, 1360, 1040, 728, + 432, 136, -432, -136 +}; + +static const int16_t q6[32] = +{ + 0, 35, 72, 110, + 150, 190, 233, 276, + 323, 370, 422, 473, + 530, 587, 650, 714, + 786, 858, 940, 1023, + 1121, 1219, 1339, 1458, + 1612, 1765, 1980, 2195, + 2557, 2919, 0, 0 +}; + +static const int16_t ilb[32] = +{ + 2048, 2093, 2139, 2186, + 2233, 2282, 2332, 2383, + 2435, 2489, 2543, 2599, + 2656, 2714, 2774, 2834, + 2896, 2960, 3025, 3091, + 3158, 3228, 3298, 3371, + 3444, 3520, 3597, 3676, + 3756, 3838, 3922, 4008 +}; + +static const int16_t iln[32] = +{ + 0, 63, 62, 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, 0 +}; + +static const int16_t ilp[32] = +{ + 0, 61, 60, 59, 58, 57, 56, 55, + 54, 53, 52, 51, 50, 49, 48, 47, + 46, 45, 44, 43, 42, 41, 40, 39, + 38, 37, 36, 35, 34, 33, 32, 0 +}; + +static const int16_t ihn[3] = +{ + 0, 1, 0 +}; + +static const int16_t ihp[3] = +{ + 0, 3, 2 +}; + +static const int16_t wl[8] = +{ + -60, -30, 58, 172, 334, 538, 1198, 3042 +}; + +static const int16_t rl42[16] = +{ + 0, 7, 6, 5, 4, 3, 2, 1, + 7, 6, 5, 4, 3, 2, 1, 0 +}; + +static const int16_t wh[3] = +{ + 0, -214, 798 +}; + +static const int16_t rh2[4] = +{ + 2, 1, 2, 1 +}; + +static void block4(g722_band_t *s, int16_t dx) +{ + int16_t wd1; + int16_t wd2; + int16_t wd3; + int16_t sp; + int16_t r; + int16_t p; + int16_t ap[2]; + int32_t wd32; + int32_t sz; + int i; + + /* RECONS */ + r = saturated_add16(s->s, dx); + /* PARREC */ + p = saturated_add16(s->sz, dx); + + /* UPPOL2 */ + wd1 = saturate((int32_t) s->a[0] << 2); + wd32 = ((p ^ s->p[0]) & 0x8000) ? wd1 : -wd1; + if (wd32 > 32767) + wd32 = 32767; + wd3 = (int16_t) ((((p ^ s->p[1]) & 0x8000) ? -128 : 128) + + (wd32 >> 7) + + (((int32_t) s->a[1]*(int32_t) 32512) >> 15)); + if (abs(wd3) > 12288) + wd3 = (wd3 < 0) ? -12288 : 12288; + ap[1] = wd3; + + /* UPPOL1 */ + wd1 = ((p ^ s->p[0]) & 0x8000) ? -192 : 192; + wd2 = (int16_t) (((int32_t) s->a[0]*(int32_t) 32640) >> 15); + ap[0] = saturated_add16(wd1, wd2); + + wd3 = saturated_sub16(15360, ap[1]); + if (abs(ap[0]) > wd3) + ap[0] = (ap[0] < 0) ? -wd3 : wd3; + + /* FILTEP */ + wd1 = saturated_add16(r, r); + wd1 = (int16_t) (((int32_t) ap[0]*(int32_t) wd1) >> 15); + wd2 = saturated_add16(s->r, s->r); + wd2 = (int16_t) (((int32_t) ap[1]*(int32_t) wd2) >> 15); + sp = saturated_add16(wd1, wd2); + s->r = r; + s->a[1] = ap[1]; + s->a[0] = ap[0]; + s->p[1] = s->p[0]; + s->p[0] = p; + + /* UPZERO */ + /* DELAYA */ + /* FILTEZ */ + wd1 = (dx == 0) ? 0 : 128; + s->d[0] = dx; + sz = 0; + for (i = 5; i >= 0; i--) + { + wd2 = ((s->d[i + 1] ^ dx) & 0x8000) ? -wd1 : wd1; + wd3 = (int16_t) (((int32_t) s->b[i]*(int32_t) 32640) >> 15); + s->b[i] = saturated_add16(wd2, wd3); + wd3 = saturated_add16(s->d[i], s->d[i]); + sz += ((int32_t) s->b[i]*(int32_t) wd3) >> 15; + s->d[i + 1] = s->d[i]; + } + s->sz = saturate(sz); + + /* PREDIC */ + s->s = saturated_add16(sp, s->sz); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(g722_decode_state_t *) g722_decode_init(g722_decode_state_t *s, int rate, int options) +{ + if (s == NULL) + { + if ((s = (g722_decode_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + if (rate == 48000) + s->bits_per_sample = 6; + else if (rate == 56000) + s->bits_per_sample = 7; + else + s->bits_per_sample = 8; + if ((options & G722_SAMPLE_RATE_8000)) + s->eight_k = TRUE; + if ((options & G722_PACKED) && s->bits_per_sample != 8) + s->packed = TRUE; + else + s->packed = FALSE; + s->band[0].det = 32; + s->band[1].det = 8; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) g722_decode_release(g722_decode_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) g722_decode_free(g722_decode_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) g722_decode(g722_decode_state_t *s, int16_t amp[], const uint8_t g722_data[], int len) +{ + int rlow; + int ihigh; + int16_t dlow; + int16_t dhigh; + int rhigh; + int wd1; + int wd2; + int wd3; + int code; + int outlen; + int j; + + outlen = 0; + rhigh = 0; + for (j = 0; j < len; ) + { + if (s->packed) + { + /* Unpack the code bits */ + if (s->in_bits < s->bits_per_sample) + { + s->in_buffer |= (g722_data[j++] << s->in_bits); + s->in_bits += 8; + } + code = s->in_buffer & ((1 << s->bits_per_sample) - 1); + s->in_buffer >>= s->bits_per_sample; + s->in_bits -= s->bits_per_sample; + } + else + { + code = g722_data[j++]; + } + + switch (s->bits_per_sample) + { + default: + case 8: + wd1 = code & 0x3F; + ihigh = (code >> 6) & 0x03; + wd2 = qm6[wd1]; + wd1 >>= 2; + break; + case 7: + wd1 = code & 0x1F; + ihigh = (code >> 5) & 0x03; + wd2 = qm5[wd1]; + wd1 >>= 1; + break; + case 6: + wd1 = code & 0x0F; + ihigh = (code >> 4) & 0x03; + wd2 = qm4[wd1]; + break; + } + /* Block 5L, LOW BAND INVQBL */ + wd2 = ((int32_t) s->band[0].det*(int32_t) wd2) >> 15; + /* Block 5L, RECONS */ + /* Block 6L, LIMIT */ + rlow = saturate15(s->band[0].s + wd2); + + /* Block 2L, INVQAL */ + wd2 = qm4[wd1]; + dlow = (int16_t) (((int32_t) s->band[0].det*(int32_t) wd2) >> 15); + + /* Block 3L, LOGSCL */ + wd2 = rl42[wd1]; + wd1 = ((int32_t) s->band[0].nb*(int32_t) 127) >> 7; + wd1 += wl[wd2]; + if (wd1 < 0) + wd1 = 0; + else if (wd1 > 18432) + wd1 = 18432; + s->band[0].nb = (int16_t) wd1; + + /* Block 3L, SCALEL */ + wd1 = (s->band[0].nb >> 6) & 31; + wd2 = 8 - (s->band[0].nb >> 11); + wd3 = (wd2 < 0) ? (ilb[wd1] << -wd2) : (ilb[wd1] >> wd2); + s->band[0].det = (int16_t) (wd3 << 2); + + block4(&s->band[0], dlow); + + if (!s->eight_k) + { + /* Block 2H, INVQAH */ + wd2 = qm2[ihigh]; + dhigh = (int16_t) (((int32_t) s->band[1].det*(int32_t) wd2) >> 15); + /* Block 5H, RECONS */ + /* Block 6H, LIMIT */ + rhigh = saturate15(dhigh + s->band[1].s); + + /* Block 2H, INVQAH */ + wd2 = rh2[ihigh]; + wd1 = ((int32_t) s->band[1].nb*(int32_t) 127) >> 7; + wd1 += wh[wd2]; + if (wd1 < 0) + wd1 = 0; + else if (wd1 > 22528) + wd1 = 22528; + s->band[1].nb = (int16_t) wd1; + + /* Block 3H, SCALEH */ + wd1 = (s->band[1].nb >> 6) & 31; + wd2 = 10 - (s->band[1].nb >> 11); + wd3 = (wd2 < 0) ? (ilb[wd1] << -wd2) : (ilb[wd1] >> wd2); + s->band[1].det = (int16_t) (wd3 << 2); + + block4(&s->band[1], dhigh); + } + + if (s->itu_test_mode) + { + amp[outlen++] = (int16_t) (rlow << 1); + amp[outlen++] = (int16_t) (rhigh << 1); + } + else + { + if (s->eight_k) + { + /* We shift by 1 to allow for the 15 bit input to the G.722 algorithm. */ + amp[outlen++] = (int16_t) (rlow << 1); + } + else + { + /* Apply the QMF to build the final signal */ + s->x[s->ptr] = (int16_t) (rlow + rhigh); + s->y[s->ptr] = (int16_t) (rlow - rhigh); + if (++s->ptr >= 12) + s->ptr = 0; + /* We shift by 12 to allow for the QMF filters (DC gain = 4096), less 1 + to allow for the 15 bit input to the G.722 algorithm. */ + amp[outlen++] = (int16_t) (vec_circular_dot_prodi16(s->y, qmf_coeffs_rev, 12, s->ptr) >> 11); + amp[outlen++] = (int16_t) (vec_circular_dot_prodi16(s->x, qmf_coeffs_fwd, 12, s->ptr) >> 11); + } + } + } + return outlen; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(g722_encode_state_t *) g722_encode_init(g722_encode_state_t *s, int rate, int options) +{ + if (s == NULL) + { + if ((s = (g722_encode_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + if (rate == 48000) + s->bits_per_sample = 6; + else if (rate == 56000) + s->bits_per_sample = 7; + else + s->bits_per_sample = 8; + if ((options & G722_SAMPLE_RATE_8000)) + s->eight_k = TRUE; + if ((options & G722_PACKED) && s->bits_per_sample != 8) + s->packed = TRUE; + else + s->packed = FALSE; + s->band[0].det = 32; + s->band[1].det = 8; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) g722_encode_release(g722_encode_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) g722_encode_free(g722_encode_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) g722_encode(g722_encode_state_t *s, uint8_t g722_data[], const int16_t amp[], int len) +{ + int16_t dlow; + int16_t dhigh; + int el; + int wd; + int wd1; + int ril; + int wd2; + int il4; + int ih2; + int wd3; + int eh; + int g722_bytes; + int ihigh; + int ilow; + int code; + /* Low and high band PCM from the QMF */ + int16_t xlow; + int16_t xhigh; + int32_t sumeven; + int32_t sumodd; + int mih; + int i; + int j; + + g722_bytes = 0; + xhigh = 0; + for (j = 0; j < len; ) + { + if (s->itu_test_mode) + { + xlow = + xhigh = amp[j++] >> 1; + } + else + { + if (s->eight_k) + { + /* We shift by 1 to allow for the 15 bit input to the G.722 algorithm. */ + xlow = amp[j++] >> 1; + } + else + { + /* Apply the transmit QMF */ + s->x[s->ptr] = amp[j++]; + s->y[s->ptr] = amp[j++]; + if (++s->ptr >= 12) + s->ptr = 0; + sumodd = vec_circular_dot_prodi16(s->x, qmf_coeffs_fwd, 12, s->ptr); + sumeven = vec_circular_dot_prodi16(s->y, qmf_coeffs_rev, 12, s->ptr); + /* We shift by 12 to allow for the QMF filters (DC gain = 4096), plus 1 + to allow for us summing two filters, plus 1 to allow for the 15 bit + input to the G.722 algorithm. */ + xlow = (int16_t) ((sumeven + sumodd) >> 14); + xhigh = (int16_t) ((sumeven - sumodd) >> 14); + } + } + /* Block 1L, SUBTRA */ + el = saturated_sub16(xlow, s->band[0].s); + + /* Block 1L, QUANTL */ + wd = (el >= 0) ? el : ~el; + + for (i = 1; i < 30; i++) + { + wd1 = ((int32_t) q6[i]*(int32_t) s->band[0].det) >> 12; + if (wd < wd1) + break; + } + ilow = (el < 0) ? iln[i] : ilp[i]; + + /* Block 2L, INVQAL */ + ril = ilow >> 2; + wd2 = qm4[ril]; + dlow = (int16_t) (((int32_t) s->band[0].det*(int32_t) wd2) >> 15); + + /* Block 3L, LOGSCL */ + il4 = rl42[ril]; + wd = ((int32_t) s->band[0].nb*(int32_t) 127) >> 7; + s->band[0].nb = (int16_t) (wd + wl[il4]); + if (s->band[0].nb < 0) + s->band[0].nb = 0; + else if (s->band[0].nb > 18432) + s->band[0].nb = 18432; + + /* Block 3L, SCALEL */ + wd1 = (s->band[0].nb >> 6) & 31; + wd2 = 8 - (s->band[0].nb >> 11); + wd3 = (wd2 < 0) ? (ilb[wd1] << -wd2) : (ilb[wd1] >> wd2); + s->band[0].det = (int16_t) (wd3 << 2); + + block4(&s->band[0], dlow); + + if (s->eight_k) + { + /* Just leave the high bits as zero */ + code = (0xC0 | ilow) >> (8 - s->bits_per_sample); + } + else + { + /* Block 1H, SUBTRA */ + eh = saturated_sub16(xhigh, s->band[1].s); + + /* Block 1H, QUANTH */ + wd = (eh >= 0) ? eh : ~eh; + wd1 = (564*s->band[1].det) >> 12; + mih = (wd >= wd1) ? 2 : 1; + ihigh = (eh < 0) ? ihn[mih] : ihp[mih]; + + /* Block 2H, INVQAH */ + wd2 = qm2[ihigh]; + dhigh = (int16_t) (((int32_t) s->band[1].det*(int32_t) wd2) >> 15); + + /* Block 3H, LOGSCH */ + ih2 = rh2[ihigh]; + wd = ((int32_t) s->band[1].nb*(int32_t) 127) >> 7; + s->band[1].nb = (int16_t) (wd + wh[ih2]); + if (s->band[1].nb < 0) + s->band[1].nb = 0; + else if (s->band[1].nb > 22528) + s->band[1].nb = 22528; + + /* Block 3H, SCALEH */ + wd1 = (s->band[1].nb >> 6) & 31; + wd2 = 10 - (s->band[1].nb >> 11); + wd3 = (wd2 < 0) ? (ilb[wd1] << -wd2) : (ilb[wd1] >> wd2); + s->band[1].det = (int16_t) (wd3 << 2); + + block4(&s->band[1], dhigh); + code = ((ihigh << 6) | ilow) >> (8 - s->bits_per_sample); + } + + if (s->packed) + { + /* Pack the code bits */ + s->out_buffer |= (code << s->out_bits); + s->out_bits += s->bits_per_sample; + if (s->out_bits >= 8) + { + g722_data[g722_bytes++] = (uint8_t) (s->out_buffer & 0xFF); + s->out_bits -= 8; + s->out_buffer >>= 8; + } + } + else + { + g722_data[g722_bytes++] = (uint8_t) code; + } + } + return g722_bytes; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/g726.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/g726.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1188 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * g726.c - The ITU G.726 codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Based on G.721/G.723 code which is: + * + * This source code is a product of Sun Microsystems, Inc. and is provided + * for unrestricted use. Users may copy or modify this source code without + * charge. + * + * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING + * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun source code is provided with no support and without any obligation on + * the part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + * + * $Id: g726.c,v 1.28.4.1 2009/12/28 12:20:46 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/dc_restore.h" +#include "spandsp/bitstream.h" +#include "spandsp/bit_operations.h" +#include "spandsp/g711.h" +#include "spandsp/g726.h" + +#include "spandsp/private/bitstream.h" +#include "spandsp/private/g726.h" + +/* + * Maps G.726_16 code word to reconstructed scale factor normalized log + * magnitude values. + */ +static const int g726_16_dqlntab[4] = +{ + 116, 365, 365, 116 +}; + +/* Maps G.726_16 code word to log of scale factor multiplier. */ +static const int g726_16_witab[4] = +{ + -704, 14048, 14048, -704 +}; + +/* + * Maps G.726_16 code words to a set of values whose long and short + * term averages are computed and then compared to give an indication + * how stationary (steady state) the signal is. + */ +static const int g726_16_fitab[4] = +{ + 0x000, 0xE00, 0xE00, 0x000 +}; + +static const int qtab_726_16[1] = +{ + 261 +}; + +/* + * Maps G.726_24 code word to reconstructed scale factor normalized log + * magnitude values. + */ +static const int g726_24_dqlntab[8] = +{ + -2048, 135, 273, 373, 373, 273, 135, -2048 +}; + +/* Maps G.726_24 code word to log of scale factor multiplier. */ +static const int g726_24_witab[8] = +{ + -128, 960, 4384, 18624, 18624, 4384, 960, -128 +}; + +/* + * Maps G.726_24 code words to a set of values whose long and short + * term averages are computed and then compared to give an indication + * how stationary (steady state) the signal is. + */ +static const int g726_24_fitab[8] = +{ + 0x000, 0x200, 0x400, 0xE00, 0xE00, 0x400, 0x200, 0x000 +}; + +static const int qtab_726_24[3] = +{ + 8, 218, 331 +}; + +/* + * Maps G.726_32 code word to reconstructed scale factor normalized log + * magnitude values. + */ +static const int g726_32_dqlntab[16] = +{ + -2048, 4, 135, 213, 273, 323, 373, 425, + 425, 373, 323, 273, 213, 135, 4, -2048 +}; + +/* Maps G.726_32 code word to log of scale factor multiplier. */ +static const int g726_32_witab[16] = +{ + -384, 576, 1312, 2048, 3584, 6336, 11360, 35904, + 35904, 11360, 6336, 3584, 2048, 1312, 576, -384 +}; + +/* + * Maps G.726_32 code words to a set of values whose long and short + * term averages are computed and then compared to give an indication + * how stationary (steady state) the signal is. + */ +static const int g726_32_fitab[16] = +{ + 0x000, 0x000, 0x000, 0x200, 0x200, 0x200, 0x600, 0xE00, + 0xE00, 0x600, 0x200, 0x200, 0x200, 0x000, 0x000, 0x000 +}; + +static const int qtab_726_32[7] = +{ + -124, 80, 178, 246, 300, 349, 400 +}; + +/* + * Maps G.726_40 code word to ructeconstructed scale factor normalized log + * magnitude values. + */ +static const int g726_40_dqlntab[32] = +{ + -2048, -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, -2048 +}; + +/* Maps G.726_40 code word to log of scale factor multiplier. */ +static const int g726_40_witab[32] = +{ + 448, 448, 768, 1248, 1280, 1312, 1856, 3200, + 4512, 5728, 7008, 8960, 11456, 14080, 16928, 22272, + 22272, 16928, 14080, 11456, 8960, 7008, 5728, 4512, + 3200, 1856, 1312, 1280, 1248, 768, 448, 448 +}; + +/* + * Maps G.726_40 code words to a set of values whose long and short + * term averages are computed and then compared to give an indication + * how stationary (steady state) the signal is. + */ +static const int g726_40_fitab[32] = +{ + 0x000, 0x000, 0x000, 0x000, 0x000, 0x200, 0x200, 0x200, + 0x200, 0x200, 0x400, 0x600, 0x800, 0xA00, 0xC00, 0xC00, + 0xC00, 0xC00, 0xA00, 0x800, 0x600, 0x400, 0x200, 0x200, + 0x200, 0x200, 0x200, 0x000, 0x000, 0x000, 0x000, 0x000 +}; + +static const int qtab_726_40[15] = +{ + -122, -16, 68, 139, 198, 250, 298, 339, + 378, 413, 445, 475, 502, 528, 553 +}; + +/* + * returns the integer product of the 14-bit integer "an" and + * "floating point" representation (4-bit exponent, 6-bit mantessa) "srn". + */ +static int16_t fmult(int16_t an, int16_t srn) +{ + int16_t anmag; + int16_t anexp; + int16_t anmant; + int16_t wanexp; + int16_t wanmant; + int16_t retval; + + anmag = (an > 0) ? an : ((-an) & 0x1FFF); + anexp = (int16_t) (top_bit(anmag) - 5); + anmant = (anmag == 0) ? 32 : (anexp >= 0) ? (anmag >> anexp) : (anmag << -anexp); + wanexp = anexp + ((srn >> 6) & 0xF) - 13; + + wanmant = (anmant*(srn & 0x3F) + 0x30) >> 4; + retval = (wanexp >= 0) ? ((wanmant << wanexp) & 0x7FFF) : (wanmant >> -wanexp); + + return (((an ^ srn) < 0) ? -retval : retval); +} +/*- End of function --------------------------------------------------------*/ + +/* + * Compute the estimated signal from the 6-zero predictor. + */ +static __inline__ int16_t predictor_zero(g726_state_t *s) +{ + int i; + int sezi; + + sezi = fmult(s->b[0] >> 2, s->dq[0]); + /* ACCUM */ + for (i = 1; i < 6; i++) + sezi += fmult(s->b[i] >> 2, s->dq[i]); + return (int16_t) sezi; +} +/*- End of function --------------------------------------------------------*/ + +/* + * Computes the estimated signal from the 2-pole predictor. + */ +static __inline__ int16_t predictor_pole(g726_state_t *s) +{ + return (fmult(s->a[1] >> 2, s->sr[1]) + fmult(s->a[0] >> 2, s->sr[0])); +} +/*- End of function --------------------------------------------------------*/ + +/* + * Computes the quantization step size of the adaptive quantizer. + */ +static int step_size(g726_state_t *s) +{ + int y; + int dif; + int al; + + if (s->ap >= 256) + return s->yu; + y = s->yl >> 6; + dif = s->yu - y; + al = s->ap >> 2; + if (dif > 0) + y += (dif*al) >> 6; + else if (dif < 0) + y += (dif*al + 0x3F) >> 6; + return y; +} +/*- End of function --------------------------------------------------------*/ + +/* + * Given a raw sample, 'd', of the difference signal and a + * quantization step size scale factor, 'y', this routine returns the + * ADPCM codeword to which that sample gets quantized. The step + * size scale factor division operation is done in the log base 2 domain + * as a subtraction. + */ +static int16_t quantize(int d, /* Raw difference signal sample */ + int y, /* Step size multiplier */ + const int table[], /* quantization table */ + int quantizer_states) /* table size of int16_t integers */ +{ + int16_t dqm; /* Magnitude of 'd' */ + int16_t exp; /* Integer part of base 2 log of 'd' */ + int16_t mant; /* Fractional part of base 2 log */ + int16_t dl; /* Log of magnitude of 'd' */ + int16_t dln; /* Step size scale factor normalized log */ + int i; + int size; + + /* + * LOG + * + * Compute base 2 log of 'd', and store in 'dl'. + */ + dqm = (int16_t) abs(d); + exp = (int16_t) (top_bit(dqm >> 1) + 1); + /* Fractional portion. */ + mant = ((dqm << 7) >> exp) & 0x7F; + dl = (exp << 7) + mant; + + /* + * SUBTB + * + * "Divide" by step size multiplier. + */ + dln = dl - (int16_t) (y >> 2); + + /* + * QUAN + * + * Search for codword i for 'dln'. + */ + size = (quantizer_states - 1) >> 1; + for (i = 0; i < size; i++) + { + if (dln < table[i]) + break; + } + if (d < 0) + { + /* Take 1's complement of i */ + return (int16_t) ((size << 1) + 1 - i); + } + if (i == 0 && (quantizer_states & 1)) + { + /* Zero is only valid if there are an even number of states, so + take the 1's complement if the code is zero. */ + return (int16_t) quantizer_states; + } + return (int16_t) i; +} +/*- End of function --------------------------------------------------------*/ + +/* + * Returns reconstructed difference signal 'dq' obtained from + * codeword 'i' and quantization step size scale factor 'y'. + * Multiplication is performed in log base 2 domain as addition. + */ +static int16_t reconstruct(int sign, /* 0 for non-negative value */ + int dqln, /* G.72x codeword */ + int y) /* Step size multiplier */ +{ + int16_t dql; /* Log of 'dq' magnitude */ + int16_t dex; /* Integer part of log */ + int16_t dqt; + int16_t dq; /* Reconstructed difference signal sample */ + + dql = (int16_t) (dqln + (y >> 2)); /* ADDA */ + + if (dql < 0) + return ((sign) ? -0x8000 : 0); + /* ANTILOG */ + dex = (dql >> 7) & 15; + dqt = 128 + (dql & 127); + dq = (dqt << 7) >> (14 - dex); + return ((sign) ? (dq - 0x8000) : dq); +} +/*- End of function --------------------------------------------------------*/ + +/* + * updates the state variables for each output code + */ +static void update(g726_state_t *s, + int y, /* quantizer step size */ + int wi, /* scale factor multiplier */ + int fi, /* for long/short term energies */ + int dq, /* quantized prediction difference */ + int sr, /* reconstructed signal */ + int dqsez) /* difference from 2-pole predictor */ +{ + int16_t mag; + int16_t exp; + int16_t a2p; /* LIMC */ + int16_t a1ul; /* UPA1 */ + int16_t pks1; /* UPA2 */ + int16_t fa1; + int16_t ylint; + int16_t dqthr; + int16_t ylfrac; + int16_t thr; + int16_t pk0; + int i; + int tr; + + a2p = 0; + /* Needed in updating predictor poles */ + pk0 = (dqsez < 0) ? 1 : 0; + + /* prediction difference magnitude */ + mag = (int16_t) (dq & 0x7FFF); + /* TRANS */ + ylint = (int16_t) (s->yl >> 15); /* exponent part of yl */ + ylfrac = (int16_t) ((s->yl >> 10) & 0x1F); /* fractional part of yl */ + /* Limit threshold to 31 << 10 */ + thr = (ylint > 9) ? (31 << 10) : ((32 + ylfrac) << ylint); + dqthr = (thr + (thr >> 1)) >> 1; /* dqthr = 0.75 * thr */ + if (!s->td) /* signal supposed voice */ + tr = FALSE; + else if (mag <= dqthr) /* supposed data, but small mag */ + tr = FALSE; /* treated as voice */ + else /* signal is data (modem) */ + tr = TRUE; + + /* + * Quantizer scale factor adaptation. + */ + + /* FUNCTW & FILTD & DELAY */ + /* update non-steady state step size multiplier */ + s->yu = (int16_t) (y + ((wi - y) >> 5)); + + /* LIMB */ + if (s->yu < 544) + s->yu = 544; + else if (s->yu > 5120) + s->yu = 5120; + + /* FILTE & DELAY */ + /* update steady state step size multiplier */ + s->yl += s->yu + ((-s->yl) >> 6); + + /* + * Adaptive predictor coefficients. + */ + if (tr) + { + /* Reset the a's and b's for a modem signal */ + s->a[0] = 0; + s->a[1] = 0; + s->b[0] = 0; + s->b[1] = 0; + s->b[2] = 0; + s->b[3] = 0; + s->b[4] = 0; + s->b[5] = 0; + } + else + { + /* Update the a's and b's */ + /* UPA2 */ + pks1 = pk0 ^ s->pk[0]; + + /* Update predictor pole a[1] */ + a2p = s->a[1] - (s->a[1] >> 7); + if (dqsez != 0) + { + fa1 = (pks1) ? s->a[0] : -s->a[0]; + /* a2p = function of fa1 */ + if (fa1 < -8191) + a2p -= 0x100; + else if (fa1 > 8191) + a2p += 0xFF; + else + a2p += fa1 >> 5; + + if (pk0 ^ s->pk[1]) + { + /* LIMC */ + if (a2p <= -12160) + a2p = -12288; + else if (a2p >= 12416) + a2p = 12288; + else + a2p -= 0x80; + } + else if (a2p <= -12416) + a2p = -12288; + else if (a2p >= 12160) + a2p = 12288; + else + a2p += 0x80; + } + + /* TRIGB & DELAY */ + s->a[1] = a2p; + + /* UPA1 */ + /* Update predictor pole a[0] */ + s->a[0] -= s->a[0] >> 8; + if (dqsez != 0) + { + if (pks1 == 0) + s->a[0] += 192; + else + s->a[0] -= 192; + } + /* LIMD */ + a1ul = 15360 - a2p; + if (s->a[0] < -a1ul) + s->a[0] = -a1ul; + else if (s->a[0] > a1ul) + s->a[0] = a1ul; + + /* UPB : update predictor zeros b[6] */ + for (i = 0; i < 6; i++) + { + /* Distinguish 40Kbps mode from the others */ + s->b[i] -= s->b[i] >> ((s->bits_per_sample == 5) ? 9 : 8); + if (dq & 0x7FFF) + { + /* XOR */ + if ((dq ^ s->dq[i]) >= 0) + s->b[i] += 128; + else + s->b[i] -= 128; + } + } + } + + for (i = 5; i > 0; i--) + s->dq[i] = s->dq[i - 1]; + /* FLOAT A : convert dq[0] to 4-bit exp, 6-bit mantissa f.p. */ + if (mag == 0) + { + s->dq[0] = (dq >= 0) ? 0x20 : 0xFC20; + } + else + { + exp = (int16_t) (top_bit(mag) + 1); + s->dq[0] = (dq >= 0) + ? ((exp << 6) + ((mag << 6) >> exp)) + : ((exp << 6) + ((mag << 6) >> exp) - 0x400); + } + + s->sr[1] = s->sr[0]; + /* FLOAT B : convert sr to 4-bit exp., 6-bit mantissa f.p. */ + if (sr == 0) + { + s->sr[0] = 0x20; + } + else if (sr > 0) + { + exp = (int16_t) (top_bit(sr) + 1); + s->sr[0] = (int16_t) ((exp << 6) + ((sr << 6) >> exp)); + } + else if (sr > -32768) + { + mag = (int16_t) -sr; + exp = (int16_t) (top_bit(mag) + 1); + s->sr[0] = (exp << 6) + ((mag << 6) >> exp) - 0x400; + } + else + { + s->sr[0] = (uint16_t) 0xFC20; + } + + /* DELAY A */ + s->pk[1] = s->pk[0]; + s->pk[0] = pk0; + + /* TONE */ + if (tr) /* this sample has been treated as data */ + s->td = FALSE; /* next one will be treated as voice */ + else if (a2p < -11776) /* small sample-to-sample correlation */ + s->td = TRUE; /* signal may be data */ + else /* signal is voice */ + s->td = FALSE; + + /* Adaptation speed control. */ + /* FILTA */ + s->dms += ((int16_t) fi - s->dms) >> 5; + /* FILTB */ + s->dml += (((int16_t) (fi << 2) - s->dml) >> 7); + + if (tr) + s->ap = 256; + else if (y < 1536) /* SUBTC */ + s->ap += (0x200 - s->ap) >> 4; + else if (s->td) + s->ap += (0x200 - s->ap) >> 4; + else if (abs((s->dms << 2) - s->dml) >= (s->dml >> 3)) + s->ap += (0x200 - s->ap) >> 4; + else + s->ap += (-s->ap) >> 4; +} +/*- End of function --------------------------------------------------------*/ + +static int16_t tandem_adjust_alaw(int16_t sr, /* decoder output linear PCM sample */ + int se, /* predictor estimate sample */ + int y, /* quantizer step size */ + int i, /* decoder input code */ + int sign, + const int qtab[], + int quantizer_states) +{ + uint8_t sp; /* A-law compressed 8-bit code */ + int16_t dx; /* prediction error */ + int id; /* quantized prediction error */ + int sd; /* adjusted A-law decoded sample value */ + + if (sr <= -32768) + sr = -1; + sp = linear_to_alaw((sr >> 1) << 3); + /* 16-bit prediction error */ + dx = (int16_t) ((alaw_to_linear(sp) >> 2) - se); + id = quantize(dx, y, qtab, quantizer_states); + if (id == i) + { + /* No adjustment of sp required */ + return (int16_t) sp; + } + /* sp adjustment needed */ + /* ADPCM codes : 8, 9, ... F, 0, 1, ... , 6, 7 */ + /* 2's complement to biased unsigned */ + if ((id ^ sign) > (i ^ sign)) + { + /* sp adjusted to next lower value */ + if (sp & 0x80) + sd = (sp == 0xD5) ? 0x55 : (((sp ^ 0x55) - 1) ^ 0x55); + else + sd = (sp == 0x2A) ? 0x2A : (((sp ^ 0x55) + 1) ^ 0x55); + } + else + { + /* sp adjusted to next higher value */ + if (sp & 0x80) + sd = (sp == 0xAA) ? 0xAA : (((sp ^ 0x55) + 1) ^ 0x55); + else + sd = (sp == 0x55) ? 0xD5 : (((sp ^ 0x55) - 1) ^ 0x55); + } + return (int16_t) sd; +} +/*- End of function --------------------------------------------------------*/ + +static int16_t tandem_adjust_ulaw(int16_t sr, /* decoder output linear PCM sample */ + int se, /* predictor estimate sample */ + int y, /* quantizer step size */ + int i, /* decoder input code */ + int sign, + const int qtab[], + int quantizer_states) +{ + uint8_t sp; /* u-law compressed 8-bit code */ + int16_t dx; /* prediction error */ + int id; /* quantized prediction error */ + int sd; /* adjusted u-law decoded sample value */ + + if (sr <= -32768) + sr = 0; + sp = linear_to_ulaw(sr << 2); + /* 16-bit prediction error */ + dx = (int16_t) ((ulaw_to_linear(sp) >> 2) - se); + id = quantize(dx, y, qtab, quantizer_states); + if (id == i) + { + /* No adjustment of sp required. */ + return (int16_t) sp; + } + /* ADPCM codes : 8, 9, ... F, 0, 1, ... , 6, 7 */ + /* 2's complement to biased unsigned */ + if ((id ^ sign) > (i ^ sign)) + { + /* sp adjusted to next lower value */ + if (sp & 0x80) + sd = (sp == 0xFF) ? 0x7E : (sp + 1); + else + sd = (sp == 0x00) ? 0x00 : (sp - 1); + } + else + { + /* sp adjusted to next higher value */ + if (sp & 0x80) + sd = (sp == 0x80) ? 0x80 : (sp - 1); + else + sd = (sp == 0x7F) ? 0xFE : (sp + 1); + } + return (int16_t) sd; +} +/*- End of function --------------------------------------------------------*/ + +/* + * Encodes a linear PCM, A-law or u-law input sample and returns its 3-bit code. + */ +static uint8_t g726_16_encoder(g726_state_t *s, int16_t amp) +{ + int y; + int16_t sei; + int16_t sezi; + int16_t se; + int16_t d; + int16_t sr; + int16_t dqsez; + int16_t dq; + int16_t i; + + sezi = predictor_zero(s); + sei = sezi + predictor_pole(s); + se = sei >> 1; + d = amp - se; + + /* Quantize prediction difference */ + y = step_size(s); + i = quantize(d, y, qtab_726_16, 4); + dq = reconstruct(i & 2, g726_16_dqlntab[i], y); + + /* Reconstruct the signal */ + sr = (dq < 0) ? (se - (dq & 0x3FFF)) : (se + dq); + + /* Pole prediction difference */ + dqsez = sr + (sezi >> 1) - se; + + update(s, y, g726_16_witab[i], g726_16_fitab[i], dq, sr, dqsez); + return (uint8_t) i; +} +/*- End of function --------------------------------------------------------*/ + +/* + * Decodes a 2-bit CCITT G.726_16 ADPCM code and returns + * the resulting 16-bit linear PCM, A-law or u-law sample value. + */ +static int16_t g726_16_decoder(g726_state_t *s, uint8_t code) +{ + int16_t sezi; + int16_t sei; + int16_t se; + int16_t sr; + int16_t dq; + int16_t dqsez; + int y; + + /* Mask to get proper bits */ + code &= 0x03; + sezi = predictor_zero(s); + sei = sezi + predictor_pole(s); + + y = step_size(s); + dq = reconstruct(code & 2, g726_16_dqlntab[code], y); + + /* Reconstruct the signal */ + se = sei >> 1; + sr = (dq < 0) ? (se - (dq & 0x3FFF)) : (se + dq); + + /* Pole prediction difference */ + dqsez = sr + (sezi >> 1) - se; + + update(s, y, g726_16_witab[code], g726_16_fitab[code], dq, sr, dqsez); + + switch (s->ext_coding) + { + case G726_ENCODING_ALAW: + return tandem_adjust_alaw(sr, se, y, code, 2, qtab_726_16, 4); + case G726_ENCODING_ULAW: + return tandem_adjust_ulaw(sr, se, y, code, 2, qtab_726_16, 4); + } + return (sr << 2); +} +/*- End of function --------------------------------------------------------*/ + +/* + * Encodes a linear PCM, A-law or u-law input sample and returns its 3-bit code. + */ +static uint8_t g726_24_encoder(g726_state_t *s, int16_t amp) +{ + int16_t sei; + int16_t sezi; + int16_t se; + int16_t d; + int16_t sr; + int16_t dqsez; + int16_t dq; + int16_t i; + int y; + + sezi = predictor_zero(s); + sei = sezi + predictor_pole(s); + se = sei >> 1; + d = amp - se; + + /* Quantize prediction difference */ + y = step_size(s); + i = quantize(d, y, qtab_726_24, 7); + dq = reconstruct(i & 4, g726_24_dqlntab[i], y); + + /* Reconstruct the signal */ + sr = (dq < 0) ? (se - (dq & 0x3FFF)) : (se + dq); + + /* Pole prediction difference */ + dqsez = sr + (sezi >> 1) - se; + + update(s, y, g726_24_witab[i], g726_24_fitab[i], dq, sr, dqsez); + return (uint8_t) i; +} +/*- End of function --------------------------------------------------------*/ + +/* + * Decodes a 3-bit CCITT G.726_24 ADPCM code and returns + * the resulting 16-bit linear PCM, A-law or u-law sample value. + */ +static int16_t g726_24_decoder(g726_state_t *s, uint8_t code) +{ + int16_t sezi; + int16_t sei; + int16_t se; + int16_t sr; + int16_t dq; + int16_t dqsez; + int y; + + /* Mask to get proper bits */ + code &= 0x07; + sezi = predictor_zero(s); + sei = sezi + predictor_pole(s); + + y = step_size(s); + dq = reconstruct(code & 4, g726_24_dqlntab[code], y); + + /* Reconstruct the signal */ + se = sei >> 1; + sr = (dq < 0) ? (se - (dq & 0x3FFF)) : (se + dq); + + /* Pole prediction difference */ + dqsez = sr + (sezi >> 1) - se; + + update(s, y, g726_24_witab[code], g726_24_fitab[code], dq, sr, dqsez); + + switch (s->ext_coding) + { + case G726_ENCODING_ALAW: + return tandem_adjust_alaw(sr, se, y, code, 4, qtab_726_24, 7); + case G726_ENCODING_ULAW: + return tandem_adjust_ulaw(sr, se, y, code, 4, qtab_726_24, 7); + } + return (sr << 2); +} +/*- End of function --------------------------------------------------------*/ + +/* + * Encodes a linear input sample and returns its 4-bit code. + */ +static uint8_t g726_32_encoder(g726_state_t *s, int16_t amp) +{ + int16_t sei; + int16_t sezi; + int16_t se; + int16_t d; + int16_t sr; + int16_t dqsez; + int16_t dq; + int16_t i; + int y; + + sezi = predictor_zero(s); + sei = sezi + predictor_pole(s); + se = sei >> 1; + d = amp - se; + + /* Quantize the prediction difference */ + y = step_size(s); + i = quantize(d, y, qtab_726_32, 15); + dq = reconstruct(i & 8, g726_32_dqlntab[i], y); + + /* Reconstruct the signal */ + sr = (dq < 0) ? (se - (dq & 0x3FFF)) : (se + dq); + + /* Pole prediction difference */ + dqsez = sr + (sezi >> 1) - se; + + update(s, y, g726_32_witab[i], g726_32_fitab[i], dq, sr, dqsez); + return (uint8_t) i; +} +/*- End of function --------------------------------------------------------*/ + +/* + * Decodes a 4-bit CCITT G.726_32 ADPCM code and returns + * the resulting 16-bit linear PCM, A-law or u-law sample value. + */ +static int16_t g726_32_decoder(g726_state_t *s, uint8_t code) +{ + int16_t sezi; + int16_t sei; + int16_t se; + int16_t sr; + int16_t dq; + int16_t dqsez; + int y; + + /* Mask to get proper bits */ + code &= 0x0F; + sezi = predictor_zero(s); + sei = sezi + predictor_pole(s); + + y = step_size(s); + dq = reconstruct(code & 8, g726_32_dqlntab[code], y); + + /* Reconstruct the signal */ + se = sei >> 1; + sr = (dq < 0) ? (se - (dq & 0x3FFF)) : (se + dq); + + /* Pole prediction difference */ + dqsez = sr + (sezi >> 1) - se; + + update(s, y, g726_32_witab[code], g726_32_fitab[code], dq, sr, dqsez); + + switch (s->ext_coding) + { + case G726_ENCODING_ALAW: + return tandem_adjust_alaw(sr, se, y, code, 8, qtab_726_32, 15); + case G726_ENCODING_ULAW: + return tandem_adjust_ulaw(sr, se, y, code, 8, qtab_726_32, 15); + } + return (sr << 2); +} +/*- End of function --------------------------------------------------------*/ + +/* + * Encodes a 16-bit linear PCM, A-law or u-law input sample and retuens + * the resulting 5-bit CCITT G.726 40Kbps code. + */ +static uint8_t g726_40_encoder(g726_state_t *s, int16_t amp) +{ + int16_t sei; + int16_t sezi; + int16_t se; + int16_t d; + int16_t sr; + int16_t dqsez; + int16_t dq; + int16_t i; + int y; + + sezi = predictor_zero(s); + sei = sezi + predictor_pole(s); + se = sei >> 1; + d = amp - se; + + /* Quantize prediction difference */ + y = step_size(s); + i = quantize(d, y, qtab_726_40, 31); + dq = reconstruct(i & 0x10, g726_40_dqlntab[i], y); + + /* Reconstruct the signal */ + sr = (dq < 0) ? (se - (dq & 0x7FFF)) : (se + dq); + + /* Pole prediction difference */ + dqsez = sr + (sezi >> 1) - se; + + update(s, y, g726_40_witab[i], g726_40_fitab[i], dq, sr, dqsez); + return (uint8_t) i; +} +/*- End of function --------------------------------------------------------*/ + +/* + * Decodes a 5-bit CCITT G.726 40Kbps code and returns + * the resulting 16-bit linear PCM, A-law or u-law sample value. + */ +static int16_t g726_40_decoder(g726_state_t *s, uint8_t code) +{ + int16_t sezi; + int16_t sei; + int16_t se; + int16_t sr; + int16_t dq; + int16_t dqsez; + int y; + + /* Mask to get proper bits */ + code &= 0x1F; + sezi = predictor_zero(s); + sei = sezi + predictor_pole(s); + + y = step_size(s); + dq = reconstruct(code & 0x10, g726_40_dqlntab[code], y); + + /* Reconstruct the signal */ + se = sei >> 1; + sr = (dq < 0) ? (se - (dq & 0x7FFF)) : (se + dq); + + /* Pole prediction difference */ + dqsez = sr + (sezi >> 1) - se; + + update(s, y, g726_40_witab[code], g726_40_fitab[code], dq, sr, dqsez); + + switch (s->ext_coding) + { + case G726_ENCODING_ALAW: + return tandem_adjust_alaw(sr, se, y, code, 0x10, qtab_726_40, 31); + case G726_ENCODING_ULAW: + return tandem_adjust_ulaw(sr, se, y, code, 0x10, qtab_726_40, 31); + } + return (sr << 2); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(g726_state_t *) g726_init(g726_state_t *s, int bit_rate, int ext_coding, int packing) +{ + int i; + + if (bit_rate != 16000 && bit_rate != 24000 && bit_rate != 32000 && bit_rate != 40000) + return NULL; + if (s == NULL) + { + if ((s = (g726_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + s->yl = 34816; + s->yu = 544; + s->dms = 0; + s->dml = 0; + s->ap = 0; + s->rate = bit_rate; + s->ext_coding = ext_coding; + s->packing = packing; + for (i = 0; i < 2; i++) + { + s->a[i] = 0; + s->pk[i] = 0; + s->sr[i] = 32; + } + for (i = 0; i < 6; i++) + { + s->b[i] = 0; + s->dq[i] = 32; + } + s->td = FALSE; + switch (bit_rate) + { + case 16000: + s->enc_func = g726_16_encoder; + s->dec_func = g726_16_decoder; + s->bits_per_sample = 2; + break; + case 24000: + s->enc_func = g726_24_encoder; + s->dec_func = g726_24_decoder; + s->bits_per_sample = 3; + break; + case 32000: + default: + s->enc_func = g726_32_encoder; + s->dec_func = g726_32_decoder; + s->bits_per_sample = 4; + break; + case 40000: + s->enc_func = g726_40_encoder; + s->dec_func = g726_40_decoder; + s->bits_per_sample = 5; + break; + } + bitstream_init(&s->bs, (s->packing != G726_PACKING_LEFT)); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) g726_release(g726_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) g726_free(g726_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) g726_decode(g726_state_t *s, + int16_t amp[], + const uint8_t g726_data[], + int g726_bytes) +{ + int i; + int samples; + uint8_t code; + int sl; + + for (samples = i = 0; ; ) + { + if (s->packing != G726_PACKING_NONE) + { + /* Unpack the code bits */ + if (s->packing != G726_PACKING_LEFT) + { + if (s->bs.residue < s->bits_per_sample) + { + if (i >= g726_bytes) + break; + s->bs.bitstream |= (g726_data[i++] << s->bs.residue); + s->bs.residue += 8; + } + code = (uint8_t) (s->bs.bitstream & ((1 << s->bits_per_sample) - 1)); + s->bs.bitstream >>= s->bits_per_sample; + } + else + { + if (s->bs.residue < s->bits_per_sample) + { + if (i >= g726_bytes) + break; + s->bs.bitstream = (s->bs.bitstream << 8) | g726_data[i++]; + s->bs.residue += 8; + } + code = (uint8_t) ((s->bs.bitstream >> (s->bs.residue - s->bits_per_sample)) & ((1 << s->bits_per_sample) - 1)); + } + s->bs.residue -= s->bits_per_sample; + } + else + { + if (i >= g726_bytes) + break; + code = g726_data[i++]; + } + sl = s->dec_func(s, code); + if (s->ext_coding != G726_ENCODING_LINEAR) + ((uint8_t *) amp)[samples++] = (uint8_t) sl; + else + amp[samples++] = (int16_t) sl; + } + return samples; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) g726_encode(g726_state_t *s, + uint8_t g726_data[], + const int16_t amp[], + int len) +{ + int i; + int g726_bytes; + int16_t sl; + uint8_t code; + + for (g726_bytes = i = 0; i < len; i++) + { + /* Linearize the input sample to 14-bit PCM */ + switch (s->ext_coding) + { + case G726_ENCODING_ALAW: + sl = alaw_to_linear(((const uint8_t *) amp)[i]) >> 2; + break; + case G726_ENCODING_ULAW: + sl = ulaw_to_linear(((const uint8_t *) amp)[i]) >> 2; + break; + default: + sl = amp[i] >> 2; + break; + } + code = s->enc_func(s, sl); + if (s->packing != G726_PACKING_NONE) + { + /* Pack the code bits */ + if (s->packing != G726_PACKING_LEFT) + { + s->bs.bitstream |= (code << s->bs.residue); + s->bs.residue += s->bits_per_sample; + if (s->bs.residue >= 8) + { + g726_data[g726_bytes++] = (uint8_t) (s->bs.bitstream & 0xFF); + s->bs.bitstream >>= 8; + s->bs.residue -= 8; + } + } + else + { + s->bs.bitstream = (s->bs.bitstream << s->bits_per_sample) | code; + s->bs.residue += s->bits_per_sample; + if (s->bs.residue >= 8) + { + g726_data[g726_bytes++] = (uint8_t) ((s->bs.bitstream >> (s->bs.residue - 8)) & 0xFF); + s->bs.residue -= 8; + } + } + } + else + { + g726_data[g726_bytes++] = (uint8_t) code; + } + } + return g726_bytes; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/gsm0610_decode.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/gsm0610_decode.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,354 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * gsm0610_decode.c - GSM 06.10 full rate speech codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * This code is based on the widely used GSM 06.10 code available from + * http://kbs.cs.tu-berlin.de/~jutta/toast.html + * + * $Id: gsm0610_decode.c,v 1.25 2009/02/03 16:28:39 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/bitstream.h" +#include "spandsp/saturated.h" +#include "spandsp/gsm0610.h" + +#include "gsm0610_local.h" + +/* 4.3 FIXED POINT IMPLEMENTATION OF THE RPE-LTP DECODER */ + +static void postprocessing(gsm0610_state_t *s, int16_t amp[]) +{ + int k; + int16_t msr; + int16_t tmp; + + msr = s->msr; + for (k = 0; k < GSM0610_FRAME_LEN; k++) + { + tmp = gsm_mult_r(msr, 28180); + /* De-emphasis */ + msr = saturated_add16(amp[k], tmp); + /* Truncation & upscaling */ + amp[k] = (int16_t) (saturated_add16(msr, msr) & 0xFFF8); + } + /*endfor*/ + s->msr = msr; +} +/*- End of function --------------------------------------------------------*/ + +static void decode_a_frame(gsm0610_state_t *s, + int16_t amp[GSM0610_FRAME_LEN], + gsm0610_frame_t *f) +{ + int j; + int k; + int16_t erp[40]; + int16_t wt[GSM0610_FRAME_LEN]; + int16_t *drp; + + drp = s->dp0 + 120; + for (j = 0; j < 4; j++) + { + gsm0610_rpe_decoding(s, f->xmaxc[j], f->Mc[j], f->xMc[j], erp); + gsm0610_long_term_synthesis_filtering(s, f->Nc[j], f->bc[j], erp, drp); + for (k = 0; k < 40; k++) + wt[j*40 + k] = drp[k]; + /*endfor*/ + } + /*endfor*/ + + gsm0610_short_term_synthesis_filter(s, f->LARc, wt, amp); + postprocessing(s, amp); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) gsm0610_unpack_none(gsm0610_frame_t *s, const uint8_t c[]) +{ + int i; + int j; + int k; + + i = 0; + for (j = 0; j < 8; j++) + s->LARc[j] = c[i++]; + for (j = 0; j < 4; j++) + { + s->Nc[j] = c[i++]; + s->bc[j] = c[i++]; + s->Mc[j] = c[i++]; + s->xmaxc[j] = c[i++]; + for (k = 0; k < 13; k++) + s->xMc[j][k] = c[i++]; + } + return 76; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) gsm0610_unpack_wav49(gsm0610_frame_t *s, const uint8_t c[]) +{ + uint16_t sr; + int i; + + sr = *c++; + s->LARc[0] = sr & 0x3F; + sr >>= 6; + sr |= (uint16_t) *c++ << 2; + s->LARc[1] = sr & 0x3F; + sr >>= 6; + sr |= (uint16_t) *c++ << 4; + s->LARc[2] = sr & 0x1F; + sr >>= 5; + s->LARc[3] = sr & 0x1F; + sr >>= 5; + sr |= (uint16_t) *c++ << 2; + s->LARc[4] = sr & 0xF; + sr >>= 4; + s->LARc[5] = sr & 0xF; + sr >>= 4; + sr |= (uint16_t) *c++ << 2; + s->LARc[6] = sr & 0x7; + sr >>= 3; + s->LARc[7] = sr & 0x7; + sr >>= 3; + + for (i = 0; i < 4; i++) + { + sr |= (uint16_t) *c++ << 4; + s->Nc[i] = sr & 0x7F; + sr >>= 7; + s->bc[i] = sr & 0x3; + sr >>= 2; + s->Mc[i] = sr & 0x3; + sr >>= 2; + sr |= (uint16_t) *c++ << 1; + s->xmaxc[i] = sr & 0x3F; + sr >>= 6; + s->xMc[i][0] = sr & 0x7; + sr >>= 3; + sr = *c++; + s->xMc[i][1] = sr & 0x7; + sr >>= 3; + s->xMc[i][2] = sr & 0x7; + sr >>= 3; + sr |= (uint16_t) *c++ << 2; + s->xMc[i][3] = sr & 0x7; + sr >>= 3; + s->xMc[i][4] = sr & 0x7; + sr >>= 3; + s->xMc[i][5] = sr & 0x7; + sr >>= 3; + sr |= (uint16_t) *c++ << 1; + s->xMc[i][6] = sr & 0x7; + sr >>= 3; + s->xMc[i][7] = sr & 0x7; + sr >>= 3; + s->xMc[i][8] = sr & 0x7; + sr >>= 3; + sr = *c++; + s->xMc[i][9] = sr & 0x7; + sr >>= 3; + s->xMc[i][10] = sr & 0x7; + sr >>= 3; + sr |= (uint16_t) *c++ << 2; + s->xMc[i][11] = sr & 0x7; + sr >>= 3; + s->xMc[i][12] = sr & 0x7; + sr >>= 3; + } + + s++; + sr |= (uint16_t) *c++ << 4; + s->LARc[0] = sr & 0x3F; + sr >>= 6; + s->LARc[1] = sr & 0x3F; + sr >>= 6; + sr = *c++; + s->LARc[2] = sr & 0x1F; + sr >>= 5; + sr |= (uint16_t) *c++ << 3; + s->LARc[3] = sr & 0x1F; + sr >>= 5; + s->LARc[4] = sr & 0xF; + sr >>= 4; + sr |= (uint16_t) *c++ << 2; + s->LARc[5] = sr & 0xF; + sr >>= 4; + s->LARc[6] = sr & 0x7; + sr >>= 3; + s->LARc[7] = sr & 0x7; + sr >>= 3; + + for (i = 0; i < 4; i++) + { + sr = *c++; + s->Nc[i] = sr & 0x7F; + sr >>= 7; + sr |= (uint16_t) *c++ << 1; + s->bc[i] = sr & 0x3; + sr >>= 2; + s->Mc[i] = sr & 0x3; + sr >>= 2; + sr |= (uint16_t) *c++ << 5; + s->xmaxc[i] = sr & 0x3F; + sr >>= 6; + s->xMc[i][0] = sr & 0x7; + sr >>= 3; + s->xMc[i][1] = sr & 0x7; + sr >>= 3; + sr |= (uint16_t) *c++ << 1; + s->xMc[i][2] = sr & 0x7; + sr >>= 3; + s->xMc[i][3] = sr & 0x7; + sr >>= 3; + s->xMc[i][4] = sr & 0x7; + sr >>= 3; + sr = *c++; + s->xMc[i][5] = sr & 0x7; + sr >>= 3; + s->xMc[i][6] = sr & 0x7; + sr >>= 3; + sr |= (uint16_t) *c++ << 2; + s->xMc[i][7] = sr & 0x7; + sr >>= 3; + s->xMc[i][8] = sr & 0x7; + sr >>= 3; + s->xMc[i][9] = sr & 0x7; + sr >>= 3; + sr |= (uint16_t) *c++ << 1; + s->xMc[i][10] = sr & 0x7; + sr >>= 3; + s->xMc[i][11] = sr & 0x7; + sr >>= 3; + s->xMc[i][12] = sr & 0x7; + sr >>= 3; + } + return 65; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) gsm0610_unpack_voip(gsm0610_frame_t *s, const uint8_t c[33]) +{ + int i; + + s->LARc[0] = (*c++ & 0xF) << 2; + s->LARc[0] |= (*c >> 6) & 0x3; + s->LARc[1] = *c++ & 0x3F; + s->LARc[2] = (*c >> 3) & 0x1F; + s->LARc[3] = (*c++ & 0x7) << 2; + s->LARc[3] |= (*c >> 6) & 0x3; + s->LARc[4] = (*c >> 2) & 0xF; + s->LARc[5] = (*c++ & 0x3) << 2; + s->LARc[5] |= (*c >> 6) & 0x3; + s->LARc[6] = (*c >> 3) & 0x7; + s->LARc[7] = *c++ & 0x7; + + for (i = 0; i < 4; i++) + { + s->Nc[i] = (*c >> 1) & 0x7F; + s->bc[i] = (*c++ & 0x1) << 1; + s->bc[i] |= (*c >> 7) & 0x1; + s->Mc[i] = (*c >> 5) & 0x3; + s->xmaxc[i] = (*c++ & 0x1F) << 1; + s->xmaxc[i] |= (*c >> 7) & 0x1; + s->xMc[i][0] = (*c >> 4) & 0x7; + s->xMc[i][1] = (*c >> 1) & 0x7; + s->xMc[i][2] = (*c++ & 0x1) << 2; + s->xMc[i][2] |= (*c >> 6) & 0x3; + s->xMc[i][3] = (*c >> 3) & 0x7; + s->xMc[i][4] = *c++ & 0x7; + s->xMc[i][5] = (*c >> 5) & 0x7; + s->xMc[i][6] = (*c >> 2) & 0x7; + s->xMc[i][7] = (*c++ & 0x3) << 1; + s->xMc[i][7] |= (*c >> 7) & 0x1; + s->xMc[i][8] = (*c >> 4) & 0x7; + s->xMc[i][9] = (*c >> 1) & 0x7; + s->xMc[i][10] = (*c++ & 0x1) << 2; + s->xMc[i][10] |= (*c >> 6) & 0x3; + s->xMc[i][11] = (*c >> 3) & 0x7; + s->xMc[i][12] = *c++ & 0x7; + } + return 33; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) gsm0610_decode(gsm0610_state_t *s, int16_t amp[], const uint8_t code[], int len) +{ + gsm0610_frame_t frame[2]; + int bytes; + int samples; + int i; + + samples = 0; + for (i = 0; i < len; i += bytes) + { + switch (s->packing) + { + default: + case GSM0610_PACKING_NONE: + if ((bytes = gsm0610_unpack_none(frame, &code[i])) < 0) + return 0; + decode_a_frame(s, &[samples], frame); + samples += GSM0610_FRAME_LEN; + break; + case GSM0610_PACKING_WAV49: + if ((bytes = gsm0610_unpack_wav49(frame, &code[i])) < 0) + return 0; + decode_a_frame(s, &[samples], frame); + samples += GSM0610_FRAME_LEN; + decode_a_frame(s, &[samples], frame + 1); + samples += GSM0610_FRAME_LEN; + break; + case GSM0610_PACKING_VOIP: + if ((bytes = gsm0610_unpack_voip(frame, &code[i])) < 0) + return 0; + decode_a_frame(s, &[samples], frame); + samples += GSM0610_FRAME_LEN; + break; + } + /*endswitch*/ + } + /*endfor*/ + return samples; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/gsm0610_encode.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/gsm0610_encode.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,342 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * gsm0610_encode.c - GSM 06.10 full rate speech codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * This code is based on the widely used GSM 06.10 code available from + * http://kbs.cs.tu-berlin.de/~jutta/toast.html + * + * $Id: gsm0610_encode.c,v 1.30 2009/02/10 13:06:46 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/bitstream.h" +#include "spandsp/saturated.h" +#include "spandsp/gsm0610.h" + +#include "gsm0610_local.h" + +/* 4.2 FIXED POINT IMPLEMENTATION OF THE RPE-LTP CODER */ + +/* The RPE-LTD coder works on a frame by frame basis. The length of + the frame is equal to 160 samples. Some computations are done + once per frame to produce at the output of the coder the + LARc[1..8] parameters which are the coded LAR coefficients and + also to realize the inverse filtering operation for the entire + frame (160 samples of signal d[0..159]). These parts produce at + the output of the coder: + + Procedure 4.2.11 to 4.2.18 are to be executed four times per + frame. That means once for each sub-segment RPE-LTP analysis of + 40 samples. These parts produce at the output of the coder. +*/ +static void encode_a_frame(gsm0610_state_t *s, gsm0610_frame_t *f, const int16_t amp[]) +{ + int k; + int16_t *dp; + int16_t *dpp; + int16_t so[GSM0610_FRAME_LEN]; + int i; + + dp = s->dp0 + 120; + dpp = dp; + gsm0610_preprocess(s, amp, so); + gsm0610_lpc_analysis(s, so, f->LARc); + gsm0610_short_term_analysis_filter(s, f->LARc, so); + + for (k = 0; k < 4; k++) + { + gsm0610_long_term_predictor(s, + so + k*40, + dp, + s->e + 5, + dpp, + &f->Nc[k], + &f->bc[k]); + gsm0610_rpe_encoding(s, s->e + 5, &f->xmaxc[k], &f->Mc[k], f->xMc[k]); + + for (i = 0; i < 40; i++) + dp[i] = saturated_add16(s->e[5 + i], dpp[i]); + /*endfor*/ + dp += 40; + dpp += 40; + } + /*endfor*/ + memcpy((char *) s->dp0, + (char *) (s->dp0 + GSM0610_FRAME_LEN), + 120*sizeof(*s->dp0)); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) gsm0610_set_packing(gsm0610_state_t *s, int packing) +{ + s->packing = packing; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(gsm0610_state_t *) gsm0610_init(gsm0610_state_t *s, int packing) +{ + if (s == NULL) + { + if ((s = (gsm0610_state_t *) malloc(sizeof (*s))) == NULL) + return NULL; + /*endif*/ + } + /*endif*/ + memset((char *) s, '\0', sizeof (gsm0610_state_t)); + s->nrp = 40; + s->packing = packing; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) gsm0610_release(gsm0610_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) gsm0610_free(gsm0610_state_t *s) +{ + if (s) + free(s); + /*endif*/ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) gsm0610_pack_none(uint8_t c[], const gsm0610_frame_t *s) +{ + int i; + int j; + int k; + + i = 0; + for (j = 0; j < 8; j++) + c[i++] = (uint8_t) s->LARc[j]; + for (j = 0; j < 4; j++) + { + c[i++] = (uint8_t) s->Nc[j]; + c[i++] = (uint8_t) s->bc[j]; + c[i++] = (uint8_t) s->Mc[j]; + c[i++] = (uint8_t) s->xmaxc[j]; + for (k = 0; k < 13; k++) + c[i++] = (uint8_t) s->xMc[j][k]; + } + /*endfor*/ + return 76; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) gsm0610_pack_wav49(uint8_t c[], const gsm0610_frame_t *s) +{ + uint16_t sr; + int i; + + sr = 0; + sr = (sr >> 6) | (s->LARc[0] << 10); + sr = (sr >> 6) | (s->LARc[1] << 10); + *c++ = (uint8_t) (sr >> 4); + sr = (sr >> 5) | (s->LARc[2] << 11); + *c++ = (uint8_t) (sr >> 7); + sr = (sr >> 5) | (s->LARc[3] << 11); + sr = (sr >> 4) | (s->LARc[4] << 12); + *c++ = (uint8_t) (sr >> 6); + sr = (sr >> 4) | (s->LARc[5] << 12); + sr = (sr >> 3) | (s->LARc[6] << 13); + *c++ = (uint8_t) (sr >> 7); + sr = (sr >> 3) | (s->LARc[7] << 13); + + for (i = 0; i < 4; i++) + { + sr = (sr >> 7) | (s->Nc[i] << 9); + *c++ = (uint8_t) (sr >> 5); + sr = (sr >> 2) | (s->bc[i] << 14); + sr = (sr >> 2) | (s->Mc[i] << 14); + sr = (sr >> 6) | (s->xmaxc[i] << 10); + *c++ = (uint8_t) (sr >> 3); + sr = (sr >> 3) | (s->xMc[i][0] << 13); + *c++ = (uint8_t) (sr >> 8); + sr = (sr >> 3) | (s->xMc[i][1] << 13); + sr = (sr >> 3) | (s->xMc[i][2] << 13); + sr = (sr >> 3) | (s->xMc[i][3] << 13); + *c++ = (uint8_t) (sr >> 7); + sr = (sr >> 3) | (s->xMc[i][4] << 13); + sr = (sr >> 3) | (s->xMc[i][5] << 13); + sr = (sr >> 3) | (s->xMc[i][6] << 13); + *c++ = (uint8_t) (sr >> 6); + sr = (sr >> 3) | (s->xMc[i][7] << 13); + sr = (sr >> 3) | (s->xMc[i][8] << 13); + *c++ = (uint8_t) (sr >> 8); + sr = (sr >> 3) | (s->xMc[i][9] << 13); + sr = (sr >> 3) | (s->xMc[i][10] << 13); + sr = (sr >> 3) | (s->xMc[i][11] << 13); + *c++ = (uint8_t) (sr >> 7); + sr = (sr >> 3) | (s->xMc[i][12] << 13); + } + /*endfor*/ + + s++; + sr = (sr >> 6) | (s->LARc[0] << 10); + *c++ = (uint8_t) (sr >> 6); + sr = (sr >> 6) | (s->LARc[1] << 10); + *c++ = (uint8_t) (sr >> 8); + sr = (sr >> 5) | (s->LARc[2] << 11); + sr = (sr >> 5) | (s->LARc[3] << 11); + *c++ = (uint8_t) (sr >> 6); + sr = (sr >> 4) | (s->LARc[4] << 12); + sr = (sr >> 4) | (s->LARc[5] << 12); + *c++ = (uint8_t) (sr >> 6); + sr = (sr >> 3) | (s->LARc[6] << 13); + sr = (sr >> 3) | (s->LARc[7] << 13); + *c++ = (uint8_t) (sr >> 8); + + for (i = 0; i < 4; i++) + { + sr = (sr >> 7) | (s->Nc[i] << 9); + sr = (sr >> 2) | (s->bc[i] << 14); + *c++ = (uint8_t) (sr >> 7); + sr = (sr >> 2) | (s->Mc[i] << 14); + sr = (sr >> 6) | (s->xmaxc[i] << 10); + *c++ = (uint8_t) (sr >> 7); + sr = (sr >> 3) | (s->xMc[i][0] << 13); + sr = (sr >> 3) | (s->xMc[i][1] << 13); + sr = (sr >> 3) | (s->xMc[i][2] << 13); + *c++ = (uint8_t) (sr >> 6); + sr = (sr >> 3) | (s->xMc[i][3] << 13); + sr = (sr >> 3) | (s->xMc[i][4] << 13); + *c++ = (uint8_t) (sr >> 8); + sr = (sr >> 3) | (s->xMc[i][5] << 13); + sr = (sr >> 3) | (s->xMc[i][6] << 13); + sr = (sr >> 3) | (s->xMc[i][7] << 13); + *c++ = (uint8_t) (sr >> 7); + sr = (sr >> 3) | (s->xMc[i][8] << 13); + sr = (sr >> 3) | (s->xMc[i][9] << 13); + sr = (sr >> 3) | (s->xMc[i][10] << 13); + *c++ = (uint8_t) (sr >> 6); + sr = (sr >> 3) | (s->xMc[i][11] << 13); + sr = (sr >> 3) | (s->xMc[i][12] << 13); + *c++ = (uint8_t) (sr >> 8); + } + /*endfor*/ + return 65; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) gsm0610_pack_voip(uint8_t c[33], const gsm0610_frame_t *s) +{ + int i; + + *c++ = (uint8_t) (((GSM0610_MAGIC & 0xF) << 4) + | ((s->LARc[0] >> 2) & 0xF)); + *c++ = (uint8_t) (((s->LARc[0] & 0x3) << 6) + | (s->LARc[1] & 0x3F)); + *c++ = (uint8_t) (((s->LARc[2] & 0x1F) << 3) + | ((s->LARc[3] >> 2) & 0x7)); + *c++ = (uint8_t) (((s->LARc[3] & 0x3) << 6) + | ((s->LARc[4] & 0xF) << 2) + | ((s->LARc[5] >> 2) & 0x3)); + *c++ = (uint8_t) (((s->LARc[5] & 0x3) << 6) + | ((s->LARc[6] & 0x7) << 3) + | (s->LARc[7] & 0x7)); + + for (i = 0; i < 4; i++) + { + *c++ = (uint8_t) (((s->Nc[i] & 0x7F) << 1) + | ((s->bc[i] >> 1) & 0x1)); + *c++ = (uint8_t) (((s->bc[i] & 0x1) << 7) + | ((s->Mc[i] & 0x3) << 5) + | ((s->xmaxc[i] >> 1) & 0x1F)); + *c++ = (uint8_t) (((s->xmaxc[i] & 0x1) << 7) + | ((s->xMc[i][0] & 0x7) << 4) + | ((s->xMc[i][1] & 0x7) << 1) + | ((s->xMc[i][2] >> 2) & 0x1)); + *c++ = (uint8_t) (((s->xMc[i][2] & 0x3) << 6) + | ((s->xMc[i][3] & 0x7) << 3) + | (s->xMc[i][4] & 0x7)); + *c++ = (uint8_t) (((s->xMc[i][5] & 0x7) << 5) + | ((s->xMc[i][6] & 0x7) << 2) + | ((s->xMc[i][7] >> 1) & 0x3)); + *c++ = (uint8_t) (((s->xMc[i][7] & 0x1) << 7) + | ((s->xMc[i][8] & 0x7) << 4) + | ((s->xMc[i][9] & 0x7) << 1) + | ((s->xMc[i][10] >> 2) & 0x1)); + *c++ = (uint8_t) (((s->xMc[i][10] & 0x3) << 6) + | ((s->xMc[i][11] & 0x7) << 3) + | (s->xMc[i][12] & 0x7)); + } + /*endfor*/ + return 33; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) gsm0610_encode(gsm0610_state_t *s, uint8_t code[], const int16_t amp[], int len) +{ + gsm0610_frame_t frame[2]; + int bytes; + int i; + + bytes = 0; + for (i = 0; i < len; i += GSM0610_FRAME_LEN) + { + encode_a_frame(s, frame, &[i]); + switch (s->packing) + { + case GSM0610_PACKING_WAV49: + i += GSM0610_FRAME_LEN; + encode_a_frame(s, frame + 1, &[i]); + bytes += gsm0610_pack_wav49(&code[bytes], frame); + break; + case GSM0610_PACKING_VOIP: + bytes += gsm0610_pack_voip(&code[bytes], frame); + break; + default: + bytes += gsm0610_pack_none(&code[bytes], frame); + break; + } + /*endswitch*/ + } + /*endfor*/ + return bytes; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/gsm0610_local.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/gsm0610_local.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,219 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * gsm0610_local.h - GSM 06.10 full rate speech codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * This code is based on the widely used GSM 06.10 code available from + * http://kbs.cs.tu-berlin.de/~jutta/toast.html + * + * $Id: gsm0610_local.h,v 1.15 2009/03/13 15:57:29 steveu Exp $ + */ + +#if !defined(_GSM0610_LOCAL_H_) +#define _GSM0610_LOCAL_H_ + +#define GSM0610_FRAME_LEN 160 + +#define GSM0610_MAGIC 0xD + +#include "spandsp/private/gsm0610.h" + +static __inline__ int16_t gsm_add(int16_t a, int16_t b) +{ +#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) + __asm__ __volatile__( + " addw %2,%0;\n" + " jno 0f;\n" + " movw $0x7fff,%0;\n" + " adcw $0,%0;\n" + "0:" + : "=&r" (a) + : "0" (a), "ir" (b) + : "cc" + ); + return a; +#else + int32_t sum; + + sum = (int32_t) a + (int32_t) b; + return saturate(sum); +#endif +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int32_t gsm_l_add(int32_t a, int32_t b) +{ +#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) + __asm__ __volatile__( + " addl %2,%0;\n" + " jno 0f;\n" + " movl $0x7fffffff,%0;\n" + " adcl $0,%0;\n" + "0:" + : "=&r" (a) + : "0" (a), "ir" (b) + : "cc" + ); + return a; +#else + uint32_t A; + + if (a < 0) + { + if (b >= 0) + return a + b; + /*endif*/ + A = (uint32_t) -(a + 1) + (uint32_t) -(b + 1); + return (A >= INT32_MAX) ? INT32_MIN : -(int32_t) A - 2; + } + /*endif*/ + if (b <= 0) + return a + b; + /*endif*/ + A = (uint32_t) a + (uint32_t) b; + return (A > INT32_MAX) ? INT32_MAX : A; +#endif +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int16_t gsm_sub(int16_t a, int16_t b) +{ + int32_t diff; + + diff = (int32_t) a - (int32_t) b; + return saturate(diff); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int16_t gsm_mult(int16_t a, int16_t b) +{ + if (a == INT16_MIN && b == INT16_MIN) + return INT16_MAX; + /*endif*/ + return (int16_t) (((int32_t) a * (int32_t) b) >> 15); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int32_t gsm_l_mult(int16_t a, int16_t b) +{ + assert (a != INT16_MIN || b != INT16_MIN); + return ((int32_t) a * (int32_t) b) << 1; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int16_t gsm_mult_r(int16_t a, int16_t b) +{ + int32_t prod; + + if (b == INT16_MIN && a == INT16_MIN) + return INT16_MAX; + /*endif*/ + prod = (int32_t) a * (int32_t) b + 16384; + prod >>= 15; + return (int16_t) (prod & 0xFFFF); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int16_t gsm_abs(int16_t a) +{ + return (a == INT16_MIN) ? INT16_MAX : (int16_t) abs(a); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int16_t gsm_asr(int16_t a, int n) +{ + if (n >= 16) + return (int16_t) (-(a < 0)); + /*endif*/ + if (n <= -16) + return 0; + /*endif*/ + if (n < 0) + return (int16_t) (a << -n); + /*endif*/ + return (int16_t) (a >> n); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int16_t gsm_asl(int16_t a, int n) +{ + if (n >= 16) + return 0; + /*endif*/ + if (n <= -16) + return (int16_t) (-(a < 0)); + /*endif*/ + if (n < 0) + return gsm_asr(a, -n); + /*endif*/ + return (int16_t) (a << n); +} +/*- End of function --------------------------------------------------------*/ + +extern void gsm0610_long_term_predictor(gsm0610_state_t *s, + int16_t d[40], + int16_t *dp, /* [-120..-1] d' IN */ + int16_t e[40], + int16_t dpp[40], + int16_t *Nc, + int16_t *bc); + +extern void gsm0610_lpc_analysis(gsm0610_state_t *s, + int16_t amp[160], + int16_t LARc[8]); + +extern void gsm0610_preprocess(gsm0610_state_t *s, + const int16_t amp[], + int16_t so[]); + +extern void gsm0610_short_term_analysis_filter(gsm0610_state_t *s, + int16_t LARc[8], + int16_t amp[160]); + +extern void gsm0610_long_term_synthesis_filtering(gsm0610_state_t *s, + int16_t Ncr, + int16_t bcr, + int16_t erp[40], + int16_t *drp); /* [-120..-1] IN, [0..40] OUT */ + +extern void gsm0610_rpe_decoding(gsm0610_state_t *s, + int16_t xmaxcr, + int16_t Mcr, + int16_t *xMcr, /* [0..12], 3 bits IN */ + int16_t erp[40]); + +extern void gsm0610_rpe_encoding(gsm0610_state_t *s, + int16_t *e, /* [-5..-1][0..39][40..44] IN/OUT */ + int16_t *xmaxc, + int16_t *Mc, + int16_t xMc[13]); + +extern void gsm0610_short_term_synthesis_filter(gsm0610_state_t *s, + int16_t LARcr[8], + int16_t drp[40], + int16_t amp[160]); + +extern int16_t gsm0610_norm(int32_t a); + +#endif + +/*- End of include ---------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/gsm0610_long_term.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/gsm0610_long_term.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,436 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * gsm0610_long_term.c - GSM 06.10 full rate speech codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * This code is based on the widely used GSM 06.10 code available from + * http://kbs.cs.tu-berlin.de/~jutta/toast.html + * + * $Id: gsm0610_long_term.c,v 1.24 2009/04/20 16:36:36 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/bitstream.h" +#include "spandsp/saturated.h" +#include "spandsp/gsm0610.h" + +#include "gsm0610_local.h" + +/* Table 4.3a Decision level of the LTP gain quantizer */ +static const int16_t gsm_DLB[4] = +{ + 6554, 16384, 26214, 32767 +}; + +/* Table 4.3b Quantization levels of the LTP gain quantizer */ +static const int16_t gsm_QLB[4] = +{ + 3277, 11469, 21299, 32767 +}; + +/* 4.2.11 .. 4.2.12 LONG TERM PREDICTOR (LTP) SECTION */ + +static int32_t gsm0610_max_cross_corr(const int16_t *wt, const int16_t *dp, int16_t *index_out) +{ + int32_t max; + int32_t index; + int32_t res; + int i; + + max = 0; + index = 40; /* index for the maximum cross-correlation */ + + for (i = 40; i <= 120; i++) + { +#if defined(__GNUC__) && defined(SPANDSP_USE_MMX) && defined(__x86_64__) + __asm__ __volatile__( + " emms;\n" + " .p2align 2;\n" + " movq (%%rdi),%%mm0;\n" + " movq (%%rsi),%%mm2;\n" + " pmaddwd %%mm2,%%mm0;\n" + " movq 8(%%rdi),%%mm1;\n" + " movq 8(%%rsi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 16(%%rdi),%%mm1;\n" + " movq 16(%%rsi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 24(%%rdi),%%mm1;\n" + " movq 24(%%rsi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 32(%%rdi),%%mm1;\n" + " movq 32(%%rsi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 40(%%rdi),%%mm1;\n" + " movq 40(%%rsi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 48(%%rdi),%%mm1;\n" + " movq 48(%%rsi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 56(%%rdi),%%mm1;\n" + " movq 56(%%rsi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 64(%%rdi),%%mm1;\n" + " movq 64(%%rsi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 72(%%rdi),%%mm1;\n" + " movq 72(%%rsi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq %%mm0,%%mm1;\n" + " punpckhdq %%mm0,%%mm1;\n" /* mm1 has high int32 of mm0 dup'd */ + " paddd %%mm1,%%mm0;\n" + " movd %%mm0,%[res];\n" + " emms;\n" + : [res] "=r" (res) + : "D" (wt), "S" (&dp[-i]) + ); +#elif defined(__GNUC__) && defined(SPANDSP_USE_MMX) && defined(__i386__) + __asm__ __volatile__( + " emms;\n" + " .p2align 2;\n" + " movq (%%edi),%%mm0;\n" + " movq (%%esi),%%mm2;\n" + " pmaddwd %%mm2,%%mm0;\n" + " movq 8(%%edi),%%mm1;\n" + " movq 8(%%esi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 16(%%edi),%%mm1;\n" + " movq 16(%%esi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 24(%%edi),%%mm1;\n" + " movq 24(%%esi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 32(%%edi),%%mm1;\n" + " movq 32(%%esi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 40(%%edi),%%mm1;\n" + " movq 40(%%esi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 48(%%edi),%%mm1;\n" + " movq 48(%%esi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 56(%%edi),%%mm1;\n" + " movq 56(%%esi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 64(%%edi),%%mm1;\n" + " movq 64(%%esi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 72(%%edi),%%mm1;\n" + " movq 72(%%esi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq %%mm0,%%mm1;\n" + " punpckhdq %%mm0,%%mm1;\n" /* mm1 has high int32 of mm0 dup'd */ + " paddd %%mm1,%%mm0;\n" + " movd %%mm0,%[res];\n" + " emms;\n" + : [res] "=r" (res) + : "D" (wt), "S" (&dp[-i]) + ); +#else + res = (wt[0]*dp[0 - i]) + + (wt[1]*dp[1 - i]) + + (wt[2]*dp[2 - i]) + + (wt[3]*dp[3 - i]) + + (wt[4]*dp[4 - i]) + + (wt[5]*dp[5 - i]) + + (wt[6]*dp[6 - i]) + + (wt[7]*dp[7 - i]) + + (wt[8]*dp[8 - i]) + + (wt[9]*dp[9 - i]) + + (wt[10]*dp[10 - i]) + + (wt[11]*dp[11 - i]) + + (wt[12]*dp[12 - i]) + + (wt[13]*dp[13 - i]) + + (wt[14]*dp[14 - i]) + + (wt[15]*dp[15 - i]) + + (wt[16]*dp[16 - i]) + + (wt[17]*dp[17 - i]) + + (wt[18]*dp[18 - i]) + + (wt[19]*dp[19 - i]) + + (wt[20]*dp[20 - i]) + + (wt[21]*dp[21 - i]) + + (wt[22]*dp[22 - i]) + + (wt[23]*dp[23 - i]) + + (wt[24]*dp[24 - i]) + + (wt[25]*dp[25 - i]) + + (wt[26]*dp[26 - i]) + + (wt[27]*dp[27 - i]) + + (wt[28]*dp[28 - i]) + + (wt[29]*dp[29 - i]) + + (wt[30]*dp[30 - i]) + + (wt[31]*dp[31 - i]) + + (wt[32]*dp[32 - i]) + + (wt[33]*dp[33 - i]) + + (wt[34]*dp[34 - i]) + + (wt[35]*dp[35 - i]) + + (wt[36]*dp[36 - i]) + + (wt[37]*dp[37 - i]) + + (wt[38]*dp[38 - i]) + + (wt[39]*dp[39 - i]); +#endif + if (res > max) + { + max = res; + index = i; + } + /*endif*/ + } + /*endfor*/ + *index_out = index; + return max; +} +/*- End of function --------------------------------------------------------*/ + +/* This procedure computes the LTP gain (bc) and the LTP lag (Nc) + for the long term analysis filter. This is done by calculating a + maximum of the cross-correlation function between the current + sub-segment short term residual signal d[0..39] (output of + the short term analysis filter; for simplification the index + of this array begins at 0 and ends at 39 for each sub-segment of the + RPE-LTP analysis) and the previous reconstructed short term + residual signal dp[ -120 .. -1 ]. A dynamic scaling must be + performed to avoid overflow. */ + +/* This procedure exists in three versions. First, the integer + version; then, the two floating point versions (as another + function), with or without scaling. */ + +static int16_t evaluate_ltp_parameters(int16_t d[40], + int16_t *dp, // [-120..-1] IN + int16_t *Nc_out) +{ + int k; + int16_t bc; + int16_t wt[40]; + int32_t L_max; + int32_t L_power; + int16_t R; + int16_t S; + int16_t dmax; + int16_t scale; + int16_t temp; + int32_t L_temp; + + /* Search of the optimum scaling of d[0..39]. */ + dmax = 0; + for (k = 0; k < 40; k++) + { + temp = d[k]; + temp = saturated_abs16(temp); + if (temp > dmax) + dmax = temp; + /*endif*/ + } + /*endfor*/ + + if (dmax == 0) + { + temp = 0; + } + else + { + assert(dmax > 0); + temp = gsm0610_norm((int32_t) dmax << 16); + } + /*endif*/ + + if (temp > 6) + scale = 0; + else + scale = (int16_t) (6 - temp); + /*endif*/ + assert(scale >= 0); + + /* Initialization of a working array wt */ + for (k = 0; k < 40; k++) + wt[k] = d[k] >> scale; + /*endfor*/ + + /* Search for the maximum cross-correlation and coding of the LTP lag */ + L_max = gsm0610_max_cross_corr(wt, dp, Nc_out); + L_max <<= 1; + + /* Rescaling of L_max */ + assert(scale <= 100 && scale >= -100); + L_max = L_max >> (6 - scale); + + assert(*Nc_out <= 120 && *Nc_out >= 40); + + /* Compute the power of the reconstructed short term residual signal dp[..] */ + L_power = 0; + for (k = 0; k < 40; k++) + { + L_temp = dp[k - *Nc_out] >> 3; + L_power += L_temp*L_temp; + } + /*endfor*/ + L_power <<= 1; /* from L_MULT */ + + /* Normalization of L_max and L_power */ + if (L_max <= 0) + return 0; + /*endif*/ + if (L_max >= L_power) + return 3; + /*endif*/ + temp = gsm0610_norm(L_power); + + R = (int16_t) ((L_max << temp) >> 16); + S = (int16_t) ((L_power << temp) >> 16); + + /* Coding of the LTP gain */ + + /* Table 4.3a must be used to obtain the level DLB[i] for the + quantization of the LTP gain b to get the coded version bc. */ + for (bc = 0; bc <= 2; bc++) + { + if (R <= saturated_mul16(S, gsm_DLB[bc])) + break; + /*endif*/ + } + /*endfor*/ + return bc; +} +/*- End of function --------------------------------------------------------*/ + +/* 4.2.12 */ +static void long_term_analysis_filtering(int16_t bc, + int16_t Nc, + int16_t *dp, // previous d [-120..-1] IN + int16_t d[40], + int16_t dpp[40], + int16_t e[40]) +{ + int k; + + /* In this part, we have to decode the bc parameter to compute + the samples of the estimate dpp[0..39]. The decoding of bc needs the + use of table 4.3b. The long term residual signal e[0..39] + is then calculated to be fed to the RPE encoding section. */ + for (k = 0; k < 40; k++) + { + dpp[k] = gsm_mult_r(gsm_QLB[bc], dp[k - Nc]); + e[k] = saturated_sub16(d[k], dpp[k]); + } + /*endfor*/ +} +/*- End of function --------------------------------------------------------*/ + +/* 4x for 160 samples */ +void gsm0610_long_term_predictor(gsm0610_state_t *s, + int16_t d[40], + int16_t *dp, // [-120..-1] d' IN + int16_t e[40], + int16_t dpp[40], + int16_t *Nc, + int16_t *bc) +{ +#if 0 + assert(d); + assert(dp); + assert(e); + assert(dpp); + assert(Nc); + assert(bc); +#endif + + *bc = evaluate_ltp_parameters(d, dp, Nc); + long_term_analysis_filtering(*bc, *Nc, dp, d, dpp, e); +} +/*- End of function --------------------------------------------------------*/ + +/* 4.3.2 */ +void gsm0610_long_term_synthesis_filtering(gsm0610_state_t *s, + int16_t Ncr, + int16_t bcr, + int16_t erp[40], + int16_t *drp) // [-120..-1] IN, [0..40] OUT +{ + int k; + int16_t brp; + int16_t drpp; + int16_t Nr; + + /* This procedure uses the bcr and Ncr parameters to realize the + long term synthesis filter. The decoding of bcr needs + table 4.3b. */ + + /* Check the limits of Nr. */ + Nr = (Ncr < 40 || Ncr > 120) ? s->nrp : Ncr; + s->nrp = Nr; + assert (Nr >= 40 && Nr <= 120); + + /* Decode the LTP gain, bcr */ + brp = gsm_QLB[bcr]; + + /* Compute the reconstructed short term residual signal, drp[0..39] */ + assert(brp != INT16_MIN); + for (k = 0; k < 40; k++) + { + drpp = gsm_mult_r(brp, drp[k - Nr]); + drp[k] = saturated_add16(erp[k], drpp); + } + /*endfor*/ + + /* Update the reconstructed short term residual signal, drp[-1..-120] */ + for (k = 0; k < 120; k++) + drp[k - 120] = drp[k - 80]; + /*endfor*/ +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/gsm0610_lpc.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/gsm0610_lpc.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,600 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * gsm0610_lpc.c - GSM 06.10 full rate speech codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * This code is based on the widely used GSM 06.10 code available from + * http://kbs.cs.tu-berlin.de/~jutta/toast.html + * + * $Id: gsm0610_lpc.c,v 1.29 2009/02/05 15:57:27 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/bitstream.h" +#include "spandsp/bit_operations.h" +#include "spandsp/saturated.h" +#include "spandsp/vector_int.h" +#include "spandsp/gsm0610.h" + +#include "gsm0610_local.h" + +/* 4.2.4 .. 4.2.7 LPC ANALYSIS SECTION */ + +/* The number of left shifts needed to normalize the 32 bit + variable x for positive values on the interval + with minimum of + minimum of 1073741824 (01000000000000000000000000000000) and + maximum of 2147483647 (01111111111111111111111111111111) + and for negative values on the interval with + minimum of -2147483648 (-10000000000000000000000000000000) and + maximum of -1073741824 ( -1000000000000000000000000000000). + + In order to normalize the result, the following + operation must be done: norm_var1 = x << gsm0610_norm(x); + + (That's 'ffs', only from the left, not the right..) +*/ + +int16_t gsm0610_norm(int32_t x) +{ + assert(x != 0); + + if (x < 0) + { + if (x <= -1073741824) + return 0; + /*endif*/ + x = ~x; + } + /*endif*/ + return (int16_t) (30 - top_bit(x)); +} +/*- End of function --------------------------------------------------------*/ + +/* + (From p. 46, end of section 4.2.5) + + NOTE: The following lines gives [sic] one correct implementation + of the div(num, denum) arithmetic operation. Compute div + which is the integer division of num by denom: with + denom >= num > 0 +*/ +static int16_t gsm_div(int16_t num, int16_t denom) +{ + int32_t num32; + int32_t denom32; + int16_t div; + int k; + + /* The parameter num sometimes becomes zero. + Although this is explicitly guarded against in 4.2.5, + we assume that the result should then be zero as well. */ + + assert(num >= 0 && denom >= num); + if (num == 0) + return 0; + /*endif*/ + num32 = num; + denom32 = denom; + div = 0; + k = 15; + while (k--) + { + div <<= 1; + num32 <<= 1; + + if (num32 >= denom32) + { + num32 -= denom32; + div++; + } + /*endif*/ + } + /*endwhile*/ + + return div; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(__GNUC__) && defined(SPANDSP_USE_MMX) +static void gsm0610_vec_vsraw(const int16_t *p, int n, int bits) +{ + static const int64_t ones = 0x0001000100010001LL; + + if (n == 0) + return; + /*endif*/ +#if defined(__x86_64__) + __asm__ __volatile__( + " leaq -16(%%rsi,%%rax,2),%%rdx;\n" /* edx = top - 16 */ + " emms;\n" + " movd %%ecx,%%mm3;\n" + " movq %[ones],%%mm2;\n" + " psllw %%mm3,%%mm2;\n" + " psrlw $1,%%mm2;\n" + " cmpq %%rdx,%%rsi;" + " ja 4f;\n" + + " .p2align 2;\n" + /* 8 words per iteration */ + "6:\n" + " movq (%%rsi),%%mm0;\n" + " movq 8(%%rsi),%%mm1;\n" + " paddsw %%mm2,%%mm0;\n" + " psraw %%mm3,%%mm0;\n" + " paddsw %%mm2,%%mm1;\n" + " psraw %%mm3,%%mm1;\n" + " movq %%mm0,(%%rsi);\n" + " movq %%mm1,8(%%rsi);\n" + " addq $16,%%rsi;\n" + " cmpq %%rdx,%%rsi;\n" + " jbe 6b;\n" + + " .p2align 2;\n" + "4:\n" + " addq $12,%%rdx;\n" /* now edx = top-4 */ + " cmpq %%rdx,%%rsi;\n" + " ja 3f;\n" + + " .p2align 2;\n" + /* do up to 6 words, two per iteration */ + "5:\n" + " movd (%%rsi),%%mm0;\n" + " paddsw %%mm2,%%mm0;\n" + " psraw %%mm3,%%mm0;\n" + " movd %%mm0,(%%rsi);\n" + " addq $4,%%rsi;\n" + " cmpq %%rdx,%%rsi;\n" + " jbe 5b;\n" + + " .p2align 2;\n" + "3:\n" + " addq $2,%%rdx;\n" /* now edx = top-2 */ + " cmpq %%rdx,%%rsi;\n" + " ja 2f;\n" + + " movzwl (%%rsi),%%eax;\n" + " movd %%eax,%%mm0;\n" + " paddsw %%mm2,%%mm0;\n" + " psraw %%mm3,%%mm0;\n" + " movd %%mm0,%%eax;\n" + " movw %%ax,(%%rsi);\n" + + " .p2align 2;\n" + "2:\n" + " emms;\n" + : + : "S" (p), "a" (n), "c" (bits), [ones] "m" (ones) + : "edx" + ); +#else + __asm__ __volatile__( + " leal -16(%%esi,%%eax,2),%%edx;\n" /* edx = top - 16 */ + " emms;\n" + " movd %%ecx,%%mm3;\n" + " movq %[ones],%%mm2;\n" + " psllw %%mm3,%%mm2;\n" + " psrlw $1,%%mm2;\n" + " cmpl %%edx,%%esi;" + " ja 4f;\n" + + " .p2align 2;\n" + /* 8 words per iteration */ + "6:\n" + " movq (%%esi),%%mm0;\n" + " movq 8(%%esi),%%mm1;\n" + " paddsw %%mm2,%%mm0;\n" + " psraw %%mm3,%%mm0;\n" + " paddsw %%mm2,%%mm1;\n" + " psraw %%mm3,%%mm1;\n" + " movq %%mm0,(%%esi);\n" + " movq %%mm1,8(%%esi);\n" + " addl $16,%%esi;\n" + " cmpl %%edx,%%esi;\n" + " jbe 6b;\n" + + " .p2align 2;\n" + "4:\n" + " addl $12,%%edx;\n" /* now edx = top-4 */ + " cmpl %%edx,%%esi;\n" + " ja 3f;\n" + + " .p2align 2;\n" + /* do up to 6 words, two per iteration */ + "5:\n" + " movd (%%esi),%%mm0;\n" + " paddsw %%mm2,%%mm0;\n" + " psraw %%mm3,%%mm0;\n" + " movd %%mm0,(%%esi);\n" + " addl $4,%%esi;\n" + " cmpl %%edx,%%esi;\n" + " jbe 5b;\n" + + " .p2align 2;\n" + "3:\n" + " addl $2,%%edx;\n" /* now edx = top-2 */ + " cmpl %%edx,%%esi;\n" + " ja 2f;\n" + + " movzwl (%%esi),%%eax;\n" + " movd %%eax,%%mm0;\n" + " paddsw %%mm2,%%mm0;\n" + " psraw %%mm3,%%mm0;\n" + " movd %%mm0,%%eax;\n" + " movw %%ax,(%%esi);\n" + + " .p2align 2;\n" + "2:\n" + " emms;\n" + : + : "S" (p), "a" (n), "c" (bits), [ones] "m" (ones) + : "edx" + ); +#endif +} +/*- End of function --------------------------------------------------------*/ +#endif + +/* 4.2.4 */ +static void autocorrelation(int16_t amp[GSM0610_FRAME_LEN], int32_t L_ACF[9]) +{ + int k; + int16_t smax; + int16_t scalauto; +#if !(defined(__GNUC__) && defined(SPANDSP_USE_MMX)) + int i; + int temp; + int16_t *sp; + int16_t sl; +#endif + + /* The goal is to compute the array L_ACF[k]. The signal s[i] must + be scaled in order to avoid an overflow situation. */ + + /* Dynamic scaling of the array s[0..159] */ + /* Search for the maximum. */ +#if defined(__GNUC__) && defined(SPANDSP_USE_MMX) + smax = saturate(vec_min_maxi16(amp, GSM0610_FRAME_LEN, NULL)); +#else + for (smax = 0, k = 0; k < GSM0610_FRAME_LEN; k++) + { + temp = saturated_abs16(amp[k]); + if (temp > smax) + smax = (int16_t) temp; + /*endif*/ + } + /*endfor*/ +#endif + + /* Computation of the scaling factor. */ + if (smax == 0) + { + scalauto = 0; + } + else + { + assert(smax > 0); + scalauto = (int16_t) (4 - gsm0610_norm((int32_t) smax << 16)); + } + /*endif*/ + + /* Scaling of the array s[0...159] */ +#if defined(__GNUC__) && defined(SPANDSP_USE_MMX) + if (scalauto > 0) + gsm0610_vec_vsraw(amp, GSM0610_FRAME_LEN, scalauto); + /*endif*/ +#else + if (scalauto > 0) + { + for (k = 0; k < GSM0610_FRAME_LEN; k++) + amp[k] = gsm_mult_r(amp[k], 16384 >> (scalauto - 1)); + /*endfor*/ + } + /*endif*/ +#endif + + /* Compute the L_ACF[..]. */ +#if defined(__GNUC__) && defined(SPANDSP_USE_MMX) + for (k = 0; k < 9; k++) + L_ACF[k] = vec_dot_prodi16(amp, amp + k, GSM0610_FRAME_LEN - k) << 1; + /*endfor*/ +#else + sp = amp; + sl = *sp; + L_ACF[0] = ((int32_t) sl*(int32_t) sp[0]); + sl = *++sp; + L_ACF[0] += ((int32_t) sl*(int32_t) sp[0]); + L_ACF[1] = ((int32_t) sl*(int32_t) sp[-1]); + sl = *++sp; + L_ACF[0] += ((int32_t) sl*(int32_t) sp[0]); + L_ACF[1] += ((int32_t) sl*(int32_t) sp[-1]); + L_ACF[2] = ((int32_t) sl*(int32_t) sp[-2]); + sl = *++sp; + L_ACF[0] += ((int32_t) sl*(int32_t) sp[0]); + L_ACF[1] += ((int32_t) sl*(int32_t) sp[-1]); + L_ACF[2] += ((int32_t) sl*(int32_t) sp[-2]); + L_ACF[3] = ((int32_t) sl*(int32_t) sp[-3]); + sl = *++sp; + L_ACF[0] += ((int32_t) sl*(int32_t) sp[0]); + L_ACF[1] += ((int32_t) sl*(int32_t) sp[-1]); + L_ACF[2] += ((int32_t) sl*(int32_t) sp[-2]); + L_ACF[3] += ((int32_t) sl*(int32_t) sp[-3]); + L_ACF[4] = ((int32_t) sl*(int32_t) sp[-4]); + sl = *++sp; + L_ACF[0] += ((int32_t) sl*(int32_t) sp[0]); + L_ACF[1] += ((int32_t) sl*(int32_t) sp[-1]); + L_ACF[2] += ((int32_t) sl*(int32_t) sp[-2]); + L_ACF[3] += ((int32_t) sl*(int32_t) sp[-3]); + L_ACF[4] += ((int32_t) sl*(int32_t) sp[-4]); + L_ACF[5] = ((int32_t) sl*(int32_t) sp[-5]); + sl = *++sp; + L_ACF[0] += ((int32_t) sl*(int32_t) sp[0]); + L_ACF[1] += ((int32_t) sl*(int32_t) sp[-1]); + L_ACF[2] += ((int32_t) sl*(int32_t) sp[-2]); + L_ACF[3] += ((int32_t) sl*(int32_t) sp[-3]); + L_ACF[4] += ((int32_t) sl*(int32_t) sp[-4]); + L_ACF[5] += ((int32_t) sl*(int32_t) sp[-5]); + L_ACF[6] = ((int32_t) sl*(int32_t) sp[-6]); + sl = *++sp; + L_ACF[0] += ((int32_t) sl*(int32_t) sp[0]); + L_ACF[1] += ((int32_t) sl*(int32_t) sp[-1]); + L_ACF[2] += ((int32_t) sl*(int32_t) sp[-2]); + L_ACF[3] += ((int32_t) sl*(int32_t) sp[-3]); + L_ACF[4] += ((int32_t) sl*(int32_t) sp[-4]); + L_ACF[5] += ((int32_t) sl*(int32_t) sp[-5]); + L_ACF[6] += ((int32_t) sl*(int32_t) sp[-6]); + L_ACF[7] = ((int32_t) sl*(int32_t) sp[-7]); + sl = *++sp; + L_ACF[0] += ((int32_t) sl*(int32_t) sp[0]); + L_ACF[1] += ((int32_t) sl*(int32_t) sp[-1]); + L_ACF[2] += ((int32_t) sl*(int32_t) sp[-2]); + L_ACF[3] += ((int32_t) sl*(int32_t) sp[-3]); + L_ACF[4] += ((int32_t) sl*(int32_t) sp[-4]); + L_ACF[5] += ((int32_t) sl*(int32_t) sp[-5]); + L_ACF[6] += ((int32_t) sl*(int32_t) sp[-6]); + L_ACF[7] += ((int32_t) sl*(int32_t) sp[-7]); + L_ACF[8] = ((int32_t) sl*(int32_t) sp[-8]); + for (i = 9; i < GSM0610_FRAME_LEN; i++) + { + sl = *++sp; + L_ACF[0] += ((int32_t) sl*(int32_t) sp[0]); + L_ACF[1] += ((int32_t) sl*(int32_t) sp[-1]); + L_ACF[2] += ((int32_t) sl*(int32_t) sp[-2]); + L_ACF[3] += ((int32_t) sl*(int32_t) sp[-3]); + L_ACF[4] += ((int32_t) sl*(int32_t) sp[-4]); + L_ACF[5] += ((int32_t) sl*(int32_t) sp[-5]); + L_ACF[6] += ((int32_t) sl*(int32_t) sp[-6]); + L_ACF[7] += ((int32_t) sl*(int32_t) sp[-7]); + L_ACF[8] += ((int32_t) sl*(int32_t) sp[-8]); + } + /*endfor*/ + for (k = 0; k < 9; k++) + L_ACF[k] <<= 1; + /*endfor*/ +#endif + /* Rescaling of the array s[0..159] */ + if (scalauto > 0) + { + assert(scalauto <= 4); + for (k = 0; k < GSM0610_FRAME_LEN; k++) + amp[k] <<= scalauto; + /*endfor*/ + } + /*endif*/ +} +/*- End of function --------------------------------------------------------*/ + +/* 4.2.5 */ +static void reflection_coefficients(int32_t L_ACF[9], int16_t r[8]) +{ + int i; + int m; + int n; + int16_t temp; + int16_t ACF[9]; + int16_t P[9]; + int16_t K[9]; + + /* Schur recursion with 16 bits arithmetic. */ + if (L_ACF[0] == 0) + { + for (i = 8; i--; *r++ = 0) + ; + /*endfor*/ + return; + } + /*endif*/ + + assert(L_ACF[0] != 0); + temp = gsm0610_norm(L_ACF[0]); + + assert(temp >= 0 && temp < 32); + + /* ? overflow ? */ + for (i = 0; i <= 8; i++) + ACF[i] = (int16_t) ((L_ACF[i] << temp) >> 16); + /*endfor*/ + + /* Initialize array P[..] and K[..] for the recursion. */ + for (i = 1; i <= 7; i++) + K[i] = ACF[i]; + /*endfor*/ + for (i = 0; i <= 8; i++) + P[i] = ACF[i]; + /*endfor*/ + /* Compute reflection coefficients */ + for (n = 1; n <= 8; n++, r++) + { + temp = P[1]; + temp = saturated_abs16(temp); + if (P[0] < temp) + { + for (i = n; i <= 8; i++) + *r++ = 0; + /*endfor*/ + return; + } + /*endif*/ + + *r = gsm_div(temp, P[0]); + + assert(*r >= 0); + if (P[1] > 0) + *r = -*r; /* r[n] = sub(0, r[n]) */ + /*endif*/ + assert(*r != INT16_MIN); + if (n == 8) + return; + /*endif*/ + + /* Schur recursion */ + temp = gsm_mult_r(P[1], *r); + P[0] = saturated_add16(P[0], temp); + + for (m = 1; m <= 8 - n; m++) + { + temp = gsm_mult_r(K[m], *r); + P[m] = saturated_add16(P[m + 1], temp); + + temp = gsm_mult_r(P[m + 1], *r); + K[m] = saturated_add16(K[m], temp); + } + /*endfor*/ + } + /*endfor*/ +} +/*- End of function --------------------------------------------------------*/ + +/* 4.2.6 */ +static void transform_to_log_area_ratios(int16_t r[8]) +{ + int16_t temp; + int i; + + /* The following scaling for r[..] and LAR[..] has been used: + + r[..] = integer (real_r[..]*32768.); -1 <= real_r < 1. + LAR[..] = integer (real_LAR[..] * 16384); + with -1.625 <= real_LAR <= 1.625 + */ + + /* Computation of the LAR[0..7] from the r[0..7] */ + for (i = 1; i <= 8; i++, r++) + { + temp = saturated_abs16(*r); + assert(temp >= 0); + + if (temp < 22118) + { + temp >>= 1; + } + else if (temp < 31130) + { + assert(temp >= 11059); + temp -= 11059; + } + else + { + assert(temp >= 26112); + temp -= 26112; + temp <<= 2; + } + /*endif*/ + + *r = (*r < 0) ? -temp : temp; + assert(*r != INT16_MIN); + } + /*endfor*/ +} +/*- End of function --------------------------------------------------------*/ + +/* 4.2.7 */ +static void quantization_and_coding(int16_t LAR[8]) +{ + int16_t temp; + + /* This procedure needs four tables; the following equations + give the optimum scaling for the constants: + + A[0..7] = integer(real_A[0..7] * 1024) + B[0..7] = integer(real_B[0..7] * 512) + MAC[0..7] = maximum of the LARc[0..7] + MIC[0..7] = minimum of the LARc[0..7] */ + +#undef STEP +#define STEP(A,B,MAC,MIC) \ + temp = saturated_mul16(A, *LAR); \ + temp = saturated_add16(temp, B); \ + temp = saturated_add16(temp, 256); \ + temp >>= 9; \ + *LAR = (int16_t) ((temp > MAC) \ + ? \ + MAC - MIC \ + : \ + ((temp < MIC) ? 0 : temp - MIC)); \ + LAR++; + + STEP(20480, 0, 31, -32); + STEP(20480, 0, 31, -32); + STEP(20480, 2048, 15, -16); + STEP(20480, -2560, 15, -16); + + STEP(13964, 94, 7, -8); + STEP(15360, -1792, 7, -8); + STEP( 8534, -341, 3, -4); + STEP( 9036, -1144, 3, -4); +#undef STEP +} +/*- End of function --------------------------------------------------------*/ + +void gsm0610_lpc_analysis(gsm0610_state_t *s, + int16_t amp[GSM0610_FRAME_LEN], + int16_t LARc[8]) +{ + int32_t L_ACF[9]; + + autocorrelation(amp, L_ACF); + reflection_coefficients(L_ACF, LARc); + transform_to_log_area_ratios(LARc); + quantization_and_coding(LARc); +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/gsm0610_preprocess.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/gsm0610_preprocess.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,151 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * gsm0610_preprocess.c - GSM 06.10 full rate speech codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * This code is based on the widely used GSM 06.10 code available from + * http://kbs.cs.tu-berlin.de/~jutta/toast.html + * + * $Id: gsm0610_preprocess.c,v 1.17 2009/02/03 16:28:39 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/bitstream.h" +#include "spandsp/saturated.h" +#include "spandsp/gsm0610.h" + +#include "gsm0610_local.h" + +/* + 4.2.0 .. 4.2.3 PREPROCESSING SECTION + + After A-law to linear conversion (or directly from the + A to D converter) the following scaling is assumed for + input to the RPE-LTP algorithm: + + in: 0.1.....................12 + S.v.v.v.v.v.v.v.v.v.v.v.v.*.*.* + + Where S is the sign bit, v a valid bit, and * a "don't care" bit. + The original signal is called sop[..] + + out: 0.1................... 12 + S.S.v.v.v.v.v.v.v.v.v.v.v.v.0.0 +*/ + +void gsm0610_preprocess(gsm0610_state_t *s, const int16_t amp[GSM0610_FRAME_LEN], int16_t so[GSM0610_FRAME_LEN]) +{ + int16_t z1; + int16_t mp; + int16_t s1; + int16_t msp; + int16_t SO; + int32_t L_z2; + int32_t L_s2; + int32_t L_temp; +#if !defined(__GNUC__) + int16_t lsp; +#endif + int k; + + z1 = s->z1; + L_z2 = s->L_z2; + mp = s->mp; + for (k = 0; k < GSM0610_FRAME_LEN; k++) + { + /* 4.2.1 Downscaling of the input signal */ + SO = (amp[k] >> 1) & ~3; + + assert(SO >= -0x4000); // downscaled by + assert(SO <= 0x3FFC); // previous routine. + + /* 4.2.2 Offset compensation */ + + /* This part implements a high-pass filter and requires extended + arithmetic precision for the recursive part of this filter. + The input of this procedure is the array so[0...159] and the + output the array sof[ 0...159 ]. + */ + /* Compute the non-recursive part */ + s1 = SO - z1; + z1 = SO; + + assert(s1 != INT16_MIN); + + /* Compute the recursive part */ + L_s2 = s1; + L_s2 <<= 15; + + /* Perform a 31 by 16 bits multiplication */ +#if defined(__GNUC__) + L_z2 = ((int64_t) L_z2*32735 + 0x4000) >> 15; + /* Alternate (ANSI) version of below line does slightly different rounding: + * L_temp = L_z2 >> 9; + * L_temp += L_temp >> 5; + * L_temp = (++L_temp) >> 1; + * L_z2 = L_z2 - L_temp; + */ + L_z2 = saturated_add32(L_z2, L_s2); +#else + /* This does L_z2 = L_z2 * 0x7FD5/0x8000 + L_s2 */ + msp = (int16_t) (L_z2 >> 15); + lsp = (int16_t) (L_z2 - ((int32_t) msp << 15)); + + L_s2 += gsm_mult_r(lsp, 32735); + L_temp = (int32_t) msp*32735; + L_z2 = saturated_add32(L_temp, L_s2); +#endif + + /* Compute sof[k] with rounding */ + L_temp = saturated_add32(L_z2, 16384); + + /* 4.2.3 Preemphasis */ + msp = gsm_mult_r(mp, -28180); + mp = (int16_t) (L_temp >> 15); + so[k] = saturated_add16(mp, msp); + } + /*endfor*/ + + s->z1 = z1; + s->L_z2 = L_z2; + s->mp = mp; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/gsm0610_rpe.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/gsm0610_rpe.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,600 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * gsm0610_rpe.c - GSM 06.10 full rate speech codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * This code is based on the widely used GSM 06.10 code available from + * http://kbs.cs.tu-berlin.de/~jutta/toast.html + * + * $Id: gsm0610_rpe.c,v 1.25.4.2 2009/12/28 11:54:58 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include + +#include "mmx_sse_decs.h" + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/bitstream.h" +#include "spandsp/saturated.h" +#include "spandsp/gsm0610.h" + +#include "gsm0610_local.h" + +/* 4.2.13 .. 4.2.17 RPE ENCODING SECTION */ + +/* 4.2.13 */ +static void weighting_filter(int16_t x[40], + const int16_t *e) // signal [-5..0.39.44] IN) +{ +#if defined(__GNUC__) && defined(SPANDSP_USE_MMX) && defined(__x86_64__) + /* Table 4.4 Coefficients of the weighting filter */ + /* This must be padded to a multiple of 4 for MMX to work */ + static const union + { + int16_t gsm_H[12]; + __m64 x[3]; + } gsm_H = + { + { + -134, -374, 0, 2054, 5741, 8192, 5741, 2054, 0, -374, -134, 0 + } + + }; + + __asm__ __volatile__( + " emms;\n" + " addq $-10,%%rcx;\n" + " leaq %[gsm_H],%%rax;\n" + " movq (%%rax),%%mm1;\n" + " movq 8(%%rax),%%mm2;\n" + " movq 16(%%rax),%%mm3;\n" + " movq $0x1000,%%rax;\n" + " movq %%rax,%%mm5;\n" /* For rounding */ + " xorq %%rsi,%%rsi;\n" + " .p2align 2;\n" + "1:\n" + " movq (%%rcx,%%rsi,2),%%mm0;\n" + " pmaddwd %%mm1,%%mm0;\n" + + " movq 8(%%rcx,%%rsi,2),%%mm4;\n" + " pmaddwd %%mm2,%%mm4;\n" + " paddd %%mm4,%%mm0;\n" + + " movq 16(%%rcx,%%rsi,2),%%mm4;\n" + " pmaddwd %%mm3,%%mm4;\n" + " paddd %%mm4,%%mm0;\n" + + " movq %%mm0,%%mm4;\n" + " punpckhdq %%mm0,%%mm4;\n" /* mm4 has high int32 of mm0 dup'd */ + " paddd %%mm4,%%mm0;\n" + + " paddd %%mm5,%%mm0;\n" /* Add for roundoff */ + " psrad $13,%%mm0;\n" + " packssdw %%mm0,%%mm0;\n" + " movd %%mm0,%%eax;\n" /* eax has result */ + " movw %%ax,(%%rdi,%%rsi,2);\n" + " incq %%rsi;\n" + " cmpq $39,%%rsi;\n" + " jle 1b;\n" + " emms;\n" + : + : "c" (e), "D" (x), [gsm_H] "X" (gsm_H) + : "rax", "rdx", "rsi", "memory" + ); +#elif defined(__GNUC__) && defined(SPANDSP_USE_MMX) && defined(__i386__) + /* Table 4.4 Coefficients of the weighting filter */ + /* This must be padded to a multiple of 4 for MMX to work */ + static const union + { + int16_t gsm_H[12]; + __m64 x[3]; + } gsm_H = + { + { + -134, -374, 0, 2054, 5741, 8192, 5741, 2054, 0, -374, -134, 0 + } + + }; + + __asm__ __volatile__( + " emms;\n" + " addl $-10,%%ecx;\n" + " leal %[gsm_H],%%eax;\n" + " movq (%%eax),%%mm1;\n" + " movq 8(%%eax),%%mm2;\n" + " movq 16(%%eax),%%mm3;\n" + " movl $0x1000,%%eax;\n" + " movd %%eax,%%mm5;\n" /* For rounding */ + " xorl %%esi,%%esi;\n" + " .p2align 2;\n" + "1:\n" + " movq (%%ecx,%%esi,2),%%mm0;\n" + " pmaddwd %%mm1,%%mm0;\n" + + " movq 8(%%ecx,%%esi,2),%%mm4;\n" + " pmaddwd %%mm2,%%mm4;\n" + " paddd %%mm4,%%mm0;\n" + + " movq 16(%%ecx,%%esi,2),%%mm4;\n" + " pmaddwd %%mm3,%%mm4;\n" + " paddd %%mm4,%%mm0;\n" + + " movq %%mm0,%%mm4;\n" + " punpckhdq %%mm0,%%mm4;\n" /* mm4 has high int32 of mm0 dup'd */ + " paddd %%mm4,%%mm0;\n" + + " paddd %%mm5,%%mm0;\n" /* Add for roundoff */ + " psrad $13,%%mm0;\n" + " packssdw %%mm0,%%mm0;\n" + " movd %%mm0,%%eax;\n" /* eax has result */ + " movw %%ax,(%%edi,%%esi,2);\n" + " incl %%esi;\n" + " cmpl $39,%%esi;\n" + " jle 1b;\n" + " emms;\n" + : + : "c" (e), "D" (x), [gsm_H] "X" (gsm_H) + : "eax", "edx", "esi", "memory" + ); +#else + int32_t L_result; + int k; + + /* The coefficients of the weighting filter are stored in a table + (see table 4.4). The following scaling is used: + + H[0..10] = integer(real_H[0..10] * 8192); + */ + /* Initialization of a temporary working array wt[0...49] */ + + /* for (k = 0; k <= 4; k++) wt[k] = 0; + * for (k = 5; k <= 44; k++) wt[k] = *e++; + * for (k = 45; k <= 49; k++) wt[k] = 0; + * + * (e[-5..-1] and e[40..44] are allocated by the caller, + * are initially zero and are not written anywhere.) + */ + e -= 5; + + /* Compute the signal x[0..39] */ + for (k = 0; k < 40; k++) + { + L_result = 8192 >> 1; + + /* for (i = 0; i <= 10; i++) + * { + * L_temp = saturated_mul_16_32(wt[k + i], gsm_H[i]); + * L_result = saturated_add32(L_result, L_temp); + * } + */ + +#undef STEP +#define STEP(i,H) (e[k + i] * (int32_t) H) + + /* Every one of these multiplications is done twice, + but I don't see an elegant way to optimize this. + Do you? + */ + L_result += STEP( 0, -134); + L_result += STEP( 1, -374); + /* += STEP( 2, 0 ); */ + L_result += STEP( 3, 2054); + L_result += STEP( 4, 5741); + L_result += STEP( 5, 8192); + L_result += STEP( 6, 5741); + L_result += STEP( 7, 2054); + /* += STEP( 8, 0 ); */ + L_result += STEP( 9, -374); + L_result += STEP(10, -134); + + /* 2 adds vs. >> 16 => 14, minus one shift to compensate for + those we lost when replacing L_MULT by '*'. */ + L_result >>= 13; + x[k] = saturate(L_result); + } + /*endfor*/ +#endif +} +/*- End of function --------------------------------------------------------*/ + +/* 4.2.14 */ +static void rpe_grid_selection(int16_t x[40], int16_t xM[13], int16_t *Mc_out) +{ + int i; + int32_t L_result; + int32_t L_temp; + int32_t EM; /* xxx should be L_EM? */ + int16_t Mc; + int32_t L_common_0_3; + + /* The signal x[0..39] is used to select the RPE grid which is + represented by Mc. */ + + EM = 0; + Mc = 0; + +#undef STEP +#define STEP(m,i) \ + L_temp = x[m + 3*i] >> 2; \ + L_result += L_temp*L_temp; + + /* Common part of 0 and 3 */ + L_result = 0; + STEP(0, 1); + STEP(0, 2); + STEP(0, 3); + STEP(0, 4); + STEP(0, 5); + STEP(0, 6); + STEP(0, 7); + STEP(0, 8); + STEP(0, 9); + STEP(0, 10); + STEP(0, 11); + STEP(0, 12); + L_common_0_3 = L_result; + + /* i = 0 */ + + STEP(0, 0); + L_result <<= 1; /* implicit in L_MULT */ + EM = L_result; + + /* i = 1 */ + + L_result = 0; + STEP(1, 0); + STEP(1, 1); + STEP(1, 2); + STEP(1, 3); + STEP(1, 4); + STEP(1, 5); + STEP(1, 6); + STEP(1, 7); + STEP(1, 8); + STEP(1, 9); + STEP(1, 10); + STEP(1, 11); + STEP(1, 12); + L_result <<= 1; + if (L_result > EM) + { + Mc = 1; + EM = L_result; + } + /*endif*/ + + /* i = 2 */ + + L_result = 0; + STEP(2, 0); + STEP(2, 1); + STEP(2, 2); + STEP(2, 3); + STEP(2, 4); + STEP(2, 5); + STEP(2, 6); + STEP(2, 7); + STEP(2, 8); + STEP(2, 9); + STEP(2, 10); + STEP(2, 11); + STEP(2, 12); + L_result <<= 1; + if (L_result > EM) + { + Mc = 2; + EM = L_result; + } + /*endif*/ + + /* i = 3 */ + + L_result = L_common_0_3; + STEP(3, 12); + L_result <<= 1; + if (L_result > EM) + { + Mc = 3; + EM = L_result; + } + /*endif*/ + + /* Down-sampling by a factor 3 to get the selected xM[0..12] + RPE sequence. */ + for (i = 0; i < 13; i++) + xM[i] = x[Mc + 3*i]; + /*endfor*/ + *Mc_out = Mc; +} +/*- End of function --------------------------------------------------------*/ + +/* 4.12.15 */ +static void apcm_quantization_xmaxc_to_exp_mant(int16_t xmaxc, + int16_t *exp_out, + int16_t *mant_out) +{ + int16_t exp; + int16_t mant; + + /* Compute exponent and mantissa of the decoded version of xmaxc */ + exp = 0; + if (xmaxc > 15) + exp = (int16_t) ((xmaxc >> 3) - 1); + /*endif*/ + mant = xmaxc - (exp << 3); + + if (mant == 0) + { + exp = -4; + mant = 7; + } + else + { + while (mant <= 7) + { + mant = (int16_t) (mant << 1 | 1); + exp--; + } + /*endwhile*/ + mant -= 8; + } + /*endif*/ + + assert(exp >= -4 && exp <= 6); + assert(mant >= 0 && mant <= 7); + + *exp_out = exp; + *mant_out = mant; +} +/*- End of function --------------------------------------------------------*/ + +static void apcm_quantization(int16_t xM[13], + int16_t xMc[13], + int16_t *mant_out, + int16_t *exp_out, + int16_t *xmaxc_out) +{ + /* Table 4.5 Normalized inverse mantissa used to compute xM/xmax */ + static const int16_t gsm_NRFAC[8] = + { + 29128, 26215, 23832, 21846, 20165, 18725, 17476, 16384 + }; + int i; + int itest; + int16_t xmax; + int16_t xmaxc; + int16_t temp; + int16_t temp1; + int16_t temp2; + int16_t exp; + int16_t mant; + + /* Find the maximum absolute value xmax of xM[0..12]. */ + xmax = 0; + for (i = 0; i < 13; i++) + { + temp = xM[i]; + temp = saturated_abs16(temp); + if (temp > xmax) + xmax = temp; + /*endif*/ + } + /*endfor*/ + + /* Quantizing and coding of xmax to get xmaxc. */ + exp = 0; + temp = xmax >> 9; + itest = 0; + + for (i = 0; i <= 5; i++) + { + itest |= (temp <= 0); + temp >>= 1; + + assert(exp <= 5); + if (itest == 0) + exp++; + /*endif*/ + } + /*endfor*/ + + assert(exp <= 6 && exp >= 0); + temp = (int16_t) (exp + 5); + + assert(temp <= 11 && temp >= 0); + xmaxc = saturated_add16((xmax >> temp), exp << 3); + + /* Quantizing and coding of the xM[0..12] RPE sequence + to get the xMc[0..12] */ + apcm_quantization_xmaxc_to_exp_mant(xmaxc, &exp, &mant); + + /* This computation uses the fact that the decoded version of xmaxc + can be calculated by using the exponent and the mantissa part of + xmaxc (logarithmic table). + So, this method avoids any division and uses only a scaling + of the RPE samples by a function of the exponent. A direct + multiplication by the inverse of the mantissa (NRFAC[0..7] + found in table 4.5) gives the 3 bit coded version xMc[0..12] + of the RPE samples. + */ + /* Direct computation of xMc[0..12] using table 4.5 */ + assert(exp <= 4096 && exp >= -4096); + assert(mant >= 0 && mant <= 7); + + temp1 = (int16_t) (6 - exp); /* Normalization by the exponent */ + temp2 = gsm_NRFAC[mant]; /* Inverse mantissa */ + + for (i = 0; i < 13; i++) + { + assert(temp1 >= 0 && temp1 < 16); + + temp = xM[i] << temp1; + temp = saturated_mul16(temp, temp2); + temp >>= 12; + xMc[i] = (int16_t) (temp + 4); /* See note below */ + } + /*endfor*/ + + /* NOTE: This equation is used to make all the xMc[i] positive. */ + *mant_out = mant; + *exp_out = exp; + *xmaxc_out = xmaxc; +} +/*- End of function --------------------------------------------------------*/ + +/* 4.2.16 */ +static void apcm_inverse_quantization(int16_t xMc[13], + int16_t mant, + int16_t exp, + int16_t xMp[13]) +{ + /* Table 4.6 Normalized direct mantissa used to compute xM/xmax */ + static const int16_t gsm_FAC[8] = + { + 18431, 20479, 22527, 24575, 26623, 28671, 30719, 32767 + }; + int i; + int16_t temp; + int16_t temp1; + int16_t temp2; + int16_t temp3; + + /* This part is for decoding the RPE sequence of coded xMc[0..12] + samples to obtain the xMp[0..12] array. Table 4.6 is used to get + the mantissa of xmaxc (FAC[0..7]). + */ +#if 0 + assert(mant >= 0 && mant <= 7); +#endif + + temp1 = gsm_FAC[mant]; /* See 4.2-15 for mant */ + temp2 = saturated_sub16(6, exp); /* See 4.2-15 for exp */ + temp3 = gsm_asl(1, saturated_sub16(temp2, 1)); + + for (i = 0; i < 13; i++) + { + assert(xMc[i] >= 0 && xMc[i] <= 7); /* 3 bit unsigned */ + + temp = (int16_t) ((xMc[i] << 1) - 7); /* Restore sign */ + assert(temp <= 7 && temp >= -7); /* 4 bit signed */ + + temp <<= 12; /* 16 bit signed */ + temp = gsm_mult_r(temp1, temp); + temp = saturated_add16(temp, temp3); + xMp[i] = gsm_asr(temp, temp2); + } + /*endfor*/ +} +/*- End of function --------------------------------------------------------*/ + +/* 4.2.17 */ +static void rpe_grid_positioning(int16_t Mc, + int16_t xMp[13], + int16_t ep[40]) +{ + int i = 13; + + /* This procedure computes the reconstructed long term residual signal + ep[0..39] for the LTP analysis filter. The inputs are the Mc + which is the grid position selection and the xMp[0..12] decoded + RPE samples which are upsampled by a factor of 3 by inserting zero + values. + */ + assert(0 <= Mc && Mc <= 3); + + switch (Mc) + { + case 3: + *ep++ = 0; + case 2: + do + { + *ep++ = 0; + case 1: + *ep++ = 0; + case 0: + *ep++ = *xMp++; + } + while (--i); + } + /*endswitch*/ + while (++Mc < 4) + *ep++ = 0; + /*endwhile*/ +} +/*- End of function --------------------------------------------------------*/ + +void gsm0610_rpe_encoding(gsm0610_state_t *s, + int16_t *e, // [-5..-1][0..39][40..44] + int16_t *xmaxc, + int16_t *Mc, + int16_t xMc[13]) +{ + int16_t x[40]; + int16_t xM[13]; + int16_t xMp[13]; + int16_t mant; + int16_t exp; + + weighting_filter(x, e); + rpe_grid_selection(x, xM, Mc); + + apcm_quantization(xM, xMc, &mant, &exp, xmaxc); + apcm_inverse_quantization(xMc, mant, exp, xMp); + + rpe_grid_positioning(*Mc, xMp, e); +} +/*- End of function --------------------------------------------------------*/ + +void gsm0610_rpe_decoding(gsm0610_state_t *s, + int16_t xmaxc, + int16_t Mcr, + int16_t xMcr[13], + int16_t erp[40]) +{ + int16_t exp; + int16_t mant; + int16_t xMp[13]; + + apcm_quantization_xmaxc_to_exp_mant(xmaxc, &exp, &mant); + apcm_inverse_quantization(xMcr, mant, exp, xMp); + rpe_grid_positioning(Mcr, xMp, erp); +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/gsm0610_short_term.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/gsm0610_short_term.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,363 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * gsm0610_short_term.c - GSM 06.10 full rate speech codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * This code is based on the widely used GSM 06.10 code available from + * http://kbs.cs.tu-berlin.de/~jutta/toast.html + * + * $Id: gsm0610_short_term.c,v 1.19 2009/02/03 16:28:39 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/bitstream.h" +#include "spandsp/saturated.h" +#include "spandsp/gsm0610.h" + +#include "gsm0610_local.h" + +/* SHORT TERM ANALYSIS FILTERING SECTION */ + +/* 4.2.8 */ +static void decode_log_area_ratios(int16_t LARc[8], int16_t *LARpp) +{ + int16_t temp1; + + /* This procedure requires for efficient implementation + two tables. + INVA[1..8] = integer((32768*8)/real_A[1..8]) + MIC[1..8] = minimum value of the LARc[1..8] + */ + + /* Compute the LARpp[1..8] */ + +#undef STEP +#define STEP(B,MIC,INVA) \ + temp1 = saturated_add16(*LARc++, MIC) << 10; \ + temp1 = saturated_sub16(temp1, B << 1); \ + temp1 = gsm_mult_r(INVA, temp1); \ + *LARpp++ = saturated_add16(temp1, temp1); + + STEP( 0, -32, 13107); + STEP( 0, -32, 13107); + STEP( 2048, -16, 13107); + STEP(-2560, -16, 13107); + + STEP( 94, -8, 19223); + STEP(-1792, -8, 17476); + STEP( -341, -4, 31454); + STEP(-1144, -4, 29708); + + /* NOTE: the addition of *MIC is used to restore the sign of *LARc. */ +} +/*- End of function --------------------------------------------------------*/ + +/* 4.2.9 */ + +/* Computation of the quantized reflection coefficients */ + +/* 4.2.9.1 Interpolation of the LARpp[1..8] to get the LARp[1..8] */ + +/* Within each frame of 160 analyzed speech samples the short term + analysis and synthesis filters operate with four different sets of + coefficients, derived from the previous set of decoded LARs(LARpp(j - 1)) + and the actual set of decoded LARs (LARpp(j)) + + (Initial value: LARpp(j - 1)[1..8] = 0.) +*/ + +static void coefficients_0_12(int16_t *LARpp_j_1, + int16_t *LARpp_j, + int16_t *LARp) +{ + int i; + + for (i = 1; i <= 8; i++, LARp++, LARpp_j_1++, LARpp_j++) + { + *LARp = saturated_add16(*LARpp_j_1 >> 2, *LARpp_j >> 2); + *LARp = saturated_add16(*LARp, *LARpp_j_1 >> 1); + } + /*endfor*/ +} +/*- End of function --------------------------------------------------------*/ + +static void coefficients_13_26(int16_t *LARpp_j_1, + int16_t *LARpp_j, + int16_t *LARp) +{ + int i; + + for (i = 1; i <= 8; i++, LARpp_j_1++, LARpp_j++, LARp++) + *LARp = saturated_add16(*LARpp_j_1 >> 1, *LARpp_j >> 1); + /*endfor*/ +} +/*- End of function --------------------------------------------------------*/ + +static void coefficients_27_39(int16_t *LARpp_j_1, + int16_t *LARpp_j, + int16_t *LARp) +{ + int i; + + for (i = 1; i <= 8; i++, LARpp_j_1++, LARpp_j++, LARp++) + { + *LARp = saturated_add16(*LARpp_j_1 >> 2, *LARpp_j >> 2); + *LARp = saturated_add16(*LARp, *LARpp_j >> 1); + } + /*endfor*/ +} +/*- End of function --------------------------------------------------------*/ + +static void coefficients_40_159(int16_t *LARpp_j, int16_t *LARp) +{ + int i; + + for (i = 1; i <= 8; i++) + *LARp++ = *LARpp_j++; + /*endfor*/ +} +/*- End of function --------------------------------------------------------*/ + +/* 4.2.9.2 */ +static void larp_to_rp(int16_t LARp[8]) +{ + int i; + int16_t *LARpx; + int16_t temp; + + /* The input to this procedure is the interpolated LARp[0..7] array. + The reflection coefficients, rp[i], are used in the analysis + filter and in the synthesis filter. + */ + + LARpx = LARp; + for (i = 1; i <= 8; i++, LARpx++) + { + temp = *LARpx; + if (temp < 0) + { + if (temp == INT16_MIN) + temp = INT16_MAX; + else + temp = -temp; + /*endif*/ + if (temp < 11059) + temp <<= 1; + else if (temp < 20070) + temp += 11059; + else + temp = saturated_add16(temp >> 2, 26112); + /*endif*/ + *LARpx = -temp; + } + else + { + if (temp < 11059) + temp <<= 1; + else if (temp < 20070) + temp += 11059; + else + temp = saturated_add16(temp >> 2, 26112); + /*endif*/ + *LARpx = temp; + } + /*endif*/ + } + /*endfor*/ +} +/*- End of function --------------------------------------------------------*/ + +/* 4.2.10 */ +static void short_term_analysis_filtering(gsm0610_state_t *s, + int16_t rp[8], + int k_n, // k_end - k_start + int16_t amp[]) // [0..n-1] IN/OUT +{ + /* This procedure computes the short term residual signal d[..] to be fed + to the RPE-LTP loop from the s[..] signal and from the local rp[..] + array (quantized reflection coefficients). As the call of this + procedure can be done in many ways (see the interpolation of the LAR + coefficient), it is assumed that the computation begins with index + k_start (for arrays d[..] and s[..]) and stops with index k_end + (k_start and k_end are defined in 4.2.9.1). This procedure also + needs to keep the array u[0..7] in memory for each call. + */ + int16_t *u0; + int16_t *u_top; + int i; + int16_t *u; + int16_t *rpx; + int32_t di; + int32_t u_out; + + u0 = s->u; + u_top = u0 + 8; + + for (i = 0; i < k_n; i++) + { + di = + u_out = amp[i]; + for (rpx = rp, u = u0; u < u_top; ) + { + int32_t ui; + int32_t rpi; + + ui = *u; + *u++ = (int16_t) u_out; + rpi = *rpx++; + u_out = ui + (((rpi*di) + 0x4000) >> 15); + di = di + (((rpi*ui) + 0x4000) >> 15); + u_out = saturate(u_out); + di = saturate(di); + } + /*endfor*/ + amp[i] = (int16_t) di; + } + /*endfor*/ +} +/*- End of function --------------------------------------------------------*/ + +static void short_term_synthesis_filtering(gsm0610_state_t *s, + int16_t rrp[8], + int k, // k_end - k_start + int16_t *wt, // [0..k - 1] + int16_t *sr) // [0..k - 1] +{ + int16_t *v; + int i; + int16_t sri; + int16_t tmp1; + int16_t tmp2; + + v = s->v; + while (k--) + { + sri = *wt++; + for (i = 8; i--; ) + { + tmp1 = rrp[i]; + tmp2 = v[i]; + tmp2 = ((tmp1 == INT16_MIN && tmp2 == INT16_MIN) + ? + INT16_MAX + : + (int16_t) (((int32_t) tmp1*(int32_t) tmp2 + 16384) >> 15) & 0xFFFF); + + sri = saturated_sub16(sri, tmp2); + + tmp1 = ((tmp1 == INT16_MIN && sri == INT16_MIN) + ? + INT16_MAX + : + (int16_t) (((int32_t) tmp1*(int32_t) sri + 16384) >> 15) & 0xFFFF); + + v[i + 1] = saturated_add16(v[i], tmp1); + } + /*endfor*/ + *sr++ = + v[0] = sri; + } + /*endwhile*/ +} +/*- End of function --------------------------------------------------------*/ + +void gsm0610_short_term_analysis_filter(gsm0610_state_t *s, + int16_t LARc[8], + int16_t amp[GSM0610_FRAME_LEN]) +{ + int16_t *LARpp_j; + int16_t *LARpp_j_1; + int16_t LARp[8]; + + LARpp_j = s->LARpp[s->j]; + LARpp_j_1 = s->LARpp[s->j ^= 1]; + + decode_log_area_ratios(LARc, LARpp_j); + + coefficients_0_12(LARpp_j_1, LARpp_j, LARp); + larp_to_rp(LARp); + short_term_analysis_filtering(s, LARp, 13, amp); + + coefficients_13_26(LARpp_j_1, LARpp_j, LARp); + larp_to_rp(LARp); + short_term_analysis_filtering(s, LARp, 14, amp + 13); + + coefficients_27_39(LARpp_j_1, LARpp_j, LARp); + larp_to_rp(LARp); + short_term_analysis_filtering(s, LARp, 13, amp + 27); + + coefficients_40_159(LARpp_j, LARp); + larp_to_rp(LARp); + short_term_analysis_filtering(s, LARp, 120, amp + 40); +} +/*- End of function --------------------------------------------------------*/ + +void gsm0610_short_term_synthesis_filter(gsm0610_state_t *s, + int16_t LARcr[8], + int16_t wt[GSM0610_FRAME_LEN], + int16_t amp[GSM0610_FRAME_LEN]) +{ + int16_t *LARpp_j; + int16_t *LARpp_j_1; + int16_t LARp[8]; + + LARpp_j = s->LARpp[s->j]; + LARpp_j_1 = s->LARpp[s->j ^= 1]; + + decode_log_area_ratios(LARcr, LARpp_j); + + coefficients_0_12(LARpp_j_1, LARpp_j, LARp); + larp_to_rp(LARp); + short_term_synthesis_filtering(s, LARp, 13, wt, amp); + + coefficients_13_26(LARpp_j_1, LARpp_j, LARp); + larp_to_rp(LARp); + short_term_synthesis_filtering(s, LARp, 14, wt + 13, amp + 13); + + coefficients_27_39(LARpp_j_1, LARpp_j, LARp); + larp_to_rp(LARp); + short_term_synthesis_filtering(s, LARp, 13, wt + 27, amp + 27); + + coefficients_40_159(LARpp_j, LARp); + larp_to_rp(LARp); + short_term_synthesis_filtering(s, LARp, 120, wt + 40, amp + 40); +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/hdlc.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/hdlc.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,630 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * hdlc.c + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: hdlc.c,v 1.72 2009/06/02 16:03:56 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/async.h" +#include "spandsp/crc.h" +#include "spandsp/bit_operations.h" +#include "spandsp/hdlc.h" +#include "spandsp/private/hdlc.h" + +static void report_status_change(hdlc_rx_state_t *s, int status) +{ + if (s->status_handler) + s->status_handler(s->status_user_data, status); + else if (s->frame_handler) + s->frame_handler(s->frame_user_data, NULL, status, TRUE); +} +/*- End of function --------------------------------------------------------*/ + +static void rx_special_condition(hdlc_rx_state_t *s, int status) +{ + /* Special conditions */ + switch (status) + { + case SIG_STATUS_CARRIER_UP: + case SIG_STATUS_TRAINING_SUCCEEDED: + /* Reset the HDLC receiver. */ + s->raw_bit_stream = 0; + s->len = 0; + s->num_bits = 0; + s->flags_seen = 0; + s->framing_ok_announced = FALSE; + /* Fall through */ + case SIG_STATUS_TRAINING_IN_PROGRESS: + case SIG_STATUS_TRAINING_FAILED: + case SIG_STATUS_CARRIER_DOWN: + case SIG_STATUS_END_OF_DATA: + report_status_change(s, status); + break; + default: + //printf("Eh!\n"); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void octet_set_and_count(hdlc_rx_state_t *s) +{ + if (s->octet_count_report_interval == 0) + return; + + /* If we are not in octet counting mode, we start it. + If we are in octet counting mode, we update it. */ + if (s->octet_counting_mode) + { + if (--s->octet_count <= 0) + { + s->octet_count = s->octet_count_report_interval; + report_status_change(s, SIG_STATUS_OCTET_REPORT); + } + } + else + { + s->octet_counting_mode = TRUE; + s->octet_count = s->octet_count_report_interval; + } +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void octet_count(hdlc_rx_state_t *s) +{ + if (s->octet_count_report_interval == 0) + return; + + /* If we are not in octet counting mode, we start it. + If we are in octet counting mode, we update it. */ + if (s->octet_counting_mode) + { + if (--s->octet_count <= 0) + { + s->octet_count = s->octet_count_report_interval; + report_status_change(s, SIG_STATUS_OCTET_REPORT); + } + } +} +/*- End of function --------------------------------------------------------*/ + +static void rx_flag_or_abort(hdlc_rx_state_t *s) +{ + if ((s->raw_bit_stream & 0x8000)) + { + /* Hit HDLC abort */ + s->rx_aborts++; + report_status_change(s, SIG_STATUS_ABORT); + /* If we have not yet seen enough flags, restart the count. If we + are beyond that point, just back off one step, so we need to see + another flag before proceeding to collect frame octets. */ + if (s->flags_seen < s->framing_ok_threshold - 1) + s->flags_seen = 0; + else + s->flags_seen = s->framing_ok_threshold - 1; + /* An abort starts octet counting */ + octet_set_and_count(s); + } + else + { + /* Hit HDLC flag */ + /* A flag clears octet counting */ + s->octet_counting_mode = FALSE; + if (s->flags_seen >= s->framing_ok_threshold) + { + /* We may have a frame, or we may have back to back flags */ + if (s->len) + { + if (s->num_bits == 7 && s->len >= (size_t) s->crc_bytes && s->len <= s->max_frame_len) + { + if ((s->crc_bytes == 2 && crc_itu16_check(s->buffer, s->len)) + || + (s->crc_bytes != 2 && crc_itu32_check(s->buffer, s->len))) + { + s->rx_frames++; + s->rx_bytes += s->len - s->crc_bytes; + s->len -= s->crc_bytes; + s->frame_handler(s->frame_user_data, s->buffer, s->len, TRUE); + } + else + { + s->rx_crc_errors++; + if (s->report_bad_frames) + { + s->len -= s->crc_bytes; + s->frame_handler(s->frame_user_data, s->buffer, s->len, FALSE); + } + } + } + else + { + /* Frame too short or too long, or the flag is misaligned with its octets. */ + if (s->report_bad_frames) + { + /* Don't let the length go below zero, or it will be confused + with one of the special conditions. */ + if (s->len >= (size_t) s->crc_bytes) + s->len -= s->crc_bytes; + else + s->len = 0; + s->frame_handler(s->frame_user_data, s->buffer, s->len, FALSE); + } + s->rx_length_errors++; + } + } + } + else + { + /* Check the flags are back-to-back when testing for valid preamble. This + greatly reduces the chances of false preamble detection, and anything + which doesn't send them back-to-back is badly broken. */ + if (s->num_bits != 7) + { + /* Don't set the flags seen indicator back to zero too aggressively. + We want to pick up with the minimum of discarded data when there + is a bit error in the stream, and a bit error could emulate a + misaligned flag. */ + if (s->flags_seen < s->framing_ok_threshold - 1) + s->flags_seen = 0; + else + s->flags_seen = s->framing_ok_threshold - 1; + } + if (++s->flags_seen >= s->framing_ok_threshold && !s->framing_ok_announced) + { + report_status_change(s, SIG_STATUS_FRAMING_OK); + s->framing_ok_announced = TRUE; + } + } + } + s->len = 0; + s->num_bits = 0; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void hdlc_rx_put_bit_core(hdlc_rx_state_t *s) +{ + if ((s->raw_bit_stream & 0x3F00) == 0x3E00) + { + /* Its time to either skip a bit, for stuffing, or process a + flag or abort */ + if ((s->raw_bit_stream & 0x4000)) + rx_flag_or_abort(s); + return; + } + s->num_bits++; + if (s->flags_seen < s->framing_ok_threshold) + { + if ((s->num_bits & 0x7) == 0) + octet_count(s); + return; + } + s->byte_in_progress = (s->byte_in_progress | (s->raw_bit_stream & 0x100)) >> 1; + if (s->num_bits == 8) + { + /* Ensure we do not accept an overlength frame, and especially that + we do not overflow our buffer */ + if (s->len < s->max_frame_len) + { + s->buffer[s->len++] = (uint8_t) s->byte_in_progress; + } + else + { + /* This is too long. Abandon the frame, and wait for the next + flag octet. */ + s->len = sizeof(s->buffer) + 1; + s->flags_seen = s->framing_ok_threshold - 1; + octet_set_and_count(s); + } + s->num_bits = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(void) hdlc_rx_put_bit(hdlc_rx_state_t *s, int new_bit) +{ + if (new_bit < 0) + { + rx_special_condition(s, new_bit); + return; + } + s->raw_bit_stream = (s->raw_bit_stream << 1) | ((new_bit << 8) & 0x100); + hdlc_rx_put_bit_core(s); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(void) hdlc_rx_put_byte(hdlc_rx_state_t *s, int new_byte) +{ + int i; + + if (new_byte < 0) + { + rx_special_condition(s, new_byte); + return; + } + s->raw_bit_stream |= new_byte; + for (i = 0; i < 8; i++) + { + s->raw_bit_stream <<= 1; + hdlc_rx_put_bit_core(s); + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(void) hdlc_rx_put(hdlc_rx_state_t *s, const uint8_t buf[], int len) +{ + int i; + + for (i = 0; i < len; i++) + hdlc_rx_put_byte(s, buf[i]); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) hdlc_rx_set_max_frame_len(hdlc_rx_state_t *s, size_t max_len) +{ + max_len += s->crc_bytes; + s->max_frame_len = (max_len <= sizeof(s->buffer)) ? max_len : sizeof(s->buffer); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) hdlc_rx_set_octet_counting_report_interval(hdlc_rx_state_t *s, int interval) +{ + s->octet_count_report_interval = interval; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(hdlc_rx_state_t *) hdlc_rx_init(hdlc_rx_state_t *s, + int crc32, + int report_bad_frames, + int framing_ok_threshold, + hdlc_frame_handler_t handler, + void *user_data) +{ + if (s == NULL) + { + if ((s = (hdlc_rx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + s->frame_handler = handler; + s->frame_user_data = user_data; + s->crc_bytes = (crc32) ? 4 : 2; + s->report_bad_frames = report_bad_frames; + s->framing_ok_threshold = (framing_ok_threshold < 1) ? 1 : framing_ok_threshold; + s->max_frame_len = sizeof(s->buffer); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) hdlc_rx_set_frame_handler(hdlc_rx_state_t *s, hdlc_frame_handler_t handler, void *user_data) +{ + s->frame_handler = handler; + s->frame_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) hdlc_rx_set_status_handler(hdlc_rx_state_t *s, modem_rx_status_func_t handler, void *user_data) +{ + s->status_handler = handler; + s->status_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) hdlc_rx_release(hdlc_rx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) hdlc_rx_free(hdlc_rx_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) hdlc_rx_get_stats(hdlc_rx_state_t *s, + hdlc_rx_stats_t *t) +{ + t->bytes = s->rx_bytes; + t->good_frames = s->rx_frames; + t->crc_errors = s->rx_crc_errors; + t->length_errors = s->rx_length_errors; + t->aborts = s->rx_aborts; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) hdlc_tx_frame(hdlc_tx_state_t *s, const uint8_t *frame, size_t len) +{ + if (len <= 0) + { + s->tx_end = TRUE; + return 0; + } + if (s->len + len > s->max_frame_len) + return -1; + if (s->progressive) + { + /* Only lock out if we are in the CRC section. */ + if (s->pos >= HDLC_MAXFRAME_LEN) + return -1; + } + else + { + /* Lock out if there is anything in the buffer. */ + if (s->len) + return -1; + } + memcpy(s->buffer + s->len, frame, len); + if (s->crc_bytes == 2) + s->crc = crc_itu16_calc(frame, len, (uint16_t) s->crc); + else + s->crc = crc_itu32_calc(frame, len, s->crc); + if (s->progressive) + s->len += len; + else + s->len = len; + s->tx_end = FALSE; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) hdlc_tx_flags(hdlc_tx_state_t *s, int len) +{ + /* Some HDLC applications require the ability to force a period of HDLC + flag words. */ + if (s->pos) + return -1; + if (len < 0) + s->flag_octets += -len; + else + s->flag_octets = len; + s->report_flag_underflow = TRUE; + s->tx_end = FALSE; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) hdlc_tx_abort(hdlc_tx_state_t *s) +{ + /* TODO: This is a really crude way of just fudging an abort out for simple + test purposes. */ + s->flag_octets++; + s->abort_octets++; + return -1; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) hdlc_tx_corrupt_frame(hdlc_tx_state_t *s) +{ + if (s->len <= 0) + return -1; + s->crc ^= 0xFFFF; + s->buffer[HDLC_MAXFRAME_LEN] ^= 0xFF; + s->buffer[HDLC_MAXFRAME_LEN + 1] ^= 0xFF; + s->buffer[HDLC_MAXFRAME_LEN + 2] ^= 0xFF; + s->buffer[HDLC_MAXFRAME_LEN + 3] ^= 0xFF; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) hdlc_tx_get_byte(hdlc_tx_state_t *s) +{ + int i; + int byte_in_progress; + int txbyte; + + if (s->flag_octets > 0) + { + /* We are in a timed flag section (preamble, inter frame gap, etc.) */ + if (--s->flag_octets <= 0 && s->report_flag_underflow) + { + s->report_flag_underflow = FALSE; + if (s->len == 0) + { + /* The timed flags have finished, there is nothing else queued to go, + and we have been told to report this underflow. */ + if (s->underflow_handler) + s->underflow_handler(s->user_data); + } + } + if (s->abort_octets) + { + s->abort_octets = 0; + return 0x7F; + } + return s->idle_octet; + } + if (s->len) + { + if (s->num_bits >= 8) + { + s->num_bits -= 8; + return (s->octets_in_progress >> s->num_bits) & 0xFF; + } + if (s->pos >= s->len) + { + if (s->pos == s->len) + { + s->crc ^= 0xFFFFFFFF; + s->buffer[HDLC_MAXFRAME_LEN] = (uint8_t) s->crc; + s->buffer[HDLC_MAXFRAME_LEN + 1] = (uint8_t) (s->crc >> 8); + if (s->crc_bytes == 4) + { + s->buffer[HDLC_MAXFRAME_LEN + 2] = (uint8_t) (s->crc >> 16); + s->buffer[HDLC_MAXFRAME_LEN + 3] = (uint8_t) (s->crc >> 24); + } + s->pos = HDLC_MAXFRAME_LEN; + } + else if (s->pos == (size_t) (HDLC_MAXFRAME_LEN + s->crc_bytes)) + { + /* Finish off the current byte with some flag bits. If we are at the + start of a byte we need a at least one whole byte of flag to ensure + we cannot end up with back to back frames, and no flag octet at all */ + txbyte = (uint8_t) ((s->octets_in_progress << (8 - s->num_bits)) | (0x7E >> s->num_bits)); + /* Create a rotated octet of flag for idling... */ + s->idle_octet = (0x7E7E >> s->num_bits) & 0xFF; + /* ...and the partial flag octet needed to start off the next message. */ + s->octets_in_progress = s->idle_octet >> (8 - s->num_bits); + s->flag_octets = s->inter_frame_flags - 1; + s->len = 0; + s->pos = 0; + if (s->crc_bytes == 2) + s->crc = 0xFFFF; + else + s->crc = 0xFFFFFFFF; + /* Report the underflow now. If there are timed flags still in progress, loading the + next frame right now will be harmless. */ + s->report_flag_underflow = FALSE; + if (s->underflow_handler) + s->underflow_handler(s->user_data); + /* Make sure we finish off with at least one flag octet, if the underflow report did not result + in a new frame being sent. */ + if (s->len == 0 && s->flag_octets < 2) + s->flag_octets = 2; + return txbyte; + } + } + byte_in_progress = s->buffer[s->pos++]; + i = bottom_bit(byte_in_progress | 0x100); + s->octets_in_progress <<= i; + byte_in_progress >>= i; + for ( ; i < 8; i++) + { + s->octets_in_progress = (s->octets_in_progress << 1) | (byte_in_progress & 0x01); + byte_in_progress >>= 1; + if ((s->octets_in_progress & 0x1F) == 0x1F) + { + /* There are 5 ones - stuff */ + s->octets_in_progress <<= 1; + s->num_bits++; + } + } + /* An input byte will generate between 8 and 10 output bits */ + return (s->octets_in_progress >> s->num_bits) & 0xFF; + } + /* Untimed idling on flags */ + if (s->tx_end) + { + s->tx_end = FALSE; + return SIG_STATUS_END_OF_DATA; + } + return s->idle_octet; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) hdlc_tx_get_bit(hdlc_tx_state_t *s) +{ + int txbit; + + if (s->bits == 0) + { + if ((s->byte = hdlc_tx_get_byte(s)) < 0) + return s->byte; + s->bits = 8; + } + s->bits--; + txbit = (s->byte >> s->bits) & 0x01; + return txbit; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) hdlc_tx_get(hdlc_tx_state_t *s, uint8_t buf[], size_t max_len) +{ + size_t i; + int x; + + for (i = 0; i < max_len; i++) + { + if ((x = hdlc_tx_get_byte(s)) == SIG_STATUS_END_OF_DATA) + return i; + buf[i] = (uint8_t) x; + } + return (int) i; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) hdlc_tx_set_max_frame_len(hdlc_tx_state_t *s, size_t max_len) +{ + s->max_frame_len = (max_len <= HDLC_MAXFRAME_LEN) ? max_len : HDLC_MAXFRAME_LEN; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(hdlc_tx_state_t *) hdlc_tx_init(hdlc_tx_state_t *s, + int crc32, + int inter_frame_flags, + int progressive, + hdlc_underflow_handler_t handler, + void *user_data) +{ + if (s == NULL) + { + if ((s = (hdlc_tx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + s->idle_octet = 0x7E; + s->underflow_handler = handler; + s->user_data = user_data; + s->inter_frame_flags = (inter_frame_flags < 1) ? 1 : inter_frame_flags; + if (crc32) + { + s->crc_bytes = 4; + s->crc = 0xFFFFFFFF; + } + else + { + s->crc_bytes = 2; + s->crc = 0xFFFF; + } + s->progressive = progressive; + s->max_frame_len = HDLC_MAXFRAME_LEN; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) hdlc_tx_release(hdlc_tx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) hdlc_tx_free(hdlc_tx_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/ima_adpcm.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/ima_adpcm.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,511 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * ima_adpcm.c - Conversion routines between linear 16 bit PCM data and + * IMA/DVI/Intel ADPCM format. + * + * Written by Steve Underwood + * + * Copyright (C) 2001, 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: ima_adpcm.c,v 1.36 2009/04/11 18:11:19 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/saturated.h" +#include "spandsp/ima_adpcm.h" +#include "spandsp/private/ima_adpcm.h" + +/* + * Intel/DVI ADPCM coder/decoder. + * + * The algorithm for this coder was taken from the IMA Compatability Project + * proceedings, Vol 2, Number 2; May 1992. + * + * The RTP payload specs. reference a variant of DVI, called VDVI. This attempts to + * further compress, in a variable bit rate manner, by expressing the 4 bit codes + * from the DVI codec as: + * + * 0 00 + * 1 010 + * 2 1100 + * 3 11100 + * 4 111100 + * 5 1111100 + * 6 11111100 + * 7 11111110 + * 8 10 + * 9 011 + * 10 1101 + * 11 11101 + * 12 111101 + * 13 1111101 + * 14 11111101 + * 15 11111111 + * + * Any left over bits in the last octet of an encoded burst are set to one. + */ + +/* + DVI4 uses an adaptive delta pulse code modulation (ADPCM) encoding + scheme that was specified by the Interactive Multimedia Association + (IMA) as the "IMA ADPCM wave type". However, the encoding defined + here as DVI4 differs in three respects from the IMA specification: + + o The RTP DVI4 header contains the predicted value rather than the + first sample value contained the IMA ADPCM block header. + + o IMA ADPCM blocks contain an odd number of samples, since the first + sample of a block is contained just in the header (uncompressed), + followed by an even number of compressed samples. DVI4 has an + even number of compressed samples only, using the `predict' word + from the header to decode the first sample. + + o For DVI4, the 4-bit samples are packed with the first sample in + the four most significant bits and the second sample in the four + least significant bits. In the IMA ADPCM codec, the samples are + packed in the opposite order. + + Each packet contains a single DVI block. This profile only defines + the 4-bit-per-sample version, while IMA also specified a 3-bit-per- + sample encoding. + + The "header" word for each channel has the following structure: + + int16 predict; // predicted value of first sample + // from the previous block (L16 format) + u_int8 index; // current index into stepsize table + u_int8 reserved; // set to zero by sender, ignored by receiver + + Each octet following the header contains two 4-bit samples, thus the + number of samples per packet MUST be even because there is no means + to indicate a partially filled last octet. +*/ + +/*! The number of ADPCM step sizes */ +#define STEP_MAX 88 + +/* Intel ADPCM step variation table */ +static const int step_size[STEP_MAX + 1] = +{ + 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 +}; + +static const int step_adjustment[8] = +{ + -1, -1, -1, -1, 2, 4, 6, 8 +}; + +static const struct +{ + uint8_t code; + uint8_t bits; +} vdvi_encode[] = +{ + {0x00, 2}, + {0x02, 3}, + {0x0C, 4}, + {0x1C, 5}, + {0x3C, 6}, + {0x7C, 7}, + {0xFC, 8}, + {0xFE, 8}, + {0x02, 2}, + {0x03, 3}, + {0x0D, 4}, + {0x1D, 5}, + {0x3D, 6}, + {0x7D, 7}, + {0xFD, 8}, + {0xFF, 8} +}; + +static const struct +{ + uint16_t code; + uint16_t mask; + uint8_t bits; +} vdvi_decode[] = +{ + {0x0000, 0xC000, 2}, + {0x4000, 0xE000, 3}, + {0xC000, 0xF000, 4}, + {0xE000, 0xF800, 5}, + {0xF000, 0xFC00, 6}, + {0xF800, 0xFE00, 7}, + {0xFC00, 0xFF00, 8}, + {0xFE00, 0xFF00, 8}, + {0x8000, 0xC000, 2}, + {0x6000, 0xE000, 3}, + {0xD000, 0xF000, 4}, + {0xE800, 0xF800, 5}, + {0xF400, 0xFC00, 6}, + {0xFA00, 0xFE00, 7}, + {0xFD00, 0xFF00, 8}, + {0xFF00, 0xFF00, 8} +}; + +static int16_t decode(ima_adpcm_state_t *s, uint8_t adpcm) +{ + int e; + int ss; + int16_t linear; + + /* e = (adpcm+0.5)*step/4 */ + ss = step_size[s->step_index]; + e = ss >> 3; + if (adpcm & 0x01) + e += (ss >> 2); + /*endif*/ + if (adpcm & 0x02) + e += (ss >> 1); + /*endif*/ + if (adpcm & 0x04) + e += ss; + /*endif*/ + if (adpcm & 0x08) + e = -e; + /*endif*/ + linear = saturate(s->last + e); + s->last = linear; + s->step_index += step_adjustment[adpcm & 0x07]; + if (s->step_index < 0) + s->step_index = 0; + else if (s->step_index > STEP_MAX) + s->step_index = STEP_MAX; + /*endif*/ + return linear; +} +/*- End of function --------------------------------------------------------*/ + +static uint8_t encode(ima_adpcm_state_t *s, int16_t linear) +{ + int e; + int ss; + int adpcm; + int diff; + int initial_e; + + ss = step_size[s->step_index]; + initial_e = + e = linear - s->last; + diff = ss >> 3; + adpcm = (uint8_t) 0x00; + if (e < 0) + { + adpcm = (uint8_t) 0x08; + e = -e; + } + /*endif*/ + if (e >= ss) + { + adpcm |= (uint8_t) 0x04; + e -= ss; + } + /*endif*/ + ss >>= 1; + if (e >= ss) + { + adpcm |= (uint8_t) 0x02; + e -= ss; + } + /*endif*/ + ss >>= 1; + if (e >= ss) + { + adpcm |= (uint8_t) 0x01; + e -= ss; + } + /*endif*/ + + if (initial_e < 0) + diff = -(diff - initial_e - e); + else + diff = diff + initial_e - e; + /*endif*/ + s->last = saturate(diff + s->last); + s->step_index += step_adjustment[adpcm & 0x07]; + if (s->step_index < 0) + s->step_index = 0; + else if (s->step_index > STEP_MAX) + s->step_index = STEP_MAX; + /*endif*/ + return (uint8_t) adpcm; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(ima_adpcm_state_t *) ima_adpcm_init(ima_adpcm_state_t *s, + int variant, + int chunk_size) +{ + if (s == NULL) + { + if ((s = (ima_adpcm_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + /*endif*/ + memset(s, 0, sizeof(*s)); + s->variant = variant; + s->chunk_size = chunk_size; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) ima_adpcm_release(ima_adpcm_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) ima_adpcm_free(ima_adpcm_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) ima_adpcm_decode(ima_adpcm_state_t *s, + int16_t amp[], + const uint8_t ima_data[], + int ima_bytes) +{ + int i; + int j; + int samples; + uint16_t code; + + samples = 0; + switch (s->variant) + { + case IMA_ADPCM_IMA4: + i = 0; + if (s->chunk_size == 0) + { + amp[samples++] = (ima_data[1] << 8) | ima_data[0]; + s->step_index = ima_data[2]; + s->last = amp[0]; + i = 4; + } + /*endif*/ + for ( ; i < ima_bytes; i++) + { + amp[samples++] = decode(s, ima_data[i] & 0xF); + amp[samples++] = decode(s, (ima_data[i] >> 4) & 0xF); + } + /*endfor*/ + break; + case IMA_ADPCM_DVI4: + i = 0; + if (s->chunk_size == 0) + { + s->last = (int16_t) ((ima_data[0] << 8) | ima_data[1]); + s->step_index = ima_data[2]; + i = 4; + } + /*endif*/ + for ( ; i < ima_bytes; i++) + { + amp[samples++] = decode(s, (ima_data[i] >> 4) & 0xF); + amp[samples++] = decode(s, ima_data[i] & 0xF); + } + /*endfor*/ + break; + case IMA_ADPCM_VDVI: + i = 0; + if (s->chunk_size == 0) + { + s->last = (int16_t) ((ima_data[0] << 8) | ima_data[1]); + s->step_index = ima_data[2]; + i = 4; + } + /*endif*/ + code = 0; + s->bits = 0; + for (;;) + { + if (s->bits <= 8) + { + if (i >= ima_bytes) + break; + /*endif*/ + code |= ((uint16_t) ima_data[i++] << (8 - s->bits)); + s->bits += 8; + } + /*endif*/ + for (j = 0; j < 8; j++) + { + if ((vdvi_decode[j].mask & code) == vdvi_decode[j].code) + break; + if ((vdvi_decode[j + 8].mask & code) == vdvi_decode[j + 8].code) + { + j += 8; + break; + } + /*endif*/ + } + /*endfor*/ + amp[samples++] = decode(s, (uint8_t) j); + code <<= vdvi_decode[j].bits; + s->bits -= vdvi_decode[j].bits; + } + /*endfor*/ + /* Use up the remanents of the last octet */ + while (s->bits > 0) + { + for (j = 0; j < 8; j++) + { + if ((vdvi_decode[j].mask & code) == vdvi_decode[j].code) + break; + /*endif*/ + if ((vdvi_decode[j + 8].mask & code) == vdvi_decode[j + 8].code) + { + j += 8; + break; + } + /*endif*/ + } + /*endfor*/ + if (vdvi_decode[j].bits > s->bits) + break; + /*endif*/ + amp[samples++] = decode(s, (uint8_t) j); + code <<= vdvi_decode[j].bits; + s->bits -= vdvi_decode[j].bits; + } + /*endwhile*/ + break; + } + /*endswitch*/ + return samples; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) ima_adpcm_encode(ima_adpcm_state_t *s, + uint8_t ima_data[], + const int16_t amp[], + int len) +{ + int i; + int bytes; + uint8_t code; + + bytes = 0; + switch (s->variant) + { + case IMA_ADPCM_IMA4: + i = 0; + if (s->chunk_size == 0) + { + ima_data[bytes++] = (uint8_t) amp[0]; + ima_data[bytes++] = (uint8_t) (amp[0] >> 8); + ima_data[bytes++] = (uint8_t) s->step_index; + ima_data[bytes++] = 0; + s->last = amp[0]; + s->bits = 0; + i = 1; + } + /*endif*/ + for ( ; i < len; i++) + { + s->ima_byte = (uint8_t) ((s->ima_byte >> 4) | (encode(s, amp[i]) << 4)); + if ((s->bits++ & 1)) + ima_data[bytes++] = (uint8_t) s->ima_byte; + /*endif*/ + } + /*endfor*/ + break; + case IMA_ADPCM_DVI4: + if (s->chunk_size == 0) + { + ima_data[bytes++] = (uint8_t) (s->last >> 8); + ima_data[bytes++] = (uint8_t) s->last; + ima_data[bytes++] = (uint8_t) s->step_index; + ima_data[bytes++] = 0; + } + /*endif*/ + for (i = 0; i < len; i++) + { + s->ima_byte = (uint8_t) ((s->ima_byte << 4) | encode(s, amp[i])); + if ((s->bits++ & 1)) + ima_data[bytes++] = (uint8_t) s->ima_byte; + /*endif*/ + } + /*endfor*/ + break; + case IMA_ADPCM_VDVI: + if (s->chunk_size == 0) + { + ima_data[bytes++] = (uint8_t) (s->last >> 8); + ima_data[bytes++] = (uint8_t) s->last; + ima_data[bytes++] = (uint8_t) s->step_index; + ima_data[bytes++] = 0; + } + /*endif*/ + s->bits = 0; + for (i = 0; i < len; i++) + { + code = encode(s, amp[i]); + s->ima_byte = (s->ima_byte << vdvi_encode[code].bits) | vdvi_encode[code].code; + s->bits += vdvi_encode[code].bits; + if (s->bits >= 8) + { + s->bits -= 8; + ima_data[bytes++] = (uint8_t) (s->ima_byte >> s->bits); + } + /*endif*/ + } + /*endfor*/ + if (s->bits) + ima_data[bytes++] = (uint8_t) (((s->ima_byte << 8) | 0xFF) >> s->bits); + /*endif*/ + break; + } + /*endswitch*/ + return bytes; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/libspandsp.2005.sln --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/libspandsp.2005.sln Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,68 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_at_dictionary", "msvc\make_at_dictionary.2005.vcproj", "{DEE932AB-5911-4700-9EEB-8C7090A0A330}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_modem_filter", "msvc\make_modem_filter.2005.vcproj", "{329A6FA0-0FCC-4435-A950-E670AEFA9838}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp", "libspandsp.2005.vcproj", "{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}" + ProjectSection(ProjectDependencies) = postProject + {329A6FA0-0FCC-4435-A950-E670AEFA9838} = {329A6FA0-0FCC-4435-A950-E670AEFA9838} + {DEE932AB-5911-4700-9EEB-8C7090A0A330} = {DEE932AB-5911-4700-9EEB-8C7090A0A330} + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp_sim", "..\spandsp-sim\libspandsp_sim.2005.vcproj", "{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}" + ProjectSection(ProjectDependencies) = postProject + {329A6FA0-0FCC-4435-A950-E670AEFA9838} = {329A6FA0-0FCC-4435-A950-E670AEFA9838} + {DEE932AB-5911-4700-9EEB-8C7090A0A330} = {DEE932AB-5911-4700-9EEB-8C7090A0A330} + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtiff", "libtiff.2005.vcproj", "{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}" + ProjectSection(ProjectDependencies) = postProject + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917} = {2B8A45C9-FEB4-4734-AB37-8DB9DB899917} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download TIFF", "msvc\Download_TIFF.2005.vcproj", "{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + All|Win32 = All|Win32 + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.ActiveCfg = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.Build.0 = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.ActiveCfg = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.Build.0 = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|Win32.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.Build.0 = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.Build.0 = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|Win32.ActiveCfg = All|Win32 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|Win32.ActiveCfg = Release|Win32 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|Win32.Build.0 = Release|Win32 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.ActiveCfg = Debug|Win32 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.Build.0 = Debug|Win32 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.ActiveCfg = Release|Win32 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.Build.0 = Release|Win32 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|Win32.ActiveCfg = Release|Win32 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|Win32.Build.0 = Release|Win32 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.ActiveCfg = Debug|Win32 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.Build.0 = Debug|Win32 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.ActiveCfg = Release|Win32 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.Build.0 = Release|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.All|Win32.ActiveCfg = All|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.All|Win32.Build.0 = All|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Debug|Win32.ActiveCfg = All|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Debug|Win32.Build.0 = All|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Release|Win32.ActiveCfg = All|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Release|Win32.Build.0 = All|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/libspandsp.2005.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/libspandsp.2005.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,340 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/libspandsp.2008.sln --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/libspandsp.2008.sln Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,209 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual C++ Express 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_at_dictionary", "msvc\make_at_dictionary.2008.vcproj", "{DEE932AB-5911-4700-9EEB-8C7090A0A330}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_modem_filter", "msvc\make_modem_filter.2008.vcproj", "{329A6FA0-0FCC-4435-A950-E670AEFA9838}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp", "libspandsp.2008.vcproj", "{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}" + ProjectSection(ProjectDependencies) = postProject + {329A6FA0-0FCC-4435-A950-E670AEFA9838} = {329A6FA0-0FCC-4435-A950-E670AEFA9838} + {DEE932AB-5911-4700-9EEB-8C7090A0A330} = {DEE932AB-5911-4700-9EEB-8C7090A0A330} + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_line_models", "..\spandsp-sim\msvc\make_line_models.2008.vcproj", "{F290BADE-82DE-4037-B49D-D563E43169DA}" + ProjectSection(ProjectDependencies) = postProject + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp_sim", "..\spandsp-sim\libspandsp_sim.2008.vcproj", "{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}" + ProjectSection(ProjectDependencies) = postProject + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtiff", "libtiff.2008.vcproj", "{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}" + ProjectSection(ProjectDependencies) = postProject + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917} = {2B8A45C9-FEB4-4734-AB37-8DB9DB899917} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download TIFF", "msvc\Download_TIFF.2008.vcproj", "{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "t38_core_tests", "..\tests\msvc\t38_core_tests.vcproj", "{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}" + ProjectSection(ProjectDependencies) = postProject + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "t38_non_ecm_buffer_tests", "..\tests\msvc\t38_non_ecm_buffer_tests.vcproj", "{80A3D9D9-3846-4DA5-8676-F940D725EA62}" + ProjectSection(ProjectDependencies) = postProject + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vector_int_tests", "..\tests\msvc\vector_int_tests.vcproj", "{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}" + ProjectSection(ProjectDependencies) = postProject + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vector_float_tests", "..\tests\msvc\vector_float_tests.vcproj", "{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}" + ProjectSection(ProjectDependencies) = postProject + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "complex_tests", "..\tests\msvc\complex_tests.vcproj", "{A349379F-0FEA-49C8-9535-05F39663337B}" + ProjectSection(ProjectDependencies) = postProject + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "complex_vector_float_tests", "..\tests\msvc\complex_vector_float_tests.vcproj", "{2B0D705C-1CF2-401C-BFBC-A43FB806908C}" + ProjectSection(ProjectDependencies) = postProject + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "complex_vector_int_tests", "..\tests\msvc\complex_vector_int_tests.vcproj", "{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}" + ProjectSection(ProjectDependencies) = postProject + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + All|Win32 = All|Win32 + All|x64 = All|x64 + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.ActiveCfg = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.Build.0 = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|x64.ActiveCfg = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.ActiveCfg = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.Build.0 = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|x64.ActiveCfg = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|Win32.ActiveCfg = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|x64.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.Build.0 = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|x64.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.Build.0 = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|x64.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|Win32.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|x64.ActiveCfg = All|Win32 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|Win32.ActiveCfg = Release|x64 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x64.ActiveCfg = Release|x64 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x64.Build.0 = Release|x64 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.ActiveCfg = Debug|Win32 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.Build.0 = Debug|Win32 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|x64.ActiveCfg = Debug|x64 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|x64.Build.0 = Debug|x64 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.ActiveCfg = Release|Win32 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.Build.0 = Release|Win32 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.ActiveCfg = Release|x64 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.Build.0 = Release|x64 + {502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.All|Win32.ActiveCfg = Release|Win32 + {502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.All|Win32.Build.0 = Release|Win32 + {502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.All|x64.ActiveCfg = Release|Win32 + {502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Debug|Win32.ActiveCfg = Debug|Win32 + {502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Debug|Win32.Build.0 = Debug|Win32 + {502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Debug|x64.ActiveCfg = Debug|Win32 + {502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Release|Win32.ActiveCfg = Release|Win32 + {502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Release|Win32.Build.0 = Release|Win32 + {502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Release|x64.ActiveCfg = Release|Win32 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|Win32.ActiveCfg = Release|x64 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.ActiveCfg = Release|x64 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.Build.0 = Release|x64 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.ActiveCfg = Debug|Win32 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.Build.0 = Debug|Win32 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|x64.ActiveCfg = Debug|x64 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|x64.Build.0 = Debug|x64 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.ActiveCfg = Release|Win32 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.Build.0 = Release|Win32 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x64.ActiveCfg = Release|x64 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x64.Build.0 = Release|x64 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.All|Win32.ActiveCfg = All|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.All|Win32.Build.0 = All|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.All|x64.ActiveCfg = All|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Debug|Win32.ActiveCfg = All|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Debug|Win32.Build.0 = All|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Debug|x64.ActiveCfg = All|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Release|Win32.ActiveCfg = All|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Release|Win32.Build.0 = All|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Release|x64.ActiveCfg = All|Win32 + {A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.All|Win32.ActiveCfg = Release|Win32 + {A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.All|Win32.Build.0 = Release|Win32 + {A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.All|x64.ActiveCfg = Release|Win32 + {A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Debug|Win32.ActiveCfg = Debug|Win32 + {A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Debug|Win32.Build.0 = Debug|Win32 + {A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Debug|x64.ActiveCfg = Debug|Win32 + {A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Release|Win32.ActiveCfg = Release|Win32 + {A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Release|Win32.Build.0 = Release|Win32 + {A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Release|x64.ActiveCfg = Release|Win32 + {80A3D9D9-3846-4DA5-8676-F940D725EA62}.All|Win32.ActiveCfg = Release|Win32 + {80A3D9D9-3846-4DA5-8676-F940D725EA62}.All|Win32.Build.0 = Release|Win32 + {80A3D9D9-3846-4DA5-8676-F940D725EA62}.All|x64.ActiveCfg = Release|Win32 + {80A3D9D9-3846-4DA5-8676-F940D725EA62}.Debug|Win32.ActiveCfg = Debug|Win32 + {80A3D9D9-3846-4DA5-8676-F940D725EA62}.Debug|Win32.Build.0 = Debug|Win32 + {80A3D9D9-3846-4DA5-8676-F940D725EA62}.Debug|x64.ActiveCfg = Debug|Win32 + {80A3D9D9-3846-4DA5-8676-F940D725EA62}.Release|Win32.ActiveCfg = Release|Win32 + {80A3D9D9-3846-4DA5-8676-F940D725EA62}.Release|Win32.Build.0 = Release|Win32 + {80A3D9D9-3846-4DA5-8676-F940D725EA62}.Release|x64.ActiveCfg = Release|Win32 + {80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.All|Win32.ActiveCfg = Release|Win32 + {80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.All|Win32.Build.0 = Release|Win32 + {80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.All|x64.ActiveCfg = Release|Win32 + {80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Debug|Win32.ActiveCfg = Debug|Win32 + {80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Debug|Win32.Build.0 = Debug|Win32 + {80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Debug|x64.ActiveCfg = Debug|Win32 + {80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Release|Win32.ActiveCfg = Release|Win32 + {80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Release|Win32.Build.0 = Release|Win32 + {80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Release|x64.ActiveCfg = Release|Win32 + {EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.All|Win32.ActiveCfg = Release|Win32 + {EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.All|Win32.Build.0 = Release|Win32 + {EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.All|x64.ActiveCfg = Release|Win32 + {EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Debug|Win32.ActiveCfg = Debug|Win32 + {EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Debug|Win32.Build.0 = Debug|Win32 + {EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Debug|x64.ActiveCfg = Debug|Win32 + {EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Release|Win32.ActiveCfg = Release|Win32 + {EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Release|Win32.Build.0 = Release|Win32 + {EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Release|x64.ActiveCfg = Release|Win32 + {A349379F-0FEA-49C8-9535-05F39663337B}.All|Win32.ActiveCfg = Release|Win32 + {A349379F-0FEA-49C8-9535-05F39663337B}.All|Win32.Build.0 = Release|Win32 + {A349379F-0FEA-49C8-9535-05F39663337B}.All|x64.ActiveCfg = Release|Win32 + {A349379F-0FEA-49C8-9535-05F39663337B}.Debug|Win32.ActiveCfg = Debug|Win32 + {A349379F-0FEA-49C8-9535-05F39663337B}.Debug|Win32.Build.0 = Debug|Win32 + {A349379F-0FEA-49C8-9535-05F39663337B}.Debug|x64.ActiveCfg = Debug|Win32 + {A349379F-0FEA-49C8-9535-05F39663337B}.Release|Win32.ActiveCfg = Release|Win32 + {A349379F-0FEA-49C8-9535-05F39663337B}.Release|Win32.Build.0 = Release|Win32 + {A349379F-0FEA-49C8-9535-05F39663337B}.Release|x64.ActiveCfg = Release|Win32 + {2B0D705C-1CF2-401C-BFBC-A43FB806908C}.All|Win32.ActiveCfg = Release|Win32 + {2B0D705C-1CF2-401C-BFBC-A43FB806908C}.All|Win32.Build.0 = Release|Win32 + {2B0D705C-1CF2-401C-BFBC-A43FB806908C}.All|x64.ActiveCfg = Release|Win32 + {2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Debug|Win32.ActiveCfg = Debug|Win32 + {2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Debug|Win32.Build.0 = Debug|Win32 + {2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Debug|x64.ActiveCfg = Debug|Win32 + {2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Release|Win32.ActiveCfg = Release|Win32 + {2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Release|Win32.Build.0 = Release|Win32 + {2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Release|x64.ActiveCfg = Release|Win32 + {C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.All|Win32.ActiveCfg = Release|Win32 + {C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.All|Win32.Build.0 = Release|Win32 + {C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.All|x64.ActiveCfg = Release|Win32 + {C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Debug|Win32.ActiveCfg = Debug|Win32 + {C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Debug|Win32.Build.0 = Debug|Win32 + {C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Debug|x64.ActiveCfg = Debug|Win32 + {C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Release|Win32.ActiveCfg = Release|Win32 + {C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Release|Win32.Build.0 = Release|Win32 + {C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Release|x64.ActiveCfg = Release|Win32 + {F290BADE-82DE-4037-B49D-D563E43169DA}.All|Win32.ActiveCfg = All|Win32 + {F290BADE-82DE-4037-B49D-D563E43169DA}.All|Win32.Build.0 = All|Win32 + {F290BADE-82DE-4037-B49D-D563E43169DA}.All|x64.ActiveCfg = All|Win32 + {F290BADE-82DE-4037-B49D-D563E43169DA}.Debug|Win32.ActiveCfg = All|Win32 + {F290BADE-82DE-4037-B49D-D563E43169DA}.Debug|Win32.Build.0 = All|Win32 + {F290BADE-82DE-4037-B49D-D563E43169DA}.Debug|x64.ActiveCfg = All|Win32 + {F290BADE-82DE-4037-B49D-D563E43169DA}.Release|Win32.ActiveCfg = All|Win32 + {F290BADE-82DE-4037-B49D-D563E43169DA}.Release|Win32.Build.0 = All|Win32 + {F290BADE-82DE-4037-B49D-D563E43169DA}.Release|x64.ActiveCfg = All|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/libspandsp.2008.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/libspandsp.2008.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,430 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/libspandsp.dsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/libspandsp.dsp Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,967 @@ +# Microsoft Developer Studio Project File - Name="spandsp" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=spandsp - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "spandsp.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "spandsp.mak" CFG="spandsp - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "spandsp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "spandsp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "spandsp - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /D "_WINDLL" /FR /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /map /debug /machine:I386 /out:"Release/libspandsp.dll" + +!ELSEIF "$(CFG)" == "spandsp - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /FR /FD /GZ /c +# SUBTRACT CPP /WX /YX +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug/libspandsp.dll" /pdbtype:sept +# SUBTRACT LINK32 /nodefaultlib + +!ENDIF + +# Begin Target + +# Name "spandsp - Win32 Release" +# Name "spandsp - Win32 Debug" +# Begin Group "Source Files" +# Begin Source File + +SOURCE=.\adsi.c +# End Source File +# Begin Source File + +SOURCE=.\async.c +# End Source File +# Begin Source File + +SOURCE=.\at_interpreter.c +# End Source File +# Begin Source File + +SOURCE=.\awgn.c +# End Source File +# Begin Source File + +SOURCE=.\bell_r2_mf.c +# End Source File +# Begin Source File + +SOURCE=.\bert.c +# End Source File +# Begin Source File + +SOURCE=.\bit_operations.c +# End Source File +# Begin Source File + +SOURCE=.\bitstream.c +# End Source File +# Begin Source File + +SOURCE=.\complex_filters.c +# End Source File +# Begin Source File + +SOURCE=.\complex_vector_float.c +# End Source File +# Begin Source File + +SOURCE=.\complex_vector_int.c +# End Source File +# Begin Source File + +SOURCE=.\crc.c +# End Source File +# Begin Source File + +SOURCE=.\dds_float.c +# End Source File +# Begin Source File + +SOURCE=.\dds_int.c +# End Source File +# Begin Source File + +SOURCE=.\dtmf.c +# End Source File +# Begin Source File + +SOURCE=.\echo.c +# End Source File +# Begin Source File + +SOURCE=.\fax.c +# End Source File +# Begin Source File + +SOURCE=.\fax_modems.c +# End Source File +# Begin Source File + +SOURCE=.\fsk.c +# End Source File +# Begin Source File + +SOURCE=.\g711.c +# End Source File +# Begin Source File + +SOURCE=.\g722.c +# End Source File +# Begin Source File + +SOURCE=.\g726.c +# End Source File +# Begin Source File + +SOURCE=.\gsm0610_decode.c +# End Source File +# Begin Source File + +SOURCE=.\gsm0610_encode.c +# End Source File +# Begin Source File + +SOURCE=.\gsm0610_long_term.c +# End Source File +# Begin Source File + +SOURCE=.\gsm0610_lpc.c +# End Source File +# Begin Source File + +SOURCE=.\gsm0610_preprocess.c +# End Source File +# Begin Source File + +SOURCE=.\gsm0610_rpe.c +# End Source File +# Begin Source File + +SOURCE=.\gsm0610_short_term.c +# End Source File +# Begin Source File + +SOURCE=.\hdlc.c +# End Source File +# Begin Source File + +SOURCE=.\ima_adpcm.c +# End Source File +# Begin Source File + +SOURCE=.\logging.c +# End Source File +# Begin Source File + +SOURCE=.\lpc10_analyse.c +# End Source File +# Begin Source File + +SOURCE=.\lpc10_decode.c +# End Source File +# Begin Source File + +SOURCE=.\lpc10_encode.c +# End Source File +# Begin Source File + +SOURCE=.\lpc10_placev.c +# End Source File +# Begin Source File + +SOURCE=.\lpc10_voicing.c +# End Source File +# Begin Source File + +SOURCE=.\modem_echo.c +# End Source File +# Begin Source File + +SOURCE=.\modem_connect_tones.c +# End Source File +# Begin Source File + +SOURCE=.\noise.c +# End Source File +# Begin Source File + +SOURCE=.\oki_adpcm.c +# End Source File +# Begin Source File + +SOURCE=.\playout.c +# End Source File +# Begin Source File + +SOURCE=.\plc.c +# End Source File +# Begin Source File + +SOURCE=.\power_meter.c +# End Source File +# Begin Source File + +SOURCE=.\queue.c +# End Source File +# Begin Source File + +SOURCE=.\schedule.c +# End Source File +# Begin Source File + +SOURCE=.\sig_tone.c +# End Source File +# Begin Source File + +SOURCE=.\silence_gen.c +# End Source File +# Begin Source File + +SOURCE=.\super_tone_rx.c +# End Source File +# Begin Source File + +SOURCE=.\super_tone_tx.c +# End Source File +# Begin Source File + +SOURCE=.\swept_tone.c +# End Source File +# Begin Source File + +SOURCE=.\t4_rx.c +# End Source File +# Begin Source File + +SOURCE=.\t4_tx.c +# End Source File +# Begin Source File + +SOURCE=.\t30.c +# End Source File +# Begin Source File + +SOURCE=.\t30_api.c +# End Source File +# Begin Source File + +SOURCE=.\t30_logging.c +# End Source File +# Begin Source File + +SOURCE=.\t31.c +# End Source File +# Begin Source File + +SOURCE=.\t35.c +# End Source File +# Begin Source File + +SOURCE=.\t38_core.c +# End Source File +# Begin Source File + +SOURCE=.\t38_gateway.c +# End Source File +# Begin Source File + +SOURCE=.\t38_non_ecm_buffer.c +# End Source File +# Begin Source File + +SOURCE=.\t38_terminal.c +# End Source File +# Begin Source File + +SOURCE=.\testcpuid.c +# End Source File +# Begin Source File + +SOURCE=.\time_scale.c +# End Source File +# Begin Source File + +SOURCE=.\tone_detect.c +# End Source File +# Begin Source File + +SOURCE=.\tone_generate.c +# End Source File +# Begin Source File + +SOURCE=.\v17rx.c +# End Source File +# Begin Source File + +SOURCE=.\v17tx.c +# End Source File +# Begin Source File + +SOURCE=.\v18.c +# End Source File +# Begin Source File + +SOURCE=.\v22bis_rx.c +# End Source File +# Begin Source File + +SOURCE=.\v22bis_tx.c +# End Source File +# Begin Source File + +SOURCE=.\v27ter_rx.c +# End Source File +# Begin Source File + +SOURCE=.\v27ter_tx.c +# End Source File +# Begin Source File + +SOURCE=.\v29rx.c +# End Source File +# Begin Source File + +SOURCE=.\v29tx.c +# End Source File +# Begin Source File + +SOURCE=.\v42.c +# End Source File +# Begin Source File + +SOURCE=.\v42bis.c +# End Source File +# Begin Source File + +SOURCE=.\v8.c +# End Source File +# Begin Source File + +SOURCE=.\vector_float.c +# End Source File +# Begin Source File + +SOURCE=.\vector_int.c +# End Source File +# Begin Source File + +SOURCE=.\.\msvc\gettimeofday.c +# End Source File +# End Group +# Begin Group "Header Files" +# Begin Source File + +SOURCE=.\spandsp/adsi.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/async.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/arctan2.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/at_interpreter.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/awgn.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/bell_r2_mf.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/bert.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/biquad.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/bit_operations.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/bitstream.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/crc.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/complex.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/complex_filters.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/complex_vector_float.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/complex_vector_int.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/dc_restore.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/dds.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/dtmf.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/echo.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/fast_convert.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/fax.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/fax_modems.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/fir.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/fsk.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/g168models.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/g711.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/g722.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/g726.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/gsm0610.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/hdlc.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/ima_adpcm.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/logging.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/lpc10.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/modem_echo.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/modem_connect_tones.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/noise.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/oki_adpcm.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/playout.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/plc.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/power_meter.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/queue.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/saturated.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/schedule.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/sig_tone.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/silence_gen.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/super_tone_rx.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/super_tone_tx.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/swept_tone.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/t4_rx.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/t4_tx.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/t30.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/t30_api.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/t30_fcf.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/t30_logging.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/t31.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/t35.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/t38_core.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/t38_gateway.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/t38_non_ecm_buffer.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/t38_terminal.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/telephony.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/time_scale.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/timing.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/tone_detect.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/tone_generate.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/v17rx.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/v17tx.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/v18.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/v22bis.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/v27ter_rx.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/v27ter_tx.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/v29rx.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/v29tx.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/v42.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/v42bis.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/v8.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/vector_float.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/vector_int.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/version.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/adsi.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/async.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/at_interpreter.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/awgn.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/bell_r2_mf.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/bert.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/bitstream.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/dtmf.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/echo.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/fax.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/fax_modems.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/fsk.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/g711.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/g722.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/g726.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/gsm0610.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/hdlc.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/ima_adpcm.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/logging.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/lpc10.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/modem_connect_tones.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/modem_echo.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/noise.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/oki_adpcm.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/queue.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/schedule.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/sig_tone.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/silence_gen.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/super_tone_rx.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/super_tone_tx.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/swept_tone.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/t30.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/t30_dis_dtc_dcs_bits.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/t31.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/t38_core.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/t38_gateway.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/t38_non_ecm_buffer.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/t38_terminal.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/t4_rx.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/t4_tx.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/time_scale.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/tone_detect.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/tone_generate.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/v17rx.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/v17tx.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/v18.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/v22bis.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/v27ter_rx.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/v27ter_tx.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/v29rx.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/v29tx.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/v42.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/v42bis.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/private/v8.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp/expose.h +# End Source File +# Begin Source File + +SOURCE=.\spandsp.h +# End Source File +# End Group + +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/libtiff.2005.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/libtiff.2005.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,352 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/libtiff.2008.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/libtiff.2008.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,483 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/logging.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/logging.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,276 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * logging.c - error and debug logging. + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: logging.c,v 1.32 2009/02/10 17:44:18 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" + +#include "spandsp/private/logging.h" + +static void default_message_handler(int level, const char *text); + +static message_handler_func_t __span_message = &default_message_handler; +static error_handler_func_t __span_error = NULL; + +/* Note that this list *must* match the enum definition in logging.h */ +static const char *severities[] = +{ + "NONE", + "ERROR", + "WARNING", + "PROTOCOL_ERROR", + "PROTOCOL_WARNING", + "FLOW", + "FLOW 2", + "FLOW 3", + "DEBUG 1", + "DEBUG 2", + "DEBUG 3" +}; + +static void default_message_handler(int level, const char *text) +{ + fprintf(stderr, "%s", text); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) span_log_test(logging_state_t *s, int level) +{ + if (s && (s->level & SPAN_LOG_SEVERITY_MASK) >= (level & SPAN_LOG_SEVERITY_MASK)) + return TRUE; + return FALSE; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) span_log(logging_state_t *s, int level, const char *format, ...) +{ + char msg[1024 + 1]; + va_list arg_ptr; + int len; + struct tm *tim; + struct timeval nowx; + time_t now; + + if (span_log_test(s, level)) + { + va_start(arg_ptr, format); + len = 0; + if ((level & SPAN_LOG_SUPPRESS_LABELLING) == 0) + { + if ((s->level & SPAN_LOG_SHOW_DATE)) + { + gettimeofday(&nowx, NULL); + now = nowx.tv_sec; + tim = gmtime(&now); + len += snprintf(msg + len, + 1024 - len, + "%04d/%02d/%02d %02d:%02d:%02d.%03d ", + tim->tm_year + 1900, + tim->tm_mon + 1, + tim->tm_mday, + tim->tm_hour, + tim->tm_min, + tim->tm_sec, + (int) nowx.tv_usec/1000); + } + /*endif*/ + if ((s->level & SPAN_LOG_SHOW_SAMPLE_TIME)) + { + now = s->elapsed_samples/s->samples_per_second; + tim = gmtime(&now); + len += snprintf(msg + len, + 1024 - len, + "%02d:%02d:%02d.%03d ", + tim->tm_hour, + tim->tm_min, + tim->tm_sec, + (int) (s->elapsed_samples%s->samples_per_second)*1000/s->samples_per_second); + } + /*endif*/ + if ((s->level & SPAN_LOG_SHOW_SEVERITY) && (level & SPAN_LOG_SEVERITY_MASK) <= SPAN_LOG_DEBUG_3) + len += snprintf(msg + len, 1024 - len, "%s ", severities[level & SPAN_LOG_SEVERITY_MASK]); + /*endif*/ + if ((s->level & SPAN_LOG_SHOW_PROTOCOL) && s->protocol) + len += snprintf(msg + len, 1024 - len, "%s ", s->protocol); + /*endif*/ + if ((s->level & SPAN_LOG_SHOW_TAG) && s->tag) + len += snprintf(msg + len, 1024 - len, "%s ", s->tag); + /*endif*/ + } + /*endif*/ + len += vsnprintf(msg + len, 1024 - len, format, arg_ptr); + if (s->span_error && level == SPAN_LOG_ERROR) + s->span_error(msg); + else if (__span_error && level == SPAN_LOG_ERROR) + __span_error(msg); + else if (s->span_message) + s->span_message(level, msg); + else if (__span_message) + __span_message(level, msg); + /*endif*/ + va_end(arg_ptr); + return 1; + } + /*endif*/ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) span_log_buf(logging_state_t *s, int level, const char *tag, const uint8_t *buf, int len) +{ + char msg[1024]; + int i; + int msg_len; + + if (span_log_test(s, level)) + { + msg_len = 0; + if (tag) + msg_len += snprintf(msg + msg_len, 1024 - msg_len, "%s", tag); + for (i = 0; i < len && msg_len < 800; i++) + msg_len += snprintf(msg + msg_len, 1024 - msg_len, " %02x", buf[i]); + msg_len += snprintf(msg + msg_len, 1024 - msg_len, "\n"); + return span_log(s, level, msg); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) span_log_set_level(logging_state_t *s, int level) +{ + s->level = level; + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) span_log_set_tag(logging_state_t *s, const char *tag) +{ + s->tag = tag; + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) span_log_set_protocol(logging_state_t *s, const char *protocol) +{ + s->protocol = protocol; + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) span_log_set_sample_rate(logging_state_t *s, int samples_per_second) +{ + s->samples_per_second = samples_per_second; + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) span_log_bump_samples(logging_state_t *s, int samples) +{ + s->elapsed_samples += samples; + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) span_log_set_message_handler(logging_state_t *s, message_handler_func_t func) +{ + s->span_message = func; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) span_log_set_error_handler(logging_state_t *s, error_handler_func_t func) +{ + s->span_error = func; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) span_set_message_handler(message_handler_func_t func) +{ + __span_message = func; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) span_set_error_handler(error_handler_func_t func) +{ + __span_error = func; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(logging_state_t *) span_log_init(logging_state_t *s, int level, const char *tag) +{ + if (s == NULL) + { + if ((s = (logging_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + s->span_error = __span_error; + s->span_message = __span_message; + s->level = level; + s->tag = tag; + s->protocol = NULL; + s->samples_per_second = SAMPLE_RATE; + s->elapsed_samples = 0; + + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) span_log_release(logging_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) span_log_free(logging_state_t *s) +{ + if (s) + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/lpc10_analyse.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/lpc10_analyse.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,714 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * lpc10_analyse.c - LPC10 low bit rate speech codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * This code is based on the U.S. Department of Defense reference + * implementation of the LPC-10 2400 bps Voice Coder. They do not + * exert copyright claims on their code, and it may be freely used. + * + * $Id: lpc10_analyse.c,v 1.22 2009/01/28 03:41:27 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/dc_restore.h" +#include "spandsp/lpc10.h" +#include "spandsp/private/lpc10.h" + +#include "lpc10_encdecs.h" + +static __inline__ float energyf(float amp[], int len) +{ + int i; + float rms; + + rms = 0.0f; + for (i = 0; i < len; i++) + rms += amp[i]*amp[i]; + rms = sqrtf(rms/len); + return rms; +} +/*- End of function --------------------------------------------------------*/ + +static void remove_dc_bias(float speech[], int len, float sigout[]) +{ + float bias; + int i; + + bias = 0.0f; + for (i = 0; i < len; i++) + bias += speech[i]; + bias /= len; + for (i = 0; i < len; i++) + sigout[i] = speech[i] - bias; +} +/*- End of function --------------------------------------------------------*/ + +static void eval_amdf(float speech[], + int32_t lpita, + const int32_t tau[], + int32_t ltau, + int32_t maxlag, + float amdf[], + int32_t *minptr, + int32_t *maxptr) +{ + float sum; + int i; + int j; + int n1; + int n2; + + *minptr = 0; + *maxptr = 0; + for (i = 0; i < ltau; i++) + { + n1 = (maxlag - tau[i])/2 + 1; + n2 = n1 + lpita - 1; + sum = 0.0f; + for (j = n1; j <= n2; j += 4) + sum += fabsf(speech[j - 1] - speech[j + tau[i] - 1]); + amdf[i] = sum; + if (amdf[i] < amdf[*minptr]) + *minptr = i; + if (amdf[i] > amdf[*maxptr]) + *maxptr = i; + } +} +/*- End of function --------------------------------------------------------*/ + +static void eval_highres_amdf(float speech[], + int32_t lpita, + const int32_t tau[], + int32_t ltau, + float amdf[], + int32_t *minptr, + int32_t *maxptr, + int32_t *mintau) +{ + float amdf2[6]; + int32_t tau2[6]; + int32_t minp2; + int32_t ltau2; + int32_t maxp2; + int32_t minamd; + int i; + int i2; + int ptr; + + /* Compute full AMDF using log spaced lags, find coarse minimum */ + eval_amdf(speech, lpita, tau, ltau, tau[ltau - 1], amdf, minptr, maxptr); + *mintau = tau[*minptr]; + minamd = (int32_t) amdf[*minptr]; + + /* Build table containing all lags within +/- 3 of the AMDF minimum, + excluding all that have already been computed */ + ltau2 = 0; + ptr = *minptr - 2; + i2 = min(*mintau + 4, tau[ltau - 1]); + for (i = max(*mintau - 3, 41); i < i2; i++) + { + while (tau[ptr] < i) + ptr++; + if (tau[ptr] != i) + tau2[ltau2++] = i; + } + /* Compute AMDF of the new lags, if there are any, and choose one + if it is better than the coarse minimum */ + if (ltau2 > 0) + { + eval_amdf(speech, lpita, tau2, ltau2, tau[ltau - 1], amdf2, &minp2, &maxp2); + if (amdf2[minp2] < (float) minamd) + { + *mintau = tau2[minp2]; + minamd = (int32_t) amdf2[minp2]; + } + } + /* Check one octave up, if there are any lags not yet computed */ + if (*mintau >= 80) + { + i = *mintau/2; + if ((i & 1) == 0) + { + ltau2 = 2; + tau2[0] = i - 1; + tau2[1] = i + 1; + } + else + { + ltau2 = 1; + tau2[0] = i; + } + eval_amdf(speech, lpita, tau2, ltau2, tau[ltau - 1], amdf2, &minp2, &maxp2); + if (amdf2[minp2] < (float) minamd) + { + *mintau = tau2[minp2]; + minamd = (int32_t) amdf2[minp2]; + *minptr -= 20; + } + } + /* Force minimum of the AMDF array to the high resolution minimum */ + amdf[*minptr] = (float) minamd; + /* Find maximum of AMDF within 1/2 octave of minimum */ + *maxptr = max(*minptr - 5, 0); + i2 = min(*minptr + 6, ltau); + for (i = *maxptr; i < i2; i++) + { + if (amdf[i] > amdf[*maxptr]) + *maxptr = i; + } +} +/*- End of function --------------------------------------------------------*/ + +static void dynamic_pitch_tracking(lpc10_encode_state_t *s, + float amdf[], + int32_t ltau, + int32_t *minptr, + int32_t voice, + int32_t *pitch, + int32_t *midx) +{ + int32_t pbar; + float sbar; + int32_t path[2]; + int32_t i; + int32_t j; + float alpha; + float minsc; + float maxsc; + + /* Calculate the confidence factor ALPHA, used as a threshold slope in */ + /* SEESAW. If unvoiced, set high slope so that every point in P array */ + /*is marked as a potential pitch frequency. A scaled up version (ALPHAX )*/ + /* is used to maintain arithmetic precision. */ + if (voice == 1) + s->alphax = s->alphax*0.75f + amdf[*minptr - 1]*0.5f; + else + s->alphax *= 0.984375f; + alpha = s->alphax/16; + if (voice == 0 && s->alphax < 128.0f) + alpha = 8.0f; + /* SEESAW: Construct a pitch pointer array and intermediate winner function */ + /* Left to right pass: */ + s->p[s->ipoint][0] = 1; + pbar = 1; + sbar = s->s[0]; + for (i = 0; i < ltau; i++) + { + sbar += alpha; + if (sbar < s->s[i]) + { + s->s[i] = sbar; + } + else + { + pbar = i + 1; + sbar = s->s[i]; + } + s->p[s->ipoint][i] = pbar; + } + /* Right to left pass: */ + sbar = s->s[pbar - 1]; + for (i = pbar - 2; i >= 0; i--) + { + sbar += alpha; + if (sbar < s->s[i]) + { + s->s[i] = sbar; + s->p[s->ipoint][i] = pbar; + } + else + { + pbar = s->p[s->ipoint][i]; + i = pbar - 1; + sbar = s->s[i]; + } + } + /* Update S using AMDF */ + /* Find maximum, minimum, and location of minimum */ + s->s[0] += amdf[0]/2; + minsc = s->s[0]; + maxsc = minsc; + *midx = 1; + for (i = 1; i < ltau; i++) + { + s->s[i] += amdf[i]/2; + if (s->s[i] > maxsc) + maxsc = s->s[i]; + if (s->s[i] < minsc) + { + *midx = i + 1; + minsc = s->s[i]; + } + } + /* Subtract MINSC from S to prevent overflow */ + for (i = 0; i < ltau; i++) + s->s[i] -= minsc; + maxsc -= minsc; + /* Use higher octave pitch if significant null there */ + j = 0; + for (i = 20; i <= 40; i += 10) + { + if (*midx > i) + { + if (s->s[*midx - i - 1] < maxsc / 4) + j = i; + } + } + *midx -= j; + /* TRACE: look back two frames to find minimum cost pitch estimate */ + *pitch = *midx; + for (i = 0, j = s->ipoint; i < 2; i++, j++) + { + *pitch = s->p[j & 1][*pitch - 1]; + path[i] = *pitch; + } + + /* The following statement subtracts one from IPOINT, mod DEPTH. I */ + /* think the author chose to add DEPTH-1, instead of subtracting 1, */ + /* because then it will work even if MOD doesn't work as desired on */ + /* negative arguments. */ + s->ipoint = (s->ipoint + 1) & 1; +} +/*- End of function --------------------------------------------------------*/ + +/* Detection of onsets in (or slightly preceding) the futuremost frame of speech. */ +static void onset(lpc10_encode_state_t *s, + float *pebuf, + int32_t osbuf[], + int32_t *osptr, + int32_t oslen, + int32_t sbufl, + int32_t sbufh, + int32_t lframe) +{ + int32_t i; + float r1; + float l2sum2; + + pebuf -= sbufl; + + if (s->hyst) + s->lasti -= lframe; + for (i = sbufh - lframe + 1; i <= sbufh; i++) + { + /* Compute FPC; Use old FPC on divide by zero; Clamp FPC to +/- 1. */ + s->n = (pebuf[i]*pebuf[i - 1] + s->n*63.0f)/64.0f; + /* Computing 2nd power */ + r1 = pebuf[i - 1]; + s->d__ = (r1*r1 + s->d__*63.0f)/64.0f; + if (s->d__ != 0.0f) + { + if (fabsf(s->n) > s->d__) + s->fpc = r_sign(1.0f, s->n); + else + s->fpc = s->n/s->d__; + } + /* Filter FPC */ + l2sum2 = s->l2buf[s->l2ptr1 - 1]; + s->l2sum1 = s->l2sum1 - s->l2buf[s->l2ptr2 - 1] + s->fpc; + s->l2buf[s->l2ptr2 - 1] = s->l2sum1; + s->l2buf[s->l2ptr1 - 1] = s->fpc; + s->l2ptr1 = (s->l2ptr1 & 0xF) + 1; + s->l2ptr2 = (s->l2ptr2 & 0xF) + 1; + if (fabsf(s->l2sum1 - l2sum2) > 1.7f) + { + if (!s->hyst) + { + /* Ignore if buffer full */ + if (*osptr <= oslen) + { + osbuf[*osptr - 1] = i - 9; + (*osptr)++; + } + s->hyst = TRUE; + } + s->lasti = i; + /* After one onset detection, at least OSHYST sample times must go */ + /* by before another is allowed to occur. */ + } + else if (s->hyst && i - s->lasti >= 10) + { + s->hyst = FALSE; + } + } +} +/*- End of function --------------------------------------------------------*/ + +/* Load a covariance matrix. */ +static void mload(int32_t order, int32_t awins, int32_t awinf, float speech[], float phi[], float psi[]) +{ + int32_t start; + int i; + int r; + + start = awins + order; + for (r = 1; r <= order; r++) + { + phi[r - 1] = 0.0f; + for (i = start; i <= awinf; i++) + phi[r - 1] += speech[i - 2]*speech[i - r - 1]; + } + + /* Load last element of vector PSI */ + psi[order - 1] = 0.0f; + for (i = start - 1; i < awinf; i++) + psi[order - 1] += speech[i]*speech[i - order]; + /* End correct to get additional columns of phi */ + for (r = 1; r < order; r++) + { + for (i = 1; i <= r; i++) + { + phi[i*order + r] = phi[(i - 1)*order + r - 1] + - speech[awinf - (r + 1)]*speech[awinf - (i + 1)] + + speech[start - (r + 2)]*speech[start - (i + 2)]; + } + } + /* End correct to get additional elements of PSI */ + for (i = 0; i < order - 1; i++) + { + psi[i] = phi[i + 1] + - speech[start - 2]*speech[start - i - 3] + + speech[awinf - 1]*speech[awinf - i - 2]; + } +} +/*- End of function --------------------------------------------------------*/ + +/* Preemphasize speech with a single-zero filter. */ +/* (When coef = .9375, preemphasis is as in LPC43.) */ +static float preemp(float inbuf[], float pebuf[], int nsamp, float coeff, float z) +{ + float temp; + int i; + + for (i = 0; i < nsamp; i++) + { + temp = inbuf[i] - coeff*z; + z = inbuf[i]; + pebuf[i] = temp; + } + return z; +} +/*- End of function --------------------------------------------------------*/ + +/* Invert a covariance matrix using Choleski decomposition method. */ +static void invert(int32_t order, float phi[], float psi[], float rc[]) +{ + float r1; + int32_t i; + int32_t j; + int32_t k; + float v[10][10]; + + for (j = 0; j < order; j++) + { + for (i = j; i < order; i++) + v[j][i] = phi[i + j*order]; + for (k = 0; k < j; k++) + { + r1 = v[k][j]*v[k][k]; + for (i = j; i <= order; i++) + v[j][i] -= v[k][i]*r1; + } + /* Compute intermediate results, which are similar to RC's */ + if (fabsf(v[j][j]) < 1.0e-10f) + { + for (i = j; i < order; i++) + rc[i] = 0.0f; + return; + } + rc[j] = psi[j]; + for (k = 0; k < j; k++) + rc[j] -= rc[k]*v[k][j]; + v[j][j] = 1.0f/v[j][j]; + rc[j] *= v[j][j]; + r1 = min(rc[j], 0.999f); + rc[j] = max(r1, -0.999f); + } +} +/*- End of function --------------------------------------------------------*/ + +/* Check RC's, repeat previous frame's RC's if unstable */ +static int rcchk(int order, float rc1f[], float rc2f[]) +{ + int i; + + for (i = 0; i < order; i++) + { + if (fabsf(rc2f[i]) > 0.99f) + { + for (i = 0; i < order; i++) + rc2f[i] = rc1f[i]; + break; + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void lpfilt(float inbuf[], float lpbuf[], int32_t len, int32_t nsamp) +{ + int32_t j; + float t; + + /* 31 point equiripple FIR LPF */ + /* Linear phase, delay = 15 samples */ + /* Passband: ripple = 0.25 dB, cutoff = 800 Hz */ + /* Stopband: atten. = 40. dB, cutoff = 1240 Hz */ + + for (j = len - nsamp; j < len; j++) + { + t = (inbuf[j] + inbuf[j - 30]) * -0.0097201988f; + t += (inbuf[j - 1] + inbuf[j - 29]) * -0.0105179986f; + t += (inbuf[j - 2] + inbuf[j - 28]) * -0.0083479648f; + t += (inbuf[j - 3] + inbuf[j - 27]) * 5.860774e-4f; + t += (inbuf[j - 4] + inbuf[j - 26]) * 0.0130892089f; + t += (inbuf[j - 5] + inbuf[j - 25]) * 0.0217052232f; + t += (inbuf[j - 6] + inbuf[j - 24]) * 0.0184161253f; + t += (inbuf[j - 7] + inbuf[j - 23]) * 3.39723e-4f; + t += (inbuf[j - 8] + inbuf[j - 22]) * -0.0260797087f; + t += (inbuf[j - 9] + inbuf[j - 21]) * -0.0455563702f; + t += (inbuf[j - 10] + inbuf[j - 20]) * -0.040306855f; + t += (inbuf[j - 11] + inbuf[j - 19]) * 5.029835e-4f; + t += (inbuf[j - 12] + inbuf[j - 18]) * 0.0729262903f; + t += (inbuf[j - 13] + inbuf[j - 17]) * 0.1572008878f; + t += (inbuf[j - 14] + inbuf[j - 16]) * 0.2247288674f; + t += inbuf[j - 15] * 0.250535965f; + lpbuf[j] = t; + } +} +/*- End of function --------------------------------------------------------*/ + +/* 2nd order inverse filter, speech is decimated 4:1 */ +static void ivfilt(float lpbuf[], float ivbuf[], int32_t len, int32_t nsamp, float ivrc[]) +{ + int32_t i; + int32_t j; + int32_t k; + float r[3]; + float pc1; + float pc2; + + /* Calculate autocorrelations */ + for (i = 1; i <= 3; i++) + { + r[i - 1] = 0.0f; + k = (i - 1) << 2; + for (j = (i << 2) + len - nsamp; j <= len; j += 2) + r[i - 1] += lpbuf[j - 1]*lpbuf[j - k - 1]; + } + /* Calculate predictor coefficients */ + pc1 = 0.0f; + pc2 = 0.0f; + ivrc[0] = 0.0f; + ivrc[1] = 0.0f; + if (r[0] > 1.0e-10f) + { + ivrc[0] = r[1]/r[0]; + ivrc[1] = (r[2] - ivrc[0]*r[1])/(r[0] - ivrc[0]*r[1]); + pc1 = ivrc[0] - ivrc[0]*ivrc[1]; + pc2 = ivrc[1]; + } + /* Inverse filter LPBUF into IVBUF */ + for (i = len - nsamp; i < len; i++) + ivbuf[i] = lpbuf[i] - pc1*lpbuf[i - 4] - pc2*lpbuf[i - 8]; +} +/*- End of function --------------------------------------------------------*/ + +void lpc10_analyse(lpc10_encode_state_t *s, float speech[], int32_t voice[], int32_t *pitch, float *rms, float rc[]) +{ + static const int32_t tau[60] = + { + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, + 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 84, 88, 92, 96, + 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, + 148, 152, 156 + }; + static const int32_t buflim[4] = + { + 181, 720, 25, 720 + }; + static const float precoef = 0.9375f; + + float amdf[60]; + float abuf[156]; + float ivrc[2]; + float temp; + float phi[100] /* was [10][10] */; + float psi[10]; + int32_t half; + int32_t midx; + int32_t ewin[3][2]; + int32_t i; + int32_t j; + int32_t lanal; + int32_t ipitch; + int32_t mintau; + int32_t minptr; + int32_t maxptr; + + /* Calculations are done on future frame due to requirements + of the pitch tracker. Delay RMS and RC's 2 frames to give + current frame parameters on return. */ + + for (i = 0; i <= 720 - LPC10_SAMPLES_PER_FRAME - 181; i++) + { + s->inbuf[i] = s->inbuf[LPC10_SAMPLES_PER_FRAME + i]; + s->pebuf[i] = s->pebuf[LPC10_SAMPLES_PER_FRAME + i]; + } + for (i = 0; i <= 540 - LPC10_SAMPLES_PER_FRAME - 229; i++) + s->ivbuf[i] = s->ivbuf[LPC10_SAMPLES_PER_FRAME + i]; + for (i = 0; i <= 720 - LPC10_SAMPLES_PER_FRAME - 25; i++) + s->lpbuf[i] = s->lpbuf[LPC10_SAMPLES_PER_FRAME + i]; + for (i = 0, j = 0; i < s->osptr - 1; i++) + { + if (s->osbuf[i] > LPC10_SAMPLES_PER_FRAME) + s->osbuf[j++] = s->osbuf[i] - LPC10_SAMPLES_PER_FRAME; + } + s->osptr = j + 1; + s->voibuf[0][0] = s->voibuf[1][0]; + s->voibuf[0][1] = s->voibuf[1][1]; + for (i = 0; i < 2; i++) + { + s->vwin[i][0] = s->vwin[i + 1][0] - LPC10_SAMPLES_PER_FRAME; + s->vwin[i][1] = s->vwin[i + 1][1] - LPC10_SAMPLES_PER_FRAME; + s->awin[i][0] = s->awin[i + 1][0] - LPC10_SAMPLES_PER_FRAME; + s->awin[i][1] = s->awin[i + 1][1] - LPC10_SAMPLES_PER_FRAME; + s->obound[i] = s->obound[i + 1]; + s->voibuf[i + 1][0] = s->voibuf[i + 2][0]; + s->voibuf[i + 1][1] = s->voibuf[i + 2][1]; + s->rmsbuf[i] = s->rmsbuf[i + 1]; + for (j = 0; j < LPC10_ORDER; j++) + s->rcbuf[i][j] = s->rcbuf[i + 1][j]; + } + /* If the average value in the frame was over 1/4096 (after current + BIAS correction), then subtract that much more from samples in the + next frame. If the average value in the frame was under + -1/4096, add 1/4096 more to samples in next frame. In all other + cases, keep BIAS the same. */ + temp = 0.0f; + for (i = 0; i < LPC10_SAMPLES_PER_FRAME; i++) + { + s->inbuf[720 - 2*LPC10_SAMPLES_PER_FRAME + i] = speech[i]*4096.0f - s->bias; + temp += s->inbuf[720 - 2*LPC10_SAMPLES_PER_FRAME + i]; + } + if (temp > (float) LPC10_SAMPLES_PER_FRAME) + s->bias++; + else if (temp < (float) (-LPC10_SAMPLES_PER_FRAME)) + s->bias--; + /* Place voicing window */ + i = 721 - LPC10_SAMPLES_PER_FRAME; + s->zpre = preemp(&s->inbuf[i - 181], &s->pebuf[i - 181], LPC10_SAMPLES_PER_FRAME, precoef, s->zpre); + onset(s, s->pebuf, s->osbuf, &s->osptr, 10, 181, 720, LPC10_SAMPLES_PER_FRAME); + + lpc10_placev(s->osbuf, &s->osptr, 10, &s->obound[2], s->vwin, 3, LPC10_SAMPLES_PER_FRAME, 90, 156, 307, 462); + /* The Pitch Extraction algorithm estimates the pitch for a frame + of speech by locating the minimum of the average magnitude difference + function (AMDF). The AMDF operates on low-pass, inverse filtered + speech. (The low-pass filter is an 800 Hz, 19 tap, equiripple, FIR + filter and the inverse filter is a 2nd-order LPC filter.) The pitch + estimate is later refined by dynamic tracking. However, since some + of the tracking parameters are a function of the voicing decisions, + a voicing decision must precede the final pitch estimation. */ + /* See subroutines LPFILT, IVFILT, and eval_highres_amdf. */ + /* LPFILT reads indices LBUFH-LFRAME-29 = 511 through LBUFH = 720 + of INBUF, and writes indices LBUFH+1-LFRAME = 541 through LBUFH + = 720 of LPBUF. */ + lpfilt(&s->inbuf[228], &s->lpbuf[384], 312, LPC10_SAMPLES_PER_FRAME); + /* IVFILT reads indices (PWINH-LFRAME-7) = 353 through PWINH = 540 + of LPBUF, and writes indices (PWINH-LFRAME+1) = 361 through + PWINH = 540 of IVBUF. */ + ivfilt(&s->lpbuf[204], s->ivbuf, 312, LPC10_SAMPLES_PER_FRAME, ivrc); + /* eval_highres_amdf reads indices PWINL = 229 through + (PWINL-1)+MAXWIN+(TAU(LTAU)-TAU(1))/2 = 452 of IVBUF, and writes + indices 1 through LTAU = 60 of AMDF. */ + eval_highres_amdf(s->ivbuf, 156, tau, 60, amdf, &minptr, &maxptr, &mintau); + /* Voicing decisions are made for each half frame of input speech. + An initial voicing classification is made for each half of the + analysis frame, and the voicing decisions for the present frame + are finalized. See subroutine VOICIN. */ + /* The voicing detector (VOICIN) classifies the input signal as + unvoiced (including silence) or voiced using the AMDF windowed + maximum-to-minimum ratio, the zero crossing rate, energy measures, + reflection coefficients, and prediction gains. */ + /* The pitch and voicing rules apply smoothing and isolated + corrections to the pitch and voicing estimates and, in the process, + introduce two frames of delay into the corrected pitch estimates and + voicing decisions. */ + for (half = 0; half < 2; half++) + { + lpc10_voicing(s, + &s->vwin[2][0], + s->inbuf, + s->lpbuf, + buflim, + half, + &amdf[minptr], + &amdf[maxptr], + &mintau, + ivrc, + s->obound); + } + /* Find the minimum cost pitch decision over several frames, + given the current voicing decision and the AMDF array */ + minptr++; + dynamic_pitch_tracking(s, amdf, 60, &minptr, s->voibuf[3][1], pitch, &midx); + ipitch = tau[midx - 1]; + /* Place spectrum analysis and energy windows */ + lpc10_placea(&ipitch, s->voibuf, &s->obound[2], 3, s->vwin, s->awin, ewin, LPC10_SAMPLES_PER_FRAME, 156); + /* Remove short term DC bias over the analysis window. */ + lanal = s->awin[2][1] + 1 - s->awin[2][0]; + remove_dc_bias(&s->pebuf[s->awin[2][0] - 181], lanal, abuf); + /* Compute RMS over integer number of pitch periods within the analysis window. */ + /* Note that in a hardware implementation this computation may be + simplified by using diagonal elements of phi computed by mload(). */ + s->rmsbuf[2] = energyf(&abuf[ewin[2][0] - s->awin[2][0]], ewin[2][1] - ewin[2][0] + 1); + /* Matrix load and invert, check RC's for stability */ + mload(LPC10_ORDER, 1, lanal, abuf, phi, psi); + invert(LPC10_ORDER, phi, psi, &s->rcbuf[2][0]); + rcchk(LPC10_ORDER, &s->rcbuf[1][0], &s->rcbuf[2][0]); + /* Set return parameters */ + voice[0] = s->voibuf[1][0]; + voice[1] = s->voibuf[1][1]; + *rms = s->rmsbuf[0]; + for (i = 0; i < LPC10_ORDER; i++) + rc[i] = s->rcbuf[0][i]; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/lpc10_decode.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/lpc10_decode.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1117 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * lpc10_decode.c - LPC10 low bit rate speech codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * This code is based on the U.S. Department of Defense reference + * implementation of the LPC-10 2400 bps Voice Coder. They do not + * exert copyright claims on their code, and it may be freely used. + * + * $Id: lpc10_decode.c,v 1.27.4.1 2009/12/24 17:00:19 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/dc_restore.h" +#include "spandsp/lpc10.h" +#include "spandsp/private/lpc10.h" + +#define LPC10_ORDER 10 + +#if !defined(min) +#define min(a,b) ((a) <= (b) ? (a) : (b)) +#endif +#if !defined(max) +#define max(a,b) ((a) >= (b) ? (a) : (b)) +#endif + +/* Pseudo random number generator based on Knuth, Vol 2, p. 27. */ +/* lpc10_random - int32_t variable, uniformly distributed over -32768 to 32767 */ +static int32_t lpc10_random(lpc10_decode_state_t *s) +{ + int32_t ret_val; + + /* The following is a 16 bit 2's complement addition, + with overflow checking disabled */ + s->y[s->k] += s->y[s->j]; + ret_val = s->y[s->k]; + if (--s->k < 0) + s->k = 4; + if (--s->j < 0) + s->j = 4; + return ret_val; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int32_t pow_ii(int32_t x, int32_t n) +{ + int32_t pow; + uint32_t u; + + if (n <= 0) + { + if (n == 0 || x == 1) + return 1; + if (x != -1) + return (x == 0) ? 1/x : 0; + n = -n; + } + u = n; + for (pow = 1; ; ) + { + if ((u & 1)) + pow *= x; + if ((u >>= 1) == 0) + break; + x *= x; + } + return pow; +} +/*- End of function --------------------------------------------------------*/ + +/* Synthesize one pitch epoch */ +static void bsynz(lpc10_decode_state_t *s, + float coef[], + int32_t ip, + int32_t *iv, + float sout[], + float rms, + float ratio, + float g2pass) +{ + static const int32_t kexc[25] = + { + 8, -16, 26, -48, 86, -162, 294, -502, 718, -728, 184, + 672, -610, -672, 184, 728, 718, 502, 294, 162, 86, 48, 26, 16, 8 + }; + int32_t i; + int32_t j; + int32_t k; + int32_t px; + float noise[166]; + float pulse; + float r1; + float gain; + float xssq; + float sscale; + float xy; + float sum; + float ssq; + float lpi0; + float hpi0; + + /* MAXPIT + MAXORD = 166 */ + /* Calculate history scale factor XY and scale filter state */ + /* Computing MIN */ + r1 = s->rmso_bsynz/(rms + 1.0e-6f); + xy = min(r1, 8.0f); + s->rmso_bsynz = rms; + for (i = 0; i < LPC10_ORDER; i++) + s->exc2[i] = s->exc2[s->ipo + i]*xy; + s->ipo = ip; + if (*iv == 0) + { + /* Generate white noise for unvoiced */ + for (i = 0; i < ip; i++) + s->exc[LPC10_ORDER + i] = (float) (lpc10_random(s)/64); + /* Impulse double excitation for plosives */ + px = (lpc10_random(s) + 32768)*(ip - 1)/65536 + LPC10_ORDER + 1; + r1 = ratio/4.0f; + pulse = r1*342; + if (pulse > 2.0e3f) + pulse = 2.0e3f; + s->exc[px - 1] += pulse; + s->exc[px] -= pulse; + } + else + { + sscale = sqrtf((float) ip)/6.928f; + for (i = 0; i < ip; i++) + { + s->exc[LPC10_ORDER + i] = 0.0f; + if (i < 25) + s->exc[LPC10_ORDER + i] = sscale*kexc[i]; + lpi0 = s->exc[LPC10_ORDER + i]; + s->exc[LPC10_ORDER + i] = s->exc[LPC10_ORDER + i]*0.125f + s->lpi[0]*0.75f + s->lpi[1]*0.125f; + s->lpi[1] = s->lpi[0]; + s->lpi[0] = lpi0; + } + for (i = 0; i < ip; i++) + { + noise[LPC10_ORDER + i] = lpc10_random(s)/64.0f; + hpi0 = noise[LPC10_ORDER + i]; + noise[LPC10_ORDER + i] = noise[LPC10_ORDER + i]*-0.125f + s->hpi[0]*0.25f + s->hpi[1]*-0.125f; + s->hpi[1] = s->hpi[0]; + s->hpi[0] = hpi0; + } + for (i = 0; i < ip; i++) + s->exc[LPC10_ORDER + i] += noise[LPC10_ORDER + i]; + } + /* Synthesis filters: */ + /* Modify the excitation with all-zero filter 1 + G*SUM */ + xssq = 0.0f; + for (i = 0; i < ip; i++) + { + k = LPC10_ORDER + i; + sum = 0.0f; + for (j = 0; j < LPC10_ORDER; j++) + sum += coef[j]*s->exc[k - j - 1]; + sum *= g2pass; + s->exc2[k] = sum + s->exc[k]; + } + /* Synthesize using the all pole filter 1/(1 - SUM) */ + for (i = 0; i < ip; i++) + { + k = LPC10_ORDER + i; + sum = 0.0f; + for (j = 0; j < LPC10_ORDER; j++) + sum += coef[j]*s->exc2[k - j - 1]; + s->exc2[k] = sum + s->exc2[k]; + xssq += s->exc2[k]*s->exc2[k]; + } + /* Save filter history for next epoch */ + for (i = 0; i < LPC10_ORDER; i++) + { + s->exc[i] = s->exc[ip + i]; + s->exc2[i] = s->exc2[ip + i]; + } + /* Apply gain to match RMS */ + ssq = rms*rms*ip; + gain = sqrtf(ssq/xssq); + for (i = 0; i < ip; i++) + sout[i] = gain*s->exc2[LPC10_ORDER + i]; +} +/*- End of function --------------------------------------------------------*/ + +/* Synthesize a single pitch epoch */ +static int pitsyn(lpc10_decode_state_t *s, + int voice[], + int32_t *pitch, + float *rms, + float *rc, + int32_t ivuv[], + int32_t ipiti[], + float *rmsi, + float *rci, + int32_t *nout, + float *ratio) +{ + int32_t rci_dim1; + int32_t rci_offset; + int32_t i1; + int32_t i; + int32_t j; + int32_t vflag; + int32_t jused; + int32_t lsamp; + int32_t ip; + int32_t nl; + int32_t ivoice; + int32_t istart; + float r1; + float alrn; + float alro; + float yarc[10]; + float prop; + float slope; + float uvpit; + float xxy; + + rci_dim1 = LPC10_ORDER; + rci_offset = rci_dim1 + 1; + rci -= rci_offset; + + if (*rms < 1.0f) + *rms = 1.0f; + if (s->rmso < 1.0f) + s->rmso = 1.0f; + uvpit = 0.0f; + *ratio = *rms/(s->rmso + 8.0f); + if (s->first_pitsyn) + { + lsamp = 0; + ivoice = voice[1]; + if (ivoice == 0) + *pitch = LPC10_SAMPLES_PER_FRAME/4; + *nout = LPC10_SAMPLES_PER_FRAME / *pitch; + s->jsamp = LPC10_SAMPLES_PER_FRAME - *nout * *pitch; + + i1 = *nout; + for (i = 0; i < i1; i++) + { + for (j = 0; j < LPC10_ORDER; j++) + rci[j + (i + 1)*rci_dim1 + 1] = rc[j]; + ivuv[i] = ivoice; + ipiti[i] = *pitch; + rmsi[i] = *rms; + } + s->first_pitsyn = FALSE; + } + else + { + vflag = 0; + lsamp = LPC10_SAMPLES_PER_FRAME + s->jsamp; + slope = (*pitch - s->ipito)/(float) lsamp; + *nout = 0; + jused = 0; + istart = 1; + if (voice[0] == s->ivoico && voice[1] == voice[0]) + { + if (voice[1] == 0) + { + /* SSUV - - 0 , 0 , 0 */ + *pitch = LPC10_SAMPLES_PER_FRAME/4; + s->ipito = *pitch; + if (*ratio > 8.0f) + s->rmso = *rms; + } + /* SSVC - - 1 , 1 , 1 */ + slope = (*pitch - s->ipito)/(float) lsamp; + ivoice = voice[1]; + } + else + { + if (s->ivoico != 1) + { + if (s->ivoico == voice[0]) + { + /* UV2VC2 - - 0 , 0 , 1 */ + nl = lsamp - LPC10_SAMPLES_PER_FRAME/4; + } + else + { + /* UV2VC1 - - 0 , 1 , 1 */ + nl = lsamp - LPC10_SAMPLES_PER_FRAME*3/4; + } + ipiti[0] = nl/2; + ipiti[1] = nl - ipiti[0]; + ivuv[0] = 0; + ivuv[1] = 0; + rmsi[0] = s->rmso; + rmsi[1] = s->rmso; + for (i = 0; i < LPC10_ORDER; i++) + { + rci[i + rci_dim1 + 1] = s->rco[i]; + rci[i + (rci_dim1 << 1) + 1] = s->rco[i]; + s->rco[i] = rc[i]; + } + slope = 0.0f; + *nout = 2; + s->ipito = *pitch; + jused = nl; + istart = nl + 1; + ivoice = 1; + } + else + { + if (s->ivoico != voice[0]) + { + /* VC2UV1 - - 1 , 0 , 0 */ + lsamp = LPC10_SAMPLES_PER_FRAME/4 + s->jsamp; + } + else + { + /* VC2UV2 - - 1 , 1 , 0 */ + lsamp = LPC10_SAMPLES_PER_FRAME*3/4 + s->jsamp; + } + for (i = 0; i < LPC10_ORDER; i++) + { + yarc[i] = rc[i]; + rc[i] = s->rco[i]; + } + ivoice = 1; + slope = 0.0f; + vflag = 1; + } + } + /* Here is the value of most variables that are used below, depending on */ + /* the values of IVOICO, VOICE(1), and VOICE(2). VOICE(1) and VOICE(2) */ + /* are input arguments, and IVOICO is the value of VOICE(2) on the */ + /* previous call (see notes for the IF (NOUT .NE. 0) statement near the */ + /* end). Each of these three values is either 0 or 1. These three */ + /* values below are given as 3-bit long strings, in the order IVOICO, */ + /* VOICE(1), and VOICE(2). It appears that the code above assumes that */ + /* the bit sequences 010 and 101 never occur, but I wonder whether a */ + /* large enough number of bit errors in the channel could cause such a */ + /* thing to happen, and if so, could that cause NOUT to ever go over 11? */ + + /* Note that all of the 180 values in the table are floatly LFRAME, but */ + /* 180 has fewer characters, and it makes the table a little more */ + /* concrete. If LFRAME is ever changed, keep this in mind. Similarly, */ + /* 135's are 3*LFRAME/4, and 45's are LFRAME/4. If LFRAME is not a */ + /* multiple of 4, then the 135 for NL-JSAMP is actually LFRAME-LFRAME/4, */ + /* and the 45 for NL-JSAMP is actually LFRAME-3*LFRAME/4. */ + + /* Note that LSAMP-JSAMP is given as the variable. This was just for */ + /* brevity, to avoid adding "+JSAMP" to all of the column entries. */ + /* Similarly for NL-JSAMP. */ + + /* Variable | 000 001 011,010 111 110 100,101 */ + /* ------------+-------------------------------------------------- */ + /* ISTART | 1 NL+1 NL+1 1 1 1 */ + /* LSAMP-JSAMP | 180 180 180 180 135 45 */ + /* IPITO | 45 PITCH PITCH oldPITCH oldPITCH oldPITCH */ + /* SLOPE | 0 0 0 seebelow 0 0 */ + /* JUSED | 0 NL NL 0 0 0 */ + /* PITCH | 45 PITCH PITCH PITCH PITCH PITCH */ + /* NL-JSAMP | -- 135 45 -- -- -- */ + /* VFLAG | 0 0 0 0 1 1 */ + /* NOUT | 0 2 2 0 0 0 */ + /* IVOICE | 0 1 1 1 1 1 */ + + /* while_loop | once once once once twice twice */ + + /* ISTART | -- -- -- -- JUSED+1 JUSED+1 */ + /* LSAMP-JSAMP | -- -- -- -- 180 180 */ + /* IPITO | -- -- -- -- oldPITCH oldPITCH */ + /* SLOPE | -- -- -- -- 0 0 */ + /* JUSED | -- -- -- -- ?? ?? */ + /* PITCH | -- -- -- -- PITCH PITCH */ + /* NL-JSAMP | -- -- -- -- -- -- */ + /* VFLAG | -- -- -- -- 0 0 */ + /* NOUT | -- -- -- -- ?? ?? */ + /* IVOICE | -- -- -- -- 0 0 */ + + /* UVPIT is always 0.0 on the first pass through the DO WHILE (TRUE) + loop below. */ + + /* The only possible non-0 value of SLOPE (in column 111) is + (PITCH-IPITO)/FLOAT(LSAMP) */ + + /* Column 101 is identical to 100. Any good properties we can prove + for 100 will also hold for 101. Similarly for 010 and 011. */ + + /* synths() calls this subroutine with PITCH restricted to the range 20 to + 156. IPITO is similarly restricted to this range, after the first + call. IP below is also restricted to this range, given the + definitions of IPITO, SLOPE, UVPIT, and that I is in the range ISTART + to LSAMP. */ + + for (;;) + { + for (i = istart; i <= lsamp; i++) + { + r1 = s->ipito + slope*i; + ip = (int32_t) (r1 + 0.5f); + if (uvpit != 0.0f) + ip = (int32_t) uvpit; + if (ip <= i - jused) + { + ++(*nout); + ipiti[*nout - 1] = ip; + *pitch = ip; + ivuv[*nout - 1] = ivoice; + jused += ip; + prop = (jused - ip/2)/(float) lsamp; + for (j = 0; j < LPC10_ORDER; j++) + { + alro = logf((s->rco[j] + 1)/(1 - s->rco[j])); + alrn = logf((rc[j] + 1)/(1 - rc[j])); + xxy = alro + prop*(alrn - alro); + xxy = expf(xxy); + rci[j + *nout*rci_dim1 + 1] = (xxy - 1.0f)/(xxy + 1.0f); + } + rmsi[*nout - 1] = expf(logf(s->rmso) + prop*(logf(*rms) - logf(s->rmso))); + } + } + if (vflag != 1) + break; + + vflag = 0; + istart = jused + 1; + lsamp = LPC10_SAMPLES_PER_FRAME + s->jsamp; + slope = 0.0f; + ivoice = 0; + uvpit = (float) ((lsamp - istart)/2); + if (uvpit > 90.0f) + uvpit /= 2; + s->rmso = *rms; + for (i = 0; i < LPC10_ORDER; i++) + { + rc[i] = yarc[i]; + s->rco[i] = yarc[i]; + } + } + s->jsamp = lsamp - jused; + } + if (*nout != 0) + { + s->ivoico = voice[1]; + s->ipito = *pitch; + s->rmso = *rms; + for (i = 0; i < LPC10_ORDER; i++) + s->rco[i] = rc[i]; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void deemp(lpc10_decode_state_t *s, float x[], int len) +{ + int i; + float r1; + float dei0; + + for (i = 0; i < len; i++) + { + dei0 = x[i]; + r1 = x[i] - s->dei[0]*1.9998f + s->dei[1]; + x[i] = r1 + s->deo[0]*2.5f - s->deo[1]*2.0925f + s->deo[2]*0.585f; + s->dei[1] = s->dei[0]; + s->dei[0] = dei0; + s->deo[2] = s->deo[1]; + s->deo[1] = s->deo[0]; + s->deo[0] = x[i]; + } +} +/*- End of function --------------------------------------------------------*/ + +/* Convert reflection coefficients to predictor coefficients */ +static float reflection_coeffs_to_predictor_coeffs(float rc[], float pc[], float gprime) +{ + float temp[10]; + float g2pass; + int i; + int j; + + g2pass = 1.0f; + for (i = 0; i < LPC10_ORDER; i++) + g2pass *= 1.0f - rc[i]*rc[i]; + g2pass = gprime*sqrtf(g2pass); + pc[0] = rc[0]; + for (i = 1; i < LPC10_ORDER; i++) + { + for (j = 0; j < i; j++) + temp[j] = pc[j] - rc[i]*pc[i - j - 1]; + for (j = 0; j < i; j++) + pc[j] = temp[j]; + pc[i] = rc[i]; + } + return g2pass; +} +/*- End of function --------------------------------------------------------*/ + +static int synths(lpc10_decode_state_t *s, + int voice[], + int32_t *pitch, + float *rms, + float *rc, + float speech[]) +{ + int32_t i1; + int32_t ivuv[16]; + int32_t ipiti[16]; + int32_t nout; + int32_t i; + int32_t j; + float rmsi[16]; + float ratio; + float g2pass; + float pc[10]; + float rci[160]; + + i1 = min(*pitch, 156); + *pitch = max(i1, 20); + for (i = 0; i < LPC10_ORDER; i++) + rc[i] = max(min(rc[i], 0.99f), -0.99f); + pitsyn(s, voice, pitch, rms, rc, ivuv, ipiti, rmsi, rci, &nout, &ratio); + if (nout > 0) + { + for (j = 0; j < nout; j++) + { + /* Add synthesized speech for pitch period J to the end of s->buf. */ + g2pass = reflection_coeffs_to_predictor_coeffs(&rci[j*10], pc, 0.7f); + bsynz(s, pc, ipiti[j], &ivuv[j], &s->buf[s->buflen], rmsi[j], ratio, g2pass); + deemp(s, &s->buf[s->buflen], ipiti[j]); + s->buflen += ipiti[j]; + } + /* Copy first MAXFRM samples from BUF to output array speech (scaling them), + and then remove them from the beginning of s->buf. */ + + for (i = 0; i < LPC10_SAMPLES_PER_FRAME; i++) + speech[i] = s->buf[i]/4096.0f; + s->buflen -= LPC10_SAMPLES_PER_FRAME; + for (i = 0; i < s->buflen; i++) + s->buf[i] = s->buf[i + LPC10_SAMPLES_PER_FRAME]; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void lpc10_unpack(lpc10_frame_t *t, const uint8_t ibits[]) +{ + static const int bit[10] = + { + 2, 4, 8, 8, 8, 8, 16, 16, 16, 16 + }; + static const int iblist[53] = + { + 13, 12, 11, 1, 2, 13, 12, 11, 1, 2, + 13, 10, 11, 2, 1, 10, 13, 12, 11, 10, + 2, 13, 12, 11, 10, 2, 1, 12, 7, 6, + 1, 10, 9, 8, 7, 4, 6, 9, 8, 7, + 5, 1, 9, 8, 4, 6, 1, 5, 9, 8, + 7, 5, 6 + }; + int32_t itab[13]; + int x; + int i; + + /* ibits is 54 bits of LPC data ordered as follows: */ + /* R1-0, R2-0, R3-0, P-0, A-0, */ + /* R1-1, R2-1, R3-1, P-1, A-1, */ + /* R1-2, R4-0, R3-2, A-2, P-2, R4-1, */ + /* R1-3, R2-2, R3-3, R4-2, A-3, */ + /* R1-4, R2-3, R3-4, R4-3, A-4, */ + /* P-3, R2-4, R7-0, R8-0, P-4, R4-4, */ + /* R5-0, R6-0, R7-1,R10-0, R8-1, */ + /* R5-1, R6-1, R7-2, R9-0, P-5, */ + /* R5-2, R6-2,R10-1, R8-2, P-6, R9-1, */ + /* R5-3, R6-3, R7-3, R9-2, R8-3, SYNC */ + + /* Reconstruct ITAB */ + for (i = 0; i < 13; i++) + itab[i] = 0; + for (i = 0; i < 53; i++) + { + x = 52 - i; + x = (ibits[x >> 3] >> (7 - (x & 7))) & 1; + itab[iblist[52 - i] - 1] = (itab[iblist[52 - i] - 1] << 1) | x; + } + /* Sign extend the RC's */ + for (i = 0; i < LPC10_ORDER; i++) + { + if ((itab[i + 3] & bit[i])) + itab[i + 3] -= (bit[i] << 1); + } + /* Restore variables */ + t->ipitch = itab[0]; + t->irms = itab[1]; + for (i = 0; i < LPC10_ORDER; i++) + t->irc[i] = itab[LPC10_ORDER - 1 - i + 3]; +} +/*- End of function --------------------------------------------------------*/ + +/* Hamming 8, 4 decoder - can correct 1 out of seven bits + and can detect up to two errors. */ + +/* This subroutine is entered with an eight bit word in INPUT. The 8th */ +/* bit is parity and is stripped off. The remaining 7 bits address the */ +/* hamming 8, 4 table and the output OUTPUT from the table gives the 4 */ +/* bits of corrected data. If bit 4 is set, no error was detected. */ +/* ERRCNT is the number of errors counted. */ + +static int32_t hamming_84_decode(int32_t input, int *errcnt) +{ + static const uint8_t dactab[128] = + { + 16, 0, 0, 3, 0, 5, 14, 7, 0, 9, 14, 11, 14, 13, 30, 14, + 0, 9, 2, 7, 4, 7, 7, 23, 9, 25, 10, 9, 12, 9, 14, 7, + 0, 5, 2, 11, 5, 21, 6, 5, 8, 11, 11, 27, 12, 5, 14, 11, + 2, 1, 18, 2, 12, 5, 2, 7, 12, 9, 2, 11, 28, 12, 12, 15, + 0, 3, 3, 19, 4, 13, 6, 3, 8, 13, 10, 3, 13, 29, 14, 13, + 4, 1, 10, 3, 20, 4, 4, 7, 10, 9, 26, 10, 4, 13, 10, 15, + 8, 1, 6, 3, 6, 5, 22, 6, 24, 8, 8, 11, 8, 13, 6, 15, + 1, 17 , 2, 1, 4, 1, 6, 15, 8, 1, 10, 15, 12, 15, 15, 31 + }; + int i; + int parity; + int32_t output; + + parity = input & 255; + parity ^= parity >> 4; + parity ^= parity >> 2; + parity ^= parity >> 1; + parity &= 1; + i = dactab[input & 127]; + output = i & 15; + if ((i & 16)) + { + /* No errors detected in seven bits */ + if (parity) + (*errcnt)++; + } + else + { + /* One or two errors detected */ + (*errcnt)++; + if (parity == 0) + { + /* Two errors detected */ + (*errcnt)++; + output = -1; + } + } + return output; +} +/*- End of function --------------------------------------------------------*/ + +static int32_t median(int32_t d1, int32_t d2, int32_t d3) +{ + int32_t ret_val; + + ret_val = d2; + if (d2 > d1 && d2 > d3) + { + ret_val = d1; + if (d3 > d1) + ret_val = d3; + } + else if (d2 < d1 && d2 < d3) + { + ret_val = d1; + if (d3 < d1) + ret_val = d3; + } + return ret_val; +} +/*- End of function --------------------------------------------------------*/ + +static void decode(lpc10_decode_state_t *s, + lpc10_frame_t *t, + int voice[], + int32_t *pitch, + float *rms, + float rc[]) +{ + static const int32_t ivtab[32] = + { + 24960, 24960, 24960, 24960, 25480, 25480, 25483, 25480, + 16640, 1560, 1560, 1560, 16640, 1816, 1563, 1560, + 24960, 24960, 24859, 24856, 26001, 25881, 25915, 25913, + 1560, 1560, 7800, 3640, 1561, 1561, 3643, 3641 + }; + static const float corth[32] = + { + 32767.0f, 10.0f, 5.0f, 0.0f, 32767.0f, 8.0f, 4.0f, 0.0f, + 32.0f, 6.4f, 3.2f, 0.0f, 32.0f, 6.4f, 3.2f, 0.0f, + 32.0f, 11.2f, 6.4f, 0.0f, 32.0f, 11.2f, 6.4f, 0.0f, + 16.0f, 5.6f, 3.2f, 0.0f, 16.0f, 5.6f, 3.2f, 0.0f + }; + static const int32_t detau[128] = + { + 0, 0, 0, 3, 0, 3, 3, 31, + 0, 3, 3, 21, 3, 3, 29, 30, + 0, 3, 3, 20, 3, 25, 27, 26, + 3, 23, 58, 22, 3, 24, 28, 3, + 0, 3, 3, 3, 3, 39, 33, 32, + 3, 37, 35, 36, 3, 38, 34, 3, + 3, 42, 46, 44, 50, 40, 48, 3, + 54, 3, 56, 3, 52, 3, 3, 1, + 0, 3, 3, 108, 3, 78, 100, 104, + 3, 84, 92, 88, 156, 80, 96, 3, + 3, 74, 70, 72, 66, 76, 68, 3, + 62, 3, 60, 3, 64, 3, 3, 1, + 3, 116, 132, 112, 148, 152, 3, 3, + 140, 3, 136, 3, 144, 3, 3, 1, + 124, 120, 128, 3, 3, 3, 3, 1, + 3, 3, 3, 1, 3, 1, 1, 1 + }; + static const int32_t rmst[64] = + { + 1024, 936, 856, 784, 718, 656, 600, 550, + 502, 460, 420, 384, 352, 328, 294, 270, + 246, 226, 206, 188, 172, 158, 144, 132, + 120, 110, 102, 92, 84, 78, 70, 64, + 60, 54, 50, 46, 42, 38, 34, 32, + 30, 26, 24, 22, 20, 18, 17, 16, + 15, 14, 13, 12, 11, 10, 9, 8, + 7, 6, 5, 4, 3, 2, 1, 0 + }; + static const int32_t detab7[32] = + { + 4, 11, 18, 25, 32, 39, 46, 53, + 60, 66, 72, 77, 82, 87, 92, 96, + 101, 104, 108, 111, 114, 115, 117, 119, + 121, 122, 123, 124, 125, 126, 127, 127 + }; + static const float descl[8] = + { + 0.6953f, 0.625f, 0.5781f, 0.5469f, 0.5312f, 0.5391f, 0.4688f, 0.3828f + }; + static const int32_t deadd[8] = + { + 1152, -2816, -1536, -3584, -1280, -2432, 768, -1920 + }; + static const int32_t qb[8] = + { + 511, 511, 1023, 1023, 1023, 1023, 2047, 4095 + }; + static const int32_t nbit[10] = + { + 8, 8, 5, 5, 4, 4, 4, 4, 3, 2 + }; + static const int32_t zrc[10] = + { + 0, 0, 0, 0, 0, 3, 0, 2, 0, 0 + }; + static const int32_t bit[5] = + { + 2, 4, 8, 16, 32 + }; + int32_t ipit; + int32_t iout; + int32_t i; + int32_t icorf; + int32_t index; + int32_t ivoic; + int32_t ixcor; + int32_t i1; + int32_t i2; + int32_t i4; + int32_t ishift; + int32_t lsb; + int errcnt; + + /* If no error correction, do pitch and voicing then jump to decode */ + i4 = detau[t->ipitch]; + if (!s->error_correction) + { + voice[0] = 1; + voice[1] = 1; + if (t->ipitch <= 1) + voice[0] = 0; + if (t->ipitch == 0 || t->ipitch == 2) + voice[1] = 0; + if (i4 <= 4) + i4 = s->iptold; + *pitch = i4; + if (voice[0] == 1 && voice[1] == 1) + s->iptold = *pitch; + if (voice[0] != voice[1]) + *pitch = s->iptold; + } + else + { + /* Do error correction pitch and voicing */ + if (i4 > 4) + { + s->dpit[0] = i4; + ivoic = 2; + s->iavgp = (s->iavgp*15 + i4 + 8)/16; + } + else + { + s->dpit[0] = s->iavgp; + ivoic = i4; + } + s->drms[0] = t->irms; + for (i = 0; i < LPC10_ORDER; i++) + s->drc[i][0] = t->irc[i]; + /* Determine index to IVTAB from V/UV decision */ + /* If error rate is high then use alternate table */ + index = (s->ivp2h << 4) + (s->iovoic << 2) + ivoic + 1; + i1 = ivtab[index - 1]; + ipit = i1 & 3; + icorf = i1 >> 3; + if (s->erate < 2048) + icorf /= 64; + /* Determine error rate: 4=high 1=low */ + ixcor = 4; + if (s->erate < 2048) + ixcor = 3; + if (s->erate < 1024) + ixcor = 2; + if (s->erate < 128) + ixcor = 1; + /* Voice/unvoice decision determined from bits 0 and 1 of IVTAB */ + voice[0] = icorf/2 & 1; + voice[1] = icorf & 1; + /* Skip decoding on first frame because present data not yet available */ + if (s->first) + { + s->first = FALSE; + /* Assign PITCH a "default" value on the first call, since */ + /* otherwise it would be left uninitialized. The two lines */ + /* below were copied from above, since it seemed like a */ + /* reasonable thing to do for the first call. */ + if (i4 <= 4) + i4 = s->iptold; + *pitch = i4; + } + else + { + /* If bit 4 of ICORF is set then correct RMS and RC(1) - RC(4). */ + /* Determine error rate and correct errors using a Hamming 8,4 code */ + /* during transition of unvoiced frames. If IOUT is negative, */ + /* more than 1 error occurred, use previous frame's parameters. */ + if ((icorf & bit[3]) != 0) + { + errcnt = 0; + lsb = s->drms[1] & 1; + index = (s->drc[7][1] << 4) + s->drms[1]/2; + iout = hamming_84_decode(index, &errcnt); + s->drms[1] = s->drms[2]; + if (iout >= 0) + s->drms[1] = (iout << 1) + lsb; + for (i = 1; i <= 4; i++) + { + if (i == 1) + i1 = ((s->drc[8][1] & 7) << 1) + (s->drc[9][1] & 1); + else + i1 = s->drc[8 - i][1] & 15; + i2 = s->drc[4 - i][1] & 31; + lsb = i2 & 1; + index = (i1 << 4) + (i2 >> 1); + iout = hamming_84_decode(index, &errcnt); + if (iout >= 0) + { + iout = (iout << 1) + lsb; + if ((iout & 16) == 16) + iout -= 32; + } + else + { + iout = s->drc[4 - i][2]; + } + s->drc[4 - i][1] = iout; + } + /* Determine error rate */ + s->erate = (int32_t) (s->erate*0.96875f + errcnt*102.0f); + } + /* Get unsmoothed RMS, RC's, and PITCH */ + t->irms = s->drms[1]; + for (i = 0; i < LPC10_ORDER; i++) + t->irc[i] = s->drc[i][1]; + if (ipit == 1) + s->dpit[1] = s->dpit[2]; + if (ipit == 3) + s->dpit[1] = s->dpit[0]; + *pitch = s->dpit[1]; + /* If bit 2 of ICORF is set then smooth RMS and RC's, */ + if ((icorf & bit[1]) != 0) + { + if ((float) abs(s->drms[1] - s->drms[0]) >= corth[ixcor + 3] + && + (float) abs(s->drms[1] - s->drms[2]) >= corth[ixcor + 3]) + { + t->irms = median(s->drms[2], s->drms[1], s->drms[0]); + } + for (i = 0; i < 6; i++) + { + if ((float) abs(s->drc[i][1] - s->drc[i][0]) >= corth[ixcor + ((i + 3) << 2) - 5] + && + (float) abs(s->drc[i][1] - s->drc[i][2]) >= corth[ixcor + ((i + 3) << 2) - 5]) + { + t->irc[i] = median(s->drc[i][2], s->drc[i][1], s->drc[i][0]); + } + } + } + /* If bit 3 of ICORF is set then smooth pitch */ + if ((icorf & bit[2]) != 0) + { + if ((float) abs(s->dpit[1] - s->dpit[0]) >= corth[ixcor - 1] + && + (float) abs(s->dpit[1] - s->dpit[2]) >= corth[ixcor - 1]) + { + *pitch = median(s->dpit[2], s->dpit[1], s->dpit[0]); + } + } + /* If bit 5 of ICORF is set then RC(5) - RC(10) are loaded with + values so that after quantization bias is removed in decode + the values will be zero. */ + } + if ((icorf & bit[4]) != 0) + { + for (i = 4; i < LPC10_ORDER; i++) + t->irc[i] = zrc[i]; + } + /* Housekeeping - one frame delay */ + s->iovoic = ivoic; + s->ivp2h = voice[1]; + s->dpit[2] = s->dpit[1]; + s->dpit[1] = s->dpit[0]; + s->drms[2] = s->drms[1]; + s->drms[1] = s->drms[0]; + for (i = 0; i < LPC10_ORDER; i++) + { + s->drc[i][2] = s->drc[i][1]; + s->drc[i][1] = s->drc[i][0]; + } + } + /* Decode RMS */ + t->irms = rmst[(31 - t->irms)*2]; + /* Decode RC(1) and RC(2) from log-area-ratios */ + /* Protect from illegal coded value (-16) caused by bit errors */ + for (i = 0; i < 2; i++) + { + i2 = t->irc[i]; + i1 = 0; + if (i2 < 0) + { + i1 = 1; + i2 = -i2; + if (i2 > 15) + i2 = 0; + } + i2 = detab7[i2*2]; + if (i1 == 1) + i2 = -i2; + ishift = 15 - nbit[i]; + t->irc[i] = i2*pow_ii(2, ishift); + } + /* Decode RC(3)-RC(10) to sign plus 14 bits */ + for (i = 2; i < LPC10_ORDER; i++) + { + ishift = 15 - nbit[i]; + i2 = t->irc[i]*pow_ii(2, ishift) + qb[i - 2]; + t->irc[i] = (int32_t) (i2*descl[i - 2] + deadd[i - 2]); + } + /* Scale RMS and RC's to floats */ + *rms = (float) t->irms; + for (i = 0; i < LPC10_ORDER; i++) + rc[i] = t->irc[i]/16384.0f; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(lpc10_decode_state_t *) lpc10_decode_init(lpc10_decode_state_t *s, int error_correction) +{ + static const int16_t rand_init[] = + { + -21161, + -8478, + 30892, + -10216, + 16950 + }; + int i; + int j; + + if (s == NULL) + { + if ((s = (lpc10_decode_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + + s->error_correction = error_correction; + + /* State used by function decode */ + s->iptold = 60; + s->first = TRUE; + s->ivp2h = 0; + s->iovoic = 0; + s->iavgp = 60; + s->erate = 0; + for (i = 0; i < 3; i++) + { + for (j = 0; j < 10; j++) + s->drc[j][i] = 0; + s->dpit[i] = 0; + s->drms[i] = 0; + } + + /* State used by function synths */ + for (i = 0; i < 360; i++) + s->buf[i] = 0.0f; + s->buflen = LPC10_SAMPLES_PER_FRAME; + + /* State used by function pitsyn */ + s->rmso = 1.0f; + s->first_pitsyn = TRUE; + + /* State used by function bsynz */ + s->ipo = 0; + for (i = 0; i < 166; i++) + { + s->exc[i] = 0.0f; + s->exc2[i] = 0.0f; + } + for (i = 0; i < 3; i++) + { + s->lpi[i] = 0.0f; + s->hpi[i] = 0.0f; + } + s->rmso_bsynz = 0.0f; + + /* State used by function lpc10_random */ + s->j = 1; + s->k = 4; + for (i = 0; i < 5; i++) + s->y[i] = rand_init[i]; + + /* State used by function deemp */ + for (i = 0; i < 2; i++) + s->dei[i] = 0.0f; + for (i = 0; i < 3; i++) + s->deo[i] = 0.0f; + + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) lpc10_decode_release(lpc10_decode_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) lpc10_decode_free(lpc10_decode_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) lpc10_decode(lpc10_decode_state_t *s, int16_t amp[], const uint8_t code[], int len) +{ + int voice[2]; + int32_t pitch; + float speech[LPC10_SAMPLES_PER_FRAME]; + float rc[LPC10_ORDER]; + lpc10_frame_t frame; + float rms; + int i; + int j; + int base; + + /* Decode 54 bits in 7 bytes to LPC10_SAMPLES_PER_FRAME speech samples. */ + len /= 7; + for (i = 0; i < len; i++) + { + lpc10_unpack(&frame, &code[i*7]); + decode(s, &frame, voice, &pitch, &rms, rc); + synths(s, voice, &pitch, &rms, rc, speech); + base = i*LPC10_SAMPLES_PER_FRAME; + for (j = 0; j < LPC10_SAMPLES_PER_FRAME; j++) + amp[base + j] = (int16_t) lfastrintf(32768.0f*speech[j]); + } + + return len*LPC10_SAMPLES_PER_FRAME; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/lpc10_encdecs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/lpc10_encdecs.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,107 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * lpc10_encdecs.h - LPC10 low bit rate speech codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: lpc10_encdecs.h,v 1.11 2008/04/17 14:26:56 steveu Exp $ + */ + +#define LPC10_ORDER 10 + +#if !defined(min) +#define min(a,b) ((a) <= (b) ? (a) : (b)) +#endif +#if !defined(max) +#define max(a,b) ((a) >= (b) ? (a) : (b)) +#endif + +void lpc10_placea(int32_t *ipitch, + int32_t voibuf[4][2], + int32_t *obound, + int32_t af, + int32_t vwin[3][2], + int32_t awin[3][2], + int32_t ewin[3][2], + int32_t lframe, + int32_t maxwin); + +void lpc10_placev(int32_t *osbuf, + int32_t *osptr, + int32_t oslen, + int32_t *obound, + int32_t vwin[3][2], + int32_t af, + int32_t lframe, + int32_t minwin, + int32_t maxwin, + int32_t dvwinl, + int32_t dvwinh); + +void lpc10_voicing(lpc10_encode_state_t *st, + int32_t *vwin, + float *inbuf, + float *lpbuf, + const int32_t buflim[], + int32_t half, + float *minamd, + float *maxamd, + int32_t *mintau, + float *ivrc, + int32_t *obound); + +void lpc10_analyse(lpc10_encode_state_t *st, float *speech, int32_t *voice, int32_t *pitch, float *rms, float rc[]); + +static __inline__ int32_t pow_ii(int32_t x, int32_t n) +{ + int32_t pow; + uint32_t u; + + if (n <= 0) + { + if (n == 0 || x == 1) + return 1; + if (x != -1) + return (x == 0) ? 1/x : 0; + n = -n; + } + u = n; + for (pow = 1; ; ) + { + if ((u & 1)) + pow *= x; + if ((u >>= 1) == 0) + break; + x *= x; + } + return pow; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ float r_sign(float a, float b) +{ + float x; + + x = fabsf(a); + return (b >= 0.0f) ? x : -x; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/lpc10_encode.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/lpc10_encode.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,403 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * lpc10_encode.c - LPC10 low bit rate speech codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * This code is based on the U.S. Department of Defense reference + * implementation of the LPC-10 2400 bps Voice Coder. They do not + * exert copyright claims on their code, and it may be freely used. + * + * $Id: lpc10_encode.c,v 1.28 2009/02/10 13:06:46 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/dc_restore.h" +#include "spandsp/lpc10.h" +#include "spandsp/private/lpc10.h" + +#include "lpc10_encdecs.h" + +static void lpc10_pack(lpc10_encode_state_t *s, uint8_t ibits[], lpc10_frame_t *t) +{ + static const int iblist[53] = + { + 13, 12, 11, 1, 2, 13, 12, 11, 1, 2, + 13, 10, 11, 2, 1, 10, 13, 12, 11, 10, + 2, 13, 12, 11, 10, 2, 1, 12, 7, 6, + 1, 10, 9, 8, 7, 4, 6, 9, 8, 7, + 5, 1, 9, 8, 4, 6, 1, 5, 9, 8, + 7, 5, 6 + }; + int32_t itab[13]; + int x; + int i; + + /* ibits is 54 bits of LPC data ordered as follows: */ + /* R1-0, R2-0, R3-0, P-0, A-0, */ + /* R1-1, R2-1, R3-1, P-1, A-1, */ + /* R1-2, R4-0, R3-2, A-2, P-2, R4-1, */ + /* R1-3, R2-2, R3-3, R4-2, A-3, */ + /* R1-4, R2-3, R3-4, R4-3, A-4, */ + /* P-3, R2-4, R7-0, R8-0, P-4, R4-4, */ + /* R5-0, R6-0, R7-1,R10-0, R8-1, */ + /* R5-1, R6-1, R7-2, R9-0, P-5, */ + /* R5-2, R6-2,R10-1, R8-2, P-6, R9-1, */ + /* R5-3, R6-3, R7-3, R9-2, R8-3, SYNC */ + + itab[0] = t->ipitch; + itab[1] = t->irms; + itab[2] = 0; + for (i = 0; i < LPC10_ORDER; i++) + itab[i + 3] = t->irc[LPC10_ORDER - 1 - i] & 0x7FFF; + /* Put 54 bits into the output buffer */ + x = 0; + for (i = 0; i < 53; i++) + { + x = (x << 1) | (itab[iblist[i] - 1] & 1); + if ((i & 7) == 7) + ibits[i >> 3] = (uint8_t) (x & 0xFF); + itab[iblist[i] - 1] >>= 1; + } + x = (x << 1) | (s->isync & 1); + s->isync ^= 1; + x <<= 2; + ibits[6] = (uint8_t) (x & 0xFF); +} +/*- End of function --------------------------------------------------------*/ + +/* Quantize LPC parameters for transmission */ +static int encode(lpc10_encode_state_t *s, + lpc10_frame_t *t, + int32_t *voice, + int32_t pitch, + float rms, + float *rc) +{ + static const int32_t enctab[16] = + { + 0, 7, 11, 12, 13, 10, 6, 1, 14, 9, 5, 2, 3, 4, 8, 15 + }; + static const int32_t entau[60] = + { + 19, 11, 27, 25, 29, 21, 23, 22, 30, 14, 15, 7, 39, 38, 46, + 42, 43, 41, 45, 37, 53, 49, 51, 50, 54, 52, 60, 56, 58, 26, + 90, 88, 92, 84, 86, 82, 83, 81, 85, 69, 77, 73, 75, 74, 78, + 70, 71, 67, 99, 97, 113, 112, 114, 98, 106, 104, 108, 100, + 101, 76 + }; + static const int32_t enadd[8] = + { + 1920, -768, 2432, 1280, 3584, 1536, 2816, -1152 + }; + static const float enscl[8] = + { + 0.0204f, 0.0167f, 0.0145f, 0.0147f, 0.0143f, 0.0135f, 0.0125f, 0.0112f + }; + static const int32_t enbits[8] = + { + 6, 5, 4, 4, 4, 4, 3, 3 + }; + static const int32_t entab6[64] = + { + 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, + 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 13, 14, 15 + }; + static const int32_t rmst[64] = + { + 1024, 936, 856, 784, 718, 656, 600, 550, 502, + 460, 420, 384, 352, 328, 294, 270, 246, 226, + 206, 188, 172, 158, 144, 132, 120, 110, 102, + 92, 84, 78, 70, 64, 60, 54, 50, + 46, 42, 38, 34, 32, 30, 26, 24, + 22, 20, 18, 17, 16, 15, 14, 13, + 12, 11, 10, 9, 8, 7, 6, 5, 4, + 3, 2, 1, 0 + }; + + int32_t idel; + int32_t nbit; + int32_t i; + int32_t j; + int32_t i2; + int32_t i3; + int32_t mrk; + + /* Scale RMS and RC's to int32_ts */ + t->irms = (int32_t) rms; + for (i = 0; i < LPC10_ORDER; i++) + t->irc[i] = (int32_t) (rc[i]*32768.0f); + if (voice[0] != 0 && voice[1] != 0) + { + t->ipitch = entau[pitch - 1]; + } + else + { + if (s->error_correction) + { + t->ipitch = 0; + if (voice[0] != voice[1]) + t->ipitch = 127; + } + else + { + t->ipitch = (voice[0] << 1) + voice[1]; + } + } + /* Encode RMS by binary table search */ + j = 32; + idel = 16; + t->irms = min(t->irms, 1023); + while (idel > 0) + { + if (t->irms > rmst[j - 1]) + j -= idel; + if (t->irms < rmst[j - 1]) + j += idel; + idel /= 2; + } + if (t->irms > rmst[j - 1]) + --j; + t->irms = 31 - j/2; + /* Encode RC(1) and (2) as log-area-ratios */ + for (i = 0; i < 2; i++) + { + i2 = t->irc[i]; + mrk = 0; + if (i2 < 0) + { + i2 = -i2; + mrk = 1; + } + i2 = min(i2/512, 63); + i2 = entab6[i2]; + if (mrk != 0) + i2 = -i2; + t->irc[i] = i2; + } + /* Encode RC(3) - (10) linearly, remove bias then scale */ + for (i = 2; i < LPC10_ORDER; i++) + { + i2 = (int32_t) ((t->irc[i]/2 + enadd[LPC10_ORDER - 1 - i])*enscl[LPC10_ORDER - 1 - i]); + i2 = max(i2, -127); + i2 = min(i2, 127); + nbit = enbits[LPC10_ORDER - 1 - i]; + i3 = (i2 < 0); + i2 /= pow_ii(2, nbit); + if (i3) + i2--; + t->irc[i] = i2; + } + /* Protect the most significant bits of the most + important parameters during non-voiced frames. + RC(1) - RC(4) are protected using 20 parity bits + replacing RC(5) - RC(10). */ + if (s->error_correction) + { + if (t->ipitch == 0 || t->ipitch == 127) + { + t->irc[4] = enctab[(t->irc[0] & 0x1E) >> 1]; + t->irc[5] = enctab[(t->irc[1] & 0x1E) >> 1]; + t->irc[6] = enctab[(t->irc[2] & 0x1E) >> 1]; + t->irc[7] = enctab[(t->irms & 0x1E) >> 1]; + t->irc[8] = enctab[(t->irc[3] & 0x1E) >> 1] >> 1; + t->irc[9] = enctab[(t->irc[3] & 0x1E) >> 1] & 1; + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void high_pass_100hz(lpc10_encode_state_t *s, float speech[], int start, int len) +{ + float si; + float err; + int i; + + /* 100 Hz high pass filter */ + for (i = start; i < len; i++) + { + si = speech[i]; + err = si + s->z11*1.859076f - s->z21*0.8648249f; + si = err - s->z11*2.0f + s->z21; + s->z21 = s->z11; + s->z11 = err; + err = si + s->z12*1.935715f - s->z22*0.9417004f; + si = err - s->z12*2.0f + s->z22; + s->z22 = s->z12; + s->z12 = err; + speech[i] = si*0.902428f; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(lpc10_encode_state_t *) lpc10_encode_init(lpc10_encode_state_t *s, int error_correction) +{ + int i; + int j; + + if (s == NULL) + { + if ((s = (lpc10_encode_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + + s->error_correction = error_correction; + + /* State used only by function high_pass_100hz */ + s->z11 = 0.0f; + s->z21 = 0.0f; + s->z12 = 0.0f; + s->z22 = 0.0f; + + /* State used by function lpc10_analyse */ + for (i = 0; i < 540; i++) + { + s->inbuf[i] = 0.0f; + s->pebuf[i] = 0.0f; + } + for (i = 0; i < 696; i++) + s->lpbuf[i] = 0.0f; + for (i = 0; i < 312; i++) + s->ivbuf[i] = 0.0f; + s->bias = 0.0f; + s->osptr = 1; + for (i = 0; i < 3; i++) + s->obound[i] = 0; + s->vwin[2][0] = 307; + s->vwin[2][1] = 462; + s->awin[2][0] = 307; + s->awin[2][1] = 462; + for (i = 0; i < 4; i++) + { + s->voibuf[i][0] = 0; + s->voibuf[i][1] = 0; + } + for (i = 0; i < 3; i++) + s->rmsbuf[i] = 0.0f; + for (i = 0; i < 3; i++) + { + for (j = 0; j < 10; j++) + s->rcbuf[i][j] = 0.0f; + } + s->zpre = 0.0f; + + /* State used by function onset */ + s->n = 0.0f; + s->d__ = 1.0f; + for (i = 0; i < 16; i++) + s->l2buf[i] = 0.0f; + s->l2sum1 = 0.0f; + s->l2ptr1 = 1; + s->l2ptr2 = 9; + s->hyst = FALSE; + + /* State used by function lpc10_voicing */ + s->dither = 20.0f; + s->maxmin = 0.0f; + for (i = 0; i < 3; i++) + { + s->voice[i][0] = 0.0f; + s->voice[i][1] = 0.0f; + } + s->lbve = 3000; + s->fbve = 3000; + s->fbue = 187; + s->ofbue = 187; + s->sfbue = 187; + s->lbue = 93; + s->olbue = 93; + s->slbue = 93; + s->snr = (float) (s->fbve / s->fbue << 6); + + /* State used by function dynamic_pitch_tracking */ + for (i = 0; i < 60; i++) + s->s[i] = 0.0f; + for (i = 0; i < 2; i++) + { + for (j = 0; j < 60; j++) + s->p[i][j] = 0; + } + s->ipoint = 0; + s->alphax = 0.0f; + + /* State used by function lpc10_pack */ + s->isync = 0; + + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) lpc10_encode_release(lpc10_encode_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) lpc10_encode_free(lpc10_encode_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) lpc10_encode(lpc10_encode_state_t *s, uint8_t code[], const int16_t amp[], int len) +{ + int32_t voice[2]; + int32_t pitch; + float speech[LPC10_SAMPLES_PER_FRAME]; + float rc[LPC10_ORDER]; + float rms; + lpc10_frame_t frame; + int i; + int j; + + len /= LPC10_SAMPLES_PER_FRAME; + for (i = 0; i < len; i++) + { + for (j = 0; j < LPC10_SAMPLES_PER_FRAME; j++) + speech[j] = (float) amp[i*LPC10_SAMPLES_PER_FRAME + j]/32768.0f; + high_pass_100hz(s, speech, 0, LPC10_SAMPLES_PER_FRAME); + lpc10_analyse(s, speech, voice, &pitch, &rms, rc); + encode(s, &frame, voice, pitch, rms, rc); + lpc10_pack(s, &code[7*i], &frame); + } + return len*7; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/lpc10_placev.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/lpc10_placev.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,336 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * lpc10_placev.c - LPC10 low bit rate speech codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * This code is based on the U.S. Department of Defense reference + * implementation of the LPC-10 2400 bps Voice Coder. They do not + * exert copyright claims on their code, and it may be freely used. + * + * $Id: lpc10_placev.c,v 1.19 2009/01/28 03:41:27 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/dc_restore.h" +#include "spandsp/lpc10.h" + +#include "lpc10_encdecs.h" + +#define subsc(x,y) (((x) << 1) + (y)) + +void lpc10_placea(int32_t *ipitch, + int32_t voibuf[3][2], + int32_t *obound, + int32_t af, + int32_t vwin[3][2], + int32_t awin[3][2], + int32_t ewin[3][2], + int32_t lframe, + int32_t maxwin) +{ + int allv; + int winv; + int32_t i; + int32_t j; + int32_t k; + int32_t l; + int32_t hrange; + int ephase; + int32_t lrange; + + lrange = (af - 2)*lframe + 1; + hrange = af*lframe; + + /* Place the analysis window based on the voicing window placement, + onsets, tentative voicing decision, and pitch. */ + + /* Case 1: Sustained voiced speech + If the five most recent voicing decisions are + voiced, then the window is placed phase-synchronously with the + previous window, as close to the present voicing window if possible. + If onsets bound the voicing window, then preference is given to + a phase-synchronous placement which does not overlap these onsets. */ + + /* Case 2: Voiced transition + If at least one voicing decision in AF is voicied, and there are no + onsets, then the window is placed as in case 1. */ + + /* Case 3: Unvoiced speech or onsets + If both voicing decisions in AF are unvoiced, or there are onsets + then the window is placed coincident with the voicing window. */ + + /* Note: During phase-synchronous placement of windows, the length + is not altered from MAXWIN, since this would defeat the purpose + of phase-synchronous placement. */ + + /* Check for case 1 and case 2 */ + allv = voibuf[af - 2][1] == 1 + && + voibuf[af - 1][0] == 1 + && + voibuf[af - 1][1] == 1 + && + voibuf[af][0] == 1 + && + voibuf[af][1] == 1; + winv = voibuf[af][0] == 1 || voibuf[af][1] == 1; + if (allv || (winv && *obound == 0)) + { + /* APHASE: Phase synchronous window placement. */ + /* Get minimum lower index of the window. */ + i = (lrange + *ipitch - 1 - awin[af - 2][0]) / *ipitch; + i *= *ipitch; + i += awin[af - 2][0]; + /* l = the actual length of this frame's analysis window. */ + l = maxwin; + /* Calculate the location where a perfectly centered window would start. */ + k = (vwin[af - 1][0] + vwin[af - 1][1] + 1 - l)/2; + /* Choose the actual location to be the pitch multiple closest to this */ + awin[af - 1][0] = i + ((int) floorf((float) (k - i)/(float) *ipitch + 0.5f))*(*ipitch); + awin[af - 1][1] = awin[af - 1][0] + l - 1; + /* If there is an onset bounding the right of the voicing window and the + analysis window overlaps that, then move the analysis window backward + to avoid this onset. */ + if (*obound >= 2 && awin[af - 1][1] > vwin[af - 1][1]) + { + awin[af - 1][0] -= *ipitch; + awin[af - 1][1] -= *ipitch; + } + /* Similarly for the left of the voicing window. */ + if ((*obound == 1 || *obound == 3) && awin[af - 1][0] < vwin[af - 1][0]) + { + awin[af - 1][0] += *ipitch; + awin[af - 1][1] += *ipitch; + } + /* If this placement puts the analysis window above HRANGE, then + move it backward an integer number of pitch periods. */ + while (awin[af - 1][1] > hrange) + { + awin[af - 1][0] -= *ipitch; + awin[af - 1][1] -= *ipitch; + } + /* Similarly if the placement puts the analysis window below LRANGE. */ + while (awin[af - 1][0] < lrange) + { + awin[af - 1][0] += *ipitch; + awin[af - 1][1] += *ipitch; + } + /* Make energy window be phase-synchronous. */ + ephase = TRUE; + } + else + { + /* Case 3 */ + awin[af - 1][0] = vwin[af - 1][0]; + awin[af - 1][1] = vwin[af - 1][1]; + ephase = FALSE; + } + /* RMS is computed over an integer number of pitch periods in the analysis + window. When it is not placed phase-synchronously, it is placed as close + as possible to onsets. */ + j = (awin[af - 1][1] - awin[af - 1][0] + 1) / *ipitch * *ipitch; + if (j == 0 || !winv) + { + ewin[af - 1][0] = vwin[af - 1][0]; + ewin[af - 1][1] = vwin[af - 1][1]; + } + else if (!ephase && *obound == 2) + { + ewin[af - 1][0] = awin[af - 1][1] - j + 1; + ewin[af - 1][1] = awin[af - 1][1]; + } + else + { + ewin[af - 1][0] = awin[af - 1][0]; + ewin[af - 1][1] = awin[af - 1][0] + j - 1; + } +} +/*- End of function --------------------------------------------------------*/ + +void lpc10_placev(int32_t *osbuf, + int32_t *osptr, + int32_t oslen, + int32_t *obound, + int32_t vwin[3][2], + int32_t af, + int32_t lframe, + int32_t minwin, + int32_t maxwin, + int32_t dvwinl, + int32_t dvwinh) +{ + int32_t i1; + int32_t i2; + int crit; + int32_t q; + int32_t osptr1; + int32_t hrange; + int32_t lrange; + int i; + + /* Voicing window placement */ + + /* __________________ __________________ ______________ */ + /* | | | */ + /* | 1F | 2F | 3F ... */ + /* |__________________|__________________|______________ */ + + /* Previous | */ + /* Window | */ + /* ...________| */ + + /* | | */ + /* ------>| This window's placement range |<------ */ + /* | | */ + + /* There are three cases. Note these are different from those + given in the LPC-10e phase 1 report. */ + + /* 1. If there are no onsets in this range, then the voicing window + is centered in the pitch window. If such a placement is not within + the window's placement range, then the window is placed in the left-most + portion of the placement range. Its length is always MAXWIN. */ + + /* 2. If the first onset is in 2F and there is sufficient room to place + the window immediately before this onset, then the window is placed + there, and its length is set to the maximum possible under these + constraints. */ + + /* "Critical Region Exception": If there is another onset in 2F + such that a window can be placed between the two onsets, the + window is placed there (ie, as in case 3). */ + + /* 3. Otherwise, the window is placed immediately after the onset. The + window's length is the longest length that can fit in the range under these + constraints, except that the window may be shortened even further to avoid + overlapping other onsets in the placement range. In any case, the window's + length is at least MINWIN. */ + + /* Note that the values of MINWIN and LFRAME must be chosen such + that case 2 = false implies case 3 = true. This means that + MINWIN <= LFRAME/2. If this were not the case, then a fourth case + would have to be added for when the window cannot fit either before + or after the onset. */ + + /* Note also that onsets which weren't in 2F last time may be in 1F this + time, due to the filter delays in computing onsets. The result is that + occasionally a voicing window will overlap that onset. The only way + to circumvent this problem is to add more delay in processing input + speech. In the trade-off between delay and window-placement, window + placement lost. */ + + /* Compute the placement range */ + + /* Computing MAX */ + i1 = vwin[af - 2][1] + 1; + i2 = (af - 2)*lframe + 1; + lrange = max(i1, i2); + hrange = af*lframe; + /* Compute OSPTR1, so the following code only looks at relevant onsets. */ + for (osptr1 = *osptr - 1; osptr1 >= 1; osptr1--) + { + if (osbuf[osptr1 - 1] <= hrange) + break; + } + osptr1++; + /* Check for case 1 first (fast case) */ + if (osptr1 <= 1 || osbuf[osptr1 - 2] < lrange) + { + /* Compute max */ + i1 = vwin[af - 2][1] + 1; + vwin[af - 1][0] = max(i1, dvwinl); + vwin[af - 1][1] = vwin[af - 1][0] + maxwin - 1; + *obound = 0; + } + else + { + /* Search backward in OSBUF for first onset in range. */ + /* This code relies on the above check being performed first. */ + for (q = osptr1 - 1; q >= 1; q--) + { + if (osbuf[q - 1] < lrange) + break; + } + q++; + /* Check for case 2 (placement before onset): */ + /* Check for critical region exception: */ + crit = FALSE; + for (i = q + 1; i < osptr1; i++) + { + if (osbuf[i - 1] - osbuf[q - 1] >= minwin) + { + crit = TRUE; + break; + } + } + /* Compute max */ + i1 = (af - 1)*lframe; + i2 = lrange + minwin - 1; + if (!crit && osbuf[q - 1] > max(i1, i2)) + { + vwin[af - 1][1] = osbuf[q - 1] - 1; + /* Compute max */ + i2 = vwin[af - 1][1] - maxwin + 1; + vwin[af - 1][0] = max(lrange, i2); + *obound = 2; + } + else + { + /* Case 3 (placement after onset) */ + vwin[af - 1][0] = osbuf[q - 1]; + do + { + if (++q >= osptr1 + || + osbuf[q - 1] > vwin[af - 1][0] + maxwin) + { + /* Compute min */ + i1 = vwin[af - 1][0] + maxwin - 1; + vwin[af - 1][1] = min(i1, hrange); + *obound = 1; + return; + } + } + while (osbuf[q - 1] < vwin[af - 1][0] + minwin); + vwin[af - 1][1] = osbuf[q - 1] - 1; + *obound = 3; + } + } +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/lpc10_voicing.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/lpc10_voicing.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,493 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * lpc10_voicing.c - LPC10 low bit rate speech codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * This code is based on the U.S. Department of Defense reference + * implementation of the LPC-10 2400 bps Voice Coder. They do not + * exert copyright claims on their code, and it may be freely used. + * + * $Id: lpc10_voicing.c,v 1.18 2009/02/03 16:28:39 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/dc_restore.h" +#include "spandsp/lpc10.h" +#include "spandsp/private/lpc10.h" + +#include "lpc10_encdecs.h" + +static void vparms(int32_t vwin[], + float *inbuf, + float *lpbuf, + const int32_t buflim[], + int32_t half, + float *dither, + int32_t *mintau, + int32_t *zc, + int32_t *lbe, + int32_t *fbe, + float *qs, + float *rc1, + float *ar_b, + float *ar_f) +{ + int32_t inbuf_offset; + int32_t lpbuf_offset; + int32_t vlen; + int32_t stop; + int32_t i; + int32_t start; + float r1; + float r2; + float e_pre; + float ap_rms; + float e_0; + float oldsgn; + float lp_rms; + float e_b; + float e_f; + float r_b; + float r_f; + float e0ap; + + /* Calculate zero crossings (ZC) and several energy and correlation */ + /* measures on low band and full band speech. Each measure is taken */ + /* over either the first or the second half of the voicing window, */ + /* depending on the variable HALF. */ + lpbuf_offset = buflim[2]; + lpbuf -= lpbuf_offset; + inbuf_offset = buflim[0]; + inbuf -= inbuf_offset; + + lp_rms = 0.0f; + ap_rms = 0.0f; + e_pre = 0.0f; + e0ap = 0.0f; + *rc1 = 0.0f; + e_0 = 0.0f; + e_b = 0.0f; + e_f = 0.0f; + r_f = 0.0f; + r_b = 0.0f; + *zc = 0; + vlen = vwin[1] - vwin[0] + 1; + start = vwin[0] + half*vlen/2 + 1; + stop = start + vlen/2 - 1; + + /* I'll use the symbol HVL in the table below to represent the value */ + /* VLEN/2. Note that if VLEN is odd, then HVL should be rounded down, */ + /* i.e., HVL = (VLEN-1)/2. */ + + /* HALF START STOP */ + + /* 1 VWIN(1)+1 VWIN(1)+HVL */ + /* 2 VWIN(1)+HVL+1 VWIN(1)+2*HVL */ + oldsgn = r_sign(1.0f, inbuf[start - 1] - *dither); + for (i = start; i <= stop; i++) + { + lp_rms += fabsf(lpbuf[i]); + ap_rms += fabsf(inbuf[i]); + e_pre += fabsf(inbuf[i] - inbuf[i - 1]); + r1 = inbuf[i]; + e0ap += r1*r1; + *rc1 += inbuf[i]*inbuf[i - 1]; + r1 = lpbuf[i]; + e_0 += r1*r1; + r1 = lpbuf[i - *mintau]; + e_b += r1*r1; + r1 = lpbuf[i + *mintau]; + e_f += r1*r1; + r_f += lpbuf[i]*lpbuf[i + *mintau]; + r_b += lpbuf[i]*lpbuf[i - *mintau]; + r1 = inbuf[i] + *dither; + if (r_sign(1.0f, r1) != oldsgn) + { + ++(*zc); + oldsgn = -oldsgn; + } + *dither = -(*dither); + } + /* Normalized short-term autocovariance coefficient at unit sample delay */ + *rc1 /= max(e0ap, 1.0f); + /* Ratio of the energy of the first difference signal (6 dB/oct preemphasis)*/ + /* to the energy of the full band signal */ + /* Computing MAX */ + r1 = ap_rms*2.0f; + *qs = e_pre/max(r1, 1.0f); + /* aR_b is the product of the forward and reverse prediction gains, */ + /* looking backward in time (the causal case). */ + *ar_b = r_b/max(e_b, 1.0f)*(r_b/max(e_0, 1.0f)); + /* aR_f is the same as aR_b, but looking forward in time (non causal case).*/ + *ar_f = r_f/max(e_f, 1.0f)*(r_f/max(e_0, 1.0f)); + /* Normalize ZC, LBE, and FBE to old fixed window length of 180. */ + /* (The fraction 90/VLEN has a range of 0.58 to 1) */ + r2 = (float) (*zc << 1); + *zc = lfastrintf(r2*(90.0f/vlen)); + r1 = lp_rms/4*(90.0f/vlen); + *lbe = min(lfastrintf(r1), 32767); + r1 = ap_rms/4*(90.0f/vlen); + *fbe = min(lfastrintf(r1), 32767); +} +/*- End of function --------------------------------------------------------*/ + +/* Voicing detection makes voicing decisions for each half */ +/* frame of input speech. Tentative voicing decisions are made two frames*/ +/* in the future (2F) for each half frame. These decisions are carried */ +/* through one frame in the future (1F) to the present (P) frame where */ +/* they are examined and smoothed, resulting in the final voicing */ +/* decisions for each half frame. */ + +/* The voicing parameter (signal measurement) column vector (VALUE) */ +/* is based on a rectangular window of speech samples determined by the */ +/* window placement algorithm. The voicing parameter vector contains the*/ +/* AMDF windowed maximum-to-minimum ratio, the zero crossing rate, energy*/ +/* measures, reflection coefficients, and prediction gains. The voicing */ +/* window is placed to avoid contamination of the voicing parameter vector*/ +/* with speech onsets. */ + +/* The input signal is then classified as unvoiced (including */ +/* silence) or voiced. This decision is made by a linear discriminant */ +/* function consisting of a dot product of the voicing decision */ +/* coefficient (VDC) row vector with the measurement column vector */ +/* (VALUE). The VDC vector is 2-dimensional, each row vector is optimized*/ +/* for a particular signal-to-noise ratio (SNR). So, before the dot */ +/* product is performed, the SNR is estimated to select the appropriate */ +/* VDC vector. */ + +/* The smoothing algorithm is a modified median smoother. The */ +/* voicing discriminant function is used by the smoother to determine how*/ +/* strongly voiced or unvoiced a signal is. The smoothing is further */ +/* modified if a speech onset and a voicing decision transition occur */ +/* within one half frame. In this case, the voicing decision transition */ +/* is extended to the speech onset. For transmission purposes, there are*/ +/* constraints on the duration and transition of voicing decisions. The */ +/* smoother takes these constraints into account. */ + +/* Finally, the energy estimates are updated along with the dither */ +/* threshold used to calculate the zero crossing rate (ZC). */ + +void lpc10_voicing(lpc10_encode_state_t *s, + int32_t vwin[], + float *inbuf, + float *lpbuf, + const int32_t buflim[], + int32_t half, + float *minamd, + float *maxamd, + int32_t *mintau, + float ivrc[], + int32_t obound[]) +{ + static const float vdc[100] = + { + 0.0f, 1714.0f, -110.0f, 334.0f, -4096.0f, -654.0f, 3752.0f, 3769.0f, 0.0f, 1181.0f, + 0.0f, 874.0f, -97.0f, 300.0f, -4096.0f, -1021.0f, 2451.0f, 2527.0f, 0.0f, -500.0f, + 0.0f, 510.0f, -70.0f, 250.0f, -4096.0f, -1270.0f, 2194.0f, 2491.0f, 0.0f, -1500.0f, + 0.0f, 500.0f, -10.0f, 200.0f, -4096.0f, -1300.0f, 2.0e3f, 2.0e3f, 0.0f, -2.0e3f, + 0.0f, 500.0f, 0.0f, 0.0f, -4096.0f, -1300.0f, 2.0e3f, 2.0e3f, 0.0f, -2500.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f + }; + static const int nvdcl = 5; + static const float vdcl[10] = + { + 600.0f, 450.0f, 300.0f, 200.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f + }; + + int32_t inbuf_offset; + int32_t lpbuf_offset; + int32_t i1; + float r1; + float r2; + float ar_b; + float ar_f; + int32_t snrl; + int32_t i; + float value[9]; + int32_t zc; + int ot; + float qs; + int32_t vstate; + float rc1; + int32_t fbe; + int32_t lbe; + float snr2; + +#if (_MSC_VER >= 1400) + __analysis_assume(half >= 0 && half < 2); +#endif + inbuf_offset = 0; + lpbuf_offset = 0; + if (inbuf) + { + inbuf_offset = buflim[0]; + inbuf -= inbuf_offset; + } + if (lpbuf) + { + lpbuf_offset = buflim[2]; + lpbuf -= lpbuf_offset; + } + + /* Voicing Decision Parameter vector (* denotes zero coefficient): */ + + /* * MAXMIN */ + /* LBE/LBVE */ + /* ZC */ + /* RC1 */ + /* QS */ + /* IVRC2 */ + /* aR_B */ + /* aR_F */ + /* * LOG(LBE/LBVE) */ + /* Define 2-D voicing decision coefficient vector according to the voicing */ + /* parameter order above. Each row (VDC vector) is optimized for a specific */ + /* SNR. The last element of the vector is the constant. */ + /* E ZC RC1 Qs IVRC2 aRb aRf c */ + + /* The VOICE array contains the result of the linear discriminant function*/ + /* (analog values). The VOIBUF array contains the hard-limited binary */ + /* voicing decisions. The VOICE and VOIBUF arrays, according to FORTRAN */ + /* memory allocation, are addressed as: */ + + /* (half-frame number, future-frame number) */ + + /* | Past | Present | Future1 | Future2 | */ + /* | 1,0 | 2,0 | 1,1 | 2,1 | 1,2 | 2,2 | 1,3 | 2,3 | ---> time */ + + /* Update linear discriminant function history each frame: */ + if (half == 0) + { + s->voice[0][0] = s->voice[1][0]; + s->voice[0][1] = s->voice[1][1]; + s->voice[1][0] = s->voice[2][0]; + s->voice[1][1] = s->voice[2][1]; + s->maxmin = *maxamd / max(*minamd, 1.0f); + } + /* Calculate voicing parameters twice per frame */ + vparms(vwin, + &inbuf[inbuf_offset], + &lpbuf[lpbuf_offset], + buflim, + half, + &s->dither, + mintau, + &zc, + &lbe, + &fbe, + &qs, + &rc1, + &ar_b, + &ar_f); + /* Estimate signal-to-noise ratio to select the appropriate VDC vector. */ + /* The SNR is estimated as the running average of the ratio of the */ + /* running average full-band voiced energy to the running average */ + /* full-band unvoiced energy. SNR filter has gain of 63. */ + r1 = (s->snr + s->fbve/(float) max(s->fbue, 1))*63/64.0f; + s->snr = (float) lfastrintf(r1); + snr2 = s->snr*s->fbue/max(s->lbue, 1); + /* Quantize SNR to SNRL according to VDCL thresholds. */ + i1 = nvdcl - 1; + for (snrl = 0; snrl < i1; snrl++) + { + if (snr2 > vdcl[snrl]) + break; + } + /* (Note: SNRL = NVDCL here) */ + /* Linear discriminant voicing parameters: */ + value[0] = s->maxmin; + value[1] = (float) lbe/max(s->lbve, 1); + value[2] = (float) zc; + value[3] = rc1; + value[4] = qs; + value[5] = ivrc[1]; + value[6] = ar_b; + value[7] = ar_f; + /* Evaluation of linear discriminant function: */ + s->voice[2][half] = vdc[snrl*10 + 9]; + for (i = 0; i < 8; i++) + s->voice[2][half] += vdc[snrl*10 + i]*value[i]; + /* Classify as voiced if discriminant > 0, otherwise unvoiced */ + /* Voicing decision for current half-frame: 1 = Voiced; 0 = Unvoiced */ + s->voibuf[3][half] = (s->voice[2][half] > 0.0f) ? 1 : 0; + /* Skip voicing decision smoothing in first half-frame: */ + /* Give a value to VSTATE, so that trace statements below will print */ + /* a consistent value from one call to the next when HALF .EQ. 1. */ + /* The value of VSTATE is not used for any other purpose when this is */ + /* true. */ + vstate = -1; + if (half != 0) + { + /* Voicing decision smoothing rules (override of linear combination): */ + + /* Unvoiced half-frames: At least two in a row. */ + /* -------------------- */ + + /* Voiced half-frames: At least two in a row in one frame. */ + /* ------------------- Otherwise at least three in a row. */ + /* (Due to the way transition frames are encoded) */ + + /* In many cases, the discriminant function determines how to smooth. */ + /* In the following chart, the decisions marked with a * may be overridden. */ + + /* Voicing override of transitions at onsets: */ + /* If a V/UV or UV/V voicing decision transition occurs within one-half */ + /* frame of an onset bounding a voicing window, then the transition is */ + /* moved to occur at the onset. */ + + /* P 1F */ + /* ----- ----- */ + /* 0 0 0 0 */ + /* 0 0 0* 1 (If there is an onset there) */ + /* 0 0 1* 0* (Based on 2F and discriminant distance) */ + /* 0 0 1 1 */ + /* 0 1* 0 0 (Always) */ + /* 0 1* 0* 1 (Based on discriminant distance) */ + /* 0* 1 1 0* (Based on past, 2F, and discriminant distance) */ + /* 0 1* 1 1 (If there is an onset there) */ + /* 1 0* 0 0 (If there is an onset there) */ + /* 1 0 0 1 */ + /* 1 0* 1* 0 (Based on discriminant distance) */ + /* 1 0* 1 1 (Always) */ + /* 1 1 0 0 */ + /* 1 1 0* 1* (Based on 2F and discriminant distance) */ + /* 1 1 1* 0 (If there is an onset there) */ + /* 1 1 1 1 */ + + /* Determine if there is an onset transition between P and 1F. */ + /* OT (Onset Transition) is true if there is an onset between */ + /* P and 1F but not after 1F. */ + ot = ((obound[0] & 2) != 0 || obound[1] == 1) && (obound[2] & 1) == 0; + /* Multi-way dispatch on voicing decision history: */ + vstate = (s->voibuf[1][0] << 3) + (s->voibuf[1][1] << 2) + (s->voibuf[2][0] << 1) + s->voibuf[2][1]; + switch (vstate + 1) + { + case 2: + if (ot && s->voibuf[3][0] == 1) + s->voibuf[2][0] = 1; + break; + case 3: + if (s->voibuf[3][0] == 0 || s->voice[1][0] < -s->voice[1][1]) + s->voibuf[2][0] = 0; + else + s->voibuf[2][1] = 1; + break; + case 5: + s->voibuf[1][1] = 0; + break; + case 6: + if (s->voice[0][1] < -s->voice[1][0]) + s->voibuf[1][1] = 0; + else + s->voibuf[2][0] = 1; + break; + case 7: + if (s->voibuf[0][0] == 1 || s->voibuf[3][0] == 1 || s->voice[1][1] > s->voice[0][0]) + s->voibuf[2][1] = 1; + else + s->voibuf[1][0] = 1; + break; + case 8: + if (ot) + s->voibuf[1][1] = 0; + break; + case 9: + if (ot) + s->voibuf[1][1] = 1; + break; + case 11: + if (s->voice[1][9] < -s->voice[0][1]) + s->voibuf[2][0] = 0; + else + s->voibuf[1][1] = 1; + break; + case 12: + s->voibuf[1][1] = 1; + break; + case 14: + if (s->voibuf[3][0] == 0 && s->voice[1][1] < -s->voice[1][0]) + s->voibuf[2][1] = 0; + else + s->voibuf[2][0] = 1; + break; + case 15: + if (ot && s->voibuf[3][0] == 0) + s->voibuf[2][0] = 0; + break; + } + } + /* During unvoiced half-frames, update the low band and full band unvoiced*/ + /* energy estimates (LBUE and FBUE) and also the zero crossing */ + /* threshold (DITHER). (The input to the unvoiced energy filters is */ + /* restricted to be less than 10dB above the previous inputs of the */ + /* filters.) */ + /* During voiced half-frames, update the low-pass (LBVE) and all-pass */ + /* (FBVE) voiced energy estimates. */ + if (s->voibuf[3][half] == 0) + { + r1 = (s->sfbue*63 + (min(fbe, s->ofbue*3) << 3))/64.0f; + s->sfbue = lfastrintf(r1); + s->fbue = s->sfbue/8; + s->ofbue = fbe; + r1 = (s->slbue*63 + (min(lbe, s->olbue*3) << 3))/64.0f; + s->slbue = lfastrintf(r1); + s->lbue = s->slbue/8; + s->olbue = lbe; + } + else + { + s->lbve = lfastrintf((s->lbve*63 + lbe)/64.0f); + s->fbve = lfastrintf((s->fbve*63 + fbe)/64.0f); + } + /* Set dither threshold to yield proper zero crossing rates in the */ + /* presence of low frequency noise and low level signal input. */ + /* NOTE: The divisor is a function of REF, the expected energies. */ + /* Computing MIN */ + /* Computing MAX */ + r2 = sqrtf((float) (s->lbue*s->lbve))*64/3000; + r1 = max(r2, 1.0f); + s->dither = min(r1, 20.0f); + /* Voicing decisions are returned in VOIBUF. */ +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/make_at_dictionary.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/make_at_dictionary.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,634 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * make_at_dictionary.c - Generate a trie based dictionary for the AT + * commands supported by the AT interpreter. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: make_at_dictionary.c,v 1.6 2009/10/09 14:53:57 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +const char *wordlist[] = +{ + " ", /* Dummy to absorb spaces in commands */ + "&C", /* V.250 6.2.8 - Circuit 109 (received line signal detector), behaviour */ + "&D", /* V.250 6.2.9 - Circuit 108 (data terminal ready) behaviour */ + "&F", /* V.250 6.1.2 - Set to factory-defined configuration */ + "+A8A", /* V.251 6.3 - V.8 calling tone indication */ + "+A8C", /* V.251 6.2 - V.8 answer signal indication */ + "+A8E", /* V.251 5.1 - V.8 and V.8bis operation controls */ + "+A8I", /* V.251 6.1 - V.8 CI signal indication */ + "+A8J", /* V.251 6.4 - V.8 negotiation complete */ + "+A8M", /* V.251 5.2 - Send V.8 menu signals */ + "+A8R", /* V.251 6.6 - V.8bis signal and message reporting */ + "+A8T", /* V.251 5.3 - Send V.8bis signal and/or message(s) */ + "+ASTO", /* V.250 6.3.15 - Store telephone number */ + "+CAAP", /* 3GPP TS 27.007 7.25 - Automatic answer for eMLPP Service */ + "+CACM", /* 3GPP TS 27.007 8.25 - Accumulated call meter */ + "+CACSP", /* 3GPP TS 27.007 11.1.7 - Voice Group or Voice Broadcast Call State Attribute Presentation */ + "+CAD", /* IS-99 5.6.3 - Query analogue or digital service */ + "+CAEMLPP", /* 3GPP TS 27.007 7.22 - eMLPP Priority Registration and Interrogation */ + "+CAHLD", /* 3GPP TS 27.007 11.1.3 - Leave an ongoing Voice Group or Voice Broadcast Call */ + "+CAJOIN", /* 3GPP TS 27.007 11.1.1 - Accept an incoming Voice Group or Voice Broadcast Call */ + "+CALA", /* 3GPP TS 27.007 8.16 - Alarm */ + "+CALCC", /* 3GPP TS 27.007 11.1.6 - List current Voice Group and Voice Broadcast Calls */ + "+CALD", /* 3GPP TS 27.007 8.38 - Delete alar m */ + "+CALM", /* 3GPP TS 27.007 8.20 - Alert sound mode */ + "+CAMM", /* 3GPP TS 27.007 8.26 - Accumulated call meter maximum */ + "+CANCHEV", /* 3GPP TS 27.007 11.1.8 - NCH Support Indication */ + "+CAOC", /* 3GPP TS 27.007 7.16 - Advice of Charge */ + "+CAPD", /* 3GPP TS 27.007 8.39 - Postpone or dismiss an alarm */ + "+CAPTT", /* 3GPP TS 27.007 11.1.4 - Talker Access for Voice Group Call */ + "+CAREJ", /* 3GPP TS 27.007 11.1.2 - Reject an incoming Voice Group or Voice Broadcast Call */ + "+CAULEV", /* 3GPP TS 27.007 11.1.5 - Voice Group Call Uplink Status Presentation */ + "+CBC", /* 3GPP TS 27.007 8.4 - Battery charge */ + "+CBCS", /* 3GPP TS 27.007 11.3.2 - VBS subscriptions and GId status */ + "+CBIP", /* IS-99 5.6 - Base station IP address */ + "+CBST", /* 3GPP TS 27.007 6.7 - Select bearer service type */ + "+CCFC", /* 3GPP TS 27.007 7.11 - Call forwarding number and conditions */ + "+CCLK", /* 3GPP TS 27.007 8.15 - Clock */ + "+CCS", /* IS-135 4.1.22 - Compression status */ + "+CCUG", /* 3GPP TS 27.007 7.10 - Closed user group */ + "+CCWA", /* 3GPP TS 27.007 7.12 - Call waiting */ + "+CCWE", /* 3GPP TS 27.007 8.28 - Call Meter maximum event */ + "+CDIP", /* 3GPP TS 27.007 7.9 - Called line identification presentation */ + "+CDIS", /* 3GPP TS 27.007 8.8 - Display control */ + "+CDV", /* IS-99 5.6 - Dial command for voice call */ + "+CEER", /* 3GPP TS 27.007 6.10 - Extended error report */ + "+CESP", /* GSM07.05 3.2.4 - Enter SMS block mode protocol */ + "+CFCS", /* 3GPP TS 27.007 7.24 - Fast call setup conditions */ + "+CFG", /* IS-99 5.6 - Configuration string */ + "+CFUN", /* 3GPP TS 27.007 8.2 - Set phone functionality */ + "+CGACT", /* 3GPP TS 27.007 10.1.10 - PDP context activate or deactivate */ + "+CGANS", /* 3GPP TS 27.007 10.1.16 - Manual response to a network request for PDP context activation */ + "+CGATT", /* 3GPP TS 27.007 10.1.9 - PS attach or detach */ + "+CGAUTO", /* 3GPP TS 27.007 10.1.15 - Automatic response to a network request for PDP context activation */ + "+CGCAP", /* IS-99 5.6 - Request complete capabilities list */ + "+CGCLASS", /* 3GPP TS 27.007 10.1.17 - GPRS mobile station class (GPRS only) */ + "+CGCLOSP", /* 3GPP TS 27.007 10.1.13 - Configure local octet stream PAD parameters (Obsolete) */ + "+CGCLPAD", /* 3GPP TS 27.007 10.1.12 - Configure local triple-X PAD parameters (GPRS only) (Obsolete) */ + "+CGCMOD", /* 3GPP TS 27.007 10.1.11 - PDP Context Modify */ + "+CGCS", /* 3GPP TS 27.007 11.3.1 - VGCS subscriptions and GId status */ + "+CGDATA", /* 3GPP TS 27.007 10.1.12 - Enter data state */ + "+CGDCONT", /* 3GPP TS 27.007 10.1.1 - Define PDP Context */ + "+CGDSCONT",/* 3GPP TS 27.007 10.1.2 - Define Secondary PDP Context */ + "+CGEQMIN", /* 3GPP TS 27.007 10.1.7 - 3G Quality of Service Profile (Minimum acceptable) */ + "+CGEQNEG", /* 3GPP TS 27.007 10.1.8 - 3G Quality of Service Profile (Negotiated) */ + "+CGEQREQ", /* 3GPP TS 27.007 10.1.6 - 3G Quality of Service Profile (Requested) */ + "+CGEREP", /* 3GPP TS 27.007 10.1.18 - Packet Domain event reporting */ + "+CGMI", /* 3GPP TS 27.007 5.1 - Request manufacturer identification */ + "+CGMM", /* 3GPP TS 27.007 5.2 - Request model identification */ + "+CGMR", /* 3GPP TS 27.007 5.3 - Request revision identification */ + "+CGOI", /* IS-99 5.6 - Request global object identification */ + "+CGPADDR", /* 3GPP TS 27.007 10.1.14 - Show PDP address */ + "+CGQMIN", /* 3GPP TS 27.007 10.1.5 - Quality of Service Profile (Minimum acceptable) */ + "+CGQREQ", /* 3GPP TS 27.007 10.1.4 - Quality of Service Profile (Requested) */ + "+CGREG", /* 3GPP TS 27.007 10.1.19 - GPRS network registration status */ + "+CGSMS", /* 3GPP TS 27.007 10.1.20 - Select service for MO SMS messages */ + "+CGSN", /* 3GPP TS 27.007 5.4 - Request product serial number identification */ + "+CGTFT", /* 3GPP TS 27.007 10.1.3 - Traffic Flow Template */ + "+CHLD", /* 3GPP TS 27.007 7.13 - Call related supplementary services */ + "+CHSA", /* 3GPP TS 27.007 6.18 - HSCSD non-transparent asymmetry configuration */ + "+CHSC", /* 3GPP TS 27.007 6.15 - HSCSD current call parameters */ + "+CHSD", /* 3GPP TS 27.007 6.12 - HSCSD device parameters */ + "+CHSN", /* 3GPP TS 27.007 6.14 - HSCSD non-transparent call configuration */ + "+CHSR", /* 3GPP TS 27.007 6.16 - HSCSD parameters report */ + "+CHST", /* 3GPP TS 27.007 6.13 - HSCSD transparent call configuration */ + "+CHSU", /* 3GPP TS 27.007 6.17 - HSCSD automatic user initiated upgrading */ + "+CHUP", /* 3GPP TS 27.007 6.5 - Hangup call */ + "+CHV", /* IS-99 5.6 - Hang-up voice */ + "+CIMI", /* 3GPP TS 27.007 5.6 - Request international mobile subscriber identity */ + "+CIND", /* 3GPP TS 27.007 8.9 - Indicator control */ + "+CIT", /* IS-99 5.6 - Command state inactivity timer */ + "+CKPD", /* 3GPP TS 27.007 8.7 - Keypad control */ + "+CLAC", /* 3GPP TS 27.007 8.37 - List all available AT commands */ + "+CLAE", /* 3GPP TS 27.007 8.31 - Language Event */ + "+CLAN", /* 3GPP TS 27.007 8.30 - Set Language */ + "+CLCC", /* 3GPP TS 27.007 7.18 - List current calls */ + "+CLCK", /* 3GPP TS 27.007 7.4 - Facility lock */ + "+CLIP", /* 3GPP TS 27.007 7.6 - Calling line identification presentation */ + "+CLIR", /* 3GPP TS 27.007 7.7 - Calling line identification restriction */ + "+CLVL", /* 3GPP TS 27.007 8.23 - Loudspeaker volume level */ + "+CMAR", /* 3GPP TS 27.007 8.36 - Master reset */ + "+CMEC", /* 3GPP TS 27.007 8.6 - Mobile termination control mode */ + "+CMEE", /* GSM07.07 9.1 - Report mobile equipment error */ + "+CMER", /* 3GPP TS 27.007 8.10 - Mobile termination event reporting */ + "+CMGC", /* GSM07.05 3.5.5/4.5 - Send command */ + "+CMGD", /* GSM07.05 3.5.4 - Delete message */ + "+CMGF", /* GSM07.05 3.2.3 - Message Format */ + "+CMGL", /* GSM07.05 3.4.2/4.1 - List messages */ + "+CMGR", /* GSM07.05 3.4.3/4.2 - Read message */ + "+CMGS", /* GSM07.05 3.5.1/4.3 - Send message */ + "+CMGW", /* GSM07.05 3.5.3/4.4 - Write message to memory */ + "+CMIP", /* IS-99 5.6 - Mobile station IP address */ + "+CMM", /* IS-135 4.1.23 - Menu map */ + "+CMMS", /* GSM07.05 3.5.6 - More messages to send */ + "+CMOD", /* 3GPP TS 27.007 6.4 - Call mode */ + "+CMSS", /* GSM07.05 3.5.2/4.7 - Send message from storage */ + "+CMUT", /* 3GPP TS 27.007 8.24 - Mute control */ + "+CMUX", /* 3GPP TS 27.007 5.7 - Multiplexing mode */ + "+CNMA", /* GSM07.05 3.4.4/4.6 - New message acknowledgement to terminal adapter */ + "+CNMI", /* GSM07.05 3.4.1 - New message indications to terminal equipment */ + "+CNUM", /* 3GPP TS 27.007 7.1 - Subscriber number */ + "+COLP", /* 3GPP TS 27.007 7.8 - Connected line identification presentation */ + "+COPN", /* 3GPP TS 27.007 7.21 - Read operator names */ + "+COPS", /* 3GPP TS 27.007 7.3 - PLMN selection */ + "+COS", /* IS-135 4.1.24 - Originating service */ + "+COTDI", /* 3GPP TS 27.007 11.1.9 - Originator to Dispatcher Information */ + "+CPAS", /* 3GPP TS 27.007 8.1 - Phone activity status */ + "+CPBF", /* 3GPP TS 27.007 8.13 - Find phonebook entries */ + "+CPBR", /* 3GPP TS 27.007 8.12 - Read phonebook entries */ + "+CPBS", /* 3GPP TS 27.007 8.11 - Select phonebook memory storage */ + "+CPBW", /* 3GPP TS 27.007 8.14 - Write phonebook entry */ + "+CPIN", /* 3GPP TS 27.007 8.3 - Enter PIN */ + "+CPLS", /* 3GPP TS 27.007 7.20 - Selection of preferred PLMN list */ + "+CPMS", /* GSM07.05 3.2.2 - Preferred message storage */ + "+CPOL", /* 3GPP TS 27.007 7.19 - Preferred PLMN list */ + "+CPPS", /* 3GPP TS 27.007 7.23 - eMLPP subscriptions */ + "+CPROT", /* 3GPP TS 27.007 8.42 - Enter protocol mode */ + "+CPUC", /* 3GPP TS 27.007 8.27 - Price per unit and currency table */ + "+CPWC", /* 3GPP TS 27.007 8.29 - Power class */ + "+CPWD", /* 3GPP TS 27.007 7.5 - Change password */ + "+CQD", /* IS-135 4.1.25 - Query disconnect timer */ + "+CR", /* 3GPP TS 27.007 6.9 - Service reporting control */ + "+CRC", /* 3GPP TS 27.007 6.11 - Cellular result codes */ + "+CREG", /* 3GPP TS 27.007 7.2 - Network registration */ + "+CRES", /* GSM07.05 3.3.6 - Restore Settings */ + "+CRLP", /* 3GPP TS 27.007 6.8 - Radio link protocol */ + "+CRM", /* IS-99 5.6 - Set rm interface protocol */ + "+CRMC", /* 3GPP TS 27.007 8.34 - Ring Melody Control */ + "+CRMP", /* 3GPP TS 27.007 8.35 - Ring Melody Playback */ + "+CRSL", /* 3GPP TS 27.007 8.21 - Ringer sound level */ + "+CRSM", /* 3GPP TS 27.007 8.18 - Restricted SIM access */ + "+CSAS", /* GSM07.05 3.3.5 - Save settings */ + "+CSCA", /* GSM07.05 3.3.1 - Service centre address */ + "+CSCB", /* GSM07.05 3.3.4 - Select cell broadcast message types */ + "+CSCC", /* 3GPP TS 27.007 8.19 - Secure control command */ + "+CSCS", /* 3GPP TS 27.007 5.5 - Select TE character set */ + "+CSDF", /* 3GPP TS 27.007 6.22 - Settings date format */ + "+CSDH", /* GSM07.05 3.3.3 - Show text mode parameters */ + "+CSGT", /* 3GPP TS 27.007 8.32 - Set Greeting Text */ + "+CSIL", /* 3GPP TS 27.007 6.23 - Silence Command */ + "+CSIM", /* 3GPP TS 27.007 8.17 - Generic SIM access */ + "+CSMP", /* GSM07.05 3.3.2 - Set text mode parameters */ + "+CSMS", /* GSM07.05 3.2.1 - Select Message Service */ + "+CSNS", /* 3GPP TS 27.007 6.19 - Single numbering scheme */ + "+CSQ", /* 3GPP TS 27.007 8.5 - Signal quality */ + "+CSS", /* IS-135 4.1.28 - Serving system identification */ + "+CSSN", /* 3GPP TS 27.007 7.17 - Supplementary service notifications */ + "+CSTA", /* 3GPP TS 27.007 6.1 - Select type of address */ + "+CSTF", /* 3GPP TS 27.007 6.24 - Settings time format */ + "+CSVM", /* 3GPP TS 27.007 8.33 - Set Voice Mail Number */ + "+CTA", /* IS-135 4.1.29 - MT-Terminated async. Data calls */ + "+CTF", /* IS-135 4.1.30 - MT-Terminated FAX calls */ + "+CTFR", /* 3GPP TS 27.007 7.14 - Call deflection */ + "+CTZR", /* 3GPP TS 27.007 8.41 - Time Zone Reporting */ + "+CTZU", /* 3GPP TS 27.007 8.40 - Automatic Time Zone Update */ + "+CUSD", /* 3GPP TS 27.007 7.15 - Unstructured supplementary service data */ + "+CUUS1", /* 3GPP TS 27.007 7.26 - User to User Signalling Service 1 */ + "+CV120", /* 3GPP TS 27.007 6.21 - V.120 rate adaption protocol */ + "+CVHU", /* 3GPP TS 27.007 6.20 - Voice Hangup Control */ + "+CVIB", /* 3GPP TS 27.007 8.22 - Vibrator mode */ + "+CXT", /* IS-99 5.6 - Cellular extension */ + "+DR", /* V.250 6.6.2 - Data compression reporting */ + "+DS", /* V.250 6.6.1 - Data compression */ + "+DS44", /* V.250 6.6.2 - V.44 data compression */ + "+EB", /* V.250 6.5.2 - Break handling in error control operation */ + "+EFCS", /* V.250 6.5.4 - 32-bit frame check sequence */ + "+EFRAM", /* V.250 6.5.8 - Frame length */ + "+ER", /* V.250 6.5.5 - Error control reporting */ + "+ES", /* V.250 6.5.1 - Error control selection */ + "+ESA", /* V.80 8.2 - Synchronous access mode configuration */ + "+ESR", /* V.250 6.5.3 - Selective repeat */ + "+ETBM", /* V.250 6.5.6 - Call termination buffer management */ + "+EWIND", /* V.250 6.5.7 - Window size */ + "+F34", /* T.31 B.6.1 - Initial V.34 rate controls for FAX */ + "+FAA", /* T.32 8.5.2.5 - Adaptive Answer parameter */ + "+FAP", /* T.32 8.5.1.12 - Addressing and polling capabilities parameter */ + "+FAR", /* T.31 8.5.1 - Adaptive reception control */ + "+FBO", /* T.32 8.5.3.4 - Phase C data bit order */ + "+FBS", /* T.32 8.5.3.2 - Buffer Size, read only parameter */ + "+FBU", /* T.32 8.5.1.10 - HDLC Frame Reporting parameter */ + "+FCC", /* T.32 8.5.1.1 - DCE capabilities parameters */ + "+FCL", /* T.31 8.5.2 - Carrier loss timeout */ + "+FCLASS", /* T.31 8.2 - Capabilities identification and control */ + "+FCQ", /* T.32 8.5.2.3 - Copy quality checking parameter */ + "+FCR", /* T.32 8.5.1.9 - Capability to receive parameter */ + "+FCS", /* T.32 8.5.1.3 - Current Session Results parameters */ + "+FCT", /* T.32 8.5.2.6 - DTE phase C timeout parameter */ + "+FDD", /* T.31 8.5.3 - Double escape character replacement */ + "+FDR", /* T.32 8.3.4 - Data reception command */ + "+FDT", /* T.32 8.3.3 - Data transmission command */ + "+FEA", /* T.32 8.5.3.5 - Phase C received EOL alignment parameter */ + "+FFC", /* T.32 8.5.3.6 - Format conversion parameter */ + "+FFD", /* T.32 8.5.1.14 - File diagnostic message parameter */ + "+FHS", /* T.32 8.5.2.7 - Call termination status parameter */ + "+FIE", /* T.32 8.5.2.1 - Procedure interrupt enable parameter */ + "+FIP", /* T.32 8.3.6 - Initialize facsimile parameters */ + "+FIS", /* T.32 8.5.1.2 - Current session parameters */ + "+FIT", /* T.31 8.5.4 - DTE inactivity timeout */ + "+FKS", /* T.32 8.3.5 - Session termination command */ + "+FLI", /* T.32 8.5.1.5 - Local ID string parameter, TSI or CSI */ + "+FLO", /* T.31 says to implement something similar to +IFC */ + "+FLP", /* T.32 8.5.1.7 - Indicate document to poll parameter */ + "+FMI", /* T.31 says to duplicate +GMI */ + "+FMM", /* T.31 says to duplicate +GMM */ + "+FMR", /* T.31 says to duplicate +GMR */ + "+FMS", /* T.32 8.5.2.9 - Minimum phase C speed parameter */ + "+FND", /* T.32 8.5.2.10 - Non-Standard Message Data Indication parameter */ + "+FNR", /* T.32 8.5.1.11 - Negotiation message reporting control parameters */ + "+FNS", /* T.32 8.5.1.6 - Non-Standard Frame FIF parameter */ + "+FPA", /* T.32 8.5.1.13 - Selective polling address parameter */ + "+FPI", /* T.32 8.5.1.5 - Local Polling ID String parameter */ + "+FPP", /* T.32 8.5.3 - Facsimile packet protocol */ + "+FPR", /* T.31 says to implement something similar to +IPR */ + "+FPS", /* T.32 8.5.2.2 - Page Status parameter */ + "+FPW", /* T.32 8.5.1.13 - PassWord parameter (Sending or Polling) */ + "+FRH", /* T.31 8.3.6 - HDLC receive */ + "+FRM", /* T.31 8.3.4 - Facsimile receive */ + "+FRQ", /* T.32 8.5.2.4 - Receive Quality Thresholds parameters */ + "+FRS", /* T.31 8.3.2 - Receive silence */ + "+FRY", /* T.32 8.5.2.8 - ECM Retry Value parameter */ + "+FSA", /* T.32 8.5.1.13 - Subaddress parameter */ + "+FSP", /* T.32 8.5.1.8 - Request to poll parameter */ + "+FTH", /* T.31 8.3.5 - HDLC transmit */ + "+FTM", /* T.31 8.3.3 - Facsimile transmit */ + "+FTS", /* T.31 8.3.1 - Transmit silence */ + "+GCAP", /* V.250 6.1.9 - Request complete capabilities list */ + "+GCI", /* V.250 6.1.10 - Country of installation, */ + "+GMI", /* V.250 6.1.4 - Request manufacturer identification */ + "+GMM", /* V.250 6.1.5 - Request model identification */ + "+GMR", /* V.250 6.1.6 - Request revision identification */ + "+GOI", /* V.250 6.1.8 - Request global object identification */ + "+GSN", /* V.250 6.1.7 - Request product serial number identification */ + "+IBC", /* V.80 7.9 - Control of in-band control */ + "+IBM", /* V.80 7.10 - In-band MARK idle reporting control */ + "+ICF", /* V.250 6.2.11 - DTE-DCE character framing */ + "+ICLOK", /* V.250 6.2.14 - Select sync transmit clock source */ + "+IDSR", /* V.250 6.2.16 - Select data set ready option */ + "+IFC", /* V.250 6.2.12 - DTE-DCE local flow control */ + "+ILRR", /* V.250 6.2.13 - DTE-DCE local rate reporting */ + "+ILSD", /* V.250 6.2.15 - Select long space disconnect option */ + "+IPR", /* V.250 6.2.10 - Fixed DTE rate */ + "+IRTS", /* V.250 6.2.17 - Select synchronous mode RTS option */ + "+ITF", /* V.80 8.4 - Transmit flow control thresholds */ + "+MA", /* V.250 6.4.2 - Modulation automode control */ + "+MR", /* V.250 6.4.3 - Modulation reporting control */ + "+MS", /* V.250 6.4.1 - Modulation selection */ + "+MSC", /* V.250 6.4.8 - Seamless rate change enable */ + "+MV18AM", /* V.250 6.4.6 - V.18 answering message editing */ + "+MV18P", /* V.250 6.4.7 - Order of probes */ + "+MV18R", /* V.250 6.4.5 - V.18 reporting control */ + "+MV18S", /* V.250 6.4.4 - V.18 selection */ + "+PCW", /* V.250 6.8.1 - Call waiting enable (V.92 DCE) */ + "+PIG", /* V.250 6.8.5 - PCM upstream ignore */ + "+PMH", /* V.250 6.8.2 - Modem on hold enable */ + "+PMHF", /* V.250 6.8.6 - V.92 Modem on hold hook flash */ + "+PMHR", /* V.250 6.8.4 - Initiate modem on hold */ + "+PMHT", /* V.250 6.8.3 - Modem on hold timer */ + "+PQC", /* V.250 6.8.7 - V.92 Phase 1 and Phase 2 Control */ + "+PSS", /* V.250 6.8.8 - V.92 Use Short Sequence */ + "+SAC", /* V.252 3.4 - Audio transmit configuration */ + "+SAM", /* V.252 3.5 - Audio receive mode */ + "+SAR", /* V.252 5.3 - Audio receive channel indication */ + "+SARR", /* V.252 3.9 - Audio indication reporting */ + "+SAT", /* V.252 5.4 - Audio transmit channel indication */ + "+SCRR", /* V.252 3.11 - Capabilities indication reporting */ + "+SDC", /* V.252 3.3 - Data configuration */ + "+SDI", /* V.252 5.2 - Data channel identification */ + "+SDR", /* V.252 3.8 - Data indication reporting */ + "+SRSC", /* V.252 5.1.2 - Remote terminal simultaneous capability indication */ + "+STC", /* V.252 3.1 - Terminal configuration */ + "+STH", /* V.252 3.2 - Close logical channel */ + "+SVC", /* V.252 3.6 - Video transmit configuration */ + "+SVM", /* V.252 3.7 - Video receive mode */ + "+SVR", /* V.252 5.5 - Video receive channel indication */ + "+SVRR", /* V.252 3.10 - Video indication reporting */ + "+SVT", /* V.252 5.6 - Video transmit channel indication */ + "+TADR", /* V.250 6.7.2.9 - Local V.54 address */ + "+TAL", /* V.250 6.7.2.15 - Local analogue loop */ + "+TALS", /* V.250 6.7.2.6 - Analogue loop status */ + "+TDLS", /* V.250 6.7.2.7 - Local digital loop status */ + "+TE140", /* V.250 6.7.2.1 - Enable ckt 140 */ + "+TE141", /* V.250 6.7.2.2 - Enable ckt 141 */ + "+TEPAL", /* V.250 6.7.2.5 - Enable front panel analogue loop */ + "+TEPDL", /* V.250 6.7.2.4 - Enable front panel RDL */ + "+TERDL", /* V.250 6.7.2.3 - Enable RDL from remote */ + "+TLDL", /* V.250 6.7.2.13 - Local digital loop */ + "+TMO", /* V.250 6.9 - V.59 command */ + "+TMODE", /* V.250 6.7.2.10 - Set V.54 mode */ + "+TNUM", /* V.250 6.7.2.12 - Errored bit and block counts */ + "+TRDL", /* V.250 6.7.2.14 - Request remote digital loop */ + "+TRDLS", /* V.250 6.7.2.8 - Remote digital loop status */ + "+TRES", /* V.250 6.7.2.17 - Self test result */ + "+TSELF", /* V.250 6.7.2.16 - Self test */ + "+TTER", /* V.250 6.7.2.11 - Test error rate */ + "+VAC", /* V.252 4.1 - Set audio code */ + "+VACR", /* V.252 6.1 - Audio code report */ + "+VBT", /* 3GPP TS 27.007 C.2.2 - Buffer threshold setting */ + "+VCID", /* V.253 9.2.3 - Caller ID service */ + "+VCIDR", /* V.252 6.2 - Caller ID report */ + "+VDID", /* V.253 9.2.4 - DID service */ + "+VDIDR", /* V.252 6.2 - DID report */ + "+VDR", /* V.253 10.3.1 - Distinctive ring (ring cadence reporting) */ + "+VDT", /* V.253 10.3.2 - Control tone cadence reporting */ + "+VDX", /* V.253 10.5.6 - Speakerphone duplex mode */ + "+VEM", /* V.253 10.5.7 - Deliver event reports */ + "+VGM", /* V.253 10.5.2 - Microphone gain */ + "+VGR", /* V.253 10.2.1 - Receive gain selection */ + "+VGS", /* V.253 10.5.3 - Speaker gain */ + "+VGT", /* V.253 10.2.2 - Volume selection */ + "+VHC", /* V.252 4.12 - Telephony port hook control */ + "+VIP", /* V.253 10.1.1 - Initialize voice parameters */ + "+VIT", /* V.253 10.2.3 - DTE/DCE inactivity timer */ + "+VLS", /* V.253 10.2.4 - Analogue source/destination selection */ + "+VNH", /* V.253 9.2.5 - Automatic hangup control */ + "+VPH", /* V.252 4.11 - Phone hookswitch status */ + "+VPP", /* V.253 10.4.2 - Voice packet protocol */ + "+VPR", /* IS-101 10.4.3 - Select DTE/DCE interface rate */ + "+VRA", /* V.253 10.2.5 - Ringing tone goes away timer */ + "+VRID", /* Extension - Find the originating and destination numbers */ + "+VRL", /* V.253 10.1.2 - Ring local phone */ + "+VRN", /* V.253 10.2.6 - Ringing tone never appeared timer */ + "+VRX", /* V.253 10.1.3 - Voice receive state */ + "+VSD", /* V.253 10.2.7 - Silence detection (QUIET and SILENCE) */ + "+VSID", /* Extension - Set the originating number */ + "+VSM", /* V.253 10.2.8 - Compression method selection */ + "+VSP", /* V.253 10.5.1 - Voice speakerphone state */ + "+VTA", /* V.253 10.5.4 - Train acoustic echo-canceller */ + "+VTD", /* V.253 10.2.9 - Beep tone duration timer */ + "+VTER", /* V.252 6.4 - Simple telephony event report */ + "+VTH", /* V.253 10.5.5 - Train line echo-canceller */ + "+VTR", /* V.253 10.1.4 - Voice duplex state */ + "+VTS", /* V.253 10.1.5 - DTMF and tone generation in voice */ + "+VTX", /* V.253 10.1.6 - Transmit data state */ + "+VXT", /* IS-101 10.1.5 - Translate voice data */ + "+W", /* TIA-678 5.2.4.1 - Compliance indication */ + "+WBAG", /* TIA-678 C.5.6 Bias modem audio gain */ + "+WCDA", /* TIA-678 B.3.2.5 Display data link address */ + "+WCHG", /* TIA-678 B.3.2.4 Display battery charging status */ + "+WCID", /* TIA-678 B.3.2.1 Display system ID (operator) */ + "+WCLK", /* TIA-678 B.3.2.3 Lock/unlock DCE */ + "+WCPN", /* TIA-678 B.3.2.2 Set personal identification number */ + "+WCXF", /* TIA-678 B.3.2.6 Display supported annex B commands */ + "+WDAC", /* TIA-678 C.5.1 Data over analogue cellular command query */ + "+WDIR", /* TIA-678 C.5.8 Phone number directory selection */ + "+WECR", /* TIA-678 C.5.3 Enable cellular result codes */ + "+WFON", /* TIA-678 C.5.5 Phone specification */ + "+WKPD", /* TIA-678 C.5.7 Keypad emulation */ + "+WPBA", /* TIA-678 C.5.9 Phone battery query */ + "+WPTH", /* TIA-678 C.5.10 Call path */ + "+WRLK", /* TIA-678 C.5.4 Roam lockout */ + "+WS45", /* TIA-678 5.2.4.2 DTE-side stack selection */ + "+WS46", /* 3GPP TS 27.007 5.9 - PCCA STD-101 [17] select wireless network */ + "+WS50", /* TIA-678 B.3.1.1 Normalized signal strength */ + "+WS51", /* TIA-678 B.3.1.2 Carrier detect signal threshold */ + "+WS52", /* TIA-678 B.3.1.3 Normalized battery level */ + "+WS53", /* TIA-678 B.3.1.4 Normalized channel quality */ + "+WS54", /* TIA-678 B.3.1.5 Carrier detect channel quality threshold */ + "+WS57", /* TIA-678 B.3.1.7 Antenna preference */ + "+WS58", /* TIA-678 B.3.1.8 Idle time-out value */ + "+WSTL", /* TIA-678 C.5.2 Call session time limit */ + ";", /* Dummy to absorb semi-colon delimiters in commands */ + "A", /* V.250 6.3.5 - Answer */ + "D", /* V.250 6.3.1 - Dial */ + "E", /* V.250 6.2.4 - Command echo */ + "H", /* V.250 6.3.6 - Hook control */ + "I", /* V.250 6.1.3 - Request identification information */ + "L", /* V.250 6.3.13 - Monitor speaker loudness */ + "M", /* V.250 6.3.14 - Monitor speaker mode */ + "O", /* V.250 6.3.7 - Return to online data state */ + "P", /* V.250 6.3.3 - Select pulse dialling (command) */ + "Q", /* V.250 6.2.5 - Result code suppression */ + "S0", /* V.250 6.3.8 - Automatic answer */ + "S10", /* V.250 6.3.12 - Automatic disconnect delay */ + "S3", /* V.250 6.2.1 - Command line termination character */ + "S4", /* V.250 6.2.2 - Response formatting character */ + "S5", /* V.250 6.2.3 - Command line editing character */ + "S6", /* V.250 6.3.9 - Pause before blind dialling */ + "S7", /* V.250 6.3.10 - Connection completion timeout */ + "S8", /* V.250 6.3.11 - Comma dial modifier time */ + "T", /* V.250 6.3.2 - Select tone dialling (command) */ + "V", /* V.250 6.2.6 - DCE response format */ + "X", /* V.250 6.2.7 - Result code selection and call progress monitoring control */ + "Z", /* V.250 6.1.1 - Reset to default configuration */ + NULL +}; + +int packed_ptr = 0; + +short int packed_trie[30000]; + +#define ALPHABET_SIZE 128 + +typedef struct trie_node_s +{ + int first; + int last; + int node_no; + int entry; + /* Array of pointers to children */ + struct trie_node_s *child_list[ALPHABET_SIZE]; +} trie_node_t; + +typedef struct +{ + int entries; + /* The root of the trie */ + trie_node_t *root; +} trie_t; + +static trie_node_t *trie_node_create(void) +{ + trie_node_t *s; + + if ((s = (trie_node_t *) malloc(sizeof(*s)))) + { + memset(s, 0, sizeof(*s)); + s->first = ALPHABET_SIZE - 1; + } + return s; +} +/*- End of function --------------------------------------------------------*/ + +static trie_t *trie_create(void) +{ + trie_t *s; + + if ((s = (trie_t *) malloc(sizeof(*s)))) + { + memset(s, 0, sizeof(*s)); + s->root = trie_node_create(); + } + return s; +} +/*- End of function --------------------------------------------------------*/ + +static void trie_recursive_add_node_numbers(trie_node_t *t) +{ + int index; + + if (t) + { + if (t->first <= t->last) + { + t->node_no = packed_ptr + 1; + packed_ptr += (t->last - t->first + 1 + 3); + for (index = 0; index < ALPHABET_SIZE; index++) + trie_recursive_add_node_numbers(t->child_list[index]); + } + else + { + t->node_no = packed_ptr + 1; + packed_ptr += 3; + } + } +} +/*- End of function --------------------------------------------------------*/ + +static void trie_recursive_build_packed_trie(trie_node_t *t) +{ + int i; + + if (t) + { + if (t->first <= t->last) + { + packed_trie[packed_ptr++] = t->first; + packed_trie[packed_ptr++] = t->last; + packed_trie[packed_ptr++] = t->entry; + for (i = t->first; i <= t->last; i++) + packed_trie[packed_ptr++] = (t->child_list[i]) ? t->child_list[i]->node_no : 0; + for (i = t->first; i <= t->last; i++) + trie_recursive_build_packed_trie(t->child_list[i]); + } + else + { + packed_trie[packed_ptr++] = 1; + packed_trie[packed_ptr++] = 0; + packed_trie[packed_ptr++] = t->entry; + } + } +} +/*- End of function --------------------------------------------------------*/ + +static void trie_add(trie_t *s, const char *u, size_t len) +{ + size_t i; + int index; + trie_node_t *t; + + s->entries++; + /* Loop over the length of the string to add and traverse the trie... */ + for (t = s->root, i = 0; i < len; i++) + { + /* The character in u we are processing... */ + index = (unsigned char) u[i]; + + /* Is there a child node for this character? */ + if (t->child_list[index] == NULL) + { + t->child_list[index] = trie_node_create(); + if (index < t->first) + t->first = index; + if (index > t->last) + t->last = index; + } + + /* Move to the new node... and loop */ + t = t->child_list[index]; + } + t->entry = s->entries; +} +/*- End of function --------------------------------------------------------*/ + +static void dump_trie(void) +{ + int i; + + printf("\nstatic const at_cmd_service_t at_commands[] =\n{\n"); + for (i = 0; wordlist[i]; i++) + { + switch (wordlist[i][0]) + { + case ' ': + case ';': + printf(" at_cmd_dummy,\n"); + break; + case '+': + printf(" at_cmd_plus_%s,\n", wordlist[i] + 1); + break; + case '&': + printf(" at_cmd_amp_%s,\n", wordlist[i] + 1); + break; + default: + printf(" at_cmd_%s,\n", wordlist[i]); + break; + } + } + printf("};\n"); + + printf("\nstatic const uint16_t command_trie[] =\n{"); + for (i = 0; i < packed_ptr; i++) + { + if ((i & 7) == 0) + printf("\n "); + printf("0x%04X, ", packed_trie[i]); + } + printf("\n};\n"); + printf("\n#define COMMAND_TRIE_LEN %d\n", packed_ptr); + +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + trie_t *s; + int i; + + s = trie_create(); + + for (i = 0; wordlist[i]; i++) + trie_add(s, wordlist[i], strlen(wordlist[i])); + printf("// The trie contains %d entries\n", i); + + packed_ptr = 0; + trie_recursive_add_node_numbers(s->root); + packed_ptr = 0; + trie_recursive_build_packed_trie(s->root); + + dump_trie(); + + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/make_modem_filter.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/make_modem_filter.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,475 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * make_modem_filter.c - Create coefficient sets for pulse shaping + * various modem rx and tx signals. + * + * Written by Steve Underwood + * + * Copyright (C) 2008 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: make_modem_filter.c,v 1.17.4.1 2009/12/28 12:20:46 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include +#include +#include +#include +#if defined(__sunos) || defined(__solaris) || defined(__sun) +#include +#endif + +#include "spandsp/telephony.h" +#include "spandsp/complex.h" +#include "filter_tools.h" + +#if !defined(FALSE) +#define FALSE 0 +#endif +#if !defined(TRUE) +#define TRUE (!FALSE) +#endif + +//#define SAMPLE_RATE 8000.0 +#define MAX_COEFFS_PER_FILTER 128 +#define MAX_COEFF_SETS 384 + +static void make_tx_filter(int coeff_sets, + int coeffs_per_filter, + double carrier, + double baud_rate, + double excess_bandwidth, + int fixed_point, + const char *tag) +{ + int i; + int j; + int x; + int total_coeffs; + double alpha; + double beta; + double gain; + double scaling; + double peak; + double coeffs[MAX_COEFF_SETS*MAX_COEFFS_PER_FILTER + 1]; + + total_coeffs = coeff_sets*coeffs_per_filter + 1; + alpha = baud_rate/(2.0*(double) (coeff_sets*baud_rate)); + beta = excess_bandwidth; + + compute_raised_cosine_filter(coeffs, total_coeffs, TRUE, FALSE, alpha, beta); + + /* Find the DC gain of the filter, and adjust the filter to unity gain. */ + gain = 0.0; + for (i = coeff_sets/2; i < total_coeffs; i += coeff_sets) + gain += coeffs[i]; + /* Normalise the gain to 1.0 */ + for (i = 0; i < total_coeffs; i++) + coeffs[i] /= gain; + gain = 1.0; + + if (fixed_point) + { + peak = -1.0; + for (i = 0; i < total_coeffs; i++) + { + if (fabs(coeffs[i]) > peak) + peak = fabs(coeffs[i]); + } + scaling = 32767.0; + if (peak >= 1.0) + { + scaling /= peak; + gain = 1.0/peak; + } + for (i = 0; i < total_coeffs; i++) + coeffs[i] *= scaling; + } + + /* Churn out the data as a C source code header file, which can be directly included by the + modem code. */ + printf("#define TX_PULSESHAPER%s_GAIN %ff\n", tag, gain); + printf("#define TX_PULSESHAPER%s_COEFF_SETS %d\n", tag, coeff_sets); + printf("static const %s tx_pulseshaper%s[TX_PULSESHAPER%s_COEFF_SETS][%d] =\n", + (fixed_point) ? "int16_t" : "float", + tag, + tag, + coeffs_per_filter); + printf("{\n"); + for (j = 0; j < coeff_sets; j++) + { + x = j; + printf(" {\n"); + if (fixed_point) + printf(" %8d, /* Filter %d */\n", (int) coeffs[x], j); + else + printf(" %15.10ff, /* Filter %d */\n", coeffs[x], j); + for (i = 1; i < coeffs_per_filter - 1; i++) + { + x = i*coeff_sets + j; + if (fixed_point) + printf(" %8d,\n", (int) coeffs[x]); + else + printf(" %15.10ff,\n", coeffs[x]); + } + x = i*coeff_sets + j; + if (fixed_point) + printf(" %8d\n", (int) coeffs[x]); + else + printf(" %15.10ff\n", coeffs[x]); + if (j < coeff_sets - 1) + printf(" },\n"); + else + printf(" }\n"); + } + printf("};\n"); +} +/*- End of function --------------------------------------------------------*/ + +static void make_rx_filter(int coeff_sets, + int coeffs_per_filter, + double carrier, + double baud_rate, + double excess_bandwidth, + int fixed_point, + const char *tag) +{ + int i; + int j; + int k; + int m; + int x; + int total_coeffs; + double alpha; + double beta; + double gain; + double peak; + double coeffs[MAX_COEFF_SETS*MAX_COEFFS_PER_FILTER + 1]; +#if 0 + complex_t co[MAX_COEFFS_PER_FILTER]; +#else + double cox[MAX_COEFFS_PER_FILTER]; +#endif + + total_coeffs = coeff_sets*coeffs_per_filter + 1; + alpha = baud_rate/(2.0*(double) (coeff_sets*SAMPLE_RATE)); + beta = excess_bandwidth; + carrier *= 2.0*3.1415926535/SAMPLE_RATE; + + compute_raised_cosine_filter(coeffs, total_coeffs, TRUE, FALSE, alpha, beta); + + /* Find the DC gain of the filter, and adjust the filter to unity gain. */ + gain = 0.0; + for (i = coeff_sets/2; i < total_coeffs; i += coeff_sets) + gain += coeffs[i]; + /* Normalise the gain to 1.0 */ + for (i = 0; i < total_coeffs; i++) + coeffs[i] /= gain; + gain = 1.0; + + if (fixed_point) + { + peak = -1.0; + for (i = 0; i < total_coeffs; i++) + { + if (fabs(coeffs[i]) > peak) + peak = fabs(coeffs[i]); + } + gain = 32767.0; + if (peak >= 1.0) + gain /= peak; + for (i = 0; i < total_coeffs; i++) + coeffs[i] *= gain; + } + + /* Churn out the data as a C source code header file, which can be directly included by the + modem code. */ + printf("#define RX_PULSESHAPER%s_GAIN %ff\n", tag, gain); + printf("#define RX_PULSESHAPER%s_COEFF_SETS %d\n", tag, coeff_sets); +#if 0 + printf("static const %s rx_pulseshaper%s[RX_PULSESHAPER%s_COEFF_SETS][%d] =\n", + (fixed_point) ? "complexi16_t" : "complexf_t", + tag, + tag, + coeffs_per_filter); + printf("{\n"); + for (j = 0; j < coeff_sets; j++) + { + /* Complex modulate the filter, to make it a complex pulse shaping bandpass filter + centred at the nominal carrier frequency. Use the same phase for all the coefficient + sets. This means the modem can step the carrier in whole samples, and not worry about + the fractional sample shift caused by selecting amongst the various coefficient sets. */ + for (i = 0; i < coeffs_per_filter; i++) + { + m = i - (coeffs_per_filter >> 1); + x = i*coeff_sets + j; + co[i].re = coeffs[x]*cos(carrier*m); + co[i].im = coeffs[x]*sin(carrier*m); + } + printf(" {\n"); + if (fixed_point) + printf(" {%8d, %8d}, /* Filter %d */\n", (int) co[i].re, (int) co[i].im, j); + else + printf(" {%15.10ff, %15.10ff}, /* Filter %d */\n", co[0].re, co[0].im, j); + for (i = 1; i < coeffs_per_filter - 1; i++) + { + if (fixed_point) + printf(" {%8d, %8d},\n", (int) co[i].re, (int) co[i].im); + else + printf(" {%15.10ff, %15.10ff},\n", co[i].re, co[i].im); + } + if (fixed_point) + printf(" {%8d, %8d}\n", (int) co[i].re, (int) co[i].im); + else + printf(" {%15.10ff, %15.10ff}\n", co[i].re, co[i].im); + if (j < coeff_sets - 1) + printf(" },\n"); + else + printf(" }\n"); + } + printf("};\n"); +#else + for (k = 0; k < 2; k++) + { + printf("static const %s rx_pulseshaper%s_%s[RX_PULSESHAPER%s_COEFF_SETS][%d] =\n", + (fixed_point) ? "int16_t" : "float", + tag, + (k == 0) ? "re" : "im", + tag, + coeffs_per_filter); + printf("{\n"); + for (j = 0; j < coeff_sets; j++) + { + /* Complex modulate the filter, to make it a complex pulse shaping bandpass filter + centred at the nominal carrier frequency. Use the same phase for all the coefficient + sets. This means the modem can step the carrier in whole samples, and not worry about + the fractional sample shift caused by selecting amongst the various coefficient sets. */ + for (i = 0; i < coeffs_per_filter; i++) + { + m = i - (coeffs_per_filter >> 1); + x = i*coeff_sets + j; + if (k == 0) + cox[i] = coeffs[x]*cos(carrier*m); + else + cox[i] = coeffs[x]*sin(carrier*m); + } + printf(" {\n"); + if (fixed_point) + printf(" %8d, /* Filter %d */\n", (int) cox[0], j); + else + printf(" %15.10ff, /* Filter %d */\n", cox[0], j); + for (i = 1; i < coeffs_per_filter - 1; i++) + { + if (fixed_point) + printf(" %8d,\n", (int) cox[i]); + else + printf(" %15.10ff,\n", cox[i]); + } + if (fixed_point) + printf(" %8d\n", (int) cox[i]); + else + printf(" %15.10ff\n", cox[i]); + if (j < coeff_sets - 1) + printf(" },\n"); + else + printf(" }\n"); + } + printf("};\n"); + } +#endif +} +/*- End of function --------------------------------------------------------*/ + +static void usage(void) +{ + fprintf(stderr, "Usage: make_modem_rx_filter -m [-i] [-r] [-t]\n"); +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char **argv) +{ + int rx_coeff_sets; + int rx_coeffs_per_filter; + int tx_coeff_sets; + int tx_coeffs_per_filter; + int opt; + int transmit_modem; + int fixed_point; + double carrier; + double baud_rate; + double rx_excess_bandwidth; + double tx_excess_bandwidth; + const char *tag; + const char *modem; + + fixed_point = FALSE; + transmit_modem = FALSE; + modem = ""; + while ((opt = getopt(argc, argv, "im:rt")) != -1) + { + switch (opt) + { + case 'i': + fixed_point = TRUE; + break; + case 'm': + modem = optarg; + break; + case 'r': + transmit_modem = FALSE; + break; + case 't': + transmit_modem = TRUE; + break; + default: + usage(); + exit(2); + break; + } + } + if (strcmp(modem, "V.17") == 0 || strcmp(modem, "V.32bis") == 0) + { + /* This applies to V.32bis as well as V.17 */ + rx_coeff_sets = 192; + rx_coeffs_per_filter = 27; + rx_excess_bandwidth = 0.5; + tx_coeff_sets = 10; + tx_coeffs_per_filter = 9; + tx_excess_bandwidth = 0.25; + carrier = 1800.0; + baud_rate = 2400.0; + tag = ""; + } + else if (strcmp(modem, "V.22bis") == 0) + { + /* This is only intended to apply to transmit. */ + rx_coeff_sets = 12; + rx_coeffs_per_filter = 37; + rx_excess_bandwidth = 0.75; + tx_coeff_sets = 40; + tx_coeffs_per_filter = 9; + tx_excess_bandwidth = 0.75; + carrier = 1200.0; + baud_rate = 600.0; + tag = ""; + } + else if (strcmp(modem, "V.22bis1200") == 0) + { + /* This is only intended to apply to receive. */ + rx_coeff_sets = 12; + rx_coeffs_per_filter = 37; + rx_excess_bandwidth = 0.75; + tx_coeff_sets = 40; + tx_coeffs_per_filter = 9; + tx_excess_bandwidth = 0.75; + carrier = 1200.0; + baud_rate = 600.0; + tag = "_1200"; + } + else if (strcmp(modem, "V.22bis2400") == 0) + { + /* This is only intended to apply to receive. */ + rx_coeff_sets = 12; + rx_coeffs_per_filter = 37; + rx_excess_bandwidth = 0.75; + tx_coeff_sets = 40; + tx_coeffs_per_filter = 9; + tx_excess_bandwidth = 0.75; + carrier = 2400.0; + baud_rate = 600.0; + tag = "_2400"; + } + else if (strcmp(modem, "V.27ter4800") == 0) + { + rx_coeff_sets = 8; + rx_coeffs_per_filter = 27; + rx_excess_bandwidth = 0.5; + tx_coeff_sets = 5; + tx_coeffs_per_filter = 9; + tx_excess_bandwidth = 0.5; + carrier = 1800.0; + baud_rate = 1600.0; + tag = "_4800"; + } + else if (strcmp(modem, "V.27ter2400") == 0) + { + rx_coeff_sets = 12; + rx_coeffs_per_filter = 27; + rx_excess_bandwidth = 0.5; + tx_coeff_sets = 20; + tx_coeffs_per_filter = 9; + tx_excess_bandwidth = 0.5; + carrier = 1800.0; + baud_rate = 1200.0; + tag = "_2400"; + } + else if (strcmp(modem, "V.29") == 0) + { + rx_coeff_sets = 48; + rx_coeffs_per_filter = 27; + rx_excess_bandwidth = 0.5; + tx_coeff_sets = 10; + tx_coeffs_per_filter = 9; + tx_excess_bandwidth = 0.25; + carrier = 1700.0; + baud_rate = 2400.0; + tag = ""; + } + else + { + usage(); + exit(2); + } + if (transmit_modem) + { + make_tx_filter(tx_coeff_sets, + tx_coeffs_per_filter, + carrier, + baud_rate, + tx_excess_bandwidth, + fixed_point, + tag); + } + else + { + make_rx_filter(rx_coeff_sets, + rx_coeffs_per_filter, + carrier, + baud_rate, + rx_excess_bandwidth, + fixed_point, + tag); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/mmx_sse_decs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/mmx_sse_decs.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,61 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * mmx_sse_decs.h - Pull in the appropriate systems headers for the MMX/SSE settings. + * + * Written by Steve Underwood + * + * Copyright (C) 2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: mmx_sse_decs.h,v 1.1 2009/07/12 09:23:09 steveu Exp $ + */ + +#if !defined(_MMX_SSE_DECS_H_) +#define _MMX_SSE_DECS_H_ + +#if defined(SPANDSP_USE_MMX) +#include +#endif +#if defined(SPANDSP_USE_SSE) +#include +#endif +#if defined(SPANDSP_USE_SSE2) +#include +#endif +#if defined(SPANDSP_USE_SSE3) +#include +#endif +#if defined(SPANDSP_USE_SSSE3) +#include +#endif +#if defined(SPANDSP_USE_SSE4_1) +#include +#endif +#if defined(SPANDSP_USE_SSE4_2) +#include +#endif +#if defined(SPANDSP_USE_SSE4A) +#include +#endif +#if defined(SPANDSP_USE_SSE5) +#include +#endif + +#endif + +/*- End of include ---------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/modem_connect_tones.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/modem_connect_tones.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,623 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * modem_connect_tones.c - Generation and detection of tones + * associated with modems calling and answering calls. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: modem_connect_tones.c,v 1.41 2009/11/06 19:21:33 steveu Exp $ + */ + +/*! \file */ + +/* CNG is 0.5s+-15% of 1100+-38Hz, 3s+-15% off, repeating. + + CED is 0.2s silence, 3.3+-0.7s of 2100+-15Hz, and 75+-20ms of silence. + + ANS is 3.3+-0.7s of 2100+-15Hz. + + ANS/ is 3.3+-0.7s of 2100+-15Hz, with phase reversals (180+-10 degrees, hopping in <1ms) every 450+-25ms. + + ANSam/ is 2100+-1Hz, with phase reversals (180+-10 degrees, hopping in <1ms) every 450+-25ms, and AM with a sinewave of 15+-0.1Hz. + The modulated envelope ranges in amplitude between (0.8+-0.01) and (1.2+-0.01) times its average + amplitude. It lasts up to 5s, but will be stopped early if the V.8 protocol proceeds. */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/logging.h" +#include "spandsp/complex.h" +#include "spandsp/dds.h" +#include "spandsp/tone_detect.h" +#include "spandsp/tone_generate.h" +#include "spandsp/super_tone_rx.h" +#include "spandsp/power_meter.h" +#include "spandsp/async.h" +#include "spandsp/fsk.h" +#include "spandsp/modem_connect_tones.h" + +#include "spandsp/private/fsk.h" +#include "spandsp/private/modem_connect_tones.h" + +#define HDLC_FRAMING_OK_THRESHOLD 5 + +SPAN_DECLARE(const char *) modem_connect_tone_to_str(int tone) +{ + switch (tone) + { + case MODEM_CONNECT_TONES_NONE: + return "No tone"; + case MODEM_CONNECT_TONES_FAX_CNG: + return "FAX CNG"; + case MODEM_CONNECT_TONES_ANS: + return "ANS or FAX CED"; + case MODEM_CONNECT_TONES_ANS_PR: + return "ANS/"; + case MODEM_CONNECT_TONES_ANSAM: + return "ANSam"; + case MODEM_CONNECT_TONES_ANSAM_PR: + return "ANSam/"; + case MODEM_CONNECT_TONES_FAX_PREAMBLE: + return "FAX preamble"; + case MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE: + return "FAX CED or preamble"; + } + return "???"; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) modem_connect_tones_tx(modem_connect_tones_tx_state_t *s, + int16_t amp[], + int len) +{ + int16_t mod; + int i; + int xlen; + + i = 0; + switch (s->tone_type) + { + case MODEM_CONNECT_TONES_FAX_CNG: + for ( ; i < len; i++) + { + if (s->duration_timer > ms_to_samples(3000)) + { + if ((xlen = i + s->duration_timer - ms_to_samples(3000)) > len) + xlen = len; + s->duration_timer -= (xlen - i); + for ( ; i < xlen; i++) + amp[i] = dds_mod(&s->tone_phase, s->tone_phase_rate, s->level, 0); + } + if (s->duration_timer > 0) + { + if ((xlen = i + s->duration_timer) > len) + xlen = len; + s->duration_timer -= (xlen - i); + memset(amp + i, 0, sizeof(int16_t)*(xlen - i)); + i = xlen; + } + if (s->duration_timer == 0) + s->duration_timer = ms_to_samples(500 + 3000); + } + break; + case MODEM_CONNECT_TONES_ANS: + if (s->duration_timer < len) + len = s->duration_timer; + if (s->duration_timer > ms_to_samples(2600)) + { + /* There is some initial silence to be generated. */ + if ((i = s->duration_timer - ms_to_samples(2600)) > len) + i = len; + memset(amp, 0, sizeof(int16_t)*i); + } + for ( ; i < len; i++) + amp[i] = dds_mod(&s->tone_phase, s->tone_phase_rate, s->level, 0); + s->duration_timer -= len; + break; + case MODEM_CONNECT_TONES_ANS_PR: + if (s->duration_timer < len) + len = s->duration_timer; + if (s->duration_timer > ms_to_samples(3300)) + { + if ((i = s->duration_timer - ms_to_samples(3300)) > len) + i = len; + memset(amp, 0, sizeof(int16_t)*i); + } + for ( ; i < len; i++) + { + if (--s->hop_timer <= 0) + { + s->hop_timer = ms_to_samples(450); + s->tone_phase += 0x80000000; + } + amp[i] = dds_mod(&s->tone_phase, s->tone_phase_rate, s->level, 0); + } + s->duration_timer -= len; + break; + case MODEM_CONNECT_TONES_ANSAM: + if (s->duration_timer < len) + len = s->duration_timer; + if (s->duration_timer > ms_to_samples(5000)) + { + if ((i = s->duration_timer - ms_to_samples(5000)) > len) + i = len; + memset(amp, 0, sizeof(int16_t)*i); + } + for ( ; i < len; i++) + { + mod = (int16_t) (s->level + dds_mod(&s->mod_phase, s->mod_phase_rate, s->mod_level, 0)); + amp[i] = dds_mod(&s->tone_phase, s->tone_phase_rate, mod, 0); + } + s->duration_timer -= len; + break; + case MODEM_CONNECT_TONES_ANSAM_PR: + if (s->duration_timer < len) + len = s->duration_timer; + if (s->duration_timer > ms_to_samples(5000)) + { + if ((i = s->duration_timer - ms_to_samples(5000)) > len) + i = len; + memset(amp, 0, sizeof(int16_t)*i); + } + for ( ; i < len; i++) + { + if (--s->hop_timer <= 0) + { + s->hop_timer = ms_to_samples(450); + s->tone_phase += 0x80000000; + } + mod = (int16_t) (s->level + dds_mod(&s->mod_phase, s->mod_phase_rate, s->mod_level, 0)); + amp[i] = dds_mod(&s->tone_phase, s->tone_phase_rate, mod, 0); + } + s->duration_timer -= len; + break; + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(modem_connect_tones_tx_state_t *) modem_connect_tones_tx_init(modem_connect_tones_tx_state_t *s, + int tone_type) +{ + int alloced; + + alloced = FALSE; + if (s == NULL) + { + if ((s = (modem_connect_tones_tx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + alloced = TRUE; + } + s->tone_type = tone_type; + switch (s->tone_type) + { + case MODEM_CONNECT_TONES_FAX_CNG: + /* 0.5s of 1100Hz+-38Hz + 3.0s of silence repeating. Timing +-15% */ + s->tone_phase_rate = dds_phase_rate(1100.0); + s->level = dds_scaling_dbm0(-11); + s->duration_timer = ms_to_samples(500 + 3000); + s->mod_phase_rate = 0; + s->tone_phase = 0; + s->mod_phase = 0; + s->mod_level = 0; + s->hop_timer = 0; + break; + case MODEM_CONNECT_TONES_ANS: + case MODEM_CONNECT_TONES_ANSAM: + /* 0.2s of silence, then 2.6s to 4s of 2100Hz+-15Hz tone, then 75ms of silence. */ + s->tone_phase_rate = dds_phase_rate(2100.0); + s->level = dds_scaling_dbm0(-11); + if (s->tone_type == MODEM_CONNECT_TONES_ANSAM) + { + s->mod_phase_rate = dds_phase_rate(15.0); + s->mod_level = s->level/5; + s->duration_timer = ms_to_samples(200 + 5000); + } + else + { + s->mod_phase_rate = 0; + s->mod_level = 0; + s->duration_timer = ms_to_samples(200 + 2600); + } + s->tone_phase = 0; + s->mod_phase = 0; + s->hop_timer = 0; + break; + case MODEM_CONNECT_TONES_ANS_PR: + case MODEM_CONNECT_TONES_ANSAM_PR: + s->tone_phase_rate = dds_phase_rate(2100.0); + s->level = dds_scaling_dbm0(-12); + if (s->tone_type == MODEM_CONNECT_TONES_ANSAM_PR) + { + s->mod_phase_rate = dds_phase_rate(15.0); + s->mod_level = s->level/5; + s->duration_timer = ms_to_samples(200 + 5000); + } + else + { + s->mod_phase_rate = 0; + s->mod_level = 0; + s->duration_timer = ms_to_samples(200 + 3300); + } + s->tone_phase = 0; + s->mod_phase = 0; + s->hop_timer = ms_to_samples(450); + break; + default: + if (alloced) + free(s); + return NULL; + } + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) modem_connect_tones_tx_release(modem_connect_tones_tx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) modem_connect_tones_tx_free(modem_connect_tones_tx_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void report_tone_state(modem_connect_tones_rx_state_t *s, int tone, int level) +{ + if (tone != s->tone_present) + { + if (s->tone_callback) + { + s->tone_callback(s->callback_data, tone, level, 0); + } + else + { + if (tone != MODEM_CONNECT_TONES_NONE) + s->hit = tone; + } + s->tone_present = tone; + } +} +/*- End of function --------------------------------------------------------*/ + +static void v21_put_bit(void *user_data, int bit) +{ + modem_connect_tones_rx_state_t *s; + + s = (modem_connect_tones_rx_state_t *) user_data; + if (bit < 0) + { + /* Special conditions. */ + switch (bit) + { + case SIG_STATUS_CARRIER_DOWN: + /* Only declare tone off, if we were the one to declare tone on. */ + if (s->tone_present == MODEM_CONNECT_TONES_FAX_PREAMBLE) + report_tone_state(s, MODEM_CONNECT_TONES_NONE, -99); + /* Fall through */ + case SIG_STATUS_CARRIER_UP: + s->raw_bit_stream = 0; + s->num_bits = 0; + s->flags_seen = 0; + s->framing_ok_announced = FALSE; + break; + } + return; + } + /* Look for enough FAX V.21 message preamble (back to back HDLC flag octets) to be sure + we are really seeing preamble, and declare the signal to be present. Any change from + preamble declares the signal to not be present, though it will probably be the body + of the messages following the preamble. */ + s->raw_bit_stream = (s->raw_bit_stream << 1) | ((bit << 8) & 0x100); + s->num_bits++; + if ((s->raw_bit_stream & 0x7F00) == 0x7E00) + { + if ((s->raw_bit_stream & 0x8000)) + { + /* Hit HDLC abort */ + s->flags_seen = 0; + } + else + { + /* Hit HDLC flag */ + if (s->flags_seen < HDLC_FRAMING_OK_THRESHOLD) + { + /* Check the flags are back-to-back when testing for valid preamble. This + greatly reduces the chances of false preamble detection, and anything + which doesn't send them back-to-back is badly broken. */ + if (s->num_bits != 8) + s->flags_seen = 0; + if (++s->flags_seen >= HDLC_FRAMING_OK_THRESHOLD && !s->framing_ok_announced) + { + report_tone_state(s, MODEM_CONNECT_TONES_FAX_PREAMBLE, lfastrintf(fsk_rx_signal_power(&(s->v21rx)))); + s->framing_ok_announced = TRUE; + } + } + } + s->num_bits = 0; + } + else + { + if (s->flags_seen >= HDLC_FRAMING_OK_THRESHOLD) + { + if (s->num_bits == 8) + { + s->framing_ok_announced = FALSE; + s->flags_seen = 0; + } + } + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *s, + const int16_t amp[], + int len) +{ + int i; + int16_t notched; + float v1; + float famp; + float filtered; + + switch (s->tone_type) + { + case MODEM_CONNECT_TONES_FAX_CNG: + for (i = 0; i < len; i++) + { + famp = amp[i]; + /* A Cauer notch at 1100Hz, spread just wide enough to meet our detection bandwidth + criteria. */ + v1 = 0.792928f*famp + 1.0018744927985f*s->znotch_1 - 0.54196833412465f*s->znotch_2; + famp = v1 - 1.2994747954630f*s->znotch_1 + s->znotch_2; + s->znotch_2 = s->znotch_1; + s->znotch_1 = v1; + notched = (int16_t) lfastrintf(famp); + + /* Estimate the overall energy in the channel, and the energy in + the notch (i.e. overall channel energy - tone energy => noise). + Use abs instead of multiply for speed (is it really faster?). */ + s->channel_level += ((abs(amp[i]) - s->channel_level) >> 5); + s->notch_level += ((abs(notched) - s->notch_level) >> 5); + if (s->channel_level > 70 && s->notch_level*6 < s->channel_level) + { + /* There is adequate energy in the channel, and it is mostly at 1100Hz. */ + if (s->tone_present != MODEM_CONNECT_TONES_FAX_CNG) + { + if (++s->tone_cycle_duration >= ms_to_samples(415)) + report_tone_state(s, MODEM_CONNECT_TONES_FAX_CNG, lfastrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f)); + } + } + else + { + /* If the signal looks wrong, even for a moment, we consider this the + end of the tone. */ + if (s->tone_present == MODEM_CONNECT_TONES_FAX_CNG) + report_tone_state(s, MODEM_CONNECT_TONES_NONE, -99); + s->tone_cycle_duration = 0; + } + } + break; + case MODEM_CONNECT_TONES_FAX_PREAMBLE: + /* Ignore any CED tone, and just look for V.21 preamble. */ + fsk_rx(&(s->v21rx), amp, len); + break; + case MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE: + /* Also look for V.21 preamble. A lot of machines don't send the 2100Hz burst. It + might also not be seen all the way through the channel, due to switching delays. */ + fsk_rx(&(s->v21rx), amp, len); + /* Now fall through and look for a 2100Hz tone */ + case MODEM_CONNECT_TONES_ANS: + for (i = 0; i < len; i++) + { + famp = amp[i]; + /* A Cauer bandpass at 15Hz, with which we demodulate the AM signal. */ + v1 = fabs(famp) + 1.996667f*s->z15hz_1 - 0.9968004f*s->z15hz_2; + filtered = 0.001599787f*(v1 - s->z15hz_2); + s->z15hz_2 = s->z15hz_1; + s->z15hz_1 = v1; + s->am_level += abs(lfastrintf(filtered)) - (s->am_level >> 8); + //printf("%9.1f %10.4f %9d %9d\n", famp, filtered, s->am_level, s->channel_level); + /* A Cauer notch at 2100Hz, spread just wide enough to meet our detection bandwidth + criteria. */ + /* This is actually centred at 2095Hz, but gets the balance we want, due + to the asymmetric walls of the notch */ + v1 = 0.76000f*famp - 0.1183852f*s->znotch_1 - 0.5104039f*s->znotch_2; + famp = v1 + 0.1567596f*s->znotch_1 + s->znotch_2; + s->znotch_2 = s->znotch_1; + s->znotch_1 = v1; + notched = (int16_t) lfastrintf(famp); + /* Estimate the overall energy in the channel, and the energy in + the notch (i.e. overall channel energy - tone energy => noise). + Use abs instead of multiply for speed (is it really faster?). + Damp the overall energy a little more for a stable result. + Damp the notch energy a little less, so we don't damp out the + blip every time the phase reverses. */ + s->channel_level += ((abs(amp[i]) - s->channel_level) >> 5); + s->notch_level += ((abs(notched) - s->notch_level) >> 4); + /* This should cut off at about -43dBm0 */ + if (s->channel_level <= 70) + { + /* If the energy level is low, even for a moment, we consider this the + end of the tone. */ + if (s->tone_present != MODEM_CONNECT_TONES_NONE) + report_tone_state(s, MODEM_CONNECT_TONES_NONE, -99); + s->tone_cycle_duration = 0; + s->good_cycles = 0; + s->tone_on = FALSE; + continue; + } + /* There is adequate energy in the channel. Is it mostly at 2100Hz? */ + s->tone_cycle_duration++; + if (s->notch_level*6 < s->channel_level) + { + /* The notch test says yes, so we have the tone. */ + /* We should get a kick from the notch filter every 450+-25ms, as the phase reverses, for an + EC disable tone. For a simple answer tone, the tone should persist unbroken for longer. */ + if (!s->tone_on) + { + if (s->tone_cycle_duration >= ms_to_samples(450 - 25)) + { + if (++s->good_cycles == 3) + { + report_tone_state(s, + (s->am_level*15/256 > s->channel_level) ? MODEM_CONNECT_TONES_ANSAM_PR : MODEM_CONNECT_TONES_ANS_PR, + lfastrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f)); + } + } + else + { + s->good_cycles = 0; + } + /* Cycles are timed from rising edge to rising edge */ + s->tone_cycle_duration = 0; + } + else + { + if (s->tone_cycle_duration >= ms_to_samples(450 + 100)) + { + if (s->tone_present == MODEM_CONNECT_TONES_NONE) + { + report_tone_state(s, + (s->am_level*15/256 > s->channel_level) ? MODEM_CONNECT_TONES_ANSAM : MODEM_CONNECT_TONES_ANS, + lfastrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f)); + } + s->good_cycles = 0; + s->tone_cycle_duration = ms_to_samples(450 + 100); + } + } + s->tone_on = TRUE; + } + else if (s->notch_level*5 > s->channel_level) + { + if (s->tone_present == MODEM_CONNECT_TONES_ANS) + { + report_tone_state(s, MODEM_CONNECT_TONES_NONE, -99); + s->good_cycles = 0; + } + else + { + if (s->tone_cycle_duration >= ms_to_samples(450 + 25)) + { + /* The change came too late for a cycle of ANS_PR tone */ + if (s->tone_present == MODEM_CONNECT_TONES_ANS_PR || s->tone_present == MODEM_CONNECT_TONES_ANSAM_PR) + report_tone_state(s, MODEM_CONNECT_TONES_NONE, -99); + s->good_cycles = 0; + } + } + s->tone_on = FALSE; + } + } + break; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) modem_connect_tones_rx_get(modem_connect_tones_rx_state_t *s) +{ + int x; + + x = s->hit; + s->hit = MODEM_CONNECT_TONES_NONE; + return x; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(modem_connect_tones_rx_state_t *) modem_connect_tones_rx_init(modem_connect_tones_rx_state_t *s, + int tone_type, + tone_report_func_t tone_callback, + void *user_data) +{ + if (s == NULL) + { + if ((s = (modem_connect_tones_rx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + + s->tone_type = tone_type; + switch (s->tone_type) + { + case MODEM_CONNECT_TONES_FAX_PREAMBLE: + case MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE: + fsk_rx_init(&(s->v21rx), &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, v21_put_bit, s); + fsk_rx_signal_cutoff(&(s->v21rx), -45.5f); + break; + case MODEM_CONNECT_TONES_ANS_PR: + case MODEM_CONNECT_TONES_ANSAM: + case MODEM_CONNECT_TONES_ANSAM_PR: + /* Treat these all the same for receive purposes */ + s->tone_type = MODEM_CONNECT_TONES_ANS; + break; + } + s->channel_level = 0; + s->notch_level = 0; + s->am_level = 0; + s->tone_present = MODEM_CONNECT_TONES_NONE; + s->tone_cycle_duration = 0; + s->good_cycles = 0; + s->hit = MODEM_CONNECT_TONES_NONE; + s->tone_on = FALSE; + s->tone_callback = tone_callback; + s->callback_data = user_data; + s->znotch_1 = 0.0f; + s->znotch_2 = 0.0f; + s->z15hz_1 = 0.0f; + s->z15hz_2 = 0.0f; + s->num_bits = 0; + s->flags_seen = 0; + s->framing_ok_announced = FALSE; + s->raw_bit_stream = 0; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) modem_connect_tones_rx_release(modem_connect_tones_rx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) modem_connect_tones_rx_free(modem_connect_tones_rx_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/modem_echo.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/modem_echo.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,178 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * modem_echo.c - An echo cancellor, suitable for electrical echos in GSTN modems + * + * Written by Steve Underwood + * + * Copyright (C) 2001, 2003, 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: modem_echo.c,v 1.26 2009/09/22 13:11:04 steveu Exp $ + */ + +/*! \file */ + +/* The FIR taps must be adapted as 32 bit values, to get the necessary finesse + in the adaption process. However, they are applied as 16 bit values (bits 30-15 + of the 32 bit values) in the FIR. For the working 16 bit values, we need 4 sets. + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/bit_operations.h" +#include "spandsp/dc_restore.h" +#include "spandsp/modem_echo.h" + +#include "spandsp/private/modem_echo.h" + +SPAN_DECLARE(modem_echo_can_state_t *) modem_echo_can_create(int len) +{ + modem_echo_can_state_t *ec; + + if ((ec = (modem_echo_can_state_t *) malloc(sizeof(*ec))) == NULL) + return NULL; + memset(ec, 0, sizeof(*ec)); + ec->taps = len; + ec->curr_pos = ec->taps - 1; + if ((ec->fir_taps32 = (int32_t *) malloc(ec->taps*sizeof(int32_t))) == NULL) + { + free(ec); + return NULL; + } + memset(ec->fir_taps32, 0, ec->taps*sizeof(int32_t)); + if ((ec->fir_taps16 = (int16_t *) malloc(ec->taps*sizeof(int16_t))) == NULL) + { + free(ec->fir_taps32); + free(ec); + return NULL; + } + memset(ec->fir_taps16, 0, ec->taps*sizeof(int16_t)); + if (fir16_create(&ec->fir_state, ec->fir_taps16, ec->taps) == NULL) + { + free(ec->fir_taps16); + free(ec->fir_taps32); + free(ec); + return NULL; + } + return ec; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) modem_echo_can_free(modem_echo_can_state_t *ec) +{ + fir16_free(&ec->fir_state); + free(ec->fir_taps32); + free(ec->fir_taps16); + free(ec); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) modem_echo_can_flush(modem_echo_can_state_t *ec) +{ + ec->tx_power = 0; + + fir16_flush(&ec->fir_state); + ec->fir_state.curr_pos = ec->taps - 1; + memset(ec->fir_taps32, 0, ec->taps*sizeof(int32_t)); + memset(ec->fir_taps16, 0, ec->taps*sizeof(int16_t)); + ec->curr_pos = ec->taps - 1; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) modem_echo_can_adaption_mode(modem_echo_can_state_t *ec, int adapt) +{ + ec->adapt = adapt; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int16_t) modem_echo_can_update(modem_echo_can_state_t *ec, int16_t tx, int16_t rx) +{ + int32_t echo_value; + int clean_rx; + int shift; + int i; + int offset1; + int offset2; + + /* Evaluate the echo - i.e. apply the FIR filter */ + /* Assume the gain of the FIR does not exceed unity. Exceeding unity + would seem like a rather poor thing for an echo cancellor to do :) + This means we can compute the result with a total disregard for + overflows. 16bits x 16bits -> 31bits, so no overflow can occur in + any multiply. While accumulating we may overflow and underflow the + 32 bit scale often. However, if the gain does not exceed unity, + everything should work itself out, and the final result will be + OK, without any saturation logic. */ + /* Overflow is very much possible here, and we do nothing about it because + of the compute costs */ + echo_value = fir16(&ec->fir_state, tx); + + /* And the answer is..... */ + clean_rx = rx - echo_value; + //printf("%8d %8d %8d %8d\n", tx, rx, echo_value, clean_rx); + if (ec->adapt) + { + /* Calculate short term power levels using very simple single pole IIRs */ + /* TODO: Is the nasty modulus approach the fastest, or would a real + tx*tx power calculation actually be faster? Using the squares + makes the numbers grow a lot! */ + ec->tx_power += ((tx*tx - ec->tx_power) >> 5); + + shift = 1; + /* Update the FIR taps */ + offset2 = ec->curr_pos; + offset1 = ec->taps - offset2; + for (i = ec->taps - 1; i >= offset1; i--) + { + /* Leak to avoid the coefficients drifting beyond the ability of the + adaption process to bring them back under control. */ + ec->fir_taps32[i] -= (ec->fir_taps32[i] >> 23); + ec->fir_taps32[i] += (ec->fir_state.history[i - offset1]*clean_rx) >> shift; + ec->fir_taps16[i] = (int16_t) (ec->fir_taps32[i] >> 15); + } + for ( ; i >= 0; i--) + { + ec->fir_taps32[i] -= (ec->fir_taps32[i] >> 23); + ec->fir_taps32[i] += (ec->fir_state.history[i + offset2]*clean_rx) >> shift; + ec->fir_taps16[i] = (int16_t) (ec->fir_taps32[i] >> 15); + } + } + + /* Roll around the rolling buffer */ + if (ec->curr_pos <= 0) + ec->curr_pos = ec->taps; + ec->curr_pos--; + return (int16_t) clean_rx; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/msvc/Download_TIFF.2005.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/msvc/Download_TIFF.2005.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/msvc/Download_TIFF.2008.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/msvc/Download_TIFF.2008.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/msvc/config.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/msvc/config.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,83 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * config.h - a fudge for MSVC, which lacks this header + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Michael Jerris + * + * + * This file is released in the public domain. + * + * $Id: config.h,v 1.4 2009/02/25 15:30:21 steveu Exp $ + */ + +#if !defined(_MSVC_CONFIG_H_) +#define _MSVC_CONFIG_H_ + +#define HAVE_SINF +#define HAVE_COSF +#define HAVE_TANF +#define HAVE_ASINF +#define HAVE_ACOSF +#define HAVE_ATANF +#define HAVE_ATAN2F +#define HAVE_CEILF +#define HAVE_FLOORF +#define HAVE_POWF +#define HAVE_EXPF +#define HAVE_LOGF +#define HAVE_LOG10F +#define HAVE_MATH_H +#define HAVE_TGMATH_H + +#define HAVE_LONG_DOUBLE +#define HAVE_LIBTIFF + +#define SPANDSP_USE_EXPORT_CAPABILITY 1 + +#define PACKAGE "spandsp" +#define VERSION "0.0.6" + +/* Win32/DevStudio compatibility stuff */ + +#ifdef _MSC_VER + + #if (_MSC_VER >= 1400) // VC8+ + #ifndef _CRT_SECURE_NO_DEPRECATE + #define _CRT_SECURE_NO_DEPRECATE + #endif + #ifndef _CRT_NONSTDC_NO_DEPRECATE + #define _CRT_NONSTDC_NO_DEPRECATE + #endif + #ifndef _CRT_SECURE_NO_WARNINGS + #define _CRT_SECURE_NO_WARNINGS + #endif + #endif // VC8+ + + // disable the following warnings + #pragma warning(disable:4100) // The formal parameter is not referenced in the body of the function. The unreferenced parameter is ignored. + #pragma warning(disable:4200) // Non standard extension C zero sized array + #pragma warning(disable:4706) // assignment within conditional expression + #pragma warning(disable:4244) // conversion from 'type1' to 'type2', possible loss of data + #pragma warning(disable:4295) // array is too small to include a terminating null character + #pragma warning(disable:4125) // decimal digit terminates octal escape sequence + #pragma warning(disable:4305) // 'function' : truncation from 'double' to 'float' + #pragma warning(disable:4018) // '<' : signed/unsigned mismatch + #pragma warning(disable:4389) // '==' : signed/unsigned mismatch + #pragma warning(disable:4245) // 'return' : conversion from 'int' to 'size_t', signed/unsigned mismatch + + #define strncasecmp _strnicmp + #define strcasecmp _stricmp + #define snprintf _snprintf + #define inline __inline + #define __inline__ __inline + + #define _MMX_H_ + + #include // To get alloca + +#endif + +#endif diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/msvc/getopt.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/msvc/getopt.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,177 @@ +/***************************************************************************** + * + * MODULE NAME : GETOPT.C + * + * COPYRIGHTS: + * This module contains code made available by IBM + * Corporation on an AS IS basis. Any one receiving the + * module is considered to be licensed under IBM copyrights + * to use the IBM-provided source code in any way he or she + * deems fit, including copying it, compiling it, modifying + * it, and redistributing it, with or without + * modifications. No license under any IBM patents or + * patent applications is to be implied from this copyright + * license. + * + * A user of the module should understand that IBM cannot + * provide technical support for the module and will not be + * responsible for any consequences of use of the program. + * + * Any notices, including this one, are not to be removed + * from the module without the prior written consent of + * IBM. + * + * AUTHOR: Original author: + * G. R. Blair (BOBBLAIR at AUSVM1) + * Internet: bobblair@bobblair.austin.ibm.com + * + * Extensively revised by: + * John Q. Walker II, Ph.D. (JOHHQ at RALVM6) + * Internet: johnq@ralvm6.vnet.ibm.com + * + *****************************************************************************/ + +/****************************************************************************** + * getopt() + * + * The getopt() function is a command line parser. It returns the next + * option character in argv that matches an option character in opstring. + * + * The argv argument points to an array of argc+1 elements containing argc + * pointers to character strings followed by a null pointer. + * + * The opstring argument points to a string of option characters; if an + * option character is followed by a colon, the option is expected to have + * an argument that may or may not be separated from it by white space. + * The external variable optarg is set to point to the start of the option + * argument on return from getopt(). + * + * The getopt() function places in optind the argv index of the next argument + * to be processed. The system initializes the external variable optind to + * 1 before the first call to getopt(). + * + * When all options have been processed (that is, up to the first nonoption + * argument), getopt() returns EOF. The special option "--" may be used to + * delimit the end of the options; EOF will be returned, and "--" will be + * skipped. + * + * The getopt() function returns a question mark (?) when it encounters an + * option character not included in opstring. This error message can be + * disabled by setting opterr to zero. Otherwise, it returns the option + * character that was detected. + * + * If the special option "--" is detected, or all options have been + * processed, EOF is returned. + * + * Options are marked by either a minus sign (-) or a slash (/). + * + * No errors are defined. + *****************************************************************************/ + +#include /* for EOF */ +#include /* for strchr() */ + + +/* static (global) variables that are specified as exported by getopt() */ +char *optarg = NULL; /* pointer to the start of the option argument */ +int optind = 1; /* number of the next argv[] to be evaluated */ +int opterr = 1; /* non-zero if a question mark should be returned + when a non-valid option character is detected */ + +/* handle possible future character set concerns by putting this in a macro */ +#define _next_char(string) (char)(*(string+1)) + +int getopt(int argc, char *argv[], char *opstring) +{ + static char *pIndexPosition = NULL; /* place inside current argv string */ + char *pArgString = NULL; /* where to start from next */ + char *pOptString; /* the string in our program */ + + + if (pIndexPosition != NULL) { + /* we last left off inside an argv string */ + if (*(++pIndexPosition)) { + /* there is more to come in the most recent argv */ + pArgString = pIndexPosition; + } + } + + if (pArgString == NULL) { + /* we didn't leave off in the middle of an argv string */ + if (optind >= argc) { + /* more command-line arguments than the argument count */ + pIndexPosition = NULL; /* not in the middle of anything */ + return EOF; /* used up all command-line arguments */ + } + + /*--------------------------------------------------------------------- + * If the next argv[] is not an option, there can be no more options. + *-------------------------------------------------------------------*/ + pArgString = argv[optind++]; /* set this to the next argument ptr */ + + if (('/' != *pArgString) && /* doesn't start with a slash or a dash? */ + ('-' != *pArgString)) { + --optind; /* point to current arg once we're done */ + optarg = NULL; /* no argument follows the option */ + pIndexPosition = NULL; /* not in the middle of anything */ + return EOF; /* used up all the command-line flags */ + } + + /* check for special end-of-flags markers */ + if ((strcmp(pArgString, "-") == 0) || + (strcmp(pArgString, "--") == 0)) { + optarg = NULL; /* no argument follows the option */ + pIndexPosition = NULL; /* not in the middle of anything */ + return EOF; /* encountered the special flag */ + } + + pArgString++; /* look past the / or - */ + } + + if (':' == *pArgString) { /* is it a colon? */ + /*--------------------------------------------------------------------- + * Rare case: if opterr is non-zero, return a question mark; + * otherwise, just return the colon we're on. + *-------------------------------------------------------------------*/ + return (opterr ? (int)'?' : (int)':'); + } + else if ((pOptString = strchr(opstring, *pArgString)) == 0) { + /*--------------------------------------------------------------------- + * The letter on the command-line wasn't any good. + *-------------------------------------------------------------------*/ + optarg = NULL; /* no argument follows the option */ + pIndexPosition = NULL; /* not in the middle of anything */ + return (opterr ? (int)'?' : (int)*pArgString); + } + else { + /*--------------------------------------------------------------------- + * The letter on the command-line matches one we expect to see + *-------------------------------------------------------------------*/ + if (':' == _next_char(pOptString)) { /* is the next letter a colon? */ + /* It is a colon. Look for an argument string. */ + if ('\0' != _next_char(pArgString)) { /* argument in this argv? */ + optarg = &pArgString[1]; /* Yes, it is */ + } + else { + /*------------------------------------------------------------- + * The argument string must be in the next argv. + * But, what if there is none (bad input from the user)? + * In that case, return the letter, and optarg as NULL. + *-----------------------------------------------------------*/ + if (optind < argc) + optarg = argv[optind++]; + else { + optarg = NULL; + return (opterr ? (int)'?' : (int)*pArgString); + } + } + pIndexPosition = NULL; /* not in the middle of anything */ + } + else { + /* it's not a colon, so just return the letter */ + optarg = NULL; /* no argument follows the option */ + pIndexPosition = pArgString; /* point to the letter we're on */ + } + return (int)*pArgString; /* return the letter that matched */ + } +} diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/msvc/gettimeofday.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/msvc/gettimeofday.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,14 @@ +#ifdef _MSC_VER +#pragma warning(disable:4100) +#endif + +#include "windows.h" + +void gettimeofday(struct timeval *tv, void *tz) +{ + long int l = GetTickCount(); + + tv->tv_sec = l / 1000; + tv->tv_usec = (l % 1000) * 1000; + return; +} diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/msvc/inttypes.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/msvc/inttypes.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,60 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * inttypes.h - a fudge for MSVC, which lacks this header + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Michael Jerris + * + * + * This file is released in the public domain. + * + */ + +#if !defined(_INTTYPES_H_) +#define _INTTYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef __int8 __int8_t; +typedef __int16 __int16_t; +typedef __int32 __int32_t; +typedef __int64 __int64_t; + +typedef unsigned __int8 uint8_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int32 uint32_t; +typedef unsigned __int64 uint64_t; +typedef __int8 int8_t; +typedef __int16 int16_t; +typedef __int32 int32_t; +typedef __int64 int64_t; + +#define INT16_MAX 0x7FFF +#define INT16_MIN (-INT16_MAX - 1) + +#if !defined(INFINITY) +#define INFINITY 0x7FFFFFFF +#endif + +#define INT32_MAX (2147483647) +#define INT32_MIN (-2147483647 - 1) + +#define PRId8 "d" +#define PRId16 "d" +#define PRId32 "ld" +#define PRId64 "lld" + +#define PRIu8 "u" +#define PRIu16 "u" +#define PRIu32 "lu" +#define PRIu64 "llu" + +#ifdef __cplusplus +} +#endif + +#endif diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/msvc/make_at_dictionary.2005.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/msvc/make_at_dictionary.2005.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/msvc/make_at_dictionary.2008.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/msvc/make_at_dictionary.2008.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/msvc/make_modem_filter.2005.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/msvc/make_modem_filter.2005.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/msvc/make_modem_filter.2008.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/msvc/make_modem_filter.2008.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/msvc/msvcproj.foot --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/msvc/msvcproj.foot Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,7 @@ + +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/msvc/msvcproj.head --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/msvc/msvcproj.head Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,92 @@ +# Microsoft Developer Studio Project File - Name="spandsp" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=spandsp - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "spandsp.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "spandsp.mak" CFG="spandsp - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "spandsp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "spandsp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "spandsp - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /D "_WINDLL" /FR /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /map /debug /machine:I386 /out:"Release/libspandsp.dll" + +!ELSEIF "$(CFG)" == "spandsp - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /FR /FD /GZ /c +# SUBTRACT CPP /WX /YX +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug/libspandsp.dll" /pdbtype:sept +# SUBTRACT LINK32 /nodefaultlib + +!ENDIF + +# Begin Target + +# Name "spandsp - Win32 Release" +# Name "spandsp - Win32 Debug" diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/msvc/spandsp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/msvc/spandsp.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,132 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * spandsp.h - The head guy amongst the headers + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: spandsp.h.in,v 1.19.4.1 2009/12/19 09:47:56 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_H_) +#define _SPANDSP_H_ + +#define __inline__ __inline +#pragma warning(disable:4200) + +#undef SPANDSP_USE_FIXED_POINT +#undef SPANDSP_MISALIGNED_ACCESS_FAILS + +#define SPANDSP_USE_EXPORT_CAPABILITY 1 + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif + +#if defined(SPANDSP_EXPOSE_INTERNAL_STRUCTURES) +#include +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/msvc/sys/time.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/msvc/sys/time.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,21 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * sys/time.h - a fudge for MSVC, which lacks this header + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Michael Jerris + * + * + * This file is released in the public domain. + * + */ + +struct timeval +{ + long int tv_sec; + long int tv_usec; +}; + +extern void gettimeofday(struct timeval *tv, void *tz); diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/msvc/tgmath.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/msvc/tgmath.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,34 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * tgmath.h - a fudge for MSVC, which lacks this header + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Michael Jerris + * + * + * This file is released in the public domain. + * + */ + +#if !defined(_TGMATH_H_) +#define _TGMATH_H_ + +#include + +#if !defined(M_PI) +/* C99 systems may not define M_PI */ +#define M_PI 3.14159265358979323846264338327 +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/msvc/tiff/cleancount --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/msvc/tiff/cleancount Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1 @@ +1 \ No newline at end of file diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/msvc/unistd.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/msvc/unistd.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,34 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * unistd.h - a fudge for MSVC, which lacks this header + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Michael Jerris + * + * + * This file is released in the public domain. + * + */ + +#if !defined(_UNISTD_H_) +#define _UNISTD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +// Declare this so we don't have to include winsock.h, it causes numerous conflicts. +extern int __stdcall gethostname(char * name, int namelen); +#pragma comment(lib, "ws2_32.lib") + +extern int getopt(int argc, char *argv[], char *opstring); + +extern char *optarg; + +#ifdef __cplusplus +} +#endif + +#endif diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/msvc/util.vbs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/msvc/util.vbs Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,199 @@ +' +' Contributor(s): +' Michael Jerris +' David A. Horner http://dave.thehorners.com +'---------------------------------------------- + +'On Error Resume Next +' ************** +' Initialization +' ************** + +Set WshShell = CreateObject("WScript.Shell") +Set FSO = CreateObject("Scripting.FileSystemObject") +Set WshSysEnv = WshShell.Environment("SYSTEM") +Set xml = CreateObject("Microsoft.XMLHTTP") +Dim UseWgetEXE + +On Error Resume Next +Set oStream = CreateObject("Adodb.Stream") +On Error Goto 0 + +If Not IsObject(oStream) Then + wscript.echo("Failed to create Adodb.Stream, using alternative download method.") + UseWgetEXE=true +Else + UseWgetEXE=false +End If +Randomize +Set objArgs = WScript.Arguments +quote=Chr(34) +ScriptDir=Left(WScript.ScriptFullName,Len(WScript.ScriptFullName)-Len(WScript.ScriptName)) +UtilsDir=Showpath(ScriptDir) +ToolsBase="http://files.freeswitch.org/downloads/win32/" + +If UseWgetEXE Then + GetWgetEXE UtilsDir +End If + +GetCompressionTools UtilsDir + + +If objArgs.Count >=3 Then + Select Case objArgs(0) + Case "Get" + Wget objArgs(1), Showpath(objArgs(2)) + Case "GetUnzip" + WgetUnCompress objArgs(1), Showpath(objArgs(2)) + End Select +End If + + +' ******************* +' Utility Subroutines +' ******************* + + +Sub WgetUnCompress(URL, DestFolder) + If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If + StartPos = InstrRev(URL, "/", -1, 1) + strlength = Len(URL) + filename=Right(URL,strlength-StartPos) + NameEnd = InstrRev(filename, ".",-1, 1) + filestrlength = Len(filename) + filebase = Left(filename,NameEnd) + fileext = Right(filename, Len(filename) - NameEnd) + Wget URL, DestFolder + If fileext = "zip" Then + UnCompress Destfolder & filename, DestFolder & filebase + Else + UnCompress Destfolder & filename, DestFolder + End If +End Sub + +Sub GetCompressionTools(DestFolder) + Dim oExec + If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If + If Not FSO.FileExists(DestFolder & "7za.exe") Then + If Not FSO.FileExists(DestFolder & "7za.tag") Then + Set MyFile = fso.CreateTextFile(DestFolder & "7za.tag", True) + MyFile.WriteLine("This file marks a pending download for 7za.exe so we don't download it twice at the same time") + MyFile.Close + + Wget ToolsBase & "7za.exe", DestFolder + + FSO.DeleteFile DestFolder & "7za.tag" ,true + Else + WScript.Sleep(5000) + End If + End If +End Sub + +Sub GetWgetEXE(DestFolder) + Dim oExec + If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If + If Not FSO.FileExists(DestFolder & "wget.exe") Then + Slow_Wget ToolsBase & "wget.exe", DestFolder + End If +End Sub + +Sub UnCompress(Archive, DestFolder) + batname = "tmp" & CStr(Int(10000*Rnd)) & ".bat" + wscript.echo("Extracting: " & Archive) + Set MyFile = fso.CreateTextFile(UtilsDir & batname, True) + MyFile.WriteLine("@" & quote & UtilsDir & "7za.exe" & quote & " x " & quote & Archive & quote & " -y -o" & quote & DestFolder & quote ) + MyFile.Close + Set oExec = WshShell.Exec(UtilsDir & batname) + Do + WScript.Echo OExec.StdOut.ReadLine() + Loop While Not OExec.StdOut.atEndOfStream + If FSO.FileExists(Left(Archive, Len(Archive)-3))Then + Set MyFile = fso.CreateTextFile(UtilsDir & batname, True) + MyFile.WriteLine("@" & quote & UtilsDir & "7za.exe" & quote & " x " & quote & Left(Archive, Len(Archive)-3) & quote & " -y -o" & quote & DestFolder & quote ) + MyFile.Close + Set oExec = WshShell.Exec(UtilsDir & batname) + Do + WScript.Echo OExec.StdOut.ReadLine() + Loop While Not OExec.StdOut.atEndOfStream + WScript.Sleep(500) + FSO.DeleteFile Left(Archive, Len(Archive)-3) ,true + End If + If FSO.FileExists(Left(Archive, Len(Archive)-3) & "tar")Then + Set MyFile = fso.CreateTextFile(UtilsDir & batname, True) + MyFile.WriteLine("@" & quote & UtilsDir & "7za.exe" & quote & " x " & quote & Left(Archive, Len(Archive)-3) & "tar" & quote & " -y -o" & quote & DestFolder & quote ) + MyFile.Close + Set oExec = WshShell.Exec(UtilsDir & batname) + Do + WScript.Echo OExec.StdOut.ReadLine() + Loop While Not OExec.StdOut.atEndOfStream + WScript.Sleep(500) + FSO.DeleteFile Left(Archive, Len(Archive)-3) & "tar",true + End If + + WScript.Sleep(500) + If FSO.FileExists(UtilsDir & batname)Then + FSO.DeleteFile UtilsDir & batname, True + End If +End Sub + +Sub Wget(URL, DestFolder) + StartPos = InstrRev(URL, "/", -1, 1) + strlength = Len(URL) + filename=Right(URL,strlength-StartPos) + If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If + + Wscript.echo("Downloading: " & URL) + +If UseWgetEXE Then + batname = "tmp" & CStr(Int(10000*Rnd)) & ".bat" + Set MyFile = fso.CreateTextFile(UtilsDir & batname, True) + MyFile.WriteLine("@cd " & quote & DestFolder & quote) + MyFile.WriteLine("@" & quote & UtilsDir & "wget.exe" & quote & " " & URL) + MyFile.Close + Set oExec = WshShell.Exec(UtilsDir & batname) + Do + WScript.Echo OExec.StdOut.ReadLine() + Loop While Not OExec.StdOut.atEndOfStream + +Else + xml.Open "GET", URL, False + xml.Send + + Const adTypeBinary = 1 + Const adSaveCreateOverWrite = 2 + Const adSaveCreateNotExist = 1 + + oStream.type = adTypeBinary + oStream.open + oStream.write xml.responseBody + oStream.savetofile DestFolder & filename, adSaveCreateOverWrite + oStream.close +End If + +End Sub + +Sub Slow_Wget(URL, DestFolder) + StartPos = InstrRev(URL, "/", -1, 1) + strlength = Len(URL) + filename=Right(URL,strlength-StartPos) + If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If + + Wscript.echo("Downloading: " & URL) + xml.Open "GET", URL, False + xml.Send + + const ForReading = 1 , ForWriting = 2 , ForAppending = 8 + Set MyFile = fso.OpenTextFile(DestFolder & filename ,ForWriting, True) + For i = 1 to lenb(xml.responseBody) + MyFile.write Chr(Ascb(midb(xml.responseBody,i,1))) + Next + MyFile.Close() + +End Sub + +Function Showpath(folderspec) + Set f = FSO.GetFolder(folderspec) + showpath = f.path & "\" +End Function + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/msvc/vc8proj.foot --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/msvc/vc8proj.foot Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,29 @@ + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/msvc/vc8proj.head --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/msvc/vc8proj.head Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/msvc/vc9proj.foot --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/msvc/vc9proj.foot Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/msvc/vc9proj.head --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/msvc/vc9proj.head Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/noise.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/noise.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,130 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * noise.c - A low complexity audio noise generator, suitable for + * real time generation (current AWGN, and Hoth) + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: noise.c,v 1.31 2009/02/10 13:06:46 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/saturated.h" +#include "spandsp/noise.h" + +#include "spandsp/private/noise.h" + +SPAN_DECLARE(int16_t) noise(noise_state_t *s) +{ + int32_t val; + int i; + + /* The central limit theorem says if you add a few random numbers together, + the result starts to look Gaussian. Quantities above 7 give diminishing + returns. Quantites above 20 are exceedingly Gaussian. */ + val = 0; + for (i = 0; i < s->quality; i++) + { + s->rndnum = 1664525U*s->rndnum + 1013904223U; + val += ((int32_t) s->rndnum) >> 22; + } + if (s->class_of_noise == NOISE_CLASS_HOTH) + { + /* Hoth noise is room-like. It should be sculpted, at the high and low ends, + and roll off at 5dB/octave across the main part of the band. However, + merely rolling off at 6dB/octave across the band gets you close + to the subjective effect. */ + s->state = (3*val + 5*s->state) >> 3; + /* Bring the overall power level back to the pre-filtered level. This + simple approx. leaves the signal about 0.35dB low. */ + val = s->state << 1; + } + return saturate((val*s->rms) >> 10); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(noise_state_t *) noise_init_dbov(noise_state_t *s, int seed, float level, int class_of_noise, int quality) +{ + float rms; + + if (s == NULL) + { + if ((s = (noise_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + s->rndnum = (uint32_t) seed; + rms = 32768.0f*powf(10.0f, level/20.0f); + if (quality < 4) + s->quality = 4; + else if (quality > 20) + s->quality = 20; + else + s->quality = quality; + if (class_of_noise == NOISE_CLASS_HOTH) + { + /* Allow for the gain of the filter */ + rms *= 1.043f; + } + s->rms = (int32_t) (rms*sqrtf(12.0f/s->quality)); + s->class_of_noise = class_of_noise; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(noise_state_t *) noise_init_dbm0(noise_state_t *s, int seed, float level, int class_of_noise, int quality) +{ + return noise_init_dbov(s, seed, (level - DBM0_MAX_POWER), class_of_noise, quality); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) noise_release(noise_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) noise_free(noise_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/oki_adpcm.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/oki_adpcm.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,387 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * oki_adpcm.c - Conversion routines between linear 16 bit PCM data and + * OKI (Dialogic) ADPCM format. Supports with the 32kbps + * and 24kbps variants used by Dialogic. + * + * Written by Steve Underwood + * + * Copyright (C) 2001, 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * The actual OKI ADPCM encode and decode method is derived from freely + * available code, whose exact origins seem uncertain. + * + * $Id: oki_adpcm.c,v 1.32 2009/02/10 13:06:46 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/oki_adpcm.h" +#include "spandsp/private/oki_adpcm.h" + +/* Routines to convert 12 bit linear samples to the Oki ADPCM coding format, + widely used in CTI, because Dialogic use it. */ + +/* OKI ADPCM step variation table */ +static const int16_t step_size[49] = +{ + 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 +}; + +static const int16_t step_adjustment[8] = +{ + -1, -1, -1, -1, 2, 4, 6, 8 +}; + +/* Band limiting filter, to allow sample rate conversion to and + from 6k samples/second. */ +static const float cutoff_coeffs[] = +{ + -3.648392e-4f, + 5.062391e-4f, + 1.206247e-3f, + 1.804452e-3f, + 1.691750e-3f, + 4.083405e-4f, + -1.931085e-3f, + -4.452107e-3f, + -5.794821e-3f, + -4.778489e-3f, + -1.161266e-3f, + 3.928504e-3f, + 8.259786e-3f, + 9.500425e-3f, + 6.512800e-3f, + 2.227856e-4f, + -6.531275e-3f, + -1.026843e-2f, + -8.718062e-3f, + -2.280487e-3f, + 5.817733e-3f, + 1.096777e-2f, + 9.634404e-3f, + 1.569301e-3f, + -9.522632e-3f, + -1.748273e-2f, + -1.684408e-2f, + -6.100054e-3f, + 1.071206e-2f, + 2.525209e-2f, + 2.871779e-2f, + 1.664411e-2f, + -7.706268e-3f, + -3.331083e-2f, + -4.521249e-2f, + -3.085962e-2f, + 1.373653e-2f, + 8.089593e-2f, + 1.529060e-1f, + 2.080487e-1f, + 2.286834e-1f, + 2.080487e-1f, + 1.529060e-1f, + 8.089593e-2f, + 1.373653e-2f, + -3.085962e-2f, + -4.521249e-2f, + -3.331083e-2f, + -7.706268e-3f, + 1.664411e-2f, + 2.871779e-2f, + 2.525209e-2f, + 1.071206e-2f, + -6.100054e-3f, + -1.684408e-2f, + -1.748273e-2f, + -9.522632e-3f, + 1.569301e-3f, + 9.634404e-3f, + 1.096777e-2f, + 5.817733e-3f, + -2.280487e-3f, + -8.718062e-3f, + -1.026843e-2f, + -6.531275e-3f, + 2.227856e-4f, + 6.512800e-3f, + 9.500425e-3f, + 8.259786e-3f, + 3.928504e-3f, + -1.161266e-3f, + -4.778489e-3f, + -5.794821e-3f, + -4.452107e-3f, + -1.931085e-3f, + 4.083405e-4f, + 1.691750e-3f, + 1.804452e-3f, + 1.206247e-3f, + 5.062391e-4f, + -3.648392e-4f +}; + +static int16_t decode(oki_adpcm_state_t *s, uint8_t adpcm) +{ + int16_t e; + int16_t ss; + int16_t linear; + + /* Doing the next part as follows: + * + * x = adpcm & 0x07; + * e = (step_size[s->step_index]*(x + x + 1)) >> 3; + * + * Seems an obvious improvement on a modern machine, but remember + * the truncation errors do not come out the same. It would + * not, therefore, be an exact match for what this code is doing. + * + * Just what a Dialogic card does, I do not know! + */ + + ss = step_size[s->step_index]; + e = ss >> 3; + if (adpcm & 0x01) + e += (ss >> 2); + /*endif*/ + if (adpcm & 0x02) + e += (ss >> 1); + /*endif*/ + if (adpcm & 0x04) + e += ss; + /*endif*/ + if (adpcm & 0x08) + e = -e; + /*endif*/ + linear = s->last + e; + + /* Saturate the values to +/- 2^11 (supposed to be 12 bits) */ + if (linear > 2047) + linear = 2047; + else if (linear < -2048) + linear = -2048; + /*endif*/ + + s->last = linear; + s->step_index += step_adjustment[adpcm & 0x07]; + if (s->step_index < 0) + s->step_index = 0; + else if (s->step_index > 48) + s->step_index = 48; + /*endif*/ + /* Note: the result here is a 12 bit value */ + return linear; +} +/*- End of function --------------------------------------------------------*/ + +static uint8_t encode(oki_adpcm_state_t *s, int16_t linear) +{ + int16_t e; + int16_t ss; + uint8_t adpcm; + + ss = step_size[s->step_index]; + e = (linear >> 4) - s->last; + adpcm = (uint8_t) 0x00; + if (e < 0) + { + adpcm = (uint8_t) 0x08; + e = -e; + } + /*endif*/ + if (e >= ss) + { + adpcm |= (uint8_t) 0x04; + e -= ss; + } + /*endif*/ + if (e >= (ss >> 1)) + { + adpcm |= (uint8_t) 0x02; + e -= ss; + } + /*endif*/ + if (e >= (ss >> 2)) + adpcm |= (uint8_t) 0x01; + /*endif*/ + + /* Use the decoder to set the estimate of the last sample. */ + /* It also will adjust the step_index for us. */ + s->last = decode(s, adpcm); + return adpcm; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(oki_adpcm_state_t *) oki_adpcm_init(oki_adpcm_state_t *s, int bit_rate) +{ + if (bit_rate != 32000 && bit_rate != 24000) + return NULL; + if (s == NULL) + { + if ((s = (oki_adpcm_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + s->bit_rate = bit_rate; + + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) oki_adpcm_release(oki_adpcm_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) oki_adpcm_free(oki_adpcm_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) oki_adpcm_decode(oki_adpcm_state_t *s, + int16_t amp[], + const uint8_t oki_data[], + int oki_bytes) +{ + int i; + int x; + int l; + int n; + int samples; + float z; + +#if (_MSC_VER >= 1400) + __analysis_assume(s->phase >= 0 && s->phase <= 4); +#endif + samples = 0; + if (s->bit_rate == 32000) + { + for (i = 0; i < oki_bytes; i++) + { + amp[samples++] = decode(s, (oki_data[i] >> 4) & 0xF) << 4; + amp[samples++] = decode(s, oki_data[i] & 0xF) << 4; + } + /*endwhile*/ + } + else + { + n = 0; + for (i = 0; i < oki_bytes; ) + { + /* 6k to 8k sample/second conversion */ + if (s->phase) + { + s->history[s->ptr++] = + decode(s, (n++ & 1) ? (oki_data[i++] & 0xF) : ((oki_data[i] >> 4) & 0xF)) << 4; + s->ptr &= (32 - 1); + } + /*endif*/ + z = 0.0f; + for (l = 80 - 3 + s->phase, x = s->ptr - 1; l >= 0; l -= 4, x--) + z += cutoff_coeffs[l]*s->history[x & (32 - 1)]; + amp[samples++] = (int16_t) (z*4.0f); + if (++s->phase > 3) + s->phase = 0; + /*endif*/ + } + /*endfor*/ + } + /*endif*/ + return samples; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) oki_adpcm_encode(oki_adpcm_state_t *s, + uint8_t oki_data[], + const int16_t amp[], + int len) +{ + int x; + int l; + int n; + int bytes; + float z; + + bytes = 0; + if (s->bit_rate == 32000) + { + for (n = 0; n < len; n++) + { + s->oki_byte = (s->oki_byte << 4) | encode(s, amp[n]); + if ((s->mark++ & 1)) + oki_data[bytes++] = s->oki_byte; + /*endif*/ + } + /*endfor*/ + } + else + { + n = 0; + for (;;) + { + /* 8k to 6k sample/second conversion */ + if (s->phase > 2) + { + s->history[s->ptr++] = amp[n]; + s->ptr &= (32 - 1); + s->phase = 0; + if (++n >= len) + break; + /*endif*/ + } + /*endif*/ + s->history[s->ptr++] = amp[n]; + s->ptr &= (32 - 1); + z = 0.0f; + for (l = 80 - s->phase, x = s->ptr - 1; l >= 0; l -= 3, x--) + z += cutoff_coeffs[l]*s->history[x & (32 - 1)]; + /*endfor*/ + s->oki_byte = (s->oki_byte << 4) | encode(s, (int16_t) (z*3.0f)); + if ((s->mark++ & 1)) + oki_data[bytes++] = s->oki_byte; + /*endif*/ + s->phase++; + if (++n >= len) + break; + /*endif*/ + } + /*endfor*/ + } + /*endif*/ + return bytes; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/playout.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/playout.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,378 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * playout.c + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This was kicked off from jitter buffering code + * Copyright (C) 2004, Horizon Wimba, Inc. + * Author Steve Kann + * However, there isn't a lot of the original left, now. The original + * was licenced under the LGPL, so any remaining fragments are + * compatible with the GPL licence used here. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: playout.c,v 1.17 2009/02/10 13:06:46 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/playout.h" + +static playout_frame_t *queue_get(playout_state_t *s, timestamp_t sender_stamp) +{ + playout_frame_t *frame; + + if ((frame = s->first_frame) == NULL) + return NULL; + + if (sender_stamp >= frame->sender_stamp) + { + /* Remove this frame from the queue */ + if (frame->later) + { + frame->later->earlier = NULL; + s->first_frame = frame->later; + } + else + { + /* The queue is now empty */ + s->first_frame = NULL; + s->last_frame = NULL; + } + return frame; + } + + return NULL; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(timestamp_t) playout_next_due(playout_state_t *s) +{ + return s->last_speech_sender_stamp + s->last_speech_sender_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(timestamp_t) playout_current_length(playout_state_t *s) +{ + return s->target_buffer_length; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(playout_frame_t *) playout_get_unconditional(playout_state_t *s) +{ + playout_frame_t *frame; + + if ((frame = queue_get(s, 0x7FFFFFFF))) + { + /* Put it on the free list */ + frame->later = s->free_frames; + s->free_frames = frame; + + /* We return the frame pointer, even though it's on the free list. + The caller *must* copy the data before this frame has any chance + of being reused. */ + } + return frame; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) playout_get(playout_state_t *s, playout_frame_t *frameout, timestamp_t now) +{ + playout_frame_t *frame; + + /* Make the last_speech_sender_stamp the current expected one. */ + s->last_speech_sender_stamp += s->last_speech_sender_len; + if ((frame = queue_get(s, s->last_speech_sender_stamp)) == NULL) + { + /* The required frame was not received (or at least not in time) */ + s->frames_missing++; + return PLAYOUT_FILLIN; + } + + if (s->dynamic && frame->type == PLAYOUT_TYPE_SPEECH) + { + /* Assess whether the buffer length is appropriate */ + if (!s->not_first) + { + /* Prime things the first time through */ + s->not_first = TRUE; + s->latest_expected = frame->receiver_stamp + s->min_length; + } + /* Leaky integrate the rate of occurance of frames received just in time and late */ + s->state_late += ((((frame->receiver_stamp > s->latest_expected) ? 0x10000000 : 0) - s->state_late) >> 8); + s->state_just_in_time += ((((frame->receiver_stamp > s->latest_expected - frame->sender_len) ? 0x10000000 : 0) - s->state_just_in_time) >> 8); + s->latest_expected += frame->sender_len; + + if (s->state_late > s->dropable_threshold) + { + if (s->since_last_step < 10) + { + if (s->target_buffer_length < s->max_length - 2) + { + /* The late bin is too big - increase buffering */ + s->target_buffer_length += 3*frame->sender_len; + s->latest_expected += 3*frame->sender_len; + s->state_just_in_time = s->dropable_threshold; + s->state_late = 0; + s->since_last_step = 0; + + s->last_speech_sender_stamp -= 3*s->last_speech_sender_len; + } + } + else + { + if (s->target_buffer_length < s->max_length) + { + /* The late bin is too big - increase buffering */ + s->target_buffer_length += frame->sender_len; + s->latest_expected += frame->sender_len; + s->state_just_in_time = s->dropable_threshold; + s->state_late = 0; + s->since_last_step = 0; + + s->last_speech_sender_stamp -= s->last_speech_sender_len; + } + } + } + else if (s->since_last_step > 500 && s->state_just_in_time < s->dropable_threshold) + { + if (s->target_buffer_length > s->min_length) + { + /* The just-in-time bin is pretty small - decrease buffering */ + s->target_buffer_length -= frame->sender_len; + s->latest_expected -= frame->sender_len; + s->state_just_in_time = s->dropable_threshold; + s->state_late = 0; + s->since_last_step = 0; + + s->last_speech_sender_stamp += s->last_speech_sender_len; + } + } + s->since_last_step++; + } + + /* If its not a speech frame, just return it. */ + if (frame->type != PLAYOUT_TYPE_SPEECH) + { + /* Rewind last_speech_sender_stamp, since this isn't speech */ + s->last_speech_sender_stamp -= s->last_speech_sender_len; + + *frameout = *frame; + /* Put it on the free list */ + frame->later = s->free_frames; + s->free_frames = frame; + + s->frames_out++; + return PLAYOUT_OK; + } + if (frame->sender_stamp < s->last_speech_sender_stamp) + { + /* This speech frame is late */ + *frameout = *frame; + /* Put it on the free list */ + frame->later = s->free_frames; + s->free_frames = frame; + + /* Rewind last_speech_sender_stamp, since we're just dumping */ + s->last_speech_sender_stamp -= s->last_speech_sender_len; + s->frames_out++; + s->frames_late++; + s->frames_missing--; + return PLAYOUT_DROP; + } + /* Keep track of frame sizes, to allow for variable sized frames */ + if (frame->sender_len > 0) + s->last_speech_sender_len = frame->sender_len; + + /* Normal case. Return the frame, and increment stuff */ + *frameout = *frame; + /* Put it on the free list */ + frame->later = s->free_frames; + s->free_frames = frame; + + s->frames_out++; + return PLAYOUT_OK; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) playout_put(playout_state_t *s, void *data, int type, timestamp_t sender_len, timestamp_t sender_stamp, timestamp_t receiver_stamp) +{ + playout_frame_t *frame; + playout_frame_t *p; + + /* When a frame arrives we just queue it in order. We leave all the tricky stuff until frames + are read from the queue. */ + s->frames_in++; + + /* Acquire a frame */ + if ((frame = s->free_frames)) + { + s->free_frames = frame->later; + } + else + { + if ((frame = (playout_frame_t *) malloc(sizeof(*frame))) == NULL) + return PLAYOUT_ERROR; + } + + /* Fill out the frame */ + frame->data = data; + frame->type = type; + frame->sender_stamp = sender_stamp; + frame->sender_len = sender_len; + frame->receiver_stamp = receiver_stamp; + + /* Frames are kept in a list, sorted by the timestamp assigned by the sender. */ + if (s->last_frame == NULL) + { + /* The queue is empty. */ + frame->later = NULL; + frame->earlier = NULL; + s->first_frame = frame; + s->last_frame = frame; + } + else if (sender_stamp >= s->last_frame->sender_stamp) + { + /* Frame goes at the end of the queue. */ + frame->later = NULL; + frame->earlier = s->last_frame; + s->last_frame->later = frame; + s->last_frame = frame; + } + else + { + /* Frame is out of sequence. */ + s->frames_oos++; + + /* Find where it should go in the queue */ + p = s->last_frame; + while (sender_stamp < p->sender_stamp && p->earlier) + p = p->earlier; + + if (p->earlier) + { + /* It needs to go somewhere in the queue */ + frame->later = p->later; + frame->earlier = p; + p->later->earlier = frame; + p->later = frame; + } + else + { + /* It needs to go at the very beginning of the queue */ + frame->later = p; + frame->earlier = NULL; + p->earlier = frame; + s->first_frame = frame; + } + } + + if (s->start && type == PLAYOUT_TYPE_SPEECH) + { + s->last_speech_sender_stamp = sender_stamp - sender_len - s->min_length; + s->last_speech_sender_len = sender_len; + s->start = FALSE; + } + + return PLAYOUT_OK; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) playout_restart(playout_state_t *s, int min_length, int max_length) +{ + playout_frame_t *frame; + playout_frame_t *next; + + /* Free all the frames on the free list */ + for (frame = s->free_frames; frame; frame = next) + { + next = frame->later; + free(frame); + } + + memset(s, 0, sizeof(*s)); + s->dynamic = (min_length < max_length); + s->min_length = min_length; + s->max_length = (max_length > min_length) ? max_length : min_length; + s->dropable_threshold = 1*0x10000000/100; + s->start = TRUE; + s->since_last_step = 0x7FFFFFFF; + /* Start with the minimum buffer length allowed, and work from there */ + s->actual_buffer_length = + s->target_buffer_length = (s->max_length - s->min_length)/2; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(playout_state_t *) playout_init(int min_length, int max_length) +{ + playout_state_t *s; + + if ((s = (playout_state_t *) malloc(sizeof(playout_state_t))) == NULL) + return NULL; + memset(s, 0, sizeof(*s)); + playout_restart(s, min_length, max_length); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) playout_release(playout_state_t *s) +{ + playout_frame_t *frame; + playout_frame_t *next; + + /* Free all the frames in the queue. In most cases these should have been + removed already, so their associated data could be freed. */ + for (frame = s->first_frame; frame; frame = next) + { + next = frame->later; + free(frame); + } + /* Free all the frames on the free list */ + for (frame = s->free_frames; frame; frame = next) + { + next = frame->later; + free(frame); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) playout_free(playout_state_t *s) +{ + if (s) + { + playout_release(s); + /* Finally, free ourselves! */ + free(s); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/plc.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/plc.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,262 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * plc.c + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: plc.c,v 1.27.4.1 2009/12/23 14:23:49 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/saturated.h" +#include "spandsp/plc.h" + +/* We do a straight line fade to zero volume in 50ms when we are filling in for missing data. */ +#define ATTENUATION_INCREMENT 0.0025f /* Attenuation per sample */ + +static void save_history(plc_state_t *s, int16_t *buf, int len) +{ + if (len >= PLC_HISTORY_LEN) + { + /* Just keep the last part of the new data, starting at the beginning of the buffer */ + memcpy(s->history, buf + len - PLC_HISTORY_LEN, sizeof(int16_t)*PLC_HISTORY_LEN); + s->buf_ptr = 0; + return; + } + if (s->buf_ptr + len > PLC_HISTORY_LEN) + { + /* Wraps around - must break into two sections */ + memcpy(s->history + s->buf_ptr, buf, sizeof(int16_t)*(PLC_HISTORY_LEN - s->buf_ptr)); + len -= (PLC_HISTORY_LEN - s->buf_ptr); + memcpy(s->history, buf + (PLC_HISTORY_LEN - s->buf_ptr), sizeof(int16_t)*len); + s->buf_ptr = len; + return; + } + /* Can use just one section */ + memcpy(s->history + s->buf_ptr, buf, sizeof(int16_t)*len); + s->buf_ptr += len; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void normalise_history(plc_state_t *s) +{ + int16_t tmp[PLC_HISTORY_LEN]; + + if (s->buf_ptr == 0) + return; + memcpy(tmp, s->history, sizeof(int16_t)*s->buf_ptr); + memcpy(s->history, s->history + s->buf_ptr, sizeof(int16_t)*(PLC_HISTORY_LEN - s->buf_ptr)); + memcpy(s->history + PLC_HISTORY_LEN - s->buf_ptr, tmp, sizeof(int16_t)*s->buf_ptr); + s->buf_ptr = 0; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int amdf_pitch(int min_pitch, int max_pitch, int16_t amp[], int len) +{ + int i; + int j; + int acc; + int min_acc; + int pitch; + + pitch = min_pitch; + min_acc = INT_MAX; + for (i = max_pitch; i <= min_pitch; i++) + { + acc = 0; + for (j = 0; j < len; j++) + acc += abs(amp[i + j] - amp[j]); + if (acc < min_acc) + { + min_acc = acc; + pitch = i; + } + } + return pitch; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) plc_rx(plc_state_t *s, int16_t amp[], int len) +{ + int i; + int pitch_overlap; + float old_step; + float new_step; + float old_weight; + float new_weight; + float gain; + + if (s->missing_samples) + { + /* Although we have a real signal, we need to smooth it to fit well + with the synthetic signal we used for the previous block */ + + /* The start of the real data is overlapped with the next 1/4 cycle + of the synthetic data. */ + pitch_overlap = s->pitch >> 2; + if (pitch_overlap > len) + pitch_overlap = len; + gain = 1.0f - s->missing_samples*ATTENUATION_INCREMENT; + if (gain < 0.0f) + gain = 0.0f; + new_step = 1.0f/pitch_overlap; + old_step = new_step*gain; + new_weight = new_step; + old_weight = (1.0f - new_step)*gain; + for (i = 0; i < pitch_overlap; i++) + { + amp[i] = fsaturate(old_weight*s->pitchbuf[s->pitch_offset] + new_weight*amp[i]); + if (++s->pitch_offset >= s->pitch) + s->pitch_offset = 0; + new_weight += new_step; + old_weight -= old_step; + if (old_weight < 0.0f) + old_weight = 0.0f; + } + s->missing_samples = 0; + } + save_history(s, amp, len); + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) plc_fillin(plc_state_t *s, int16_t amp[], int len) +{ + int i; + int pitch_overlap; + float old_step; + float new_step; + float old_weight; + float new_weight; + float gain; + int16_t *orig_amp; + int orig_len; + + orig_amp = amp; + orig_len = len; + if (s->missing_samples == 0) + { + /* As the gap in real speech starts we need to assess the last known pitch, + and prepare the synthetic data we will use for fill-in */ + normalise_history(s); + s->pitch = amdf_pitch(PLC_PITCH_MIN, PLC_PITCH_MAX, s->history + PLC_HISTORY_LEN - CORRELATION_SPAN - PLC_PITCH_MIN, CORRELATION_SPAN); + /* We overlap a 1/4 wavelength */ + pitch_overlap = s->pitch >> 2; + /* Cook up a single cycle of pitch, using a single of the real signal with 1/4 + cycle OLA'ed to make the ends join up nicely */ + /* The first 3/4 of the cycle is a simple copy */ + for (i = 0; i < s->pitch - pitch_overlap; i++) + s->pitchbuf[i] = s->history[PLC_HISTORY_LEN - s->pitch + i]; + /* The last 1/4 of the cycle is overlapped with the end of the previous cycle */ + new_step = 1.0f/pitch_overlap; + new_weight = new_step; + for ( ; i < s->pitch; i++) + { + s->pitchbuf[i] = s->history[PLC_HISTORY_LEN - s->pitch + i]*(1.0f - new_weight) + s->history[PLC_HISTORY_LEN - 2*s->pitch + i]*new_weight; + new_weight += new_step; + } + /* We should now be ready to fill in the gap with repeated, decaying cycles + of what is in pitchbuf */ + + gain = 1.0f; + /* We need to OLA the first 1/4 wavelength of the synthetic data, to smooth + it into the previous real data. To avoid the need to introduce a delay + in the stream, reverse the last 1/4 wavelength, and OLA with that. */ + new_step = 1.0f/pitch_overlap; + old_step = new_step; + new_weight = new_step; + old_weight = 1.0f - new_step; + for (i = 0; i < pitch_overlap; i++) + { + amp[i] = fsaturate(old_weight*s->history[PLC_HISTORY_LEN - 1 - i] + new_weight*s->pitchbuf[i]); + new_weight += new_step; + old_weight -= old_step; + if (old_weight < 0.0f) + old_weight = 0.0f; + } + s->pitch_offset = i; + } + else + { + gain = 1.0f - s->missing_samples*ATTENUATION_INCREMENT; + i = 0; + } + for ( ; gain > 0.0f && i < len; i++) + { + amp[i] = (int16_t) (s->pitchbuf[s->pitch_offset]*gain); + gain -= ATTENUATION_INCREMENT; + if (++s->pitch_offset >= s->pitch) + s->pitch_offset = 0; + } + for ( ; i < len; i++) + amp[i] = 0; + s->missing_samples += orig_len; + save_history(s, amp, len); + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(plc_state_t *) plc_init(plc_state_t *s) +{ + if (s == NULL) + { + if ((s = (plc_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) plc_release(plc_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) plc_free(plc_state_t *s) +{ + if (s) + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/power_meter.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/power_meter.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,214 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * power_meter.c + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: power_meter.c,v 1.31 2009/05/30 17:29:23 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include + +#include "spandsp/telephony.h" +#include "spandsp/power_meter.h" + +SPAN_DECLARE(power_meter_t *) power_meter_init(power_meter_t *s, int shift) +{ + if (s == NULL) + { + if ((s = (power_meter_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + s->shift = shift; + s->reading = 0; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) power_meter_release(power_meter_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) power_meter_free(power_meter_t *s) +{ + if (s) + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(power_meter_t *) power_meter_damping(power_meter_t *s, int shift) +{ + s->shift = shift; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int32_t) power_meter_update(power_meter_t *s, int16_t amp) +{ + s->reading += ((amp*amp - s->reading) >> s->shift); + return s->reading; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int32_t) power_meter_level_dbm0(float level) +{ + float l; + + level -= DBM0_MAX_POWER; + if (level > 0.0) + level = 0.0; + l = powf(10.0f, level/10.0f)*(32767.0f*32767.0f); + return (int32_t) l; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int32_t) power_meter_level_dbov(float level) +{ + float l; + + if (level > 0.0) + level = 0.0; + l = powf(10.0f, level/10.0f)*(32767.0f*32767.0f); + return (int32_t) l; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int32_t) power_meter_current(power_meter_t *s) +{ + return s->reading; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) power_meter_current_dbm0(power_meter_t *s) +{ + if (s->reading <= 0) + return -96.329f + DBM0_MAX_POWER; + /* This is based on A-law, but u-law is only 0.03dB different, so don't worry. */ + return log10f((float) s->reading/(32767.0f*32767.0f))*10.0f + DBM0_MAX_POWER; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) power_meter_current_dbov(power_meter_t *s) +{ + if (s->reading <= 0) + return -96.329f; + return log10f((float) s->reading/(32767.0f*32767.0f))*10.0f; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int32_t) power_surge_detector(power_surge_detector_state_t *s, int16_t amp) +{ + int32_t pow_short; + int32_t pow_medium; + + pow_short = power_meter_update(&s->short_term, amp); + pow_medium = power_meter_update(&s->medium_term, amp); + if (pow_medium < s->min) + return 0; + if (!s->signal_present) + { + if (pow_short <= s->surge*(pow_medium >> 10)) + return 0; + s->signal_present = TRUE; + s->medium_term.reading = s->short_term.reading; + } + else + { + if (pow_short < s->sag*(pow_medium >> 10)) + { + s->signal_present = FALSE; + s->medium_term.reading = s->short_term.reading; + return 0; + } + } + return pow_short; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) power_surge_detector_current_dbm0(power_surge_detector_state_t *s) +{ + return power_meter_current_dbm0(&s->short_term); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) power_surge_detector_current_dbov(power_surge_detector_state_t *s) +{ + return power_meter_current_dbov(&s->short_term); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(power_surge_detector_state_t *) power_surge_detector_init(power_surge_detector_state_t *s, float min, float surge) +{ + float ratio; + + if (s == NULL) + { + if ((s = (power_surge_detector_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + power_meter_init(&s->short_term, 4); + power_meter_init(&s->medium_term, 7); + ratio = powf(10.0f, surge/10.0f); + s->surge = 1024.0f*ratio; + s->sag = 1024.0f/ratio; + s->min = power_meter_level_dbm0(min); + s->medium_term.reading = s->min + 1; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) power_surge_detector_release(power_surge_detector_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) power_surge_detector_free(power_surge_detector_state_t *s) +{ + if (s) + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/queue.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/queue.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,425 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * queue.c - simple in-process message queuing + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: queue.c,v 1.31 2009/04/11 18:11:19 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include + +#define SPANDSP_FULLY_DEFINE_QUEUE_STATE_T +#include "spandsp/telephony.h" +#include "spandsp/queue.h" + +#include "spandsp/private/queue.h" + +SPAN_DECLARE(int) queue_empty(queue_state_t *s) +{ + return (s->iptr == s->optr); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) queue_free_space(queue_state_t *s) +{ + int len; + + if ((len = s->optr - s->iptr - 1) < 0) + len += s->len; + /*endif*/ + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) queue_contents(queue_state_t *s) +{ + int len; + + if ((len = s->iptr - s->optr) < 0) + len += s->len; + /*endif*/ + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) queue_flush(queue_state_t *s) +{ + s->optr = s->iptr; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) queue_view(queue_state_t *s, uint8_t *buf, int len) +{ + int real_len; + int to_end; + int iptr; + int optr; + + /* Snapshot the values (although only iptr should be changeable during this processing) */ + iptr = s->iptr; + optr = s->optr; + if ((real_len = iptr - optr) < 0) + real_len += s->len; + /*endif*/ + if (real_len < len) + { + if (s->flags & QUEUE_READ_ATOMIC) + return -1; + /*endif*/ + } + else + { + real_len = len; + } + /*endif*/ + if (real_len == 0) + return 0; + /*endif*/ + to_end = s->len - optr; + if (iptr < optr && to_end < real_len) + { + /* A two step process */ + if (buf) + { + memcpy(buf, s->data + optr, to_end); + memcpy(buf + to_end, s->data, real_len - to_end); + } + /*endif*/ + } + else + { + /* A one step process */ + if (buf) + memcpy(buf, s->data + optr, real_len); + /*endif*/ + } + /*endif*/ + return real_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) queue_read(queue_state_t *s, uint8_t *buf, int len) +{ + int real_len; + int to_end; + int new_optr; + int iptr; + int optr; + + /* Snapshot the values (although only iptr should be changeable during this processing) */ + iptr = s->iptr; + optr = s->optr; + if ((real_len = iptr - optr) < 0) + real_len += s->len; + /*endif*/ + if (real_len < len) + { + if (s->flags & QUEUE_READ_ATOMIC) + return -1; + /*endif*/ + } + else + { + real_len = len; + } + /*endif*/ + if (real_len == 0) + return 0; + /*endif*/ + to_end = s->len - optr; + if (iptr < optr && to_end < real_len) + { + /* A two step process */ + if (buf) + { + memcpy(buf, s->data + optr, to_end); + memcpy(buf + to_end, s->data, real_len - to_end); + } + /*endif*/ + new_optr = real_len - to_end; + } + else + { + /* A one step process */ + if (buf) + memcpy(buf, s->data + optr, real_len); + /*endif*/ + new_optr = optr + real_len; + if (new_optr >= s->len) + new_optr = 0; + /*endif*/ + } + /*endif*/ + /* Only change the pointer now we have really finished */ + s->optr = new_optr; + return real_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) queue_read_byte(queue_state_t *s) +{ + int real_len; + int to_end; + int iptr; + int optr; + int byte; + + /* Snapshot the values (although only iptr should be changeable during this processing) */ + iptr = s->iptr; + optr = s->optr; + if ((real_len = iptr - optr) < 0) + real_len += s->len; + /*endif*/ + if (real_len < 1) + return -1; + /*endif*/ + to_end = s->len - optr; + byte = s->data[optr]; + if (++optr >= s->len) + optr = 0; + /*endif*/ + /* Only change the pointer now we have really finished */ + s->optr = optr; + return byte; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) queue_write(queue_state_t *s, const uint8_t *buf, int len) +{ + int real_len; + int to_end; + int new_iptr; + int iptr; + int optr; + + /* Snapshot the values (although only optr should be changeable during this processing) */ + iptr = s->iptr; + optr = s->optr; + + if ((real_len = optr - iptr - 1) < 0) + real_len += s->len; + /*endif*/ + if (real_len < len) + { + if (s->flags & QUEUE_WRITE_ATOMIC) + return -1; + /*endif*/ + } + else + { + real_len = len; + } + /*endif*/ + if (real_len == 0) + return 0; + /*endif*/ + to_end = s->len - iptr; + if (iptr < optr || to_end >= real_len) + { + /* A one step process */ + memcpy(s->data + iptr, buf, real_len); + new_iptr = iptr + real_len; + if (new_iptr >= s->len) + new_iptr = 0; + /*endif*/ + } + else + { + /* A two step process */ + memcpy(s->data + iptr, buf, to_end); + memcpy(s->data, buf + to_end, real_len - to_end); + new_iptr = real_len - to_end; + } + /*endif*/ + /* Only change the pointer now we have really finished */ + s->iptr = new_iptr; + return real_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) queue_write_byte(queue_state_t *s, uint8_t byte) +{ + int real_len; + int iptr; + int optr; + + /* Snapshot the values (although only optr should be changeable during this processing) */ + iptr = s->iptr; + optr = s->optr; + + if ((real_len = optr - iptr - 1) < 0) + real_len += s->len; + /*endif*/ + if (real_len < 1) + { + if (s->flags & QUEUE_WRITE_ATOMIC) + return -1; + /*endif*/ + return 0; + } + /*endif*/ + s->data[iptr] = byte; + if (++iptr >= s->len) + iptr = 0; + /*endif*/ + /* Only change the pointer now we have really finished */ + s->iptr = iptr; + return 1; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) queue_state_test_msg(queue_state_t *s) +{ + uint16_t lenx; + + if (queue_view(s, (uint8_t *) &lenx, sizeof(uint16_t)) != sizeof(uint16_t)) + return -1; + /*endif*/ + return lenx; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) queue_read_msg(queue_state_t *s, uint8_t *buf, int len) +{ + uint16_t lenx; + + /* If we assume the write message was atomic, this read message should be + safe when conducted in multiple chunks */ + if (queue_read(s, (uint8_t *) &lenx, sizeof(uint16_t)) != sizeof(uint16_t)) + return -1; + /*endif*/ + /* If we got this far, the actual message chunk should be guaranteed to be + available */ + if (lenx == 0) + return 0; + /*endif*/ + if ((int) lenx > len) + { + len = queue_read(s, buf, len); + /* Discard the rest of the message */ + queue_read(s, NULL, lenx - len); + return len; + } + /*endif*/ + return queue_read(s, buf, lenx); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) queue_write_msg(queue_state_t *s, const uint8_t *buf, int len) +{ + int real_len; + int to_end; + int new_iptr; + int iptr; + int optr; + uint16_t lenx; + + /* Snapshot the values (although only optr should be changeable during this processing) */ + iptr = s->iptr; + optr = s->optr; + + if ((real_len = optr - iptr - 1) < 0) + real_len += s->len; + /*endif*/ + if (real_len < len + (int) sizeof(uint16_t)) + return -1; + /*endif*/ + real_len = len + (int) sizeof(uint16_t); + + to_end = s->len - iptr; + lenx = (uint16_t) len; + if (iptr < optr || to_end >= real_len) + { + /* A one step process */ + memcpy(s->data + iptr, &lenx, sizeof(uint16_t)); + memcpy(s->data + iptr + sizeof(uint16_t), buf, len); + new_iptr = iptr + real_len; + if (new_iptr >= s->len) + new_iptr = 0; + /*endif*/ + } + else + { + /* A two step process */ + if (to_end >= sizeof(uint16_t)) + { + /* The actual message wraps around the end of the buffer */ + memcpy(s->data + iptr, &lenx, sizeof(uint16_t)); + memcpy(s->data + iptr + sizeof(uint16_t), buf, to_end - sizeof(uint16_t)); + memcpy(s->data, buf + to_end - sizeof(uint16_t), real_len - to_end); + } + else + { + /* The message length wraps around the end of the buffer */ + memcpy(s->data + iptr, (uint8_t *) &lenx, to_end); + memcpy(s->data, ((uint8_t *) &lenx) + to_end, sizeof(uint16_t) - to_end); + memcpy(s->data + sizeof(uint16_t) - to_end, buf, len); + } + new_iptr = real_len - to_end; + } + /*endif*/ + /* Only change the pointer now we have really finished */ + s->iptr = new_iptr; + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(queue_state_t *) queue_init(queue_state_t *s, int len, int flags) +{ + if (s == NULL) + { + if ((s = (queue_state_t *) malloc(sizeof(*s) + len + 1)) == NULL) + return NULL; + } + s->iptr = + s->optr = 0; + s->flags = flags; + s->len = len + 1; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) queue_release(queue_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) queue_free(queue_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/schedule.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/schedule.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,161 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * schedule.c + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: schedule.c,v 1.22 2009/02/10 13:06:46 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/schedule.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/schedule.h" + +SPAN_DECLARE(int) span_schedule_event(span_sched_state_t *s, int us, span_sched_callback_func_t function, void *user_data) +{ + int i; + + for (i = 0; i < s->max_to_date; i++) + { + if (s->sched[i].callback == NULL) + break; + /*endif*/ + } + /*endfor*/ + if (i >= s->allocated) + { + s->allocated += 5; + s->sched = (span_sched_t *) realloc(s->sched, sizeof(span_sched_t)*s->allocated); + } + /*endif*/ + if (i >= s->max_to_date) + s->max_to_date = i + 1; + /*endif*/ + s->sched[i].when = s->ticker + us; + s->sched[i].callback = function; + s->sched[i].user_data = user_data; + return i; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(uint64_t) span_schedule_next(span_sched_state_t *s) +{ + int i; + uint64_t earliest; + + earliest = ~((uint64_t) 0); + for (i = 0; i < s->max_to_date; i++) + { + if (s->sched[i].callback && earliest > s->sched[i].when) + earliest = s->sched[i].when; + /*endif*/ + } + /*endfor*/ + return earliest; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(uint64_t) span_schedule_time(span_sched_state_t *s) +{ + return s->ticker; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) span_schedule_update(span_sched_state_t *s, int us) +{ + int i; + span_sched_callback_func_t callback; + void *user_data; + + s->ticker += us; + for (i = 0; i < s->max_to_date; i++) + { + if (s->sched[i].callback && s->sched[i].when <= s->ticker) + { + callback = s->sched[i].callback; + user_data = s->sched[i].user_data; + s->sched[i].callback = NULL; + s->sched[i].user_data = NULL; + callback(s, user_data); + } + /*endif*/ + } + /*endfor*/ +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) span_schedule_del(span_sched_state_t *s, int i) +{ + if (i >= s->max_to_date + || + i < 0 + || + s->sched[i].callback == NULL) + { + span_log(&s->logging, SPAN_LOG_WARNING, "Requested to delete invalid scheduled ID %d ?\n", i); + return; + } + /*endif*/ + s->sched[i].callback = NULL; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(span_sched_state_t *) span_schedule_init(span_sched_state_t *s) +{ + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "SCHEDULE"); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) span_schedule_release(span_sched_state_t *s) +{ + if (s->sched) + { + free(s->sched); + s->sched = NULL; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) span_schedule_free(span_sched_state_t *s) +{ + span_schedule_release(s); + if (s) + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/sig_tone.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/sig_tone.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,725 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * sig_tone.c - Signalling tone processing for the 2280Hz, 2600Hz and similar + * signalling tone used in older protocols. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: sig_tone.c,v 1.33 2009/09/04 14:38:46 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include +#include +#include + +#undef SPANDSP_USE_FIXED_POINT +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/dc_restore.h" +#include "spandsp/saturated.h" +#include "spandsp/vector_int.h" +#include "spandsp/complex.h" +#include "spandsp/dds.h" +#include "spandsp/super_tone_rx.h" +#include "spandsp/sig_tone.h" + +#include "spandsp/private/sig_tone.h" + +/*! PI */ +#define PI 3.14159265358979323 + +/* The coefficients for the data notch filter. This filter is also the + guard filter for tone detection. */ + +sig_tone_descriptor_t sig_tones[4] = +{ + { + /* 2280Hz (e.g. AC15, and many other European protocols) */ + {2280, 0}, + {{-10, -20}, {0, 0}}, /* -10+-1 dBmO and -20+-1 dBm0 */ + ms_to_samples(400), /* 300ms to 550ms */ + + ms_to_samples(225), + + ms_to_samples(225), + TRUE, + + 24, + 64, + + 1, + { + { +#if defined(SPANDSP_USE_FIXED_POINT) + { 3600, 14397, 32767}, + { 0, -9425, -28954}, + { 0, 14196, 32767}, + { 0, -17393, -28954}, + 12, +#else + {0.878906f, 0.439362f, 1.0f}, + {0.0f, -0.287627f, -0.883605f}, + {0.0f, 0.433228f, 1.0f}, + {0.0f, -0.530792f, -0.883605f}, +#endif + }, + { +#if defined(SPANDSP_USE_FIXED_POINT) + { 0, 0, 0}, + { 0, 0, 0}, + { 0, 0, 0}, + { 0, 0, 0}, + 0, +#else + {0.0f, 0.0f, 0.0f}, + {0.0f, 0.0f, 0.0f}, + {0.0f, 0.0f, 0.0f}, + {0.0f, 0.0f, 0.0f}, +#endif + } + }, +#if defined(SPANDSP_USE_FIXED_POINT) + { 12900, -16384, -16384}, + { 0, -8578, -11796}, + 15, +#else + {0.393676f, -0.5f, -0.5f}, + {0.0f, -0.261778f, -0.359985f}, +#endif + + 31744, + 1024, + + 31744, + 187, + + 31744, + 187, + + -1, + -32, + + 57 + }, + { + /* 2600Hz (e.g. many US protocols) */ + {2600, 0}, + {{-8, -8}, {0, 0}}, + ms_to_samples(400), + + ms_to_samples(225), + + ms_to_samples(225), + FALSE, + + 24, + 64, + + 1, + { + { +#if defined(SPANDSP_USE_FIXED_POINT) + { 3539, 29569, 32767}, + { 0, -24010, -28341}, + { 0, 29844, 32767}, + { 0, -31208, -28341}, + 12, +#else + {0.864014f, 0.902374f, 1.0f}, + {0.0f, -0.732727f, -0.864899f}, + {0.0f, 0.910766f, 1.0f}, + {0.0f, -0.952393f, -0.864899f}, +#endif + }, + { +#if defined(SPANDSP_USE_FIXED_POINT) + { 0, 0, 0}, + { 0, 0, 0}, + { 0, 0, 0}, + { 0, 0, 0}, + 0, +#else + {0.0f, 0.0f, 0.0f}, + {0.0f, 0.0f, 0.0f}, + {0.0f, 0.0f, 0.0f}, + {0.0f, 0.0f, 0.0f}, +#endif + } + }, +#if defined(SPANDSP_USE_FIXED_POINT) + { 32768, 0, 0}, + { 0, 0, 0}, + 15, +#else + {1.0f, 0.0f, 0.0f}, + {0.0f, 0.0f, 0.0f}, +#endif + + 31744, + 1024, + + 31744, + 170, + + 31744, + 170, + + -1, + -32, + + 52 + }, + { + /* 2400Hz/2600Hz (e.g. SS5 and SS5bis) */ + {2600, 2400}, + {{-8, -8}, {-8, -8}}, + ms_to_samples(400), + + ms_to_samples(225), + + ms_to_samples(225), + FALSE, + + 24, + 64, + + 2, + { + { +#if defined(SPANDSP_USE_FIXED_POINT) + { 3539, 29569, 32767}, + { 0, -24010, -28341}, + { 0, 29844, 32767}, + { 0, -31208, -28341}, + 12, +#else + {0.864014f, 0.902374f, 1.0f}, + {0.0f, -0.732727f, -0.864899f}, + {0.0f, 0.910766f, 1.0f}, + {0.0f, -0.952393f, -0.864899f}, +#endif + }, + { +#if defined(SPANDSP_USE_FIXED_POINT) + { 3539, 20349, 32767}, + { 0, -22075, -31856}, + { 0, 20174, 32767}, + { 0, -17832, -31836}, + 12, +#else + {0.864014f, 0.621007f, 1.0f}, + {0.0f, -0.673667f, -0.972167f}, + {0.0f, 0.615669f, 1.0f}, + {0.0f, -0.544180f, -0.971546f}, +#endif + } + }, +#if defined(SPANDSP_USE_FIXED_POINT) + { 32768, 0, 0}, + { 0, 0, 0}, + 15, +#else + {1.0f, 0.0f, 0.0f}, + {0.0f, 0.0f, 0.0f}, +#endif + + 31744, + 1024, + + 31744, + 170, + + 31744, + 170, + + -1, + -32, + + 52 + } +}; + +SPAN_DECLARE(int) sig_tone_tx(sig_tone_tx_state_t *s, int16_t amp[], int len) +{ + int i; + int j; + int n; + int16_t tone; + int need_update; + int high_low; + + for (i = 0; i < len; i += n) + { + if (s->current_tx_timeout) + { + if (s->current_tx_timeout <= len - i) + { + n = s->current_tx_timeout; + need_update = TRUE; + } + else + { + n = len - i; + need_update = FALSE; + } + s->current_tx_timeout -= n; + } + else + { + n = len - i; + need_update = FALSE; + } + if (!(s->current_tx_tone & SIG_TONE_TX_PASSTHROUGH)) + vec_zeroi16(&[i], n); + /*endif*/ + if ((s->current_tx_tone & (SIG_TONE_1_PRESENT || SIG_TONE_2_PRESENT))) + { + /* Are we in the early phase (high tone energy level), or the sustaining + phase (low tone energy level) of tone generation? */ + /* This doesn't try to get the high/low timing precise, as there is no + value in doing so. It works block by block, and the blocks are normally + quite short. */ + if (s->high_low_timer > 0) + { + if (n > s->high_low_timer) + n = s->high_low_timer; + s->high_low_timer -= n; + high_low = 0; + } + else + { + high_low = 1; + } + /*endif*/ + if ((s->current_tx_tone & SIG_TONE_1_PRESENT) && s->phase_rate[0]) + { + for (j = i; j < i + n; j++) + { + tone = dds_mod(&(s->phase_acc[0]), s->phase_rate[0], s->tone_scaling[0][high_low], 0); + amp[j] = saturate(amp[j] + tone); + } + /*endfor*/ + } + /*endif*/ + if ((s->current_tx_tone & SIG_TONE_2_PRESENT) && s->phase_rate[1]) + { + for (j = i; j < i + n; j++) + { + tone = dds_mod(&(s->phase_acc[1]), s->phase_rate[1], s->tone_scaling[1][high_low], 0); + amp[j] = saturate(amp[j] + tone); + } + /*endfor*/ + } + /*endif*/ + } + /*endif*/ + if (need_update && s->sig_update) + s->sig_update(s->user_data, SIG_TONE_TX_UPDATE_REQUEST, 0, 0); + /*endif*/ + } + /*endfor*/ + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) sig_tone_tx_set_mode(sig_tone_tx_state_t *s, int mode, int duration) +{ + int old_tones; + int new_tones; + + old_tones = s->current_tx_tone & (SIG_TONE_1_PRESENT | SIG_TONE_2_PRESENT); + new_tones = mode & (SIG_TONE_1_PRESENT | SIG_TONE_2_PRESENT); + if (new_tones && old_tones != new_tones) + s->high_low_timer = s->desc->high_low_timeout; + /*endif*/ + s->current_tx_tone = mode; + s->current_tx_timeout = duration; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(sig_tone_tx_state_t *) sig_tone_tx_init(sig_tone_tx_state_t *s, int tone_type, tone_report_func_t sig_update, void *user_data) +{ + int i; + + if (sig_update == NULL || tone_type < 1 || tone_type > 3) + return NULL; + /*endif*/ + + if (s == NULL) + { + if ((s = (sig_tone_tx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + + s->sig_update = sig_update; + s->user_data = user_data; + + s->desc = &sig_tones[tone_type - 1]; + + for (i = 0; i < 2; i++) + { + if (s->desc->tone_freq[i]) + s->phase_rate[i] = dds_phase_rate((float) s->desc->tone_freq[i]); + else + s->phase_rate[i] = 0; + s->tone_scaling[i][0] = dds_scaling_dbm0((float) s->desc->tone_amp[i][0]); + s->tone_scaling[i][1] = dds_scaling_dbm0((float) s->desc->tone_amp[i][1]); + } + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) sig_tone_tx_release(sig_tone_tx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) sig_tone_tx_free(sig_tone_tx_state_t *s) +{ + if (s) + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) sig_tone_rx(sig_tone_rx_state_t *s, int16_t amp[], int len) +{ +#if defined(SPANDSP_USE_FIXED_POINT) + int32_t x; + int32_t notched_signal; + int32_t bandpass_signal; +#else + float x; + float notched_signal; + float bandpass_signal; +#endif + int i; + int j; + int32_t mown_notch[2]; + int32_t mown_bandpass; + + for (i = 0; i < len; i++) + { + if (s->signaling_state_duration < INT_MAX) + s->signaling_state_duration++; + /*endif*/ + notched_signal = 0; + for (j = 0; j < s->desc->tones; j++) + { + /* The notch filter is two cascaded biquads. */ + notched_signal = amp[i]; + +#if defined(SPANDSP_USE_FIXED_POINT) + notched_signal *= s->desc->tone[j].notch_a1[0]; + notched_signal += s->tone[j].notch_z1[1]*s->desc->tone[j].notch_b1[1]; + notched_signal += s->tone[j].notch_z1[2]*s->desc->tone[j].notch_b1[2]; + x = notched_signal; + notched_signal += s->tone[j].notch_z1[1]*s->desc->tone[j].notch_a1[1]; + notched_signal += s->tone[j].notch_z1[2]*s->desc->tone[j].notch_a1[2]; + s->tone[j].notch_z1[2] = s->tone[j].notch_z1[1]; + s->tone[j].notch_z1[1] = x >> 15; + + notched_signal += s->tone[j].notch_z2[1]*s->desc->tone[j].notch_b2[1]; + notched_signal += s->tone[j].notch_z2[2]*s->desc->tone[j].notch_b2[2]; + x = notched_signal; + notched_signal += s->tone[j].notch_z2[1]*s->desc->tone[j].notch_a2[1]; + notched_signal += s->tone[j].notch_z2[2]*s->desc->tone[j].notch_a2[2]; + s->tone[j].notch_z2[2] = s->tone[j].notch_z2[1]; + s->tone[j].notch_z2[1] = x >> 15; + + notched_signal >>= s->desc->notch_postscale; +#else + notched_signal *= s->desc->tone[j].notch_a1[0]; + notched_signal += s->tone[j].notch_z1[1]*s->desc->tone[j].notch_b1[1]; + notched_signal += s->tone[j].notch_z1[2]*s->desc->tone[j].notch_b1[2]; + x = notched_signal; + notched_signal += s->tone[j].notch_z1[1]*s->desc->tone[j].notch_a1[1]; + notched_signal += s->tone[j].notch_z1[2]*s->desc->tone[j].notch_a1[2]; + s->tone[j].notch_z1[2] = s->tone[j].notch_z1[1]; + s->tone[j].notch_z1[1] = x; + + notched_signal += s->tone[j].notch_z2[1]*s->desc->tone[j].notch_b2[1]; + notched_signal += s->tone[j].notch_z2[2]*s->desc->tone[j].notch_b2[2]; + x = notched_signal; + notched_signal += s->tone[j].notch_z2[1]*s->desc->tone[j].notch_a2[1]; + notched_signal += s->tone[j].notch_z2[2]*s->desc->tone[j].notch_a2[2]; + s->tone[j].notch_z2[2] = s->tone[j].notch_z2[1]; + s->tone[j].notch_z2[1] = x; +#endif + /* Modulus and leaky integrate the notched data. The result of + this isn't used in low tone detect mode, but we must keep notch_zl + rolling along. */ + s->tone[j].notch_zl = ((s->tone[j].notch_zl*s->desc->notch_slugi) >> 15) + + ((abs((int) notched_signal)*s->desc->notch_slugp) >> 15); + /* Mow the grass to weed out the noise! */ + mown_notch[j] = s->tone[0].notch_zl & s->desc->notch_threshold; + } + + if (s->tone_present) + { + if (s->flat_mode_timeout <= 0) + s->flat_mode = TRUE; + else + s->flat_mode_timeout--; + /*endif*/ + } + else + { + s->flat_mode_timeout = s->desc->sharp_flat_timeout; + s->flat_mode = FALSE; + } + /*endif*/ + + if (s->flat_mode) + { + /* Flat mode */ + + /* The bandpass filter is a single bi-quad stage */ + bandpass_signal = amp[i]; +#if defined(SPANDSP_USE_FIXED_POINT) + bandpass_signal *= s->desc->broad_a[0]; + bandpass_signal += s->broad_z[1]*s->desc->broad_b[1]; + bandpass_signal += s->broad_z[2]*s->desc->broad_b[2]; + x = bandpass_signal; + bandpass_signal += s->broad_z[1]*s->desc->broad_a[1]; + bandpass_signal += s->broad_z[2]*s->desc->broad_a[2]; + s->broad_z[2] = s->broad_z[1]; + s->broad_z[1] = x >> 15; + bandpass_signal >>= s->desc->broad_postscale; +#else + bandpass_signal *= s->desc->broad_a[0]; + bandpass_signal += s->broad_z[1]*s->desc->broad_b[1]; + bandpass_signal += s->broad_z[2]*s->desc->broad_b[2]; + x = bandpass_signal; + bandpass_signal += s->broad_z[1]*s->desc->broad_a[1]; + bandpass_signal += s->broad_z[2]*s->desc->broad_a[2]; + s->broad_z[2] = s->broad_z[1]; + s->broad_z[1] = x; +#endif + /* Leaky integrate the bandpassed data */ + s->broad_zl = ((s->broad_zl*s->desc->broad_slugi) >> 15) + + ((abs((int) bandpass_signal)*s->desc->broad_slugp) >> 15); + + /* For the broad band receiver we use a simple linear threshold! */ + if (s->tone_present) + { + s->tone_present = (s->broad_zl > s->desc->broad_threshold); + if (!s->tone_present) + { + if (s->sig_update) + s->sig_update(s->user_data, SIG_TONE_1_CHANGE, 0, s->signaling_state_duration); + /*endif*/ + s->signaling_state_duration = 0; + } + /*endif*/ + } + else + { + s->tone_present = (s->broad_zl > s->desc->broad_threshold); + if (s->tone_present) + { + if (s->sig_update) + s->sig_update(s->user_data, SIG_TONE_1_CHANGE | SIG_TONE_1_PRESENT, 0, s->signaling_state_duration); + /*endif*/ + s->signaling_state_duration = 0; + } + /*endif*/ + } + /*endif*/ + + /* Notch insertion logic */ + /* tone_present and tone_on are equivalent in flat mode */ + if (s->tone_present) + { + s->notch_enabled = s->desc->notch_allowed; + s->notch_insertion_timeout = s->desc->notch_lag_time; + } + else + { + if (s->notch_insertion_timeout > 0) + s->notch_insertion_timeout--; + else + s->notch_enabled = FALSE; + /*endif*/ + } + /*endif*/ + } + else + { + /* Sharp mode */ + + /* Modulus and leaky integrate the data */ + s->broad_zl = ((s->broad_zl*s->desc->unfiltered_slugi) >> 15) + + ((abs((int) amp[i])*s->desc->unfiltered_slugp) >> 15); + + /* Mow the grass to weed out the noise! */ + mown_bandpass = s->broad_zl & s->desc->unfiltered_threshold; + + /* Persistence checking and notch insertion logic */ + if (!s->tone_present) + { + if (mown_notch[0] < mown_bandpass) + { + /* Tone is detected this sample */ + if (s->tone_persistence_timeout <= 0) + { + s->tone_present = TRUE; + s->notch_enabled = s->desc->notch_allowed; + s->tone_persistence_timeout = s->desc->tone_off_check_time; + s->notch_insertion_timeout = s->desc->notch_lag_time; + if (s->sig_update) + s->sig_update(s->user_data, SIG_TONE_1_CHANGE | SIG_TONE_1_PRESENT, 0, s->signaling_state_duration); + /*endif*/ + s->signaling_state_duration = 0; + } + else + { + s->tone_persistence_timeout--; + if (s->notch_insertion_timeout > 0) + s->notch_insertion_timeout--; + else + s->notch_enabled = FALSE; + /*endif*/ + } + /*endif*/ + } + else + { + s->tone_persistence_timeout = s->desc->tone_on_check_time; + if (s->notch_insertion_timeout > 0) + s->notch_insertion_timeout--; + else + s->notch_enabled = FALSE; + /*endif*/ + } + /*endif*/ + } + else + { + if (mown_notch[0] > mown_bandpass) + { + /* Tone is not detected this sample */ + if (s->tone_persistence_timeout <= 0) + { + s->tone_present = FALSE; + s->tone_persistence_timeout = s->desc->tone_on_check_time; + if (s->sig_update) + s->sig_update(s->user_data, SIG_TONE_1_CHANGE, 0, s->signaling_state_duration); + /*endif*/ + s->signaling_state_duration = 0; + } + else + { + s->tone_persistence_timeout--; + } + /*endif*/ + } + else + { + s->tone_persistence_timeout = s->desc->tone_off_check_time; + } + /*endif*/ + } + /*endif*/ + } + /*endif*/ + + if ((s->current_rx_tone & SIG_TONE_RX_PASSTHROUGH)) + { + if ((s->current_rx_tone & SIG_TONE_RX_FILTER_TONE) || s->notch_enabled) + amp[i] = (int16_t) notched_signal; + /*endif*/ + } + else + { + amp[i] = 0; + } + /*endif*/ + } + /*endfor*/ + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) sig_tone_rx_set_mode(sig_tone_rx_state_t *s, int mode, int duration) +{ + s->current_rx_tone = mode; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(sig_tone_rx_state_t *) sig_tone_rx_init(sig_tone_rx_state_t *s, int tone_type, tone_report_func_t sig_update, void *user_data) +{ + if (sig_update == NULL || tone_type < 1 || tone_type > 3) + return NULL; + /*endif*/ + + if (s == NULL) + { + if ((s = (sig_tone_rx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + + s->sig_update = sig_update; + s->user_data = user_data; + + s->desc = &sig_tones[tone_type - 1]; + + s->flat_mode_timeout = 0; + s->notch_insertion_timeout = 0; + s->tone_persistence_timeout = 0; + s->signaling_state_duration = 0; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) sig_tone_rx_release(sig_tone_rx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) sig_tone_rx_free(sig_tone_rx_state_t *s) +{ + if (s) + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/silence_gen.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/silence_gen.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,167 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * silence_gen.c - A silence generator, for inserting timed silences. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: silence_gen.c,v 1.23 2009/09/04 14:38:46 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/async.h" +#include "spandsp/silence_gen.h" + +#include "spandsp/private/silence_gen.h" + +SPAN_DECLARE_NONSTD(int) silence_gen(silence_gen_state_t *s, int16_t *amp, int max_len) +{ + if (s->remaining_samples != INT_MAX) + { + if (max_len >= s->remaining_samples) + { + max_len = s->remaining_samples; + if (max_len && s->status_handler) + s->status_handler(s->status_user_data, SIG_STATUS_SHUTDOWN_COMPLETE); + } + s->remaining_samples -= max_len; + } + if (INT_MAX - s->total_samples >= max_len) + s->total_samples += max_len; + memset(amp, 0, max_len*sizeof(int16_t)); + return max_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) silence_gen_always(silence_gen_state_t *s) +{ + s->remaining_samples = INT_MAX; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) silence_gen_set(silence_gen_state_t *s, int silent_samples) +{ + s->remaining_samples = silent_samples; + s->total_samples = 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) silence_gen_alter(silence_gen_state_t *s, int silent_samples) +{ + /* Block negative silences */ + if (silent_samples < 0) + { + if (-silent_samples > s->remaining_samples) + silent_samples = -s->remaining_samples; + } + s->remaining_samples += silent_samples; + s->total_samples += silent_samples; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) silence_gen_remainder(silence_gen_state_t *s) +{ + return s->remaining_samples; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) silence_gen_generated(silence_gen_state_t *s) +{ + return s->total_samples; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) silence_gen_status_handler(silence_gen_state_t *s, modem_tx_status_func_t handler, void *user_data) +{ + s->status_handler = handler; + s->status_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(silence_gen_state_t *) silence_gen_init(silence_gen_state_t *s, int silent_samples) +{ + if (s == NULL) + { + if ((s = (silence_gen_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + s->remaining_samples = silent_samples; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) silence_gen_release(silence_gen_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) silence_gen_free(silence_gen_state_t *s) +{ + if (s) + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +/* The following dummy routines, to absorb data, don't really have a proper home, + so they have been put here. */ + +SPAN_DECLARE_NONSTD(int) span_dummy_rx(void *user_data, const int16_t amp[], int len) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) span_dummy_mod(void *user_data, int16_t amp[], int len) +{ + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) span_dummy_rx_fillin(void *user_data, int len) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp.h.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp.h.in Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,129 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * spandsp.h - The head guy amongst the headers + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: spandsp.h.in,v 1.19.4.1 2009/12/19 09:47:56 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_H_) +#define _SPANDSP_H_ + +@SPANDSP_USE_FIXED_POINT@ +@SPANDSP_MISALIGNED_ACCESS_FAILS@ + +@SPANDSP_USE_EXPORT_CAPABILITY@ + +#include +@INSERT_INTTYPES_HEADER@ +#include +#include +#include +@INSERT_MATH_HEADER@ +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif + +#if defined(SPANDSP_EXPOSE_INTERNAL_STRUCTURES) +#include +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/adsi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/adsi.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,516 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * adsi.h - Analogue display services interface and other call ID related handling. + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: adsi.h,v 1.40 2009/05/22 16:39:01 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_ADSI_H_) +#define _SPANDSP_ADSI_H_ + +/*! \page adsi_page ADSI transmission and reception +\section adsi_page_sec_1 What does it do? +Although ADSI has a specific meaning in some places, the term is used here to indicate +any form of Analogue Display Service Interface, which includes caller ID, SMS, and others. + +The ADSI module provides for the transmission and reception of ADSI messages +in various formats. Currently, the supported formats are: + + - Bellcore/Telcordia GR-30 CORE CLASS (Custom Local Area Signaling Services) standard + (North America, Australia, China, Taiwan, and Hong Kong). + + - ETSI ETS 300 648, ETS 300 659-1 CLIP (Calling Line Identity Presentation) FSK standard + (France, Germany, Norway, Italy, Spain, South Africa, Turkey, and the UK). + + - ETSI Caller-ID support for the UK, British Telecom SIN227 and SIN242. + + - ETSI ETS 300 648, ETS 300 659-1 CLIP (Calling Line Identity Presentation) DTMF standard + variant 1 (Belgium, Brazil, Denmark, Finland, Iceland, India, Netherlands, Saudi Arabia, + Sweden and Uruguay). + + - ETSI ETS 300 648, ETS 300 659-1 CLIP (Calling Line Identity Presentation) DTMF standard + variant 2 (Denmark and Holland). + + - ETSI ETS 300 648, ETS 300 659-1 CLIP (Calling Line Identity Presentation) DTMF standard + variant 3. + + - ETSI ETS 300 648, ETS 300 659-1 CLIP (Calling Line Identity Presentation) DTMF standard + variant 4. (Taiwan and Kuwait). + + - ETSI Caller-ID support in UK (British Telecom), British Telecomm SIN227, SIN242. + + - Nippon Telegraph & Telephone Corporation JCLIP (Japanese Calling Line Identity + Presentation) standard. + + - Telecommunications Authority of Singapore ACLIP (Analog Calling Line Identity + Presentation) standard. + + - TDD (Telecommunications Device for the Deaf). + +\section adsi_page_sec_2 How does it work? + +\section adsi_page_sec_2a The Bellcore CLASS specification +Most FSK based CLI formats are similar to the US CLASS one, which is as follows: + +The alert tone for CLI during a call is at least 100ms of silence, then +2130Hz + 2750Hz for 88ms to 110ms. When CLI is presented at ringing time, +this tone is not sent. In the US, CLI is usually sent between the first +two rings. This silence period is long in the US, so the message fits easily. +In other places, where the standard ring tone has much smaller silences, +a line voltage reversal is used to wake up a power saving receiver, then the +message is sent, then the phone begins to ring. + +The message is sent using a Bell 202 FSK modem. The data rate is 1200 bits +per second. The message protocol uses 8-bit data words (bytes), each bounded +by a start bit and a stop bit. + +Channel Carrier Message Message Data Checksum +Seizure Signal Type Length Word(s) Word +Signal Word Word + +\section adsi_page_sec_2a1 CHANNEL SEIZURE SIGNAL +The channel seizure is 30 continuous bytes of 55h (01010101), including +the start and stop bits (i.e. 300 bits of alternations in total). +This provides a detectable alternating function to the CPE (i.e. the +modem data pump). + +\section adsi_page_sec_2a2 CARRIER SIGNAL +The carrier signal consists of 180 bits of 1s. This may be reduced to 80 +bits of 1s for caller ID on call waiting. + +\section adsi_page_sec_2a3 MESSAGE TYPE WORD +Various message types are defined. The commonest ones for the US CLASS +standard are: + + - Type 0x04 (SDMF) - single data message. Simple caller ID (CND) + - Type 0x80 (MDMF) - multiple data message. A more flexible caller ID, + with extra information. + +Other messages support message waiting, for voice mail, and other display features. + +\section adsi_page_sec_2a4 MESSAGE LENGTH WORD +The message length word specifies the total number of data words +to follow. + +\section adsi_page_sec_2a5 DATA WORDS +The data words contain the actual message. + +\section adsi_page_sec_2a6 CHECKSUM WORD +The Checksum Word contains the twos complement of the modulo 256 +sum of the other words in the data message (i.e., message type, +message length, and data words). The receiving equipment may +calculate the modulo 256 sum of the received words and add this +sum to the received checksum word. A result of zero generally +indicates that the message was correctly received. Message +retransmission is not supported. The sumcheck word should be followed +by a minimum of two stop bits. + +\section adsi_page_sec_2b The ETSI CLIP specification +The ETSI CLIP specification uses similar messages to the Bellcore specification. +They are not, however, identical. First, ETSI use the V.23 modem standard, rather +than Bell 202. Second, different fields, and different message types are available. + +The wake up indication generally differs from the Bellcore specification, to +accomodate differences in European ring cadences. + +\section adsi_page_sec_2c The ETSI caller ID by DTMF specification +CLI by DTMF is usually sent in a very simple way. The exchange does not give +any prior warning (no reversal, or ring) to wake up the receiver. It just +sends a string of DTMF digits. Around the world several variants of this +basic scheme are used. + +One variant of the digit string is used in Belgium, Brazil, Denmark, Finland, Iceland, +India, Netherlands, Saudi Arabia, Sweden and Uruguay: + + - ADBC + +Each of these fields may be omitted. The following special information codes are defined + + - "00" indicates the calling party number is not available. + - "10" indicates that the presentation of the calling party number is restricted. + +A second variant of the digit string is one of the following: + + - A# + - D1# Number not available because the caller has restricted it. + - D2# Number not available because the call is international. + - D3# Number not available due to technical reasons. + +A third variant of the digit string is used in Taiwan and Kuwait: + + - DC + +A forth variant of the digit string is used in Denmark and Holland: + + - # + +There is no distinctive start marker in this format. + +\section adsi_page_sec_2d The Japanese specification from NTT + +The Japanese caller ID specification is considerably different from any of the others. It +uses V.23 modem signals, but the message structure is uniqeue. Also, the message is delivered +while off hook. This results in a sequence + + - The phone line rings + - CPE answers and waits for the caller ID message + - CPE hangs up on receipt of the caller ID message + - The phone line rings a second time + - The CPE answers a second time, connecting the called party with the caller. + +Timeouts are, obviously, required to ensure this system behaves well when the caller ID message +or the second ring are missing. +*/ + +enum +{ + ADSI_STANDARD_NONE = 0, + ADSI_STANDARD_CLASS = 1, + ADSI_STANDARD_CLIP = 2, + ADSI_STANDARD_ACLIP = 3, + ADSI_STANDARD_JCLIP = 4, + ADSI_STANDARD_CLIP_DTMF = 5, + ADSI_STANDARD_TDD = 6 +}; + +/* In some of the messages code characters are used, as follows: + 'C' for public callbox + 'L' for long distance + 'O' for overseas + 'P' for private + 'S' for service conflict + + Taiwan and Kuwait change this pattern to: + 'C' for coin/public callbox + 'I' for international call + 'O' for out of area call + 'P' for private + */ + +/*! Definitions for CLASS (Custom Local Area Signaling Services) */ +enum +{ + /*! Single data message caller ID */ + CLASS_SDMF_CALLERID = 0x04, + /*! Multiple data message caller ID */ + CLASS_MDMF_CALLERID = 0x80, + /*! Single data message message waiting */ + CLASS_SDMF_MSG_WAITING = 0x06, + /*! Multiple data message message waiting */ + CLASS_MDMF_MSG_WAITING = 0x82 +}; + +/*! CLASS MDMF message IDs */ +enum +{ + /*! Date and time (MMDDHHMM) */ + MCLASS_DATETIME = 0x01, + /*! Caller number */ + MCLASS_CALLER_NUMBER = 0x02, + /*! Dialed number */ + MCLASS_DIALED_NUMBER = 0x03, + /*! Caller number absent: 'O' or 'P' */ + MCLASS_ABSENCE1 = 0x04, + /*! Call forward: universal ('0'), on busy ('1'), or on unanswered ('2') */ + MCLASS_REDIRECT = 0x05, + /*! Long distance: 'L' */ + MCLASS_QUALIFIER = 0x06, + /*! Caller's name */ + MCLASS_CALLER_NAME = 0x07, + /*! Caller's name absent: 'O' or 'P' */ + MCLASS_ABSENCE2 = 0x08, + /*! Alternate route */ + MCLASS_ALT_ROUTE = 0x09 +}; + +/*! CLASS MDMF message waiting message IDs */ +/*! Message waiting/not waiting */ +#define MCLASS_VISUAL_INDICATOR 0x0B + +/*! Definitions for CLIP (Calling Line Identity Presentation) (from ETS 300 659-1) */ +enum +{ + /*! Multiple data message caller ID */ + CLIP_MDMF_CALLERID = 0x80, + /*! Multiple data message message waiting */ + CLIP_MDMF_MSG_WAITING = 0x82, + /*! Multiple data message charge information */ + CLIP_MDMF_CHARGE_INFO = 0x86, + /*! Multiple data message SMS */ + CLIP_MDMF_SMS = 0x89 +}; + +/*! CLIP message IDs (from ETS 300 659-1) */ +enum +{ + /*! Date and time (MMDDHHMM) */ + CLIP_DATETIME = 0x01, + /*! Caller number (AKA calling line identity) */ + CLIP_CALLER_NUMBER = 0x02, + /*! Dialed number (AKA called line identity) */ + CLIP_DIALED_NUMBER = 0x03, + /*! Caller number absent: 'O' or 'P' (AKA reason for absence of calling line identity) */ + CLIP_ABSENCE1 = 0x04, + /*! Caller's name (AKA calling party name) */ + CLIP_CALLER_NAME = 0x07, + /*! Caller's name absent: 'O' or 'P' (AKA reason for absence of calling party name) */ + CLIP_ABSENCE2 = 0x08, + /*! Visual indicator */ + CLIP_VISUAL_INDICATOR = 0x0B, + /*! Message ID */ + CLIP_MESSAGE_ID = 0x0D, + /*! Complementary calling line identity */ + CLIP_COMPLEMENTARY_CALLER_NUMBER = 0x10, + /*! Call type - voice call (1), ring-back-when-free call (2), calling name delivery (3) or msg waiting call(0x81) */ + CLIP_CALLTYPE = 0x11, + /*! Number of messages */ + CLIP_NUM_MSG = 0x13, + /*! Type of forwarded call */ + CLIP_TYPE_OF_FORWARDED_CALL = 0x15, + /*! Type of calling user */ + CLIP_TYPE_OF_CALLING_USER = 0x16, + /*! Redirecting number */ + CLIP_REDIR_NUMBER = 0x1A, + /*! Charge */ + CLIP_CHARGE = 0x20, + /*! Duration of the call */ + CLIP_DURATION = 0x23, + /*! Additional charge */ + CLIP_ADD_CHARGE = 0x21, + /*! Display information */ + CLIP_DISPLAY_INFO = 0x50, + /*! Service information */ + CLIP_SERVICE_INFO = 0x55 +}; + +/*! Definitions for A-CLIP (Analog Calling Line Identity Presentation) */ +enum +{ + /*! Single data message caller ID frame */ + ACLIP_SDMF_CALLERID = 0x04, + /*! Multiple data message caller ID frame */ + ACLIP_MDMF_CALLERID = 0x80 +}; + +/*! A-CLIP MDM message IDs */ +enum +{ + /*! Date and time (MMDDHHMM) */ + ACLIP_DATETIME = 0x01, + /*! Caller number */ + ACLIP_CALLER_NUMBER = 0x02, + /*! Dialed number */ + ACLIP_DIALED_NUMBER = 0x03, + /*! Caller number absent: 'O' or 'P' */ + ACLIP_NUMBER_ABSENCE = 0x04, + /*! Call forward: universal, on busy, or on unanswered */ + ACLIP_REDIRECT = 0x05, + /*! Long distance call: 'L' */ + ACLIP_QUALIFIER = 0x06, + /*! Caller's name */ + ACLIP_CALLER_NAME = 0x07, + /*! Caller's name absent: 'O' or 'P' */ + ACLIP_NAME_ABSENCE = 0x08 +}; + +/*! Definitions for J-CLIP (Japan Calling Line Identity Presentation) */ +/*! Multiple data message caller ID frame */ +#define JCLIP_MDMF_CALLERID 0x40 + +/*! J-CLIP MDM message IDs */ +enum +{ + /*! Caller number */ + JCLIP_CALLER_NUMBER = 0x02, + /*! Caller number data extension signal */ + JCLIP_CALLER_NUM_DES = 0x21, + /*! Dialed number */ + JCLIP_DIALED_NUMBER = 0x09, + /*! Dialed number data extension signal */ + JCLIP_DIALED_NUM_DES = 0x22, + /*! Caller number absent: 'C', 'O', 'P' or 'S' */ + JCLIP_ABSENCE = 0x04 +}; + +/* Definitions for CLIP-DTMF and its variants */ + +/*! Caller number is '#' terminated DTMF. */ +#define CLIP_DTMF_HASH_TERMINATED '#' +/*! Caller number is 'C' terminated DTMF. */ +#define CLIP_DTMF_C_TERMINATED 'C' + +/*! Caller number */ +#define CLIP_DTMF_HASH_CALLER_NUMBER 'A' +/*! Caller number absent: private (1), overseas (2) or not available (3) */ +#define CLIP_DTMF_HASH_ABSENCE 'D' +/*! Caller ID field with no explicit field type */ +#define CLIP_DTMF_HASH_UNSPECIFIED 0 + +/*! Caller number */ +#define CLIP_DTMF_C_CALLER_NUMBER 'A' +/*! Diverting number */ +#define CLIP_DTMF_C_REDIRECT_NUMBER 'D' +/*! Caller number absent: private/restricted (00) or not available (10) */ +#define CLIP_DTMF_C_ABSENCE 'B' + +/*! + ADSI transmitter descriptor. This contains all the state information for an ADSI + (caller ID, CLASS, CLIP, ACLIP) transmit channel. + */ +typedef struct adsi_tx_state_s adsi_tx_state_t; + +/*! + ADSI receiver descriptor. This contains all the state information for an ADSI + (caller ID, CLASS, CLIP, ACLIP, JCLIP) receive channel. + */ +typedef struct adsi_rx_state_s adsi_rx_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! \brief Initialise an ADSI receive context. + \param s The ADSI receive context. + \param standard The code for the ADSI standard to be used. + \param put_msg A callback routine called to deliver the received messages + to the application. + \param user_data An opaque pointer for the callback routine. + \return A pointer to the initialised context, or NULL if there was a problem. +*/ +SPAN_DECLARE(adsi_rx_state_t *) adsi_rx_init(adsi_rx_state_t *s, + int standard, + put_msg_func_t put_msg, + void *user_data); + +/*! \brief Release an ADSI receive context. + \param s The ADSI receive context. + \return 0 for OK. +*/ +SPAN_DECLARE(int) adsi_rx_release(adsi_rx_state_t *s); + +/*! \brief Free the resources of an ADSI receive context. + \param s The ADSI receive context. + \return 0 for OK. +*/ +SPAN_DECLARE(int) adsi_rx_free(adsi_rx_state_t *s); + +/*! \brief Receive a chunk of ADSI audio. + \param s The ADSI receive context. + \param amp The audio sample buffer. + \param len The number of samples in the buffer. + \return The number of samples unprocessed. +*/ +SPAN_DECLARE(int) adsi_rx(adsi_rx_state_t *s, const int16_t amp[], int len); + +/*! \brief Initialise an ADSI transmit context. + \param s The ADSI transmit context. + \param standard The code for the ADSI standard to be used. + \return A pointer to the initialised context, or NULL if there was a problem. +*/ +SPAN_DECLARE(adsi_tx_state_t *) adsi_tx_init(adsi_tx_state_t *s, int standard); + +/*! \brief Release an ADSI transmit context. + \param s The ADSI transmit context. + \return 0 for OK. +*/ +SPAN_DECLARE(int) adsi_tx_release(adsi_tx_state_t *s); + +/*! \brief Free the resources of an ADSI transmit context. + \param s The ADSI transmit context. + \return 0 for OK. +*/ +SPAN_DECLARE(int) adsi_tx_free(adsi_tx_state_t *s); + +/*! \brief Adjust the preamble associated with an ADSI transmit context. + \param s The ADSI transmit context. + \param preamble_len The number of bits of preamble. + \param preamble_ones_len The number of bits of continuous one before a message. + \param postamble_ones_len The number of bits of continuous one after a message. + \param stop_bits The number of stop bits per character. +*/ +SPAN_DECLARE(void) adsi_tx_set_preamble(adsi_tx_state_t *s, + int preamble_len, + int preamble_ones_len, + int postamble_ones_len, + int stop_bits); + +/*! \brief Generate a block of ADSI audio samples. + \param s The ADSI transmit context. + \param amp The audio sample buffer. + \param max_len The number of samples to be generated. + \return The number of samples actually generated. +*/ +SPAN_DECLARE(int) adsi_tx(adsi_tx_state_t *s, int16_t amp[], int max_len); + +/*! \brief Request generation of an ADSI alert tone. + \param s The ADSI transmit context. +*/ +SPAN_DECLARE(void) adsi_tx_send_alert_tone(adsi_tx_state_t *s); + +/*! \brief Put a message into the input buffer of an ADSI transmit context. + \param s The ADSI transmit context. + \param msg The message. + \param len The length of the message. + \return The length actually added. If a message is already in progress + in the transmitter, this function will return zero, as it will + not successfully add the message to the buffer. If the message is + invalid (e.g. it is too long), this function will return -1. +*/ +SPAN_DECLARE(int) adsi_tx_put_message(adsi_tx_state_t *s, const uint8_t *msg, int len); + +/*! \brief Get a field from an ADSI message. + \param s The ADSI receive context. + \param msg The message buffer. + \param msg_len The length of the message. + \param pos Current position within the message. Set to -1 when starting a message. + \param field_type The type code for the field. + \param field_body Pointer to the body of the field. + \param field_len The length of the field, or -1 for no more fields, or -2 for message structure corrupt. +*/ +SPAN_DECLARE(int) adsi_next_field(adsi_rx_state_t *s, const uint8_t *msg, int msg_len, int pos, uint8_t *field_type, uint8_t const **field_body, int *field_len); + +/*! \brief Insert the header or a field into an ADSI message. + \param s The ADSI transmit context. + \param msg The message buffer. + \param len The current length of the message. + \param field_type The type code for the new field. + \param field_body Pointer to the body of the new field. + \param field_len The length of the new field. +*/ +SPAN_DECLARE(int) adsi_add_field(adsi_tx_state_t *s, uint8_t *msg, int len, uint8_t field_type, uint8_t const *field_body, int field_len); + +/*! \brief Return a short name for an ADSI standard + \param standard The code for the standard. + \return A pointer to the name. +*/ +SPAN_DECLARE(const char *) adsi_standard_to_str(int standard); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/arctan2.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/arctan2.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,108 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * arctan2.h - A quick rough approximate arc tan + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: arctan2.h,v 1.13 2008/05/29 13:04:19 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_ARCTAN2_H_) +#define _SPANDSP_ARCTAN2_H_ + +/*! \page arctan2_page Fast approximate four quadrant arc-tangent +\section arctan2_page_sec_1 What does it do? +This module provides a fast approximate 4-quadrant arc tangent function, +based on something at dspguru.com. The worst case error is about 4.07 degrees. +This is fine for many "where am I" type evaluations in comms. work. + +\section arctan2_page_sec_2 How does it work? +???. +*/ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/* This returns its answer as a signed 32 bit integer phase value. */ +static __inline__ int32_t arctan2(float y, float x) +{ + float abs_y; + float angle; + + if (x == 0.0f || y == 0.0f) + return 0; + + abs_y = fabsf(y); + + /* If we are in quadrant II or III, flip things around */ + if (x < 0.0f) + angle = 3.0f - (x + abs_y)/(abs_y - x); + else + angle = 1.0f - (x - abs_y)/(abs_y + x); + angle *= 536870912.0f; + + /* If we are in quadrant III or IV, negate to return an + answer in the range +-pi */ + if (y < 0.0f) + angle = -angle; + return (int32_t) angle; +} +/*- End of function --------------------------------------------------------*/ + +#if 0 +/* This returns its answer in radians, in the range +-pi. */ +static __inline__ float arctan2f(float y, float x) +{ + float angle; + float fx; + float fy; + + if (x == 0.0f || y == 0.0f) + return 0; + fx = fabsf(x); + fy = fabsf(y); + /* Deal with the octants */ + /* N.B. 0.28125 == (1/4 + 1/32) */ + if (fy > fx) + angle = 3.1415926f/2.0f - fx*fy/(y*y + 0.28125f*x*x); + else + angle = fy*fx/(x*x + 0.28125f*y*y); + + /* Deal with the quadrants, to bring the final answer to the range +-pi */ + if (x < 0.0f) + angle = 3.1415926f - angle; + if (y < 0.0f) + angle = -angle; + return angle; +} +/*- End of function --------------------------------------------------------*/ +#endif + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/async.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/async.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,213 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * async.h - Asynchronous serial bit stream encoding and decoding + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: async.h,v 1.25 2009/04/23 14:12:34 steveu Exp $ + */ + +/*! \file */ + +/*! \page async_page Asynchronous bit stream processing +\section async_page_sec_1 What does it do? +The asynchronous serial bit stream processing module provides +generation and decoding facilities for most asynchronous data +formats. It supports: + - 1 or 2 stop bits. + - Odd, even or no parity. + - 5, 6, 7, or 8 bit characters. + - V.14 rate adaption. +The input to this module is a bit stream. This means any symbol synchronisation +and decoding must occur before data is fed to this module. + +\section async_page_sec_2 The transmitter +???. + +\section async_page_sec_3 The receiver +???. +*/ + +#if !defined(_SPANDSP_ASYNC_H_) +#define _SPANDSP_ASYNC_H_ + +/*! Special "bit" values for the bitstream put and get functions, and the signal status functions. */ +enum +{ + /*! \brief The carrier signal has dropped. */ + SIG_STATUS_CARRIER_DOWN = -1, + /*! \brief The carrier signal is up. This merely indicates that carrier + energy has been seen. It is not an indication that the carrier is either + valid, or of the expected type. */ + SIG_STATUS_CARRIER_UP = -2, + /*! \brief The modem is training. This is an early indication that the + signal seems to be of the right type. This may be needed in time critical + applications, like T.38, to forward an early indication of what is happening + on the wire. */ + SIG_STATUS_TRAINING_IN_PROGRESS = -3, + /*! \brief The modem has trained, and is ready for data exchange. */ + SIG_STATUS_TRAINING_SUCCEEDED = -4, + /*! \brief The modem has failed to train. */ + SIG_STATUS_TRAINING_FAILED = -5, + /*! \brief Packet framing (e.g. HDLC framing) is OK. */ + SIG_STATUS_FRAMING_OK = -6, + /*! \brief The data stream has ended. */ + SIG_STATUS_END_OF_DATA = -7, + /*! \brief An abort signal (e.g. an HDLC abort) has been received. */ + SIG_STATUS_ABORT = -8, + /*! \brief A break signal (e.g. an async break) has been received. */ + SIG_STATUS_BREAK = -9, + /*! \brief A modem has completed its task, and shut down. */ + SIG_STATUS_SHUTDOWN_COMPLETE = -10, + /*! \brief Regular octet report for things like HDLC to the MTP standards. */ + SIG_STATUS_OCTET_REPORT = -11, + /*! \brief Notification that a modem has detected signal quality degradation. */ + SIG_STATUS_POOR_SIGNAL_QUALITY = -12, + /*! \brief Notification that a modem retrain has occurred. */ + SIG_STATUS_MODEM_RETRAIN_OCCURRED = -13 +}; + +/*! Message put function for data pumps */ +typedef void (*put_msg_func_t)(void *user_data, const uint8_t *msg, int len); + +/*! Message get function for data pumps */ +typedef int (*get_msg_func_t)(void *user_data, uint8_t *msg, int max_len); + +/*! Byte put function for data pumps */ +typedef void (*put_byte_func_t)(void *user_data, int byte); + +/*! Byte get function for data pumps */ +typedef int (*get_byte_func_t)(void *user_data); + +/*! Bit put function for data pumps */ +typedef void (*put_bit_func_t)(void *user_data, int bit); + +/*! Bit get function for data pumps */ +typedef int (*get_bit_func_t)(void *user_data); + +/*! Completion callback function for tx data pumps */ +typedef void (*modem_tx_status_func_t)(void *user_data, int status); + +/*! Completion callback function for rx data pumps */ +typedef void (*modem_rx_status_func_t)(void *user_data, int status); + +enum +{ + /*! No parity bit should be used */ + ASYNC_PARITY_NONE = 0, + /*! An even parity bit will exist, after the data bits */ + ASYNC_PARITY_EVEN, + /*! An odd parity bit will exist, after the data bits */ + ASYNC_PARITY_ODD +}; + +/*! + Asynchronous data transmit descriptor. This defines the state of a single + working instance of a byte to asynchronous serial converter, for use + in FSK modems. +*/ +typedef struct async_tx_state_s async_tx_state_t; + +/*! + Asynchronous data receive descriptor. This defines the state of a single + working instance of an asynchronous serial to byte converter, for use + in FSK modems. +*/ +typedef struct async_rx_state_s async_rx_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Convert a signal status to a short text description. + \brief Convert a signal status to a short text description. + \param status The modem signal status. + \return A pointer to the description. */ +SPAN_DECLARE(const char *) signal_status_to_str(int status); + +/*! Initialise an asynchronous data transmit context. + \brief Initialise an asynchronous data transmit context. + \param s The transmitter context. + \param data_bits The number of data bit. + \param parity_bits The type of parity. + \param stop_bits The number of stop bits. + \param use_v14 TRUE if V.14 rate adaption processing should be used. + \param get_byte The callback routine used to get the data to be transmitted. + \param user_data An opaque pointer. + \return A pointer to the initialised context, or NULL if there was a problem. */ +SPAN_DECLARE(async_tx_state_t *) async_tx_init(async_tx_state_t *s, + int data_bits, + int parity_bits, + int stop_bits, + int use_v14, + get_byte_func_t get_byte, + void *user_data); + +SPAN_DECLARE(int) async_tx_release(async_tx_state_t *s); + +SPAN_DECLARE(int) async_tx_free(async_tx_state_t *s); + +/*! Get the next bit of a transmitted serial bit stream. + \brief Get the next bit of a transmitted serial bit stream. + \param user_data An opaque point which must point to a transmitter context. + \return the next bit, or PUTBIT_END_OF_DATA to indicate the data stream has ended. */ +SPAN_DECLARE_NONSTD(int) async_tx_get_bit(void *user_data); + +/*! Initialise an asynchronous data receiver context. + \brief Initialise an asynchronous data receiver context. + \param s The receiver context. + \param data_bits The number of data bits. + \param parity_bits The type of parity. + \param stop_bits The number of stop bits. + \param use_v14 TRUE if V.14 rate adaption processing should be used. + \param put_byte The callback routine used to put the received data. + \param user_data An opaque pointer. + \return A pointer to the initialised context, or NULL if there was a problem. */ +SPAN_DECLARE(async_rx_state_t *) async_rx_init(async_rx_state_t *s, + int data_bits, + int parity_bits, + int stop_bits, + int use_v14, + put_byte_func_t put_byte, + void *user_data); + +SPAN_DECLARE(int) async_rx_release(async_rx_state_t *s); + +SPAN_DECLARE(int) async_rx_free(async_rx_state_t *s); + +/*! Accept a bit from a received serial bit stream + \brief Accept a bit from a received serial bit stream + \param user_data An opaque point which must point to a receiver context. + \param bit The new bit. Some special values are supported for this field. + - SIG_STATUS_CARRIER_UP + - SIG_STATUS_CARRIER_DOWN + - SIG_STATUS_TRAINING_SUCCEEDED + - SIG_STATUS_TRAINING_FAILED + - SIG_STATUS_END_OF_DATA */ +SPAN_DECLARE_NONSTD(void) async_rx_put_bit(void *user_data, int bit); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/at_interpreter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/at_interpreter.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,199 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * at_interpreter.h - AT command interpreter to V.251, V.252, V.253, T.31 and the 3GPP specs. + * + * Written by Steve Underwood + * + * Copyright (C) 2004, 2005, 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: at_interpreter.h,v 1.23 2009/02/10 13:06:47 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_AT_INTERPRETER_H_) +#define _SPANDSP_AT_INTERPRETER_H_ + +/*! \page at_page AT command interpreter +\section at_page_sec_1 What does it do? +The AT interpreter module implements V.251, V.252, V.253, T.31 and various 3GPP +modem control commands. + +\section at_page_sec_2 How does it work? +*/ + +typedef struct at_state_s at_state_t; + +typedef int (at_modem_control_handler_t)(at_state_t *s, void *user_data, int op, const char *num); +typedef int (at_tx_handler_t)(at_state_t *s, void *user_data, const uint8_t *buf, size_t len); +typedef int (at_class1_handler_t)(at_state_t *s, void *user_data, int direction, int operation, int val); + +enum at_rx_mode_e +{ + AT_MODE_ONHOOK_COMMAND, + AT_MODE_OFFHOOK_COMMAND, + AT_MODE_CONNECTED, + AT_MODE_DELIVERY, + AT_MODE_HDLC, + AT_MODE_STUFFED +}; + +enum at_call_event_e +{ + AT_CALL_EVENT_ALERTING = 1, + AT_CALL_EVENT_CONNECTED, + AT_CALL_EVENT_ANSWERED, + AT_CALL_EVENT_BUSY, + AT_CALL_EVENT_NO_DIALTONE, + AT_CALL_EVENT_NO_ANSWER, + AT_CALL_EVENT_HANGUP +}; + +enum at_modem_control_operation_e +{ + /*! Start an outgoing call. */ + AT_MODEM_CONTROL_CALL, + /*! Answer an incoming call. */ + AT_MODEM_CONTROL_ANSWER, + /*! Hangup a call. */ + AT_MODEM_CONTROL_HANGUP, + /*! Take the line off hook. */ + AT_MODEM_CONTROL_OFFHOOK, + /*! Put the line on hook. */ + AT_MODEM_CONTROL_ONHOOK, + /*! Control V.24 Circuit 108, "data terminal ready". */ + AT_MODEM_CONTROL_DTR, + /*! Control V.24 Circuit 105, "request to send". */ + AT_MODEM_CONTROL_RTS, + /*! Control V.24 Circuit 106, "clear to send". */ + AT_MODEM_CONTROL_CTS, + /*! Control V.24 Circuit 109, "receive line signal detector" (i.e. carrier detect). */ + AT_MODEM_CONTROL_CAR, + /*! Control V.24 Circuit 125, "ring indicator". */ + AT_MODEM_CONTROL_RNG, + /*! Control V.24 Circuit 107, "data set ready". */ + AT_MODEM_CONTROL_DSR, + /*! Set the caller ID for outgoing calls. */ + AT_MODEM_CONTROL_SETID, + /* The remainder of the control functions should not get past the modem, to the + application. */ + AT_MODEM_CONTROL_RESTART, + AT_MODEM_CONTROL_DTE_TIMEOUT +}; + +enum +{ + AT_RESPONSE_CODE_OK = 0, + AT_RESPONSE_CODE_CONNECT, + AT_RESPONSE_CODE_RING, + AT_RESPONSE_CODE_NO_CARRIER, + AT_RESPONSE_CODE_ERROR, + AT_RESPONSE_CODE_XXX, + AT_RESPONSE_CODE_NO_DIALTONE, + AT_RESPONSE_CODE_BUSY, + AT_RESPONSE_CODE_NO_ANSWER, + AT_RESPONSE_CODE_FCERROR, + AT_RESPONSE_CODE_FRH3 +}; + +/*! + AT profile. +*/ +typedef struct +{ + /*! TRUE if character echo is enabled */ + int echo; + /*! TRUE if verbose reporting is enabled */ + int verbose; + /*! TRUE if result codes are verbose */ + int result_code_format; + /*! TRUE if pulse dialling is the default */ + int pulse_dial; + /*! ??? */ + int double_escape; + /*! ??? */ + int adaptive_receive; + /*! The state of all possible S registers */ + uint8_t s_regs[100]; +} at_profile_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +SPAN_DECLARE(void) at_set_at_rx_mode(at_state_t *s, int new_mode); + +SPAN_DECLARE(void) at_put_response(at_state_t *s, const char *t); + +SPAN_DECLARE(void) at_put_numeric_response(at_state_t *s, int val); + +SPAN_DECLARE(void) at_put_response_code(at_state_t *s, int code); + +SPAN_DECLARE(void) at_reset_call_info(at_state_t *s); + +/*! Set the call information for an AT interpreter. + \brief Set the call information for an AT interpreter. + \param s The AT interpreter context. + \param id . + \param value . */ +SPAN_DECLARE(void) at_set_call_info(at_state_t *s, char const *id, char const *value); + +SPAN_DECLARE(void) at_display_call_info(at_state_t *s); + +SPAN_DECLARE(int) at_modem_control(at_state_t *s, int op, const char *num); + +SPAN_DECLARE(void) at_call_event(at_state_t *s, int event); + +SPAN_DECLARE(void) at_interpreter(at_state_t *s, const char *cmd, int len); + +SPAN_DECLARE(void) at_set_class1_handler(at_state_t *s, at_class1_handler_t handler, void *user_data); + +/*! Initialise an AT interpreter context. + \brief Initialise an AT interpreter context. + \param s The AT context. + \param at_tx_handler x. + \param at_tx_user_data x. + \param modem_control_handler x. + \param modem_control_user_data x. + \return A pointer to the AT context, or NULL if there was a problem. */ +SPAN_DECLARE(at_state_t *) at_init(at_state_t *s, + at_tx_handler_t *at_tx_handler, + void *at_tx_user_data, + at_modem_control_handler_t *modem_control_handler, + void *modem_control_user_data); + +/*! Release an AT interpreter context. + \brief Release an AT interpreter context. + \param s The AT context. + \return 0 for OK */ +SPAN_DECLARE(int) at_release(at_state_t *s); + +/*! Free an AT interpreter context. + \brief Free an AT interpreter context. + \param s The AT context. + \return 0 for OK */ +SPAN_DECLARE(int) at_free(at_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/awgn.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/awgn.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,96 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * awgn.h - An additive Gaussian white noise generator + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: awgn.h,v 1.18 2009/02/10 13:06:47 steveu Exp $ + */ + +/*! \file */ + +/* This code is based on some demonstration code in a research + paper somewhere. I can't track down where I got the original from, + so that due recognition can be given. The original had no explicit + copyright notice, and I hope nobody objects to its use here. + + Having a reasonable Gaussian noise generator is pretty important for + telephony testing (in fact, pretty much any DSP testing), and this + one seems to have served me OK. Since the generation of Gaussian + noise is only for test purposes, and not a core system component, + I don't intend to worry excessively about copyright issues, unless + someone worries me. + + The non-core nature of this code also explains why it is unlikely + to ever be optimised. */ + +#if !defined(_SPANDSP_AWGN_H_) +#define _SPANDSP_AWGN_H_ + +/*! \page awgn_page Additive white gaussian noise (AWGN) generation + +\section awgn_page_sec_1 What does it do? +Adding noise is not the most useful thing in most DSP applications, but it is +awfully useful for test suites. + +\section awgn_page_sec_2 How does it work? + +This code is based on some demonstration code in a research paper somewhere. I +can't track down where I got the original from, so that due recognition can be +given. The original had no explicit copyright notice, and I hope nobody objects +to its use here. + +Having a reasonable Gaussian noise generator is pretty important for telephony +testing (in fact, pretty much any DSP testing), and this one seems to have +served me OK. Since the generation of Gaussian noise is only for test purposes, +and not a core system component, I don't intend to worry excessively about +copyright issues, unless someone worries me. + +The non-core nature of this code also explains why it is unlikely to ever be +optimised. +*/ + +/*! + AWGN generator descriptor. This contains all the state information for an AWGN generator. + */ +typedef struct awgn_state_s awgn_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +SPAN_DECLARE(awgn_state_t *) awgn_init_dbm0(awgn_state_t *s, int idum, float level); + +SPAN_DECLARE(awgn_state_t *) awgn_init_dbov(awgn_state_t *s, int idum, float level); + +SPAN_DECLARE(int) awgn_release(awgn_state_t *s); + +SPAN_DECLARE(int) awgn_free(awgn_state_t *s); + +SPAN_DECLARE(int16_t) awgn(awgn_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/bell_r2_mf.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/bell_r2_mf.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,275 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * bell_r2_mf.h - Bell MF and MFC/R2 tone generation and detection. + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: bell_r2_mf.h,v 1.24 2009/02/10 13:06:47 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_BELL_R2_MF_H_) +#define _SPANDSP_BELL_R2_MF_H_ + +/*! \page mfc_r2_tone_generation_page MFC/R2 tone generation +\section mfc_r2_tone_generation_page_sec_1 What does it do? +The MFC/R2 tone generation module provides for the generation of the +repertoire of 15 dual tones needs for the digital MFC/R2 signalling protocol. + +\section mfc_r2_tone_generation_page_sec_2 How does it work? +*/ + +/*! \page bell_mf_tone_generation_page Bell MF tone generation +\section bell_mf_tone_generation_page_sec_1 What does it do? +The Bell MF tone generation module provides for the generation of the +repertoire of 15 dual tones needs for various Bell MF signalling protocols. + +\section bell_mf_tone_generation_page_sec_2 How does it work? +Basic Bell MF tone generation specs: + - Tone on time = KP: 100+-7ms. All other signals: 68+-7ms + - Tone off time (between digits) = 68+-7ms + - Frequency tolerance +- 1.5% + - Signal level -7+-1dBm per frequency +*/ + +/*! \page mfc_r2_tone_rx_page MFC/R2 tone receiver + +\section mfc_r2_tone_rx_page_sec_1 What does it do? +The MFC/R2 tone receiver module provides for the detection of the +repertoire of 15 dual tones needs for the digital MFC/R2 signalling protocol. +It is compliant with ITU-T Q.441D. + +\section mfc_r2_tone_rx_page_sec_2 How does it work? +Basic MFC/R2 tone detection specs: + - Receiver response range: -5dBm to -35dBm + - Difference in level for a pair of frequencies + - Adjacent tones: <5dB + - Non-adjacent tones: <7dB + - Receiver not to detect a signal of 2 frequencies of level -5dB and + duration <7ms. + - Receiver not to recognise a signal of 2 frequencies having a difference + in level >=20dB. + - Max received signal frequency error: +-10Hz + - The sum of the operate and release times of a 2 frequency signal not to + exceed 80ms (there are no individual specs for the operate and release + times). + - Receiver not to release for signal interruptions <=7ms. + - System malfunction due to signal interruptions >7ms (typically 20ms) is + prevented by further logic elements. +*/ + +/*! \page bell_mf_tone_rx_page Bell MF tone receiver + +\section bell_mf_tone_rx_page_sec_1 What does it do? +The Bell MF tone receiver module provides for the detection of the +repertoire of 15 dual tones needs for various Bell MF signalling protocols. +It is compliant with ITU-T Q.320, ITU-T Q.322, ITU-T Q.323B. + +\section bell_mf_tone_rx_page_sec_2 How does it work? +Basic Bell MF tone detection specs: + - Frequency tolerance +- 1.5% +-10Hz + - Signal level -14dBm to 0dBm + - Perform a "two and only two tones present" test. + - Twist <= 6dB accepted + - Receiver sensitive to signals above -22dBm per frequency + - Test for a minimum of 55ms if KP, or 30ms of other signals. + - Signals to be recognised if the two tones arrive within 8ms of each other. + - Invalid signals result in the return of the re-order tone. + +Note: Above -3dBm the signal starts to clip. We can detect with a little clipping, + but not up to 0dBm, which the above spec seems to require. There isn't a lot + we can do about that. Is the spec. incorrectly worded about the dBm0 reference + point, or have I misunderstood it? +*/ + +/*! The maximum number of Bell MF digits we can buffer. */ +#define MAX_BELL_MF_DIGITS 128 + +/*! + Bell MF generator state descriptor. This defines the state of a single + working instance of a Bell MF generator. +*/ +typedef struct bell_mf_tx_state_s bell_mf_tx_state_t; + +/*! + Bell MF digit detector descriptor. +*/ +typedef struct bell_mf_rx_state_s bell_mf_rx_state_t; + +/*! + MFC/R2 tone detector descriptor. +*/ +typedef struct r2_mf_tx_state_s r2_mf_tx_state_t; + +/*! + MFC/R2 tone detector descriptor. +*/ +typedef struct r2_mf_rx_state_s r2_mf_rx_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! \brief Generate a buffer of Bell MF tones. + \param s The Bell MF generator context. + \param amp The buffer for the generated signal. + \param max_samples The required number of generated samples. + \return The number of samples actually generated. This may be less than + max_samples if the input buffer empties. */ +SPAN_DECLARE(int) bell_mf_tx(bell_mf_tx_state_t *s, int16_t amp[], int max_samples); + +/*! \brief Put a string of digits in a Bell MF generator's input buffer. + \param s The Bell MF generator context. + \param digits The string of digits to be added. + \param len The length of the string of digits. If negative, the string is + assumed to be a NULL terminated string. + \return The number of digits actually added. This may be less than the + length of the digit string, if the buffer fills up. */ +SPAN_DECLARE(int) bell_mf_tx_put(bell_mf_tx_state_t *s, const char *digits, int len); + +/*! \brief Initialise a Bell MF generator context. + \param s The Bell MF generator context. + \return A pointer to the Bell MF generator context.*/ +SPAN_DECLARE(bell_mf_tx_state_t *) bell_mf_tx_init(bell_mf_tx_state_t *s); + +/*! \brief Release a Bell MF generator context. + \param s The Bell MF generator context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) bell_mf_tx_release(bell_mf_tx_state_t *s); + +/*! \brief Free a Bell MF generator context. + \param s The Bell MF generator context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) bell_mf_tx_free(bell_mf_tx_state_t *s); + +/*! \brief Generate a block of R2 MF tones. + \param s The R2 MF generator context. + \param amp The buffer for the generated signal. + \param samples The required number of generated samples. + \return The number of samples actually generated. */ +SPAN_DECLARE(int) r2_mf_tx(r2_mf_tx_state_t *s, int16_t amp[], int samples); + +/*! \brief Generate a block of R2 MF tones. + \param s The R2 MF generator context. + \param digit The digit to be generated. + \return 0 for OK, or -1 for a bad request. */ +SPAN_DECLARE(int) r2_mf_tx_put(r2_mf_tx_state_t *s, char digit); + +/*! \brief Initialise an R2 MF tone generator context. + \param s The R2 MF generator context. + \param fwd TRUE if the context is for forward signals. FALSE if the + context is for backward signals. + \return A pointer to the MFC/R2 generator context.*/ +SPAN_DECLARE(r2_mf_tx_state_t *) r2_mf_tx_init(r2_mf_tx_state_t *s, int fwd); + +/*! \brief Release an R2 MF tone generator context. + \param s The R2 MF tone generator context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) r2_mf_tx_release(r2_mf_tx_state_t *s); + +/*! \brief Free an R2 MF tone generator context. + \param s The R2 MF tone generator context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) r2_mf_tx_free(r2_mf_tx_state_t *s); + +/*! Process a block of received Bell MF audio samples. + \brief Process a block of received Bell MF audio samples. + \param s The Bell MF receiver context. + \param amp The audio sample buffer. + \param samples The number of samples in the buffer. + \return The number of samples unprocessed. */ +SPAN_DECLARE(int) bell_mf_rx(bell_mf_rx_state_t *s, const int16_t amp[], int samples); + +/*! \brief Get a string of digits from a Bell MF receiver's output buffer. + \param s The Bell MF receiver context. + \param buf The buffer for the received digits. + \param max The maximum number of digits to be returned, + \return The number of digits actually returned. */ +SPAN_DECLARE(size_t) bell_mf_rx_get(bell_mf_rx_state_t *s, char *buf, int max); + +/*! \brief Initialise a Bell MF receiver context. + \param s The Bell MF receiver context. + \param callback An optional callback routine, used to report received digits. If + no callback routine is set, digits may be collected, using the bell_mf_rx_get() + function. + \param user_data An opaque pointer which is associated with the context, + and supplied in callbacks. + \return A pointer to the Bell MF receiver context.*/ +SPAN_DECLARE(bell_mf_rx_state_t *) bell_mf_rx_init(bell_mf_rx_state_t *s, + digits_rx_callback_t callback, + void *user_data); + +/*! \brief Release a Bell MF receiver context. + \param s The Bell MF receiver context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) bell_mf_rx_release(bell_mf_rx_state_t *s); + +/*! \brief Free a Bell MF receiver context. + \param s The Bell MF receiver context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) bell_mf_rx_free(bell_mf_rx_state_t *s); + +/*! Process a block of received R2 MF audio samples. + \brief Process a block of received R2 MF audio samples. + \param s The R2 MF receiver context. + \param amp The audio sample buffer. + \param samples The number of samples in the buffer. + \return The number of samples unprocessed. */ +SPAN_DECLARE(int) r2_mf_rx(r2_mf_rx_state_t *s, const int16_t amp[], int samples); + +/*! \brief Get the current digit from an R2 MF receiver. + \param s The R2 MF receiver context. + \return The number digits being received. */ +SPAN_DECLARE(int) r2_mf_rx_get(r2_mf_rx_state_t *s); + +/*! \brief Initialise an R2 MF receiver context. + \param s The R2 MF receiver context. + \param fwd TRUE if the context is for forward signals. FALSE if the + context is for backward signals. + \param callback An optional callback routine, used to report received digits. If + no callback routine is set, digits may be collected, using the r2_mf_rx_get() + function. + \param user_data An opaque pointer which is associated with the context, + and supplied in callbacks. + \return A pointer to the R2 MF receiver context. */ +SPAN_DECLARE(r2_mf_rx_state_t *) r2_mf_rx_init(r2_mf_rx_state_t *s, + int fwd, + tone_report_func_t callback, + void *user_data); + +/*! \brief Release an R2 MF receiver context. + \param s The R2 MF receiver context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) r2_mf_rx_release(r2_mf_rx_state_t *s); + +/*! \brief Free an R2 MF receiver context. + \param s The R2 MF receiver context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) r2_mf_rx_free(r2_mf_rx_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/bert.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/bert.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,162 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * bert.h - Bit error rate tests. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: bert.h,v 1.23 2009/02/10 13:06:47 steveu Exp $ + */ + +#if !defined(_SPANDSP_BERT_H_) +#define _SPANDSP_BERT_H_ + +/*! \page bert_page The Bit Error Rate tester +\section bert_page_sec_1 What does it do? +The Bit Error Rate tester generates a pseudo random bit stream. It also accepts such +a pattern, synchronises to it, and checks the bit error rate in this stream. + +\section bert_page_sec_2 How does it work? +The Bit Error Rate tester generates a bit stream, with a repeating 2047 bit pseudo +random pattern, using an 11 stage polynomial generator. It also accepts such a pattern, +synchronises to it, and checks the bit error rate in this stream. If the error rate is +excessive the tester assumes synchronisation has been lost, and it attempts to +resynchronise with the stream. + +The bit error rate is continuously assessed against decadic ranges - + > 1 in 10^2 + > 1 in 10^3 + > 1 in 10^4 + > 1 in 10^5 + > 1 in 10^6 + > 1 in 10^7 + < 1 in 10^7 +To ensure fairly smooth results from this assessment, each decadic level is assessed +over 10/error rate bits. That is, to assess if the signal's BER is above or below 1 in 10^5 +the software looks over 10*10^5 => 10^6 bits. +*/ + +enum +{ + BERT_REPORT_SYNCED = 0, + BERT_REPORT_UNSYNCED, + BERT_REPORT_REGULAR, + BERT_REPORT_GT_10_2, + BERT_REPORT_LT_10_2, + BERT_REPORT_LT_10_3, + BERT_REPORT_LT_10_4, + BERT_REPORT_LT_10_5, + BERT_REPORT_LT_10_6, + BERT_REPORT_LT_10_7 +}; + +/* The QBF strings should be: + "VoyeZ Le BricK GeanT QuE J'ExaminE PreS Du WharF 123 456 7890 + - * : = $ % ( )" + "ThE QuicK BrowN FoX JumpS OveR ThE LazY DoG 123 456 7890 + - * : = $ % ( )" +*/ + +enum +{ + BERT_PATTERN_ZEROS = 0, + BERT_PATTERN_ONES, + BERT_PATTERN_7_TO_1, + BERT_PATTERN_3_TO_1, + BERT_PATTERN_1_TO_1, + BERT_PATTERN_1_TO_3, + BERT_PATTERN_1_TO_7, + BERT_PATTERN_QBF, + BERT_PATTERN_ITU_O151_23, + BERT_PATTERN_ITU_O151_20, + BERT_PATTERN_ITU_O151_15, + BERT_PATTERN_ITU_O152_11, + BERT_PATTERN_ITU_O153_9 +}; + +/*! + Bit error rate tester (BERT) results descriptor. This is used to report the + results of a BER test. +*/ +typedef struct +{ + int total_bits; + int bad_bits; + int resyncs; +} bert_results_t; + +typedef void (*bert_report_func_t)(void *user_data, int reason, bert_results_t *bert_results); + +/*! + Bit error rate tester (BERT) descriptor. This defines the working state for a + single instance of the BERT. +*/ +typedef struct bert_state_s bert_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Return a short description of a BERT event. + \param event The event type. + \return A pointer to a short text string describing the event. */ +SPAN_DECLARE(const char *) bert_event_to_str(int event); + +/*! Initialise a BERT context. + \param s The BERT context. + \param limit The maximum test duration. + \param pattern One of the supported BERT signal patterns. + \param resync_len ??? + \param resync_percent The percentage of bad bits which will cause a resync. + \return The BERT context. */ +SPAN_DECLARE(bert_state_t *) bert_init(bert_state_t *s, int limit, int pattern, int resync_len, int resync_percent); + +SPAN_DECLARE(int) bert_release(bert_state_t *s); + +SPAN_DECLARE(int) bert_free(bert_state_t *s); + +/*! Get the next bit of the BERT sequence from the generator. + \param s The BERT context. + \return The bit. */ +SPAN_DECLARE(int) bert_get_bit(bert_state_t *s); + +/*! Put the next bit of the BERT sequence to the analyser. + \param s The BERT context. + \param bit The bit. */ +SPAN_DECLARE(void) bert_put_bit(bert_state_t *s, int bit); + +/*! Set the callback function for reporting the test status. + \param s The BERT context. + \param freq The required frequency of regular reports. + \param reporter The callback function. + \param user_data An opaque pointer passed to the reporter routine. */ +SPAN_DECLARE(void) bert_set_report(bert_state_t *s, int freq, bert_report_func_t reporter, void *user_data); + +/*! Get the results of the BERT. + \param s The BERT context. + \param results The results. + \return The size of the result structure. */ +SPAN_DECLARE(int) bert_result(bert_state_t *s, bert_results_t *results); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/biquad.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/biquad.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,117 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * biquad.h - General telephony bi-quad section routines (currently this just + * handles canonic/type 2 form) + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: biquad.h,v 1.14 2008/04/17 14:26:59 steveu Exp $ + */ + +/*! \page biquad_page Bi-quadratic filter sections +\section biquad_page_sec_1 What does it do? +???. + +\section biquad_page_sec_2 How does it work? +???. +*/ + +#if !defined(_SPANDSP_BIQUAD_H_) +#define _SPANDSP_BIQUAD_H_ + +typedef struct +{ + int32_t gain; + int32_t a1; + int32_t a2; + int32_t b1; + int32_t b2; + + int32_t z1; + int32_t z2; + +#if FIRST_ORDER_NOISE_SHAPING + int32_t residue; +#elif SECOND_ORDER_NOISE_SHAPING + int32_t residue1; + int32_t residue2; +#endif +} biquad2_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +static __inline__ void biquad2_init(biquad2_state_t *bq, + int32_t gain, + int32_t a1, + int32_t a2, + int32_t b1, + int32_t b2) +{ + bq->gain = gain; + bq->a1 = a1; + bq->a2 = a2; + bq->b1 = b1; + bq->b2 = b2; + + bq->z1 = 0; + bq->z2 = 0; + +#if FIRST_ORDER_NOISE_SHAPING + bq->residue = 0; +#elif SECOND_ORDER_NOISE_SHAPING + bq->residue1 = 0; + bq->residue2 = 0; +#endif +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int16_t biquad2(biquad2_state_t *bq, int16_t sample) +{ + int32_t y; + int32_t z0; + + z0 = sample*bq->gain + bq->z1*bq->a1 + bq->z2*bq->a2; + y = z0 + bq->z1*bq->b1 + bq->z2*bq->b2; + + bq->z2 = bq->z1; + bq->z1 = z0 >> 15; +#if FIRST_ORDER_NOISE_SHAPING + y += bq->residue; + bq->residue = y & 0x7FFF; +#elif SECOND_ORDER_NOISE_SHAPING + y += (2*bq->residue1 - bq->residue2); + bq->residue2 = bq->residue1; + bq->residue1 = y & 0x7FFF; +#endif + y >>= 15; + return (int16_t) y; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/bit_operations.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/bit_operations.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,314 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * bit_operations.h - Various bit level operations, such as bit reversal + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: bit_operations.h,v 1.27 2009/07/10 13:15:56 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_BIT_OPERATIONS_H_) +#define _SPANDSP_BIT_OPERATIONS_H_ + +#if defined(__i386__) || defined(__x86_64__) +#if !defined(__SUNPRO_C) || (__SUNPRO_C >= 0x0590) +#define SPANDSP_USE_86_ASM +#endif +#endif + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! \brief Find the bit position of the highest set bit in a word + \param bits The word to be searched + \return The bit number of the highest set bit, or -1 if the word is zero. */ +static __inline__ int top_bit(unsigned int bits) +{ +#if defined(SPANDSP_USE_86_ASM) + int res; + + __asm__ (" xorl %[res],%[res];\n" + " decl %[res];\n" + " bsrl %[bits],%[res]\n" + : [res] "=&r" (res) + : [bits] "rm" (bits)); + return res; +#elif defined(__ppc__) || defined(__powerpc__) + int res; + + __asm__ ("cntlzw %[res],%[bits];\n" + : [res] "=&r" (res) + : [bits] "r" (bits)); + return 31 - res; +#elif defined(_M_IX86) + /* Visual Studio i386 */ + __asm + { + xor eax, eax + dec eax + bsr eax, bits + } +#elif defined(_M_X64) + /* Visual Studio x86_64 */ + /* TODO: Need the appropriate x86_64 code */ + int res; + + if (bits == 0) + return -1; + res = 0; + if (bits & 0xFFFF0000) + { + bits &= 0xFFFF0000; + res += 16; + } + if (bits & 0xFF00FF00) + { + bits &= 0xFF00FF00; + res += 8; + } + if (bits & 0xF0F0F0F0) + { + bits &= 0xF0F0F0F0; + res += 4; + } + if (bits & 0xCCCCCCCC) + { + bits &= 0xCCCCCCCC; + res += 2; + } + if (bits & 0xAAAAAAAA) + { + bits &= 0xAAAAAAAA; + res += 1; + } + return res; +#else + int res; + + if (bits == 0) + return -1; + res = 0; + if (bits & 0xFFFF0000) + { + bits &= 0xFFFF0000; + res += 16; + } + if (bits & 0xFF00FF00) + { + bits &= 0xFF00FF00; + res += 8; + } + if (bits & 0xF0F0F0F0) + { + bits &= 0xF0F0F0F0; + res += 4; + } + if (bits & 0xCCCCCCCC) + { + bits &= 0xCCCCCCCC; + res += 2; + } + if (bits & 0xAAAAAAAA) + { + bits &= 0xAAAAAAAA; + res += 1; + } + return res; +#endif +} +/*- End of function --------------------------------------------------------*/ + +/*! \brief Find the bit position of the lowest set bit in a word + \param bits The word to be searched + \return The bit number of the lowest set bit, or -1 if the word is zero. */ +static __inline__ int bottom_bit(unsigned int bits) +{ + int res; + +#if defined(SPANDSP_USE_86_ASM) + __asm__ (" xorl %[res],%[res];\n" + " decl %[res];\n" + " bsfl %[bits],%[res]\n" + : [res] "=&r" (res) + : [bits] "rm" (bits)); + return res; +#else + if (bits == 0) + return -1; + res = 31; + if (bits & 0x0000FFFF) + { + bits &= 0x0000FFFF; + res -= 16; + } + if (bits & 0x00FF00FF) + { + bits &= 0x00FF00FF; + res -= 8; + } + if (bits & 0x0F0F0F0F) + { + bits &= 0x0F0F0F0F; + res -= 4; + } + if (bits & 0x33333333) + { + bits &= 0x33333333; + res -= 2; + } + if (bits & 0x55555555) + { + bits &= 0x55555555; + res -= 1; + } + return res; +#endif +} +/*- End of function --------------------------------------------------------*/ + +/*! \brief Bit reverse a byte. + \param data The byte to be reversed. + \return The bit reversed version of data. */ +static __inline__ uint8_t bit_reverse8(uint8_t x) +{ +#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__powerpc__) + /* If multiply is fast */ + return ((x*0x0802U & 0x22110U) | (x*0x8020U & 0x88440U))*0x10101U >> 16; +#else + /* If multiply is slow, but we have a barrel shifter */ + x = (x >> 4) | (x << 4); + x = ((x & 0xCC) >> 2) | ((x & 0x33) << 2); + return ((x & 0xAA) >> 1) | ((x & 0x55) << 1); +#endif +} +/*- End of function --------------------------------------------------------*/ + +/*! \brief Bit reverse a 16 bit word. + \param data The word to be reversed. + \return The bit reversed version of data. */ +SPAN_DECLARE(uint16_t) bit_reverse16(uint16_t data); + +/*! \brief Bit reverse a 32 bit word. + \param data The word to be reversed. + \return The bit reversed version of data. */ +SPAN_DECLARE(uint32_t) bit_reverse32(uint32_t data); + +/*! \brief Bit reverse each of the four bytes in a 32 bit word. + \param data The word to be reversed. + \return The bit reversed version of data. */ +SPAN_DECLARE(uint32_t) bit_reverse_4bytes(uint32_t data); + +#if defined(__x86_64__) +/*! \brief Bit reverse each of the eight bytes in a 64 bit word. + \param data The word to be reversed. + \return The bit reversed version of data. */ +SPAN_DECLARE(uint64_t) bit_reverse_8bytes(uint64_t data); +#endif + +/*! \brief Bit reverse each bytes in a buffer. + \param to The buffer to place the reversed data in. + \param from The buffer containing the data to be reversed. + \param len The length of the data in the buffer. */ +SPAN_DECLARE(void) bit_reverse(uint8_t to[], const uint8_t from[], int len); + +/*! \brief Find the number of set bits in a 32 bit word. + \param x The word to be searched. + \return The number of set bits. */ +SPAN_DECLARE(int) one_bits32(uint32_t x); + +/*! \brief Create a mask as wide as the number in a 32 bit word. + \param x The word to be searched. + \return The mask. */ +SPAN_DECLARE(uint32_t) make_mask32(uint32_t x); + +/*! \brief Create a mask as wide as the number in a 16 bit word. + \param x The word to be searched. + \return The mask. */ +SPAN_DECLARE(uint16_t) make_mask16(uint16_t x); + +/*! \brief Find the least significant one in a word, and return a word + with just that bit set. + \param x The word to be searched. + \return The word with the single set bit. */ +static __inline__ uint32_t least_significant_one32(uint32_t x) +{ + return (x & (-(int32_t) x)); +} +/*- End of function --------------------------------------------------------*/ + +/*! \brief Find the most significant one in a word, and return a word + with just that bit set. + \param x The word to be searched. + \return The word with the single set bit. */ +static __inline__ uint32_t most_significant_one32(uint32_t x) +{ +#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__powerpc__) + return 1 << top_bit(x); +#else + x = make_mask32(x); + return (x ^ (x >> 1)); +#endif +} +/*- End of function --------------------------------------------------------*/ + +/*! \brief Find the parity of a byte. + \param x The byte to be checked. + \return 1 for odd, or 0 for even. */ +static __inline__ int parity8(uint8_t x) +{ + x = (x ^ (x >> 4)) & 0x0F; + return (0x6996 >> x) & 1; +} +/*- End of function --------------------------------------------------------*/ + +/*! \brief Find the parity of a 16 bit word. + \param x The word to be checked. + \return 1 for odd, or 0 for even. */ +static __inline__ int parity16(uint16_t x) +{ + x ^= (x >> 8); + x = (x ^ (x >> 4)) & 0x0F; + return (0x6996 >> x) & 1; +} +/*- End of function --------------------------------------------------------*/ + +/*! \brief Find the parity of a 32 bit word. + \param x The word to be checked. + \return 1 for odd, or 0 for even. */ +static __inline__ int parity32(uint32_t x) +{ + x ^= (x >> 16); + x ^= (x >> 8); + x = (x ^ (x >> 4)) & 0x0F; + return (0x6996 >> x) & 1; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/bitstream.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/bitstream.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,81 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * bitstream.h - Bitstream composition and decomposition routines. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: bitstream.h,v 1.14.4.1 2009/12/28 12:20:47 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_BITSTREAM_H_) +#define _SPANDSP_BITSTREAM_H_ + +/*! \page bitstream_page Bitstream composition and decomposition +\section bitstream_page_sec_1 What does it do? + +\section bitstream_page_sec_2 How does it work? +*/ + +/*! Bitstream handler state */ +typedef struct bitstream_state_s bitstream_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! \brief Put a chunk of bits into the output buffer. + \param s A pointer to the bitstream context. + \param c A pointer to the bitstream output buffer. + \param value The value to be pushed into the output buffer. + \param bits The number of bits of value to be pushed. 1 to 25 bits is valid. */ +SPAN_DECLARE(void) bitstream_put(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits); + +/*! \brief Get a chunk of bits from the input buffer. + \param s A pointer to the bitstream context. + \param c A pointer to the bitstream input buffer. + \param bits The number of bits of value to be grabbed. 1 to 25 bits is valid. + \return The value retrieved from the input buffer. */ +SPAN_DECLARE(uint32_t) bitstream_get(bitstream_state_t *s, const uint8_t **c, int bits); + +/*! \brief Flush any residual bit to the output buffer. + \param s A pointer to the bitstream context. + \param c A pointer to the bitstream output buffer. */ +SPAN_DECLARE(void) bitstream_flush(bitstream_state_t *s, uint8_t **c); + +/*! \brief Initialise a bitstream context. + \param s A pointer to the bitstream context. + \param lsb_first TRUE if the bit stream is LSB first, else its MSB first. + \return A pointer to the bitstream context. */ +SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s, int direction); + +SPAN_DECLARE(int) bitstream_release(bitstream_state_t *s); + +SPAN_DECLARE(int) bitstream_free(bitstream_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/complex.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/complex.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,507 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * complex.h + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: complex.h,v 1.20 2009/02/21 05:39:08 steveu Exp $ + */ + +/*! \file */ + +/*! \page complex_page Complex number support +\section complex_page_sec_1 What does it do? +Complex number support is part of the C99 standard. However, support for this +in C compilers is still patchy. A set of complex number feaures is provided as +a "temporary" measure, until native C language complex number support is +widespread. +*/ + +#if !defined(_SPANDSP_COMPLEX_H_) +#define _SPANDSP_COMPLEX_H_ + +/*! + Floating complex type. +*/ +typedef struct +{ + /*! \brief Real part. */ + float re; + /*! \brief Imaginary part. */ + float im; +} complexf_t; + +/*! + Floating complex type. +*/ +typedef struct +{ + /*! \brief Real part. */ + double re; + /*! \brief Imaginary part. */ + double im; +} complex_t; + +#if defined(HAVE_LONG_DOUBLE) +/*! + Long double complex type. +*/ +typedef struct +{ + /*! \brief Real part. */ + long double re; + /*! \brief Imaginary part. */ + long double im; +} complexl_t; +#endif + +/*! + Complex integer type. +*/ +typedef struct +{ + /*! \brief Real part. */ + int re; + /*! \brief Imaginary part. */ + int im; +} complexi_t; + +/*! + Complex 16 bit integer type. +*/ +typedef struct +{ + /*! \brief Real part. */ + int16_t re; + /*! \brief Imaginary part. */ + int16_t im; +} complexi16_t; + +/*! + Complex 32 bit integer type. +*/ +typedef struct +{ + /*! \brief Real part. */ + int32_t re; + /*! \brief Imaginary part. */ + int32_t im; +} complexi32_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +static __inline__ complexf_t complex_setf(float re, float im) +{ + complexf_t z; + + z.re = re; + z.im = im; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complex_t complex_set(double re, double im) +{ + complex_t z; + + z.re = re; + z.im = im; + return z; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +static __inline__ complexl_t complex_setl(long double re, long double im) +{ + complexl_t z; + + z.re = re; + z.im = im; + return z; +} +/*- End of function --------------------------------------------------------*/ +#endif + +static __inline__ complexi_t complex_seti(int re, int im) +{ + complexi_t z; + + z.re = re; + z.im = im; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complexi16_t complex_seti16(int16_t re, int16_t im) +{ + complexi16_t z; + + z.re = re; + z.im = im; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complexi32_t complex_seti32(int32_t re, int32_t im) +{ + complexi32_t z; + + z.re = re; + z.im = im; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complexf_t complex_addf(const complexf_t *x, const complexf_t *y) +{ + complexf_t z; + + z.re = x->re + y->re; + z.im = x->im + y->im; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complex_t complex_add(const complex_t *x, const complex_t *y) +{ + complex_t z; + + z.re = x->re + y->re; + z.im = x->im + y->im; + return z; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +static __inline__ complexl_t complex_addl(const complexl_t *x, const complexl_t *y) +{ + complexl_t z; + + z.re = x->re + y->re; + z.im = x->im + y->im; + return z; +} +/*- End of function --------------------------------------------------------*/ +#endif + +static __inline__ complexi_t complex_addi(const complexi_t *x, const complexi_t *y) +{ + complexi_t z; + + z.re = x->re + y->re; + z.im = x->im + y->im; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complexi16_t complex_addi16(const complexi16_t *x, const complexi16_t *y) +{ + complexi16_t z; + + z.re = x->re + y->re; + z.im = x->im + y->im; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complexi32_t complex_addi32(const complexi32_t *x, const complexi32_t *y) +{ + complexi32_t z; + + z.re = x->re + y->re; + z.im = x->im + y->im; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complexf_t complex_subf(const complexf_t *x, const complexf_t *y) +{ + complexf_t z; + + z.re = x->re - y->re; + z.im = x->im - y->im; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complex_t complex_sub(const complex_t *x, const complex_t *y) +{ + complex_t z; + + z.re = x->re - y->re; + z.im = x->im - y->im; + return z; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +static __inline__ complexl_t complex_subl(const complexl_t *x, const complexl_t *y) +{ + complexl_t z; + + z.re = x->re - y->re; + z.im = x->im - y->im; + return z; +} +/*- End of function --------------------------------------------------------*/ +#endif + +static __inline__ complexi_t complex_subi(const complexi_t *x, const complexi_t *y) +{ + complexi_t z; + + z.re = x->re - y->re; + z.im = x->im - y->im; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complexi16_t complex_subi16(const complexi16_t *x, const complexi16_t *y) +{ + complexi16_t z; + + z.re = x->re - y->re; + z.im = x->im - y->im; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complexi32_t complex_subi32(const complexi32_t *x, const complexi32_t *y) +{ + complexi32_t z; + + z.re = x->re - y->re; + z.im = x->im - y->im; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complexf_t complex_mulf(const complexf_t *x, const complexf_t *y) +{ + complexf_t z; + + z.re = x->re*y->re - x->im*y->im; + z.im = x->re*y->im + x->im*y->re; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complex_t complex_mul(const complex_t *x, const complex_t *y) +{ + complex_t z; + + z.re = x->re*y->re - x->im*y->im; + z.im = x->re*y->im + x->im*y->re; + return z; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +static __inline__ complexl_t complex_mull(const complexl_t *x, const complexl_t *y) +{ + complexl_t z; + + z.re = x->re*y->re - x->im*y->im; + z.im = x->re*y->im + x->im*y->re; + return z; +} +/*- End of function --------------------------------------------------------*/ +#endif + +static __inline__ complexi_t complex_muli(const complexi_t *x, const complexi_t *y) +{ + complexi_t z; + + z.re = x->re*y->re - x->im*y->im; + z.im = x->re*y->im + x->im*y->re; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complexi16_t complex_muli16(const complexi16_t *x, const complexi16_t *y) +{ + complexi16_t z; + + z.re = (int16_t) ((int32_t) x->re*(int32_t) y->re - (int32_t) x->im*(int32_t) y->im); + z.im = (int16_t) ((int32_t) x->re*(int32_t) y->im + (int32_t) x->im*(int32_t) y->re); + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complexi16_t complex_mul_q1_15(const complexi16_t *x, const complexi16_t *y) +{ + complexi16_t z; + + z.re = (int16_t) (((int32_t) x->re*(int32_t) y->re - (int32_t) x->im*(int32_t) y->im) >> 15); + z.im = (int16_t) (((int32_t) x->re*(int32_t) y->im + (int32_t) x->im*(int32_t) y->re) >> 15); + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complexi32_t complex_muli32i16(const complexi32_t *x, const complexi16_t *y) +{ + complexi32_t z; + + z.re = x->re*(int32_t) y->re - x->im*(int32_t) y->im; + z.im = x->re*(int32_t) y->im + x->im*(int32_t) y->re; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complexi32_t complex_muli32(const complexi32_t *x, const complexi32_t *y) +{ + complexi32_t z; + + z.re = x->re*y->re - x->im*y->im; + z.im = x->re*y->im + x->im*y->re; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complexf_t complex_divf(const complexf_t *x, const complexf_t *y) +{ + complexf_t z; + float f; + + f = y->re*y->re + y->im*y->im; + z.re = ( x->re*y->re + x->im*y->im)/f; + z.im = (-x->re*y->im + x->im*y->re)/f; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complex_t complex_div(const complex_t *x, const complex_t *y) +{ + complex_t z; + double f; + + f = y->re*y->re + y->im*y->im; + z.re = ( x->re*y->re + x->im*y->im)/f; + z.im = (-x->re*y->im + x->im*y->re)/f; + return z; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +static __inline__ complexl_t complex_divl(const complexl_t *x, const complexl_t *y) +{ + complexl_t z; + long double f; + + f = y->re*y->re + y->im*y->im; + z.re = ( x->re*y->re + x->im*y->im)/f; + z.im = (-x->re*y->im + x->im*y->re)/f; + return z; +} +/*- End of function --------------------------------------------------------*/ +#endif + +static __inline__ complexf_t complex_conjf(const complexf_t *x) +{ + complexf_t z; + + z.re = x->re; + z.im = -x->im; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complex_t complex_conj(const complex_t *x) +{ + complex_t z; + + z.re = x->re; + z.im = -x->im; + return z; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +static __inline__ complexl_t complex_conjl(const complexl_t *x) +{ + complexl_t z; + + z.re = x->re; + z.im = -x->im; + return z; +} +/*- End of function --------------------------------------------------------*/ +#endif + +static __inline__ complexi_t complex_conji(const complexi_t *x) +{ + complexi_t z; + + z.re = x->re; + z.im = -x->im; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complexi16_t complex_conji16(const complexi16_t *x) +{ + complexi16_t z; + + z.re = x->re; + z.im = -x->im; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ complexi32_t complex_conji32(const complexi32_t *x) +{ + complexi32_t z; + + z.re = x->re; + z.im = -x->im; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ float powerf(const complexf_t *x) +{ + return x->re*x->re + x->im*x->im; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ double power(const complex_t *x) +{ + return x->re*x->re + x->im*x->im; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +static __inline__ long double powerl(const complexl_t *x) +{ + return x->re*x->re + x->im*x->im; +} +/*- End of function --------------------------------------------------------*/ +#endif + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/complex_filters.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/complex_filters.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,75 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * complex_filters.h + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: complex_filters.h,v 1.14 2009/02/03 16:28:41 steveu Exp $ + */ + +#if !defined(_SPANDSP_COMPLEX_FILTERS_H_) +#define _SPANDSP_COMPLEX_FILTERS_H_ + +typedef struct filter_s filter_t; + +typedef float (*filter_step_func_t)(filter_t *fi, float x); + +/*! Filter state */ +typedef struct +{ + int nz; + int np; + filter_step_func_t fsf; +} fspec_t; + +struct filter_s +{ + fspec_t *fs; + float sum; + int ptr; /* Only for moving average filters */ + float v[]; +}; + +typedef struct +{ + filter_t *ref; + filter_t *imf; +} cfilter_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +SPAN_DECLARE(filter_t *) filter_create(fspec_t *fs); +SPAN_DECLARE(void) filter_delete(filter_t *fi); +SPAN_DECLARE(float) filter_step(filter_t *fi, float x); + +SPAN_DECLARE(cfilter_t *) cfilter_create(fspec_t *fs); +SPAN_DECLARE(void) cfilter_delete(cfilter_t *cfi); +SPAN_DECLARE(complexf_t) cfilter_step(cfilter_t *cfi, const complexf_t *z); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/complex_vector_float.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/complex_vector_float.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,172 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * complex_vector_float.h + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: complex_vector_float.h,v 1.13 2009/02/04 13:18:53 steveu Exp $ + */ + +#if !defined(_SPANDSP_COMPLEX_VECTOR_FLOAT_H_) +#define _SPANDSP_COMPLEX_VECTOR_FLOAT_H_ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +static __inline__ void cvec_copyf(complexf_t z[], const complexf_t x[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void cvec_copy(complex_t z[], const complex_t x[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +static __inline__ void cvec_copyl(complexl_t z[], const complexl_t x[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]; +} +/*- End of function --------------------------------------------------------*/ +#endif + +static __inline__ void cvec_zerof(complexf_t z[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = complex_setf(0.0f, 0.0f); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void cvec_zero(complex_t z[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = complex_set(0.0, 0.0); +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +static __inline__ void cvec_zerol(complexl_t z[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = complex_setl(0.0, 0.0); +} +/*- End of function --------------------------------------------------------*/ +#endif + +static __inline__ void cvec_setf(complexf_t z[], complexf_t *x, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = *x; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void cvec_set(complex_t z[], complex_t *x, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = *x; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +static __inline__ void cvec_setl(complexl_t z[], complexl_t *x, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = *x; +} +/*- End of function --------------------------------------------------------*/ +#endif + +SPAN_DECLARE(void) cvec_mulf(complexf_t z[], const complexf_t x[], const complexf_t y[], int n); + +SPAN_DECLARE(void) cvec_mul(complex_t z[], const complex_t x[], const complex_t y[], int n); + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) cvec_mull(complexl_t z[], const complexl_t x[], const complexl_t y[], int n); +#endif + +/*! \brief Find the dot product of two complex float vectors. + \param x The first vector. + \param y The first vector. + \param n The number of elements in the vectors. + \return The dot product of the two vectors. */ +SPAN_DECLARE(complexf_t) cvec_dot_prodf(const complexf_t x[], const complexf_t y[], int n); + +/*! \brief Find the dot product of two complex double vectors. + \param x The first vector. + \param y The first vector. + \param n The number of elements in the vectors. + \return The dot product of the two vectors. */ +SPAN_DECLARE(complex_t) cvec_dot_prod(const complex_t x[], const complex_t y[], int n); + +#if defined(HAVE_LONG_DOUBLE) +/*! \brief Find the dot product of two complex long double vectors. + \param x The first vector. + \param y The first vector. + \param n The number of elements in the vectors. + \return The dot product of the two vectors. */ +SPAN_DECLARE(complexl_t) cvec_dot_prodl(const complexl_t x[], const complexl_t y[], int n); +#endif + +/*! \brief Find the dot product of two complex float vectors, where the first is a circular buffer + with an offset for the starting position. + \param x The first vector. + \param y The first vector. + \param n The number of elements in the vectors. + \param pos The starting position in the x vector. + \return The dot product of the two vectors. */ +SPAN_DECLARE(complexf_t) cvec_circular_dot_prodf(const complexf_t x[], const complexf_t y[], int n, int pos); + +SPAN_DECLARE(void) cvec_lmsf(const complexf_t x[], complexf_t y[], int n, const complexf_t *error); + +SPAN_DECLARE(void) cvec_circular_lmsf(const complexf_t x[], complexf_t y[], int n, int pos, const complexf_t *error); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/complex_vector_int.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/complex_vector_int.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,131 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * complex_vector_int.h + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: complex_vector_int.h,v 1.4 2009/01/31 08:48:11 steveu Exp $ + */ + +#if !defined(_SPANDSP_COMPLEX_VECTOR_INT_H_) +#define _SPANDSP_COMPLEX_VECTOR_INT_H_ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +static __inline__ void cvec_copyi(complexi_t z[], const complexi_t x[], int n) +{ + memcpy(z, x, n*sizeof(z[0])); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void cvec_copyi16(complexi16_t z[], const complexi16_t x[], int n) +{ + memcpy(z, x, n*sizeof(z[0])); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void cvec_copyi32(complexi32_t z[], const complexi32_t x[], int n) +{ + memcpy(z, x, n*sizeof(z[0])); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void cvec_zeroi(complexi_t z[], int n) +{ + memset(z, 0, n*sizeof(z[0])); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void cvec_zeroi16(complexi16_t z[], int n) +{ + memset(z, 0, n*sizeof(z[0])); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void cvec_zeroi32(complexi32_t z[], int n) +{ + memset(z, 0, n*sizeof(z[0])); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void cvec_seti(complexi_t z[], complexi_t *x, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = *x; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void cvec_seti16(complexi16_t z[], complexi16_t *x, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = *x; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void cvec_seti32(complexi32_t z[], complexi32_t *x, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = *x; +} +/*- End of function --------------------------------------------------------*/ + +/*! \brief Find the dot product of two complex int16_t vectors. + \param x The first vector. + \param y The first vector. + \param n The number of elements in the vectors. + \return The dot product of the two vectors. */ +SPAN_DECLARE(complexi32_t) cvec_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n); + +/*! \brief Find the dot product of two complex int32_t vectors. + \param x The first vector. + \param y The first vector. + \param n The number of elements in the vectors. + \return The dot product of the two vectors. */ +SPAN_DECLARE(complexi32_t) cvec_dot_prodi32(const complexi32_t x[], const complexi32_t y[], int n); + +/*! \brief Find the dot product of two complex int16_t vectors, where the first is a circular buffer + with an offset for the starting position. + \param x The first vector. + \param y The first vector. + \param n The number of elements in the vectors. + \param pos The starting position in the x vector. + \return The dot product of the two vectors. */ +SPAN_DECLARE(complexi32_t) cvec_circular_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n, int pos); + +SPAN_DECLARE(void) cvec_lmsi16(const complexi16_t x[], complexi16_t y[], int n, const complexi16_t *error); + +SPAN_DECLARE(void) cvec_circular_lmsi16(const complexi16_t x[], complexi16_t y[], int n, int pos, const complexi16_t *error); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/crc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/crc.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,98 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * crc.h + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: crc.h,v 1.5 2009/01/31 08:48:11 steveu Exp $ + */ + +/*! \file */ + +/*! \page crc_page CRC + +\section crc_page_sec_1 What does it do? + +\section crc_page_sec_2 How does it work? +*/ + +#if !defined(_SPANDSP_CRC_H_) +#define _SPANDSP_CRC_H_ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! \brief Calculate the ITU/CCITT CRC-32 value in buffer. + \param buf The buffer containing the data. + \param len The length of the frame. + \param crc The initial CRC value. This is usually 0xFFFFFFFF, or 0 for a new block (it depends on + the application). It is previous returned CRC value for the continuation of a block. + \return The CRC value. +*/ +SPAN_DECLARE(uint32_t) crc_itu32_calc(const uint8_t *buf, int len, uint32_t crc); + +/*! \brief Append an ITU/CCITT CRC-32 value to a frame. + \param buf The buffer containing the frame. This must be at least 2 bytes longer than + the frame it contains, to allow room for the CRC value. + \param len The length of the frame. + \return The new length of the frame. +*/ +SPAN_DECLARE(int) crc_itu32_append(uint8_t *buf, int len); + +/*! \brief Check the ITU/CCITT CRC-32 value in a frame. + \param buf The buffer containing the frame. + \param len The length of the frame. + \return TRUE if the CRC is OK, else FALSE. +*/ +SPAN_DECLARE(int) crc_itu32_check(const uint8_t *buf, int len); + +/*! \brief Calculate the ITU/CCITT CRC-16 value in buffer. + \param buf The buffer containing the data. + \param len The length of the frame. + \param crc The initial CRC value. This is usually 0xFFFF, or 0 for a new block (it depends on + the application). It is previous returned CRC value for the continuation of a block. + \return The CRC value. +*/ +SPAN_DECLARE(uint16_t) crc_itu16_calc(const uint8_t *buf, int len, uint16_t crc); + +/*! \brief Append an ITU/CCITT CRC-16 value to a frame. + \param buf The buffer containing the frame. This must be at least 2 bytes longer than + the frame it contains, to allow room for the CRC value. + \param len The length of the frame. + \return The new length of the frame. +*/ +SPAN_DECLARE(int) crc_itu16_append(uint8_t *buf, int len); + +/*! \brief Check the ITU/CCITT CRC-16 value in a frame. + \param buf The buffer containing the frame. + \param len The length of the frame. + \return TRUE if the CRC is OK, else FALSE. +*/ +SPAN_DECLARE(int) crc_itu16_check(const uint8_t *buf, int len); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/dc_restore.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/dc_restore.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,93 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * dc_restore.h - General telephony routines to restore the zero D.C. + * level to audio which has a D.C. bias. + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: dc_restore.h,v 1.24 2008/09/19 14:02:05 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_DC_RESTORE_H_) +#define _SPANDSP_DC_RESTORE_H_ + +/*! \page dc_restore_page Removing DC bias from a signal + +\section dc_restore_page_sec_1 What does it do? + +Telecoms signals often contain considerable DC, but DC upsets a lot of signal +processing functions. Placing a zero DC restorer at the front of the processing +chain can often simplify the downstream processing. + +\section dc_restore_page_sec_2 How does it work? + +The DC restorer uses a leaky integrator to provide a long-ish term estimate of +the DC bias in the signal. A 32 bit estimate is used for the 16 bit audio, so +the noise introduced by the estimation can be keep in the lower bits, and the 16 +bit DC value, which is subtracted from the signal, is fairly clean. The +following code fragment shows the algorithm used. dc_bias is a 32 bit integer, +while the sample and the resulting clean_sample are 16 bit integers. + + dc_bias += ((((int32_t) sample << 15) - dc_bias) >> 14); + clean_sample = sample - (dc_bias >> 15); +*/ + +/*! + Zero DC restoration descriptor. This defines the working state for a single + instance of DC content filter. +*/ +typedef struct +{ + int32_t state; +} dc_restore_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +static __inline__ void dc_restore_init(dc_restore_state_t *dc) +{ + dc->state = 0; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int16_t dc_restore(dc_restore_state_t *dc, int16_t sample) +{ + dc->state += ((((int32_t) sample << 15) - dc->state) >> 14); + return (int16_t) (sample - (dc->state >> 15)); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int16_t dc_restore_estimate(dc_restore_state_t *dc) +{ + return (int16_t) (dc->state >> 15); +} +/*- End of function --------------------------------------------------------*/ + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/dds.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/dds.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,259 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * dds.h + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: dds.h,v 1.23 2009/01/31 08:48:11 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_DDS_H_) +#define _SPANDSP_DDS_H_ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! \brief Find the phase rate value to achieve a particular frequency. + \param frequency The desired frequency, in Hz. + \return The phase rate which while achieve the desired frequency. +*/ +SPAN_DECLARE(int32_t) dds_phase_rate(float frequency); + +/*! \brief Find the frequency, in Hz, equivalent to a phase rate. + \param phase_rate The phase rate. + \return The equivalent frequency, in Hz. +*/ +SPAN_DECLARE(float) dds_frequency(int32_t phase_rate); + +/*! \brief Find the scaling factor needed to achieve a specified level in dBm0. + \param level The desired signal level, in dBm0. + \return The scaling factor. +*/ +SPAN_DECLARE(int16_t) dds_scaling_dbm0(float level); + +/*! \brief Find the scaling factor needed to achieve a specified level in dBmov. + \param level The desired signal level, in dBmov. + \return The scaling factor. +*/ +SPAN_DECLARE(int16_t) dds_scaling_dbov(float level); + +/*! \brief Find the amplitude for a particular phase. + \param phase The desired phase 32 bit phase. + \return The signal amplitude. +*/ +SPAN_DECLARE(int16_t) dds_lookup(uint32_t phase); + +/*! \brief Find the amplitude for a particular phase offset from an accumulated phase. + \param phase_acc The accumulated phase. + \param phase_offset The phase offset. + \return The signal amplitude. +*/ +SPAN_DECLARE(int16_t) dds_offset(uint32_t phase_acc, int32_t phase_offset); + +/*! \brief Advance the phase, without returning any new signal sample. + \param phase_acc A pointer to a phase accumulator value. + \param phase_rate The phase increment to be applied. +*/ +SPAN_DECLARE(void) dds_advance(uint32_t *phase_acc, int32_t phase_rate); + +/*! \brief Generate an integer tone sample. + \param phase_acc A pointer to a phase accumulator value. + \param phase_rate The phase increment to be applied. + \return The signal amplitude, between -32767 and 32767. +*/ +SPAN_DECLARE(int16_t) dds(uint32_t *phase_acc, int32_t phase_rate); + +/*! \brief Lookup the integer value of a specified phase. + \param phase The phase accumulator value to be looked up. + \return The signal amplitude, between -32767 and 32767. +*/ +SPAN_DECLARE(int16_t) dds_lookup(uint32_t phase); + +/*! \brief Generate an integer tone sample, with modulation. + \param phase_acc A pointer to a phase accumulator value. + \param phase_rate The phase increment to be applied. + \param scale The scaling factor. + \param phase The phase offset. + \return The signal amplitude, between -32767 and 32767. +*/ +SPAN_DECLARE(int16_t) dds_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase); + +/*! \brief Lookup the complex integer value of a specified phase. + \param phase The phase accumulator value to be looked up. + \return The complex signal amplitude, between (-32767, -32767) and (32767, 32767). +*/ +SPAN_DECLARE(complexi_t) dds_lookup_complexi(uint32_t phase); + +/*! \brief Generate a complex integer tone sample. + \param phase_acc A pointer to a phase accumulator value. + \param phase_rate The phase increment to be applied. + \return The complex signal amplitude, between (-32767, -32767) and (32767, 32767). +*/ +SPAN_DECLARE(complexi_t) dds_complexi(uint32_t *phase_acc, int32_t phase_rate); + +/*! \brief Generate a complex integer tone sample, with modulation. + \param phase_acc A pointer to a phase accumulator value. + \param phase_rate The phase increment to be applied. + \param scale The scaling factor. + \param phase The phase offset. + \return The complex signal amplitude, between (-32767, -32767) and (32767, 32767). +*/ +SPAN_DECLARE(complexi_t) dds_complexi_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase); + +/*! \brief Generate a complex 16 bit integer tone sample. + \param phase_acc A pointer to a phase accumulator value. + \param phase_rate The phase increment to be applied. + \return The complex signal amplitude, between (-32767, -32767) and (32767, 32767). +*/ +SPAN_DECLARE(complexi16_t) dds_lookup_complexi16(uint32_t phase); + +/*! \brief Generate a complex 16 bit integer tone sample. + \param phase_acc A pointer to a phase accumulator value. + \param phase_rate The phase increment to be applied. + \return The complex signal amplitude, between (-32767, -32767) and (32767, 32767). +*/ +SPAN_DECLARE(complexi16_t) dds_complexi16(uint32_t *phase_acc, int32_t phase_rate); + +/*! \brief Generate a complex 16bit integer tone sample, with modulation. + \param phase_acc A pointer to a phase accumulator value. + \param phase_rate The phase increment to be applied. + \param scale The scaling factor. + \param phase The phase offset. + \return The complex signal amplitude, between (-32767, -32767) and (32767, 32767). +*/ +SPAN_DECLARE(complexi16_t) dds_complexi16_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase); + +/*! \brief Generate a complex 32 bit integer tone sample, with modulation. + \param phase_acc A pointer to a phase accumulator value. + \param phase_rate The phase increment to be applied. + \param scale The scaling factor. + \param phase The phase offset. + \return The complex signal amplitude, between (-32767, -32767) and (32767, 32767). +*/ +SPAN_DECLARE(complexi32_t) dds_complexi32_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase); + +/*! \brief Generate a complex 32 bit integer tone sample. + \param phase_acc A pointer to a phase accumulator value. + \param phase_rate The phase increment to be applied. + \return The complex signal amplitude, between (-32767, -32767) and (32767, 32767). +*/ +SPAN_DECLARE(complexi32_t) dds_lookup_complexi32(uint32_t phase); + +/*! \brief Generate a complex 32 bit integer tone sample. + \param phase_acc A pointer to a phase accumulator value. + \param phase_rate The phase increment to be applied. + \return The complex signal amplitude, between (-32767, -32767) and (32767, 32767). +*/ +SPAN_DECLARE(complexi32_t) dds_complexi32(uint32_t *phase_acc, int32_t phase_rate); + +/*! \brief Generate a complex 32 bit integer tone sample, with modulation. + \param phase_acc A pointer to a phase accumulator value. + \param phase_rate The phase increment to be applied. + \param scale The scaling factor. + \param phase The phase offset. + \return The complex signal amplitude, between (-32767, -32767) and (32767, 32767). +*/ +SPAN_DECLARE(complexi32_t) dds_complexi32_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase); + +/*! \brief Find the phase rate equivalent to a frequency, in Hz. + \param frequency The frequency, in Hz. + \return The equivalent phase rate. +*/ +SPAN_DECLARE(int32_t) dds_phase_ratef(float frequency); + +/*! \brief Find the frequency, in Hz, equivalent to a phase rate. + \param phase_rate The phase rate. + \return The equivalent frequency, in Hz. +*/ +SPAN_DECLARE(float) dds_frequencyf(int32_t phase_rate); + +/*! \brief Find the scaling factor equivalent to a dBm0 value. + \param level The signal level in dBm0. + \return The equivalent scaling factor. +*/ +SPAN_DECLARE(float) dds_scaling_dbm0f(float level); + +/*! \brief Find the scaling factor equivalent to a dBmov value. + \param level The signal level in dBmov. + \return The equivalent scaling factor. +*/ +SPAN_DECLARE(float) dds_scaling_dbovf(float level); + +/*! \brief Advance the phase, without returning any new signal sample. + \param phase_acc A pointer to a phase accumulator value. + \param phase_rate The phase increment to be applied. +*/ +SPAN_DECLARE(void) dds_advancef(uint32_t *phase_acc, int32_t phase_rate); + +/*! \brief Generate a floating point tone sample. + \param phase_acc A pointer to a phase accumulator value. + \param phase_rate The phase increment to be applied. + \return The signal amplitude, between -1.0 and 1.0. +*/ +SPAN_DECLARE(float) ddsf(uint32_t *phase_acc, int32_t phase_rate); + +/*! \brief Lookup the floating point value of a specified phase. + \param phase The phase accumulator value to be looked up. + \return The signal amplitude, between -1.0 and 1.0. +*/ +SPAN_DECLARE(float) dds_lookupf(uint32_t phase); + +/*! \brief Generate a floating point tone sample, with modulation. + \param phase_acc A pointer to a phase accumulator value. + \param phase_rate The phase increment to be applied. + \param scale The scaling factor. + \param phase The phase offset. + \return The signal amplitude, between -1.0 and 1.0. +*/ +SPAN_DECLARE(float) dds_modf(uint32_t *phase_acc, int32_t phase_rate, float scale, int32_t phase); + +/*! \brief Generate a complex floating point tone sample. + \param phase_acc A pointer to a phase accumulator value. + \param phase_rate The phase increment to be applied. + \return The complex signal amplitude, between (-1.0, -1.0) and (1.0, 1.0). +*/ +SPAN_DECLARE(complexf_t) dds_complexf(uint32_t *phase_acc, int32_t phase_rate); + +/*! \brief Lookup the complex value of a specified phase. + \param phase The phase accumulator value to be looked up. + \return The complex signal amplitude, between (-1.0, -1.0) and (1.0, 1.0). +*/ +SPAN_DECLARE(complexf_t) dds_lookup_complexf(uint32_t phase_acc); + +/*! \brief Generate a complex floating point tone sample, with modulation. + \param phase_acc A pointer to a phase accumulator value. + \param phase_rate The phase increment to be applied. + \param scale The scaling factor. + \param phase The phase offset. + \return The complex signal amplitude, between (-1.0, -1.0) and (1.0, 1.0). +*/ +SPAN_DECLARE(complexf_t) dds_complex_modf(uint32_t *phase_acc, int32_t phase_rate, float scale, int32_t phase); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/dtmf.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/dtmf.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,218 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * dtmf.h - DTMF tone generation and detection. + * + * Written by Steve Underwood + * + * Copyright (C) 2001, 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: dtmf.h,v 1.32 2009/02/10 13:06:47 steveu Exp $ + */ + +#if !defined(_SPANDSP_DTMF_H_) +#define _SPANDSP_DTMF_H_ + +/*! \page dtmf_rx_page DTMF receiver +\section dtmf_rx_page_sec_1 What does it do? +The DTMF receiver detects the standard DTMF digits. It is compliant with +ITU-T Q.23, ITU-T Q.24, and the local DTMF specifications of most administrations. +Its passes the test suites. It also scores *very* well on the standard +talk-off tests. + +The current design uses floating point extensively. It is not tolerant of DC. +It is expected that a DC restore stage will be placed before the DTMF detector. +Unless the dial tone filter is switched on, the detector has poor tolerance +of dial tone. Whether this matter depends on your application. If you are using +the detector in an IVR application you will need proper echo cancellation to +get good performance in the presence of speech prompts, so dial tone will not +exist. If you do need good dial tone tolerance, a dial tone filter can be +enabled in the detector. + +The DTMF receiver's design assumes the channel is free of any DC component. + +\section dtmf_rx_page_sec_2 How does it work? +Like most other DSP based DTMF detector's, this one uses the Goertzel algorithm +to look for the DTMF tones. What makes each detector design different is just how +that algorithm is used. + +Basic DTMF specs: + - Minimum tone on = 40ms + - Minimum tone off = 50ms + - Maximum digit rate = 10 per second + - Normal twist <= 8dB accepted + - Reverse twist <= 4dB accepted + - S/N >= 15dB will detect OK + - Attenuation <= 26dB will detect OK + - Frequency tolerance +- 1.5% will detect, +-3.5% will reject + +TODO: +*/ + +/*! \page dtmf_tx_page DTMF tone generation +\section dtmf_tx_page_sec_1 What does it do? + +The DTMF tone generation module provides for the generation of the +repertoire of 16 DTMF dual tones. + +\section dtmf_tx_page_sec_2 How does it work? +*/ + +#define MAX_DTMF_DIGITS 128 + +typedef void (*digits_rx_callback_t)(void *user_data, const char *digits, int len); + +/*! + DTMF generator state descriptor. This defines the state of a single + working instance of a DTMF generator. +*/ +typedef struct dtmf_tx_state_s dtmf_tx_state_t; + +/*! + DTMF digit detector descriptor. +*/ +typedef struct dtmf_rx_state_s dtmf_rx_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! \brief Generate a buffer of DTMF tones. + \param s The DTMF generator context. + \param amp The buffer for the generated signal. + \param max_samples The required number of generated samples. + \return The number of samples actually generated. This may be less than + max_samples if the input buffer empties. */ +SPAN_DECLARE(int) dtmf_tx(dtmf_tx_state_t *s, int16_t amp[], int max_samples); + +/*! \brief Put a string of digits in a DTMF generator's input buffer. + \param s The DTMF generator context. + \param digits The string of digits to be added. + \param len The length of the string of digits. If negative, the string is + assumed to be a NULL terminated string. + \return The number of digits actually added. This may be less than the + length of the digit string, if the buffer fills up. */ +SPAN_DECLARE(int) dtmf_tx_put(dtmf_tx_state_t *s, const char *digits, int len); + +/*! \brief Change the transmit level for a DTMF tone generator context. + \param s The DTMF generator context. + \param level The level of the low tone, in dBm0. + \param twist The twist, in dB. */ +SPAN_DECLARE(void) dtmf_tx_set_level(dtmf_tx_state_t *s, int level, int twist); + +/*! \brief Change the transmit on and off time for a DTMF tone generator context. + \param s The DTMF generator context. + \param on-time The on time, in ms. + \param off_time The off time, in ms. */ +SPAN_DECLARE(void) dtmf_tx_set_timing(dtmf_tx_state_t *s, int on_time, int off_time); + +/*! \brief Initialise a DTMF tone generator context. + \param s The DTMF generator context. + \return A pointer to the DTMF generator context. */ +SPAN_DECLARE(dtmf_tx_state_t *) dtmf_tx_init(dtmf_tx_state_t *s); + +/*! \brief Release a DTMF tone generator context. + \param s The DTMF tone generator context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) dtmf_tx_release(dtmf_tx_state_t *s); + +/*! \brief Free a DTMF tone generator context. + \param s The DTMF tone generator context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) dtmf_tx_free(dtmf_tx_state_t *s); + +/*! Set a optional realtime callback for a DTMF receiver context. This function + is called immediately a confirmed state change occurs in the received DTMF. It + is called with the ASCII value for a DTMF tone pair, or zero to indicate no tone + is being received. + \brief Set a realtime callback for a DTMF receiver context. + \param s The DTMF receiver context. + \param callback Callback routine used to report the start and end of digits. + \param user_data An opaque pointer which is associated with the context, + and supplied in callbacks. */ +SPAN_DECLARE(void) dtmf_rx_set_realtime_callback(dtmf_rx_state_t *s, + tone_report_func_t callback, + void *user_data); + +/*! \brief Adjust a DTMF receiver context. + \param s The DTMF receiver context. + \param filter_dialtone TRUE to enable filtering of dialtone, FALSE + to disable, < 0 to leave unchanged. + \param twist Acceptable twist, in dB. < 0 to leave unchanged. + \param reverse_twist Acceptable reverse twist, in dB. < 0 to leave unchanged. + \param threshold The minimum acceptable tone level for detection, in dBm0. + <= -99 to leave unchanged. */ +SPAN_DECLARE(void) dtmf_rx_parms(dtmf_rx_state_t *s, + int filter_dialtone, + int twist, + int reverse_twist, + int threshold); + +/*! Process a block of received DTMF audio samples. + \brief Process a block of received DTMF audio samples. + \param s The DTMF receiver context. + \param amp The audio sample buffer. + \param samples The number of samples in the buffer. + \return The number of samples unprocessed. */ +SPAN_DECLARE(int) dtmf_rx(dtmf_rx_state_t *s, const int16_t amp[], int samples); + +/*! Get the status of DTMF detection during processing of the last audio + chunk. + \brief Get the status of DTMF detection during processing of the last + audio chunk. + \param s The DTMF receiver context. + \return The current digit status. Either 'x' for a "maybe" condition, or the + digit being detected. */ +SPAN_DECLARE(int) dtmf_rx_status(dtmf_rx_state_t *s); + +/*! \brief Get a string of digits from a DTMF receiver's output buffer. + \param s The DTMF receiver context. + \param digits The buffer for the received digits. + \param max The maximum number of digits to be returned, + \return The number of digits actually returned. */ +SPAN_DECLARE(size_t) dtmf_rx_get(dtmf_rx_state_t *s, char *digits, int max); + +/*! \brief Initialise a DTMF receiver context. + \param s The DTMF receiver context. + \param callback An optional callback routine, used to report received digits. If + no callback routine is set, digits may be collected, using the dtmf_rx_get() + function. + \param user_data An opaque pointer which is associated with the context, + and supplied in callbacks. + \return A pointer to the DTMF receiver context. */ +SPAN_DECLARE(dtmf_rx_state_t *) dtmf_rx_init(dtmf_rx_state_t *s, + digits_rx_callback_t callback, + void *user_data); + +/*! \brief Release a DTMF receiver context. + \param s The DTMF receiver context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) dtmf_rx_release(dtmf_rx_state_t *s); + +/*! \brief Free a DTMF receiver context. + \param s The DTMF receiver context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) dtmf_rx_free(dtmf_rx_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/echo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/echo.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,194 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * echo.h - An echo cancellor, suitable for electrical and acoustic + * cancellation. This code does not currently comply with + * any relevant standards (e.g. G.164/5/7/8). + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: echo.h,v 1.20 2009/09/22 13:11:04 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_ECHO_H_) +#define _SPANDSP_ECHO_H_ + +/*! \page echo_can_page Line echo cancellation for voice + +\section echo_can_page_sec_1 What does it do? +This module aims to provide G.168-2002 compliant echo cancellation, to remove +electrical echoes (e.g. from 2-4 wire hybrids) from voice calls. + +\section echo_can_page_sec_2 How does it work? +The heart of the echo cancellor is FIR filter. This is adapted to match the echo +impulse response of the telephone line. It must be long enough to adequately cover +the duration of that impulse response. The signal transmitted to the telephone line +is passed through the FIR filter. Once the FIR is properly adapted, the resulting +output is an estimate of the echo signal received from the line. This is subtracted +from the received signal. The result is an estimate of the signal which originated +at the far end of the line, free from echos of our own transmitted signal. + +The least mean squares (LMS) algorithm is attributed to Widrow and Hoff, and was +introduced in 1960. It is the commonest form of filter adaption used in things +like modem line equalisers and line echo cancellers. There it works very well. +However, it only works well for signals of constant amplitude. It works very poorly +for things like speech echo cancellation, where the signal level varies widely. +This is quite easy to fix. If the signal level is normalised - similar to applying +AGC - LMS can work as well for a signal of varying amplitude as it does for a modem +signal. This normalised least mean squares (NLMS) algorithm is the commonest one used +for speech echo cancellation. Many other algorithms exist - e.g. RLS (essentially +the same as Kalman filtering), FAP, etc. Some perform significantly better than NLMS. +However, factors such as computational complexity and patents favour the use of NLMS. + +A simple refinement to NLMS can improve its performance with speech. NLMS tends +to adapt best to the strongest parts of a signal. If the signal is white noise, +the NLMS algorithm works very well. However, speech has more low frequency than +high frequency content. Pre-whitening (i.e. filtering the signal to flatten +its spectrum) the echo signal improves the adapt rate for speech, and ensures the +final residual signal is not heavily biased towards high frequencies. A very low +complexity filter is adequate for this, so pre-whitening adds little to the +compute requirements of the echo canceller. + +An FIR filter adapted using pre-whitened NLMS performs well, provided certain +conditions are met: + + - The transmitted signal has poor self-correlation. + - There is no signal being generated within the environment being cancelled. + +The difficulty is that neither of these can be guaranteed. + +If the adaption is performed while transmitting noise (or something fairly noise +like, such as voice) the adaption works very well. If the adaption is performed +while transmitting something highly correlative (typically narrow band energy +such as signalling tones or DTMF), the adaption can go seriously wrong. The reason +is there is only one solution for the adaption on a near random signal - the impulse +response of the line. For a repetitive signal, there are any number of solutions +which converge the adaption, and nothing guides the adaption to choose the generalised +one. Allowing an untrained canceller to converge on this kind of narrowband +energy probably a good thing, since at least it cancels the tones. Allowing a well +converged canceller to continue converging on such energy is just a way to ruin +its generalised adaption. A narrowband detector is needed, so adapation can be +suspended at appropriate times. + +The adaption process is based on trying to eliminate the received signal. When +there is any signal from within the environment being cancelled it may upset the +adaption process. Similarly, if the signal we are transmitting is small, noise +may dominate and disturb the adaption process. If we can ensure that the +adaption is only performed when we are transmitting a significant signal level, +and the environment is not, things will be OK. Clearly, it is easy to tell when +we are sending a significant signal. Telling, if the environment is generating a +significant signal, and doing it with sufficient speed that the adaption will +not have diverged too much more we stop it, is a little harder. + +The key problem in detecting when the environment is sourcing significant energy +is that we must do this very quickly. Given a reasonably long sample of the +received signal, there are a number of strategies which may be used to assess +whether that signal contains a strong far end component. However, by the time +that assessment is complete the far end signal will have already caused major +mis-convergence in the adaption process. An assessment algorithm is needed which +produces a fairly accurate result from a very short burst of far end energy. + +\section echo_can_page_sec_3 How do I use it? +The echo cancellor processes both the transmit and receive streams sample by +sample. The processing function is not declared inline. Unfortunately, +cancellation requires many operations per sample, so the call overhead is only a +minor burden. +*/ + +#include "fir.h" + +/* Mask bits for the adaption mode */ +enum +{ + ECHO_CAN_USE_ADAPTION = 0x01, + ECHO_CAN_USE_NLP = 0x02, + ECHO_CAN_USE_CNG = 0x04, + ECHO_CAN_USE_CLIP = 0x08, + ECHO_CAN_USE_SUPPRESSOR = 0x10, + ECHO_CAN_USE_TX_HPF = 0x20, + ECHO_CAN_USE_RX_HPF = 0x40, + ECHO_CAN_DISABLE = 0x80 +}; + +/*! + G.168 echo canceller descriptor. This defines the working state for a line + echo canceller. +*/ +typedef struct echo_can_state_s echo_can_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Create a voice echo canceller context. + \param len The length of the canceller, in samples. + \return The new canceller context, or NULL if the canceller could not be created. +*/ +SPAN_DECLARE(echo_can_state_t *) echo_can_init(int len, int adaption_mode); + +/*! Release a voice echo canceller context. + \param ec The echo canceller context. + \return 0 for OK, else -1. +*/ +SPAN_DECLARE(int) echo_can_release(echo_can_state_t *ec); + +/*! Free a voice echo canceller context. + \param ec The echo canceller context. + \return 0 for OK, else -1. +*/ +SPAN_DECLARE(int) echo_can_free(echo_can_state_t *ec); + +/*! Flush (reinitialise) a voice echo canceller context. + \param ec The echo canceller context. +*/ +SPAN_DECLARE(void) echo_can_flush(echo_can_state_t *ec); + +/*! Set the adaption mode of a voice echo canceller context. + \param ec The echo canceller context. + \param adaption_mode The mode. +*/ +SPAN_DECLARE(void) echo_can_adaption_mode(echo_can_state_t *ec, int adaption_mode); + +/*! Process a sample through a voice echo canceller. + \param ec The echo canceller context. + \param tx The transmitted audio sample. + \param rx The received audio sample. + \return The clean (echo cancelled) received sample. +*/ +SPAN_DECLARE(int16_t) echo_can_update(echo_can_state_t *ec, int16_t tx, int16_t rx); + +/*! Process to high pass filter the tx signal. + \param ec The echo canceller context. + \param tx The transmitted auio sample. + \return The HP filtered transmit sample, send this to your D/A. +*/ +SPAN_DECLARE(int16_t) echo_can_hpf_tx(echo_can_state_t *ec, int16_t tx); + +SPAN_DECLARE(void) echo_can_snapshot(echo_can_state_t *ec); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/expose.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/expose.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,90 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * expose.h - Expose the internal structures of spandsp, for users who + * really need that. + * + * Written by Steve Underwood + * + * Copyright (C) 2008 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: expose.h,v 1.14.4.1 2009/12/19 09:47:56 steveu Exp $ + */ + +/*! \file */ + +/* TRY TO ONLY INCLUDE THIS IF YOU REALLY REALLY HAVE TO */ + +#if !defined(_SPANDSP_EXPOSE_H_) +#define _SPANDSP_EXPOSE_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/fast_convert.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/fast_convert.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,438 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * fast_convert.h - Quick ways to convert floating point numbers to integers + * + * Written by Steve Underwood + * + * Copyright (C) 2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: fast_convert.h,v 1.9 2009/10/03 04:37:25 steveu Exp $ + */ + +#if !defined(_SPANDSP_FAST_CONVERT_H_) +#define _SPANDSP_FAST_CONVERT_H_ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/* The following code, to handle issues with lrint() and lrintf() on various + * platforms, is adapted from similar code in libsndfile, which is: + * + * Copyright (C) 2001-2004 Erik de Castro Lopo + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 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 Lesser General Public License for more details. + */ + +/* + * On Intel Pentium processors (especially PIII and probably P4), converting + * from float to int is very slow. To meet the C specs, the code produced by + * most C compilers targeting Pentium needs to change the FPU rounding mode + * before the float to int conversion is performed. + * + * Changing the FPU rounding mode causes the FPU pipeline to be flushed. It + * is this flushing of the pipeline which is so slow. + * + * Fortunately the ISO C99 specification defines the functions lrint, lrintf, + * llrint and llrintf which fix this problem as a side effect. + * + * On Unix-like systems, the configure process should have detected the + * presence of these functions. If they weren't found we have to replace them + * here with a standard C cast. + */ + +/* + * The C99 prototypes for these functions are as follows: + * + * int rintf(float x); + * int rint(double x); + * long int lrintf(float x); + * long int lrint(double x); + * long long int llrintf(float x); + * long long int llrint(double x); + * + * The presence of the required functions are detected during the configure + * process and the values HAVE_LRINT and HAVE_LRINTF are set accordingly in + * the config file. + */ + +#if defined(__CYGWIN__) +#if !defined(__cplusplus) + /* + * CYGWIN has lrint and lrintf functions, but they are slow and buggy: + * http://sourceware.org/ml/cygwin/2005-06/msg00153.html + * http://sourceware.org/ml/cygwin/2005-09/msg00047.html + * The latest version of cygwin seems to have made no effort to fix this. + * These replacement functions (pulled from the Public Domain MinGW + * math.h header) replace the native versions. + */ + static __inline__ long int lrint(double x) + { + long int retval; + + __asm__ __volatile__ + ( + "fistpl %0" + : "=m" (retval) + : "t" (x) + : "st" + ); + + return retval; + } + + static __inline__ long int lrintf(float x) + { + long int retval; + + __asm__ __volatile__ + ( + "fistpl %0" + : "=m" (retval) + : "t" (x) + : "st" + ); + return retval; + } +#endif + + /* The fastest way to convert is the equivalent of lrint() */ + static __inline__ long int lfastrint(double x) + { + long int retval; + + __asm__ __volatile__ + ( + "fistpl %0" + : "=m" (retval) + : "t" (x) + : "st" + ); + + return retval; + } + + static __inline__ long int lfastrintf(float x) + { + long int retval; + + __asm__ __volatile__ + ( + "fistpl %0" + : "=m" (retval) + : "t" (x) + : "st" + ); + return retval; + } +#elif defined(__GNUC__) || (__SUNPRO_C >= 0x0590) + +#if defined(__i386__) + /* These routines are guaranteed fast on an i386 machine. Using the built in + lrint() and lrintf() should be similar, but they may not always be enabled. + Sometimes, especially with "-O0", you might get slow calls to routines. */ + static __inline__ long int lfastrint(double x) + { + long int retval; + + __asm__ __volatile__ + ( + "fistpl %0" + : "=m" (retval) + : "t" (x) + : "st" + ); + + return retval; + } + + static __inline__ long int lfastrintf(float x) + { + long int retval; + + __asm__ __volatile__ + ( + "fistpl %0" + : "=m" (retval) + : "t" (x) + : "st" + ); + return retval; + } +#elif defined(__x86_64__) + /* On an x86_64 machine, the fastest thing seems to be a pure assignment from a + double or float to an int. It looks like the design on the x86_64 took account + of the default behaviour specified for C. */ + static __inline__ long int lfastrint(double x) + { + return (long int) (x); + } + + static __inline__ long int lfastrintf(float x) + { + return (long int) (x); + } +#elif defined(__ppc__) || defined(__powerpc__) + static __inline__ long int lfastrint(register double x) + { + int res[2]; + + __asm__ __volatile__ + ( + "fctiw %1, %1\n\t" + "stfd %1, %0" + : "=m" (res) /* Output */ + : "f" (x) /* Input */ + : "memory" + ); + + return res[1]; + } + + static __inline__ long int lfastrintf(register float x) + { + int res[2]; + + __asm__ __volatile__ + ( + "fctiw %1, %1\n\t" + "stfd %1, %0" + : "=m" (res) /* Output */ + : "f" (x) /* Input */ + : "memory" + ); + + return res[1]; + } +#else + /* Fallback routines, for unrecognised platforms */ + static __inline__ long int lfastrint(double x) + { + return (long int) x; + } + + static __inline__ long int lfastrintf(float x) + { + return (long int) x; + } +#endif + +#elif defined(_M_IX86) + /* Visual Studio i386 */ + /* + * Win32 doesn't seem to have the lrint() and lrintf() functions. + * Therefore implement inline versions of these functions here. + */ + + __inline long int lrint(double x) + { + long int i; + + _asm + { + fld x + fistp i + }; + return i; + } + + __inline long int lrintf(float x) + { + long int i; + + _asm + { + fld x + fistp i + }; + return i; + } + + __inline float rintf(float flt) + { + _asm + { fld flt + frndint + } + } + + __inline double rint(double dbl) + { + _asm + { + fld dbl + frndint + } + } + + __inline long int lfastrint(double x) + { + long int i; + + _asm + { + fld x + fistp i + }; + return i; + } + + __inline long int lfastrintf(float x) + { + long int i; + + _asm + { + fld x + fistp i + }; + return i; + } +#elif defined(_M_X64) + /* Visual Studio x86_64 */ + /* x86_64 machines will do best with a simple assignment. */ +#include + + __inline long int lrint(double x) + { + return (long int)_mm_cvtsd_si64x( _mm_loadu_pd ((const double*)&x) ); + } + + __inline long int lrintf(float x) + { + return _mm_cvt_ss2si( _mm_load_ss((const float*)&x) ); + } + + __inline long int lfastrint(double x) + { + return (long int) (x); + } + + __inline long int lfastrintf(float x) + { + return (long int) (x); + } +#elif defined(__MWERKS__) && defined(macintosh) + /* This MacOS 9 solution was provided by Stephane Letz */ + + long int __inline__ lfastrint(register double x) + { + long int res[2]; + + asm + { + fctiw x, x + stfd x, res + } + return res[1]; + } + + long int __inline__ lfastrintf(register float x) + { + long int res[2]; + + asm + { + fctiw x, x + stfd x, res + } + return res[1]; + } +#elif defined(__MACH__) && defined(__APPLE__) && (defined(__ppc__) || defined(__powerpc__)) + /* For Apple Mac OS/X - do recent versions still need this? */ + + static __inline__ long int lfastrint(register double x) + { + int res[2]; + + __asm__ __volatile__ + ( + "fctiw %1, %1\n\t" + "stfd %1, %0" + : "=m" (res) /* Output */ + : "f" (x) /* Input */ + : "memory" + ); + + return res[1]; + } + + static __inline__ long int lfastrintf(register float x) + { + int res[2]; + + __asm__ __volatile__ + ( + "fctiw %1, %1\n\t" + "stfd %1, %0" + : "=m" (res) /* Output */ + : "f" (x) /* Input */ + : "memory" + ); + + return res[1]; + } +#else + /* There is nothing else to do, but use a simple casting operation, instead of a real + rint() type function. Since we are only trying to use rint() to speed up conversions, + the accuracy issues related to changing the rounding scheme are of little concern + to us. */ + + #if !defined(__sgi) && !defined(__sunos) && !defined(__solaris) && !defined(__sun) + #warning "No usable lrint() and lrintf() functions available." + #warning "Replacing these functions with a simple C cast." + #endif + + static __inline__ long int lrint(double x) + { + return (long int) (x); + } + + static __inline__ long int lrintf(float x) + { + return (long int) (x); + } + + static __inline__ long int lfastrint(double x) + { + return (long int) (x); + } + + static __inline__ long int lfastrintf(float x) + { + return (long int) (x); + } +#endif + +#if defined(__cplusplus) +} +#endif + +#endif + +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/fax.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/fax.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,133 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * fax.h - definitions for analogue line ITU T.30 fax processing + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: fax.h,v 1.39 2009/03/13 12:59:26 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_FAX_H_) +#define _SPANDSP_FAX_H_ + +/*! \page fax_page FAX over analogue modem handling + +\section fax_page_sec_1 What does it do? + +\section fax_page_sec_2 How does it work? +*/ + +typedef struct fax_state_s fax_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Apply T.30 receive processing to a block of audio samples. + \brief Apply T.30 receive processing to a block of audio samples. + \param s The FAX context. + \param amp The audio sample buffer. + \param len The number of samples in the buffer. + \return The number of samples unprocessed. This should only be non-zero if + the software has reached the end of the FAX call. +*/ +SPAN_DECLARE(int) fax_rx(fax_state_t *s, int16_t *amp, int len); + +/*! Apply fake T.30 receive processing when a block of audio samples is missing (e.g due + to packet loss). + \brief Apply fake T.30 receive processing. + \param s The FAX context. + \param len The number of samples to fake. + \return The number of samples unprocessed. This should only be non-zero if + the software has reached the end of the FAX call. +*/ +SPAN_DECLARE(int) fax_rx_fillin(fax_state_t *s, int len); + +/*! Apply T.30 transmit processing to generate a block of audio samples. + \brief Apply T.30 transmit processing to generate a block of audio samples. + \param s The FAX context. + \param amp The audio sample buffer. + \param max_len The number of samples to be generated. + \return The number of samples actually generated. This will be zero when + there is nothing to send. +*/ +SPAN_DECLARE(int) fax_tx(fax_state_t *s, int16_t *amp, int max_len); + +/*! Select whether silent audio will be sent when FAX transmit is idle. + \brief Select whether silent audio will be sent when FAX transmit is idle. + \param s The FAX context. + \param transmit_on_idle TRUE if silent audio should be output when the FAX transmitter is + idle. FALSE to transmit zero length audio when the FAX transmitter is idle. The default + behaviour is FALSE. +*/ +SPAN_DECLARE(void) fax_set_transmit_on_idle(fax_state_t *s, int transmit_on_idle); + +/*! Select whether talker echo protection tone will be sent for the image modems. + \brief Select whether TEP will be sent for the image modems. + \param s The FAX context. + \param use_tep TRUE if TEP should be sent. +*/ +SPAN_DECLARE(void) fax_set_tep_mode(fax_state_t *s, int use_tep); + +/*! Get a pointer to the T.30 engine associated with a FAX context. + \brief Get a pointer to the T.30 engine associated with a FAX context. + \param s The FAX context. + \return A pointer to the T.30 context, or NULL. +*/ +SPAN_DECLARE(t30_state_t *) fax_get_t30_state(fax_state_t *s); + +/*! Get a pointer to the logging context associated with a FAX context. + \brief Get a pointer to the logging context associated with a FAX context. + \param s The FAX context. + \return A pointer to the logging context, or NULL. +*/ +SPAN_DECLARE(logging_state_t *) fax_get_logging_state(fax_state_t *s); + +/*! Initialise a FAX context. + \brief Initialise a FAX context. + \param s The FAX context. + \param calling_party TRUE if the context is for a calling party. FALSE if the + context is for an answering party. + \return A pointer to the FAX context, or NULL if there was a problem. +*/ +SPAN_DECLARE(fax_state_t *) fax_init(fax_state_t *s, int calling_party); + +/*! Release a FAX context. + \brief Release a FAX context. + \param s The FAX context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) fax_release(fax_state_t *s); + +/*! Free a FAX context. + \brief Free a FAX context. + \param s The FAX context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) fax_free(fax_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/fax_modems.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/fax_modems.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,91 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * fax_modems.h - definitions for the analogue modem set for fax processing + * + * Written by Steve Underwood + * + * Copyright (C) 2008 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: fax_modems.h,v 1.11 2009/04/26 12:55:23 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_FAX_MODEMS_H_) +#define _SPANDSP_FAX_MODEMS_H_ + +enum +{ + FAX_MODEM_NONE = -1, + FAX_MODEM_FLUSH = 0, + FAX_MODEM_SILENCE_TX, + FAX_MODEM_SILENCE_RX, + FAX_MODEM_CED_TONE, + FAX_MODEM_CNG_TONE, + FAX_MODEM_NOCNG_TONE, + FAX_MODEM_V21_TX, + FAX_MODEM_V17_TX, + FAX_MODEM_V27TER_TX, + FAX_MODEM_V29_TX, + FAX_MODEM_V21_RX, + FAX_MODEM_V17_RX, + FAX_MODEM_V27TER_RX, + FAX_MODEM_V29_RX +}; + +/*! + The set of modems needed for FAX, plus the auxilliary stuff, like tone generation. +*/ +typedef struct fax_modems_state_s fax_modems_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/* N.B. the following are currently a work in progress */ +SPAN_DECLARE(int) fax_modems_v17_v21_rx(void *user_data, const int16_t amp[], int len); +SPAN_DECLARE(int) fax_modems_v27ter_v21_rx(void *user_data, const int16_t amp[], int len); +SPAN_DECLARE(int) fax_modems_v29_v21_rx(void *user_data, const int16_t amp[], int len); +SPAN_DECLARE(int) fax_modems_v17_v21_rx_fillin(void *user_data, int len); +SPAN_DECLARE(int) fax_modems_v27ter_v21_rx_fillin(void *user_data, int len); +SPAN_DECLARE(int) fax_modems_v29_v21_rx_fillin(void *user_data, int len); +SPAN_DECLARE(void) fax_modems_start_rx_modem(fax_modems_state_t *s, int which); + +SPAN_DECLARE(void) fax_modems_set_tep_mode(fax_modems_state_t *s, int use_tep); + +SPAN_DECLARE(fax_modems_state_t *) fax_modems_init(fax_modems_state_t *s, + int use_tep, + hdlc_frame_handler_t hdlc_accept, + hdlc_underflow_handler_t hdlc_tx_underflow, + put_bit_func_t non_ecm_put_bit, + get_bit_func_t non_ecm_get_bit, + tone_report_func_t tone_callback, + void *user_data); + +SPAN_DECLARE(int) fax_modems_release(fax_modems_state_t *s); + +SPAN_DECLARE(int) fax_modems_free(fax_modems_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/fir.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/fir.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,304 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * fir.h - General telephony FIR routines + * + * Written by Steve Underwood + * + * Copyright (C) 2002 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: fir.h,v 1.13 2008/04/17 14:27:00 steveu Exp $ + */ + +/*! \page fir_page FIR filtering +\section fir_page_sec_1 What does it do? +???. + +\section fir_page_sec_2 How does it work? +???. +*/ + +#if !defined(_SPANDSP_FIR_H_) +#define _SPANDSP_FIR_H_ + +#if defined(USE_MMX) || defined(USE_SSE2) +#include "mmx.h" +#endif + +/*! + 16 bit integer FIR descriptor. This defines the working state for a single + instance of an FIR filter using 16 bit integer coefficients. +*/ +typedef struct +{ + int taps; + int curr_pos; + const int16_t *coeffs; + int16_t *history; +} fir16_state_t; + +/*! + 32 bit integer FIR descriptor. This defines the working state for a single + instance of an FIR filter using 32 bit integer coefficients, and filtering + 16 bit integer data. +*/ +typedef struct +{ + int taps; + int curr_pos; + const int32_t *coeffs; + int16_t *history; +} fir32_state_t; + +/*! + Floating point FIR descriptor. This defines the working state for a single + instance of an FIR filter using floating point coefficients and data. +*/ +typedef struct +{ + int taps; + int curr_pos; + const float *coeffs; + float *history; +} fir_float_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +static __inline__ const int16_t *fir16_create(fir16_state_t *fir, + const int16_t *coeffs, + int taps) +{ + fir->taps = taps; + fir->curr_pos = taps - 1; + fir->coeffs = coeffs; +#if defined(USE_MMX) || defined(USE_SSE2) + if ((fir->history = malloc(2*taps*sizeof(int16_t)))) + memset(fir->history, 0, 2*taps*sizeof(int16_t)); +#else + if ((fir->history = (int16_t *) malloc(taps*sizeof(int16_t)))) + memset(fir->history, 0, taps*sizeof(int16_t)); +#endif + return fir->history; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void fir16_flush(fir16_state_t *fir) +{ +#if defined(USE_MMX) || defined(USE_SSE2) + memset(fir->history, 0, 2*fir->taps*sizeof(int16_t)); +#else + memset(fir->history, 0, fir->taps*sizeof(int16_t)); +#endif +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void fir16_free(fir16_state_t *fir) +{ + free(fir->history); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int16_t fir16(fir16_state_t *fir, int16_t sample) +{ + int i; + int32_t y; +#if defined(USE_MMX) + mmx_t *mmx_coeffs; + mmx_t *mmx_hist; + + fir->history[fir->curr_pos] = sample; + fir->history[fir->curr_pos + fir->taps] = sample; + + mmx_coeffs = (mmx_t *) fir->coeffs; + mmx_hist = (mmx_t *) &fir->history[fir->curr_pos]; + i = fir->taps; + pxor_r2r(mm4, mm4); + /* 8 samples per iteration, so the filter must be a multiple of 8 long. */ + while (i > 0) + { + movq_m2r(mmx_coeffs[0], mm0); + movq_m2r(mmx_coeffs[1], mm2); + movq_m2r(mmx_hist[0], mm1); + movq_m2r(mmx_hist[1], mm3); + mmx_coeffs += 2; + mmx_hist += 2; + pmaddwd_r2r(mm1, mm0); + pmaddwd_r2r(mm3, mm2); + paddd_r2r(mm0, mm4); + paddd_r2r(mm2, mm4); + i -= 8; + } + movq_r2r(mm4, mm0); + psrlq_i2r(32, mm0); + paddd_r2r(mm0, mm4); + movd_r2m(mm4, y); + emms(); +#elif defined(USE_SSE2) + xmm_t *xmm_coeffs; + xmm_t *xmm_hist; + + fir->history[fir->curr_pos] = sample; + fir->history[fir->curr_pos + fir->taps] = sample; + + xmm_coeffs = (xmm_t *) fir->coeffs; + xmm_hist = (xmm_t *) &fir->history[fir->curr_pos]; + i = fir->taps; + pxor_r2r(xmm4, xmm4); + /* 16 samples per iteration, so the filter must be a multiple of 16 long. */ + while (i > 0) + { + movdqu_m2r(xmm_coeffs[0], xmm0); + movdqu_m2r(xmm_coeffs[1], xmm2); + movdqu_m2r(xmm_hist[0], xmm1); + movdqu_m2r(xmm_hist[1], xmm3); + xmm_coeffs += 2; + xmm_hist += 2; + pmaddwd_r2r(xmm1, xmm0); + pmaddwd_r2r(xmm3, xmm2); + paddd_r2r(xmm0, xmm4); + paddd_r2r(xmm2, xmm4); + i -= 16; + } + movdqa_r2r(xmm4, xmm0); + psrldq_i2r(8, xmm0); + paddd_r2r(xmm0, xmm4); + movdqa_r2r(xmm4, xmm0); + psrldq_i2r(4, xmm0); + paddd_r2r(xmm0, xmm4); + movd_r2m(xmm4, y); +#else + int offset1; + int offset2; + + fir->history[fir->curr_pos] = sample; + + offset2 = fir->curr_pos; + offset1 = fir->taps - offset2; + y = 0; + for (i = fir->taps - 1; i >= offset1; i--) + y += fir->coeffs[i]*fir->history[i - offset1]; + for ( ; i >= 0; i--) + y += fir->coeffs[i]*fir->history[i + offset2]; +#endif + if (fir->curr_pos <= 0) + fir->curr_pos = fir->taps; + fir->curr_pos--; + return (int16_t) (y >> 15); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ const int16_t *fir32_create(fir32_state_t *fir, + const int32_t *coeffs, + int taps) +{ + fir->taps = taps; + fir->curr_pos = taps - 1; + fir->coeffs = coeffs; + fir->history = (int16_t *) malloc(taps*sizeof(int16_t)); + if (fir->history) + memset(fir->history, '\0', taps*sizeof(int16_t)); + return fir->history; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void fir32_flush(fir32_state_t *fir) +{ + memset(fir->history, 0, fir->taps*sizeof(int16_t)); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void fir32_free(fir32_state_t *fir) +{ + free(fir->history); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int16_t fir32(fir32_state_t *fir, int16_t sample) +{ + int i; + int32_t y; + int offset1; + int offset2; + + fir->history[fir->curr_pos] = sample; + offset2 = fir->curr_pos; + offset1 = fir->taps - offset2; + y = 0; + for (i = fir->taps - 1; i >= offset1; i--) + y += fir->coeffs[i]*fir->history[i - offset1]; + for ( ; i >= 0; i--) + y += fir->coeffs[i]*fir->history[i + offset2]; + if (fir->curr_pos <= 0) + fir->curr_pos = fir->taps; + fir->curr_pos--; + return (int16_t) (y >> 15); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ const float *fir_float_create(fir_float_state_t *fir, + const float *coeffs, + int taps) +{ + fir->taps = taps; + fir->curr_pos = taps - 1; + fir->coeffs = coeffs; + fir->history = (float *) malloc(taps*sizeof(float)); + if (fir->history) + memset(fir->history, '\0', taps*sizeof(float)); + return fir->history; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void fir_float_free(fir_float_state_t *fir) +{ + free(fir->history); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int16_t fir_float(fir_float_state_t *fir, int16_t sample) +{ + int i; + float y; + int offset1; + int offset2; + + fir->history[fir->curr_pos] = sample; + + offset2 = fir->curr_pos; + offset1 = fir->taps - offset2; + y = 0; + for (i = fir->taps - 1; i >= offset1; i--) + y += fir->coeffs[i]*fir->history[i - offset1]; + for ( ; i >= 0; i--) + y += fir->coeffs[i]*fir->history[i + offset2]; + if (fir->curr_pos <= 0) + fir->curr_pos = fir->taps; + fir->curr_pos--; + return (int16_t) y; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/fsk.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/fsk.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,255 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * fsk.h - FSK modem transmit and receive parts + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: fsk.h,v 1.41 2009/11/02 13:25:20 steveu Exp $ + */ + +/*! \file */ + +/*! \page fsk_page FSK modems +\section fsk_page_sec_1 What does it do? +Most of the oldest telephony modems use incoherent FSK modulation. This module can +be used to implement both the transmit and receive sides of a number of these +modems. There are integrated definitions for: + + - V.21 + - V.23 + - Bell 103 + - Bell 202 + - Weitbrecht (Used for TDD - Telecoms Device for the Deaf) + +The audio output or input is a stream of 16 bit samples, at 8000 samples/second. +The transmit and receive sides can be used independantly. + +\section fsk_page_sec_2 The transmitter + +The FSK transmitter uses a DDS generator to synthesise the waveform. This +naturally produces phase coherent transitions, as the phase update rate is +switched, producing a clean spectrum. The symbols are not generally an integer +number of samples long. However, the symbol time for the fastest data rate +generally used (1200bps) is more than 7 samples long. The jitter resulting from +switching at the nearest sample is, therefore, acceptable. No interpolation is +used. + +\section fsk_page_sec_3 The receiver + +The FSK receiver uses a quadrature correlation technique to demodulate the +signal. Two DDS quadrature oscillators are used. The incoming signal is +correlated with the oscillator signals over a period of one symbol. The +oscillator giving the highest net correlation from its I and Q outputs is the +one that matches the frequency being transmitted during the correlation +interval. Because the transmission is totally asynchronous, the demodulation +process must run sample by sample to find the symbol transitions. The +correlation is performed on a sliding window basis, so the computational load of +demodulating sample by sample is not great. + +Two modes of symbol synchronisation are provided: + + - In synchronous mode, symbol transitions are smoothed, to track their true + position in the prescence of high timing jitter. This provides the most + reliable symbol recovery in poor signal to noise conditions. However, it + takes a little time to settle, so it not really suitable for data streams + which must start up instantaneously (e.g. the TDD systems used by hearing + impaired people). + + - In asynchronous mode each transition is taken at face value, with no temporal + smoothing. There is no settling time for this mode, but when the signal to + noise ratio is very poor it does not perform as well as the synchronous mode. +*/ + +#if !defined(_SPANDSP_FSK_H_) +#define _SPANDSP_FSK_H_ + +/*! + FSK modem specification. This defines the frequencies, signal levels and + baud rate (== bit rate for simple FSK) for a single channel of an FSK modem. +*/ +typedef struct +{ + /*! Short text name for the modem. */ + const char *name; + /*! The frequency of the zero bit state, in Hz */ + int freq_zero; + /*! The frequency of the one bit state, in Hz */ + int freq_one; + /*! The transmit power level, in dBm0 */ + int tx_level; + /*! The minimum acceptable receive power level, in dBm0 */ + int min_level; + /*! The bit rate of the modem, in units of 1/100th bps */ + int baud_rate; +} fsk_spec_t; + +/* Predefined FSK modem channels */ +enum +{ + FSK_V21CH1 = 0, + FSK_V21CH2, + FSK_V23CH1, + FSK_V23CH2, + FSK_BELL103CH1, + FSK_BELL103CH2, + FSK_BELL202, + FSK_WEITBRECHT, /* 45.45 baud version, used for TDD (Telecom Device for the Deaf) */ + FSK_WEITBRECHT50 /* 50 baud version, used for TDD (Telecom Device for the Deaf) */ +}; + +enum +{ + FSK_FRAME_MODE_ASYNC = 0, + FSK_FRAME_MODE_SYNC = 1, + FSK_FRAME_MODE_5N1_FRAMES = 7, /* 5 bits of data + start bit + stop bit */ + FSK_FRAME_MODE_7N1_FRAMES = 9, /* 7 bits of data + start bit + stop bit */ + FSK_FRAME_MODE_8N1_FRAMES = 10 /* 8 bits of data + start bit + stop bit */ +}; + +SPAN_DECLARE_DATA extern const fsk_spec_t preset_fsk_specs[]; + +/*! + FSK modem transmit descriptor. This defines the state of a single working + instance of an FSK modem transmitter. +*/ +typedef struct fsk_tx_state_s fsk_tx_state_t; + +/* The longest window will probably be 106 for 75 baud */ +#define FSK_MAX_WINDOW_LEN 128 + +/*! + FSK modem receive descriptor. This defines the state of a single working + instance of an FSK modem receiver. +*/ +typedef struct fsk_rx_state_s fsk_rx_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Initialise an FSK modem transmit context. + \brief Initialise an FSK modem transmit context. + \param s The modem context. + \param spec The specification of the modem tones and rate. + \param get_bit The callback routine used to get the data to be transmitted. + \param user_data An opaque pointer. + \return A pointer to the modem context, or NULL if there was a problem. */ +SPAN_DECLARE(fsk_tx_state_t *) fsk_tx_init(fsk_tx_state_t *s, + const fsk_spec_t *spec, + get_bit_func_t get_bit, + void *user_data); + +SPAN_DECLARE(int) fsk_tx_restart(fsk_tx_state_t *s, const fsk_spec_t *spec); + +SPAN_DECLARE(int) fsk_tx_release(fsk_tx_state_t *s); + +SPAN_DECLARE(int) fsk_tx_free(fsk_tx_state_t *s); + +/*! Adjust an FSK modem transmit context's power output. + \brief Adjust an FSK modem transmit context's power output. + \param s The modem context. + \param power The power level, in dBm0 */ +SPAN_DECLARE(void) fsk_tx_power(fsk_tx_state_t *s, float power); + +SPAN_DECLARE(void) fsk_tx_set_get_bit(fsk_tx_state_t *s, get_bit_func_t get_bit, void *user_data); + +/*! Change the modem status report function associated with an FSK modem transmit context. + \brief Change the modem status report function associated with an FSK modem transmit context. + \param s The modem context. + \param handler The callback routine used to report modem status changes. + \param user_data An opaque pointer. */ +SPAN_DECLARE(void) fsk_tx_set_modem_status_handler(fsk_tx_state_t *s, modem_tx_status_func_t handler, void *user_data); + +/*! Generate a block of FSK modem audio samples. + \brief Generate a block of FSK modem audio samples. + \param s The modem context. + \param amp The audio sample buffer. + \param len The number of samples to be generated. + \return The number of samples actually generated. +*/ +SPAN_DECLARE_NONSTD(int) fsk_tx(fsk_tx_state_t *s, int16_t amp[], int len); + +/*! Get the current received signal power. + \param s The modem context. + \return The signal power, in dBm0. */ +SPAN_DECLARE(float) fsk_rx_signal_power(fsk_rx_state_t *s); + +/*! Adjust an FSK modem receive context's carrier detect power threshold. + \brief Adjust an FSK modem receive context's carrier detect power threshold. + \param s The modem context. + \param cutoff The power level, in dBm0 */ +SPAN_DECLARE(void) fsk_rx_signal_cutoff(fsk_rx_state_t *s, float cutoff); + +/*! Initialise an FSK modem receive context. + \brief Initialise an FSK modem receive context. + \param s The modem context. + \param spec The specification of the modem tones and rate. + \param framing_mode 0 for fully asynchronous mode. 1 for synchronous mode. >1 for + this many bits per asynchronous character frame. + \param put_bit The callback routine used to put the received data. + \param user_data An opaque pointer. + \return A pointer to the modem context, or NULL if there was a problem. */ +SPAN_DECLARE(fsk_rx_state_t *) fsk_rx_init(fsk_rx_state_t *s, + const fsk_spec_t *spec, + int framing_mode, + put_bit_func_t put_bit, + void *user_data); + +SPAN_DECLARE(int) fsk_rx_restart(fsk_rx_state_t *s, const fsk_spec_t *spec, int framing_mode); + +SPAN_DECLARE(int) fsk_rx_release(fsk_rx_state_t *s); + +SPAN_DECLARE(int) fsk_rx_free(fsk_rx_state_t *s); + +/*! Process a block of received FSK modem audio samples. + \brief Process a block of received FSK modem audio samples. + \param s The modem context. + \param amp The audio sample buffer. + \param len The number of samples in the buffer. + \return The number of samples unprocessed. +*/ +SPAN_DECLARE_NONSTD(int) fsk_rx(fsk_rx_state_t *s, const int16_t *amp, int len); + +/*! Fake processing of a missing block of received FSK modem audio samples + (e.g due to packet loss). + \brief Fake processing of a missing block of received FSK modem audio samples. + \param s The modem context. + \param len The number of samples to fake. + \return The number of samples unprocessed. +*/ +SPAN_DECLARE(int) fsk_rx_fillin(fsk_rx_state_t *s, int len); + +SPAN_DECLARE(void) fsk_rx_set_put_bit(fsk_rx_state_t *s, put_bit_func_t put_bit, void *user_data); + +/*! Change the modem status report function associated with an FSK modem receive context. + \brief Change the modem status report function associated with an FSK modem receive context. + \param s The modem context. + \param handler The callback routine used to report modem status changes. + \param user_data An opaque pointer. */ +SPAN_DECLARE(void) fsk_rx_set_modem_status_handler(fsk_rx_state_t *s, modem_rx_status_func_t handler, void *user_data); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/g168models.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/g168models.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,340 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * g168models.h - line models for echo cancellation tests against the G.168 + * spec. + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: g168models.h,v 1.9 2008/08/29 09:28:13 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_G168MODELS_H_) +#define _SPANDSP_G168MODELS_H_ + +/*! \page g168_test_data_page The test data from the G.168 specification +*/ + +/*! + The line model from section D.2 of G.168. + + These are the coefficients for the line simulation model defined in + section D.2 of G.168. It may be used with the fir32_xxx + routines to build a line simulator. +*/ +const int32_t line_model_d2_coeffs[] = +{ + -436, -829, -2797, -4208, -17968, -11215, 46150, 34480, + -10427, 9049, -1309, -6320, 390, -8191, -1751, -6051, + -3796, -4055, -3948, -2557, -3372, -1808, -2259, -1300, + -1098, -618, -340, -61, 323, 419, 745, 716, + 946, 880, 1014, 976, 1033, 1091, 1053, 1042, + 794, 831, 899, 716, 390, 313, 304, 304, + 73, -119, -109, -176, -359, -407, -512, -580, + -704, -618, -685, -791, -772, -820, -839, -724 +}; +#define LINE_MODEL_D2_GAIN 1.39E-5f + +/*! + The line model from section D.3 of G.168. + + These are the coefficients for the line simulation model defined in + section D.3 of G.168. It may be used with the fir32_xxx + routines to build a line simulator. +*/ +const int32_t line_model_d3_coeffs[] = +{ + -381, 658, 1730, -51, -3511, -1418, 7660, 8861, + -8106, -21370, -5307, 23064, 24020, 1020, -12374, -16296, + -19524, -7480, 13509, 17115, 13952, 13952, 97, -9326, + -9046, -15208, -9853, -3858, -1979, 6029, 5616, 7214, + 6820, 3935, 3919, 921, 1316, -693, -759, -1517, + -2176, -2028, -2654, -1814, -2077, -1468, -1221, -842, + -463, -298, -68, 64, 493, 723, 789, 954, + 756, 839, 872, 1020, 789, 822, 558, 658, + 476, 377, 377, 262, 97, -68, -183, -232, + -331, -347, -430, -314, -430, -463, -463, -414, + -381, -479, -479, -512, -479, -397, -430, -397, + -298, -265, -249, -216, -249, -265, -166, -232 +}; +#define LINE_MODEL_D3_GAIN 1.44E-5f + +/*! + The line model from section D.4 of G.168. + + These are the coefficients for the line simulation model defined in + section D.4 of G.168. It may be used with the fir32_xxx + routines to build a line simulator. +*/ +const int32_t line_model_d4_coeffs[] = +{ + -448, -436, 2230, 2448, -4178, -7050, 5846, 18581, + 2322, -26261, -16249, 21637, 25649, -2267, -10311, -4693, + -12690, -7428, 14164, 13467, 4438, 8627, 456, -11879, + -6352, -5104, -7496, 3271, 6566, 4277, 11131, 7562, + 1475, 3728, -3525, -7301, -3101, -9269, -6146, -2553, + -6272, 811, 124, 788, 5147, 2172, 5387, 4598, + 3535, 4004, 2311, 2150, 1017, 330, -139, -573, + -1100, -1157, -1180, -1455, -1123, -1386, -1123, -1066, + -1020, -1100, -1008, -1077, -1088, -917, -917, -963, + -814, -871, -734, -642, -562, -356, -379, -345, + -230, -233, -333, -356, -390, -310, -265, -368, + -310, -310, -390, -482, -459, -482, -551, -573 +}; +#define LINE_MODEL_D4_GAIN 1.52E-5f + +/*! + The line model from section D.5 of G.168. + + These are the coefficients for the line simulation model defined in + section D.5 of G.168. It may be used with the fir32_xxx + routines to build a line simulator. +*/ +const int32_t line_model_d5_coeffs[] = +{ + 160, 312, -241, -415, 897, 908, -1326, -1499, + 2405, 3347, -3624, -7733, 4041, 14484, -1477, -21739, + -4470, 25356, 11458, -19696, -11800, 5766, 789, 6633, + 14624, -6975, -17156, -187, 149, 1515, 14907, 4345, + -7128, -2757, -10185, -7083, 6850, 3944, 6969, 8694, + -4068, -3852, -5793, -9371, 453, 1060, 3965, 9463, + 2393, 2784, -892, -7366, -3376, -5847, -2399, 3011, + 1537, 6623, 4205, 1602, 1592, -4752, -3646, -5207, + -5577, -501, -1174, 4041, 5647, 4628, 7252, 2123, + 2654, -881, -4113, -3244, -7289, -3830, -4600, -2508, + 431, -144, 4184, 2372, 4617, 3576, 2382, 2839, + -404, 539, -1803, -1401, -1705, -2269, -783, -1608, + -220, -306, 257, 615, 225, 561, 8, 344, + 127, -57, 182, 41, 203, -111, 95, -79, + 30, 84, -13, -68, -241, -68, -24, 19, + -57, -24, 30, -68, 84, -155, -68, 19 +}; +#define LINE_MODEL_D5_GAIN 1.77E-5f + +/*! + The line model from section D.6 of G.168. + + These are the coefficients for the line simulation model defined in + section D.6 of G.168. It may be used with the fir32_xxx + routines to build a line simulator. +*/ +const int32_t line_model_d6_coeffs[] = +{ + 293, 268, 475, 460, 517, 704, 581, 879, + 573, 896, 604, 787, 561, 538, 440, 97, + 265, -385, 20, -938, -523, -1438, -1134, -1887, + -1727, -1698, -4266, -22548, -43424, 2743, 25897, 7380, + 21499, 11983, 10400, 11667, 3889, 7241, 925, 2018, + -821, -2068, -2236, -4283, -3406, -5022, -4039, -4842, + -4104, -4089, -3582, -2978, -2734, -1805, -1608, -645, + -495, 279, 471, 947, 1186, 1438, 1669, 1640, + 1901, 1687, 1803, 1543, 1566, 1342, 1163, 963, + 733, 665, 323, 221, -14, -107, -279, -379, + -468, -513, -473, -588, -612, -652, -616, -566, + -515, -485, -404, -344, -290, -202, -180, -123 +}; +#define LINE_MODEL_D6_GAIN 9.33E-6f + +/*! + The line model from section D.7 of G.168. + + These are the coefficients for the line simulation model defined in + section D.8 of G.168. It may be used with the fir32_xxx + routines to build a line simulator. +*/ +const int32_t line_model_d7_coeffs[] = +{ + 29, 109, -83, 198, -294, -135, -415, -202, + -444, -337, -313, -450, -105, -503, 145, -490, + 267, -231, 340, 77, 343, 783, 158, 1341, + 195, 1798, 344, 1845, 629, 1604, 1182, 940, + 5163, 19522, 8421, -50953, -9043, 18046, -13553, 13336, + -3471, -107, 1788, -7409, 2469, -7994, 490, -3860, + -837, 490, -636, 3682, 1141, 5019, 2635, 5025, + 3946, 4414, 4026, 3005, 3380, 1616, 2007, 158, + 388, -1198, -1117, -2134, -2547, -2589, -3310, -2778, + -3427, -2779, -3116, -2502, -2399, -1956, -1539, -1239, + -570, -377, 251, 331, 964, 1177, 1449, 1564, + 1724, 1871, 1767, 1802, 1630, 1632, 1379, 1271, + 1063, 856, 711, 482, 289, 54, -137, -321, + -490, -638, -764, -836, -800, -859, -838, -837, + -834, -740, -673, -581, -493, -436, -327, -201 +}; +#define LINE_MODEL_D7_GAIN 1.51E-5f + +/*! + The line model from section D.8 of G.168. + + These are the coefficients for the line simulation model defined in + section D.8 of G.168. It may be used with the fir32_xxx + routines to build a line simulator. +*/ +const int32_t line_model_d8_coeffs[] = +{ + 258, -111, 337, -319, 347, -434, 192, -450, + -108, -343, -596, -177, -1187, -52, -1781, -147, + -1959, -326, -1601, -1389, -13620, -720, 33818, -10683, + -6742, 12489, -9862, 8950, -1574, 758, 3526, -3118, + 2421, -8966, -4901, 11385, 18072, -14410, -7473, 19836, + -16854, -3115, 9483, -17799, 7399, -4342, -7415, 7929, + -10726, 6239, -2526, -1317, 5345, -4565, 6868, -2195, + 3425, 1969, -109, 3963, -1275, 3087, -892, 1239, + 2, -427, 596, -1184, 551, -1244, 141, -743, + -415, -372, -769, -183, -785, -270, -659, -377, + -523, -325, -245, -255, -60, 35, 218, 149, + 340, 233, 365, 303, 251, 230, 209, 179 +}; +#define LINE_MODEL_D8_GAIN 2.33E-5f + +/*! + The line model from section D.9 of G.168. + + These are the coefficients for the line simulation model defined in + section D.9 of G.168. It may be used with the fir32_xxx + routines to build a line simulator. +*/ +const int32_t line_model_d9_coeffs[] = +{ + 80, 31, 4, 42, 42, -61, -81, -64, + 121, -102, -26, 1002, -9250, -22562, 39321, 35681, + -35289, 25312, -1457, -229, 15659, -6786, 16791, 3860, + 2239, -28730, -11885, 33871, -176, -16421, 18173, -9669, + -10163, 9941, -19365, 3592, -5907, -10257, 5336, -12933, + 4348, -4802, -1791, 3035, -4433, 5553, -2596, 3992, + 1255, 1450, 4079, 324, 4340, 1059, 3083, 1917, + 1756, 2478, 1027, 1871, 845, 1284, 813, 806, + 869, 471, 646, 438, 449, 432, 473, 394, + 452, 538, 717, 723, 850, 756, 753, 899, + 555, 669, 619, 500, 650, 615, 516, 492, + 427, 291, 356, 147, 107, -50, -88, -59, + -238, -165, -183 +}; +#define LINE_MODEL_D9_GAIN 1.33E-5f + +/*! + The filter coefficients for the bandpass filter specified for level measurements + in section 6.4.1.2.1 of G.168. +*/ +const float level_measurement_bp_coeffs[] = +{ + 0.0000, 0.0006, 0.0005, 0.0004, 0.0011, + 0.0000, 0.0015, -0.0003, 0.0012, -0.0002, + 0.0000, 0.0002, -0.0020, 0.0005, -0.0040, + 0.0000, -0.0047, -0.0019, -0.0033, -0.0047, + 0.0000, -0.0068, 0.0036, -0.0057, 0.0054, + 0.0000, 0.0044, 0.0095, 0.0017, 0.0188, + 0.0000, 0.0225, 0.0024, 0.0163, 0.0092, + 0.0000, 0.0164, -0.0210, 0.0161, -0.0375, + 0.0000, -0.0406, -0.0357, -0.0267, -0.0871, + 0.0000, -0.1420, 0.0289, -0.1843, 0.0475, + 0.8006, 0.0475, -0.1843, 0.0289, -0.1420, + 0.0000, -0.0871, -0.0267, -0.0357, -0.0406, + 0.0000, -0.0375, 0.0161, -0.0210, 0.0164, + 0.0000, 0.0092, 0.0163, 0.0024, 0.0225, + 0.0000, 0.0188, 0.0017, 0.0095, 0.0044, + 0.0000, 0.0054, -0.0057, 0.0036, -0.0068, + 0.0000, -0.0047, -0.0033, -0.0019, -0.0047, + 0.0000, -0.0040, 0.0005, -0.0020, 0.0002, + 0.0000, -0.0002, 0.0012, -0.0003, 0.0015, + 0.0000, 0.0011, 0.0004, 0.0005, 0.0006, + 0.0000 +}; + +/*! + The composite source signal "voiced" section from section C.1 of G.168. +*/ +const int css_c1[] = +{ + -155, 276, 517, 578, 491, 302, 86, -103, + -207, -198, 60, 190, 543, 948, 1362, 1741, + 2043, 2276, 2422, 2500, 2552, 2595, 2655, 2758, + 2896, 3060, 3224, 3370, 3500, 3569, 3603, 3603, + 3595, 3586, 3595, 3638, 3724, 3819, 3922, 4000, + 4043, 4034, 3974, 3862, 3724, 3577, 3439, 3336, + 3267, 3224, 3198, 3172, 3129, 3043, 2914, 2750, + 2560, 2353, 2155, 1991, 1853, 1750, 1672, 1603, + 1534, 1440, 1310, 1146, 965, 776, 603, 448, + 345, 276, 250, 250, 267, 267, 241, 190, + 103, -9, -138, -267, -388, -491, -569, -638, + -698, -759, -813, -888, -957, -1034, -1103, -1146, + -1181, -1190, -1198, -1215, -1259, -1327, -1457, -1629, + -1853, -2121, -2414, -2707, -3017, -3319, -3612, -3913, + -4224, -4560, -4922, -5301, -5715, -6137, -6560, -6948, + -7301, -7568, -7732, -7758, -7620, -7310, -6810, -6155, + -5344, -4439, -3474, -2508, -1595, -802 +}; + +/*! + The composite source signal "voiced" section from section C.3 of G.168. +*/ +const int css_c3[] = +{ + -198, -112, -9, 103, 233, 388, 543, 724, + 896, 1060, 1233, 1388, 1517, 1638, 1747, 1810, + 1845, 1845, 1802, 1707, 1569, 1379, 1146, 871, + 560, 233, -121, -491, -871, -1250, -1638, -2043, + -2465, -2896, -3345, -3819, -4310, -4810, -5319, -5836, + -6353, -6853, -7353, -7836, -8292, -8715, -9077, -9370, + -9542, -9542, -9361, -8956, -8327, -7465, -6396, -5163, + -3827, -2448, -1103, 155, 1293, 2241, 3034, 3655, + 4138, 4517, 4827, 5094, 5344, 5594, 5827, 6043, + 6215, 6344, 6413, 6422, 6379, 6310, 6215, 6120, + 6051, 6000, 5991, 5991, 6000, 6008, 5991, 5939, + 5853, 5715, 5560, 5387, 5215, 5043, 4879, 4732, + 4586, 4439, 4276, 4086, 3870, 3629, 3370, 3086, + 2801, 2534, 2267, 2034, 1819, 1612, 1422, 1224, + 1026, 819, 603, 388, 181, 9, -181, -328, + -448, -543, -629, -707, -784, -871, -948, -1026, + -1112, -1181, -1241, -1276, -1293, -1302, -1293, -1267, + -1250, -1233, -1224, -1224, -1224, -1224, -1215, -1198, + -1172, -1129, -1077, -1026, -974, -922, -888, -871, + -845, -828, -810, -793, -767, -741, -698, -672, + -638, -603, -595, -586, -595, -603, -621, -629, + -938, -638, -638, -638, -638, -638, -647, -664, + -690, -724, -767, -793, -819, -845, -853, -871, + -879, -888, -896, -922, -948, -974, -1009, -1026, + -1052, -1069, -1077, -1069, -1060, -1060, -1052, -1043, + -1043, -1052, -1060, -1060, -1060, -1052, -1034, -1017, + -991, -957, -931, -905, -888, -862, -845, -819, + -793, -767, -724, -672, -621, -560, -509, -457, + -397, -345, -276, -207, -112 +}; + +/*! + From section 6.4.2.7 of G.168 - Test No. 6 Non-divergence on narrow-band signals. + These tones and tone pairs are each applied for 5 seconds. +*/ +const int tones_6_4_2_7[][2] = +{ + { 697, 0}, + { 941, 0}, + {1336, 0}, + {1633, 0}, + { 697, 1209}, + { 770, 1336}, + { 852, 1477}, + { 941, 1633}, + { 0, 0} +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/g711.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/g711.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,327 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * g711.h - In line A-law and u-law conversion routines + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: g711.h,v 1.19 2009/04/12 09:12:10 steveu Exp $ + */ + +/*! \file */ + +/*! \page g711_page A-law and mu-law handling +Lookup tables for A-law and u-law look attractive, until you consider the impact +on the CPU cache. If it causes a substantial area of your processor cache to get +hit too often, cache sloshing will severely slow things down. The main reason +these routines are slow in C, is the lack of direct access to the CPU's "find +the first 1" instruction. A little in-line assembler fixes that, and the +conversion routines can be faster than lookup tables, in most real world usage. +A "find the first 1" instruction is available on most modern CPUs, and is a +much underused feature. + +If an assembly language method of bit searching is not available, these routines +revert to a method that can be a little slow, so the cache thrashing might not +seem so bad :( + +Feel free to submit patches to add fast "find the first 1" support for your own +favourite processor. + +Look up tables are used for transcoding between A-law and u-law, since it is +difficult to achieve the precise transcoding procedure laid down in the G.711 +specification by other means. +*/ + +#if !defined(_SPANDSP_G711_H_) +#define _SPANDSP_G711_H_ + +/* The usual values to use on idle channels, to emulate silence */ +/*! Idle value for A-law channels */ +#define G711_ALAW_IDLE_OCTET 0x5D +/*! Idle value for u-law channels */ +#define G711_ULAW_IDLE_OCTET 0xFF + +enum +{ + G711_ALAW = 0, + G711_ULAW +}; + +/*! + G.711 state + */ +typedef struct g711_state_s g711_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/* N.B. It is tempting to use look-up tables for A-law and u-law conversion. + * However, you should consider the cache footprint. + * + * A 64K byte table for linear to x-law and a 512 byte table for x-law to + * linear sound like peanuts these days, and shouldn't an array lookup be + * real fast? No! When the cache sloshes as badly as this one will, a tight + * calculation may be better. The messiest part is normally finding the + * segment, but a little inline assembly can fix that on an i386, x86_64 and + * many other modern processors. + */ + +/* + * Mu-law is basically as follows: + * + * Biased Linear Input Code Compressed Code + * ------------------------ --------------- + * 00000001wxyza 000wxyz + * 0000001wxyzab 001wxyz + * 000001wxyzabc 010wxyz + * 00001wxyzabcd 011wxyz + * 0001wxyzabcde 100wxyz + * 001wxyzabcdef 101wxyz + * 01wxyzabcdefg 110wxyz + * 1wxyzabcdefgh 111wxyz + * + * Each biased linear code has a leading 1 which identifies the segment + * number. The value of the segment number is equal to 7 minus the number + * of leading 0's. The quantization interval is directly available as the + * four bits wxyz. * The trailing bits (a - h) are ignored. + * + * Ordinarily the complement of the resulting code word is used for + * transmission, and so the code word is complemented before it is returned. + * + * For further information see John C. Bellamy's Digital Telephony, 1982, + * John Wiley & Sons, pps 98-111 and 472-476. + */ + +/* Enable the trap as per the MIL-STD */ +//#define ULAW_ZEROTRAP +/*! Bias for u-law encoding from linear. */ +#define ULAW_BIAS 0x84 + +/*! \brief Encode a linear sample to u-law + \param linear The sample to encode. + \return The u-law value. +*/ +static __inline__ uint8_t linear_to_ulaw(int linear) +{ + uint8_t u_val; + int mask; + int seg; + + /* Get the sign and the magnitude of the value. */ + if (linear >= 0) + { + linear = ULAW_BIAS + linear; + mask = 0xFF; + } + else + { + linear = ULAW_BIAS - linear; + mask = 0x7F; + } + + seg = top_bit(linear | 0xFF) - 7; + + /* + * Combine the sign, segment, quantization bits, + * and complement the code word. + */ + if (seg >= 8) + u_val = (uint8_t) (0x7F ^ mask); + else + u_val = (uint8_t) (((seg << 4) | ((linear >> (seg + 3)) & 0xF)) ^ mask); +#ifdef ULAW_ZEROTRAP + /* Optional ITU trap */ + if (u_val == 0) + u_val = 0x02; +#endif + return u_val; +} +/*- End of function --------------------------------------------------------*/ + +/*! \brief Decode an u-law sample to a linear value. + \param ulaw The u-law sample to decode. + \return The linear value. +*/ +static __inline__ int16_t ulaw_to_linear(uint8_t ulaw) +{ + int t; + + /* Complement to obtain normal u-law value. */ + ulaw = ~ulaw; + /* + * Extract and bias the quantization bits. Then + * shift up by the segment number and subtract out the bias. + */ + t = (((ulaw & 0x0F) << 3) + ULAW_BIAS) << (((int) ulaw & 0x70) >> 4); + return (int16_t) ((ulaw & 0x80) ? (ULAW_BIAS - t) : (t - ULAW_BIAS)); +} +/*- End of function --------------------------------------------------------*/ + +/* + * A-law is basically as follows: + * + * Linear Input Code Compressed Code + * ----------------- --------------- + * 0000000wxyza 000wxyz + * 0000001wxyza 001wxyz + * 000001wxyzab 010wxyz + * 00001wxyzabc 011wxyz + * 0001wxyzabcd 100wxyz + * 001wxyzabcde 101wxyz + * 01wxyzabcdef 110wxyz + * 1wxyzabcdefg 111wxyz + * + * For further information see John C. Bellamy's Digital Telephony, 1982, + * John Wiley & Sons, pps 98-111 and 472-476. + */ + +/*! The A-law alternate mark inversion mask */ +#define ALAW_AMI_MASK 0x55 + +/*! \brief Encode a linear sample to A-law + \param linear The sample to encode. + \return The A-law value. +*/ +static __inline__ uint8_t linear_to_alaw(int linear) +{ + int mask; + int seg; + + if (linear >= 0) + { + /* Sign (bit 7) bit = 1 */ + mask = ALAW_AMI_MASK | 0x80; + } + else + { + /* Sign (bit 7) bit = 0 */ + mask = ALAW_AMI_MASK; + linear = -linear - 1; + } + + /* Convert the scaled magnitude to segment number. */ + seg = top_bit(linear | 0xFF) - 7; + if (seg >= 8) + { + if (linear >= 0) + { + /* Out of range. Return maximum value. */ + return (uint8_t) (0x7F ^ mask); + } + /* We must be just a tiny step below zero */ + return (uint8_t) (0x00 ^ mask); + } + /* Combine the sign, segment, and quantization bits. */ + return (uint8_t) (((seg << 4) | ((linear >> ((seg) ? (seg + 3) : 4)) & 0x0F)) ^ mask); +} +/*- End of function --------------------------------------------------------*/ + +/*! \brief Decode an A-law sample to a linear value. + \param alaw The A-law sample to decode. + \return The linear value. +*/ +static __inline__ int16_t alaw_to_linear(uint8_t alaw) +{ + int i; + int seg; + + alaw ^= ALAW_AMI_MASK; + i = ((alaw & 0x0F) << 4); + seg = (((int) alaw & 0x70) >> 4); + if (seg) + i = (i + 0x108) << (seg - 1); + else + i += 8; + return (int16_t) ((alaw & 0x80) ? i : -i); +} +/*- End of function --------------------------------------------------------*/ + +/*! \brief Transcode from A-law to u-law, using the procedure defined in G.711. + \param alaw The A-law sample to transcode. + \return The best matching u-law value. +*/ +SPAN_DECLARE(uint8_t) alaw_to_ulaw(uint8_t alaw); + +/*! \brief Transcode from u-law to A-law, using the procedure defined in G.711. + \param ulaw The u-law sample to transcode. + \return The best matching A-law value. +*/ +SPAN_DECLARE(uint8_t) ulaw_to_alaw(uint8_t ulaw); + +/*! \brief Decode from u-law or A-law to linear. + \param s The G.711 context. + \param amp The linear audio buffer. + \param g711_data The G.711 data. + \param g711_bytes The number of G.711 samples to decode. + \return The number of samples of linear audio produced. +*/ +SPAN_DECLARE(int) g711_decode(g711_state_t *s, + int16_t amp[], + const uint8_t g711_data[], + int g711_bytes); + +/*! \brief Encode from linear to u-law or A-law. + \param s The G.711 context. + \param g711_data The G.711 data. + \param amp The linear audio buffer. + \param len The number of samples to encode. + \return The number of G.711 samples produced. +*/ +SPAN_DECLARE(int) g711_encode(g711_state_t *s, + uint8_t g711_data[], + const int16_t amp[], + int len); + +/*! \brief Transcode between u-law and A-law. + \param s The G.711 context. + \param g711_out The resulting G.711 data. + \param g711_in The original G.711 data. + \param g711_bytes The number of G.711 samples to transcode. + \return The number of G.711 samples produced. +*/ +SPAN_DECLARE(int) g711_transcode(g711_state_t *s, + uint8_t g711_out[], + const uint8_t g711_in[], + int g711_bytes); + +/*! Initialise a G.711 encode or decode context. + \param s The G.711 context. + \param mode The G.711 mode. + \return A pointer to the G.711 context, or NULL for error. */ +SPAN_DECLARE(g711_state_t *) g711_init(g711_state_t *s, int mode); + +/*! Release a G.711 encode or decode context. + \param s The G.711 context. + \return 0 for OK. */ +SPAN_DECLARE(int) g711_release(g711_state_t *s); + +/*! Free a G.711 encode or decode context. + \param s The G.711 context. + \return 0 for OK. */ +SPAN_DECLARE(int) g711_free(g711_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/g722.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/g722.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,130 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * g722.h - The ITU G.722 codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Based on a single channel G.722 codec which is: + * + ***** Copyright (c) CMU 1993 ***** + * Computer Science, Speech Group + * Chengxiang Lu and Alex Hauptmann + * + * $Id: g722.h,v 1.26 2009/04/12 09:12:10 steveu Exp $ + */ + + +/*! \file */ + +#if !defined(_SPANDSP_G722_H_) +#define _SPANDSP_G722_H_ + +/*! \page g722_page G.722 encoding and decoding +\section g722_page_sec_1 What does it do? +The G.722 module is a bit exact implementation of the ITU G.722 specification for all three +specified bit rates - 64000bps, 56000bps and 48000bps. It passes the ITU tests. + +To allow fast and flexible interworking with narrow band telephony, the encoder and decoder +support an option for the linear audio to be an 8k samples/second stream. In this mode the +codec is considerably faster, and still fully compatible with wideband terminals using G.722. + +\section g722_page_sec_2 How does it work? +???. +*/ + +enum +{ + G722_SAMPLE_RATE_8000 = 0x0001, + G722_PACKED = 0x0002 +}; + +/*! + G.722 encode state + */ +typedef struct g722_encode_state_s g722_encode_state_t; + +/*! + G.722 decode state + */ +typedef struct g722_decode_state_s g722_decode_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Initialise an G.722 encode context. + \param s The G.722 encode context. + \param rate The required bit rate for the G.722 data. + The valid rates are 64000, 56000 and 48000. + \param options + \return A pointer to the G.722 encode context, or NULL for error. */ +SPAN_DECLARE(g722_encode_state_t *) g722_encode_init(g722_encode_state_t *s, int rate, int options); + +/*! Release a G.722 encode context. + \param s The G.722 encode context. + \return 0 for OK. */ +SPAN_DECLARE(int) g722_encode_release(g722_encode_state_t *s); + +/*! Free a G.722 encode context. + \param s The G.722 encode context. + \return 0 for OK. */ +SPAN_DECLARE(int) g722_encode_free(g722_encode_state_t *s); + +/*! Encode a buffer of linear PCM data to G.722 + \param s The G.722 context. + \param g722_data The G.722 data produced. + \param amp The audio sample buffer. + \param len The number of samples in the buffer. + \return The number of bytes of G.722 data produced. */ +SPAN_DECLARE(int) g722_encode(g722_encode_state_t *s, uint8_t g722_data[], const int16_t amp[], int len); + +/*! Initialise an G.722 decode context. + \param s The G.722 decode context. + \param rate The bit rate of the G.722 data. + The valid rates are 64000, 56000 and 48000. + \param options + \return A pointer to the G.722 decode context, or NULL for error. */ +SPAN_DECLARE(g722_decode_state_t *) g722_decode_init(g722_decode_state_t *s, int rate, int options); + +/*! Release a G.722 decode context. + \param s The G.722 decode context. + \return 0 for OK. */ +SPAN_DECLARE(int) g722_decode_release(g722_decode_state_t *s); + +/*! Free a G.722 decode context. + \param s The G.722 decode context. + \return 0 for OK. */ +SPAN_DECLARE(int) g722_decode_free(g722_decode_state_t *s); + +/*! Decode a buffer of G.722 data to linear PCM. + \param s The G.722 context. + \param amp The audio sample buffer. + \param g722_data + \param len + \return The number of samples returned. */ +SPAN_DECLARE(int) g722_decode(g722_decode_state_t *s, int16_t amp[], const uint8_t g722_data[], int len); + +#if defined(__cplusplus) +} +#endif + +#endif diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/g726.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/g726.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,122 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * g726.h - ITU G.726 codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: g726.h,v 1.26 2009/04/12 09:12:10 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_G726_H_) +#define _SPANDSP_G726_H_ + +/*! \page g726_page G.726 encoding and decoding +\section g726_page_sec_1 What does it do? + +The G.726 module is a bit exact implementation of the full ITU G.726 specification. +It supports: + - 16 kbps, 24kbps, 32kbps, and 40kbps operation. + - Tandem adjustment, for interworking with A-law and u-law. + - Annex A support, for use in environments not using A-law or u-law. + +It passes the ITU tests. + +\section g726_page_sec_2 How does it work? +???. +*/ + +enum +{ + G726_ENCODING_LINEAR = 0, /* Interworking with 16 bit signed linear */ + G726_ENCODING_ULAW, /* Interworking with u-law */ + G726_ENCODING_ALAW /* Interworking with A-law */ +}; + +enum +{ + G726_PACKING_NONE = 0, + G726_PACKING_LEFT = 1, + G726_PACKING_RIGHT = 2 +}; + +/*! + G.726 state + */ +typedef struct g726_state_s g726_state_t; + +typedef int16_t (*g726_decoder_func_t)(g726_state_t *s, uint8_t code); + +typedef uint8_t (*g726_encoder_func_t)(g726_state_t *s, int16_t amp); + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Initialise a G.726 encode or decode context. + \param s The G.726 context. + \param bit_rate The required bit rate for the ADPCM data. + The valid rates are 16000, 24000, 32000 and 40000. + \param ext_coding The coding used outside G.726. + \param packing One of the G.726_PACKING_xxx options. + \return A pointer to the G.726 context, or NULL for error. */ +SPAN_DECLARE(g726_state_t *) g726_init(g726_state_t *s, int bit_rate, int ext_coding, int packing); + +/*! Release a G.726 encode or decode context. + \param s The G.726 context. + \return 0 for OK. */ +SPAN_DECLARE(int) g726_release(g726_state_t *s); + +/*! Free a G.726 encode or decode context. + \param s The G.726 context. + \return 0 for OK. */ +SPAN_DECLARE(int) g726_free(g726_state_t *s); + +/*! Decode a buffer of G.726 ADPCM data to linear PCM, a-law or u-law. + \param s The G.726 context. + \param amp The audio sample buffer. + \param g726_data + \param g726_bytes + \return The number of samples returned. */ +SPAN_DECLARE(int) g726_decode(g726_state_t *s, + int16_t amp[], + const uint8_t g726_data[], + int g726_bytes); + +/*! Encode a buffer of linear PCM data to G.726 ADPCM. + \param s The G.726 context. + \param g726_data The G.726 data produced. + \param amp The audio sample buffer. + \param len The number of samples in the buffer. + \return The number of bytes of G.726 data produced. */ +SPAN_DECLARE(int) g726_encode(g726_state_t *s, + uint8_t g726_data[], + const int16_t amp[], + int len); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/gsm0610.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/gsm0610.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,153 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * gsm0610.h - GSM 06.10 full rate speech codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: gsm0610.h,v 1.21 2009/02/10 13:06:47 steveu Exp $ + */ + +#if !defined(_SPANDSP_GSM0610_H_) +#define _SPANDSP_GSM0610_H_ + +/*! \page gsm0610_page GSM 06.10 encoding and decoding +\section gsm0610_page_sec_1 What does it do? + +The GSM 06.10 module is an version of the widely used GSM FR codec software +available from http://kbs.cs.tu-berlin.de/~jutta/toast.html. This version +was produced since some versions of this codec are not bit exact, or not +very efficient on modern processors. This implementation can use MMX instructions +on Pentium class processors, or alternative methods on other processors. It +passes all the ETSI test vectors. That is, it is a tested bit exact implementation. + +This implementation supports encoded data in one of three packing formats: + - Unpacked, with the 76 parameters of a GSM 06.10 code frame each occupying a + separate byte. (note that none of the parameters exceed 8 bits). + - Packed the the 33 byte per frame, used for VoIP, where 4 bits per frame are wasted. + - Packed in WAV49 format, where 2 frames are packed into 65 bytes. + +\section gsm0610_page_sec_2 How does it work? +???. +*/ + +enum +{ + GSM0610_PACKING_NONE, + GSM0610_PACKING_WAV49, + GSM0610_PACKING_VOIP +}; + +/*! + GSM 06.10 FR codec unpacked frame. +*/ +typedef struct +{ + int16_t LARc[8]; + int16_t Nc[4]; + int16_t bc[4]; + int16_t Mc[4]; + int16_t xmaxc[4]; + int16_t xMc[4][13]; +} gsm0610_frame_t; + +/*! + GSM 06.10 FR codec state descriptor. This defines the state of + a single working instance of the GSM 06.10 FR encoder or decoder. +*/ +typedef struct gsm0610_state_s gsm0610_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Initialise a GSM 06.10 encode or decode context. + \param s The GSM 06.10 context + \param packing One of the GSM0610_PACKING_xxx options. + \return A pointer to the GSM 06.10 context, or NULL for error. */ +SPAN_DECLARE(gsm0610_state_t *) gsm0610_init(gsm0610_state_t *s, int packing); + +/*! Release a GSM 06.10 encode or decode context. + \param s The GSM 06.10 context + \return 0 for success, else -1. */ +SPAN_DECLARE(int) gsm0610_release(gsm0610_state_t *s); + +/*! Free a GSM 06.10 encode or decode context. + \param s The GSM 06.10 context + \return 0 for success, else -1. */ +SPAN_DECLARE(int) gsm0610_free(gsm0610_state_t *s); + +/*! Set the packing format for a GSM 06.10 encode or decode context. + \param s The GSM 06.10 context + \param packing One of the GSM0610_PACKING_xxx options. + \return 0 for success, else -1. */ +SPAN_DECLARE(int) gsm0610_set_packing(gsm0610_state_t *s, int packing); + +/*! Encode a buffer of linear PCM data to GSM 06.10. + \param s The GSM 06.10 context. + \param code The GSM 06.10 data produced. + \param amp The audio sample buffer. + \param len The number of samples in the buffer. + \return The number of bytes of GSM 06.10 data produced. */ +SPAN_DECLARE(int) gsm0610_encode(gsm0610_state_t *s, uint8_t code[], const int16_t amp[], int len); + +/*! Decode a buffer of GSM 06.10 data to linear PCM. + \param s The GSM 06.10 context. + \param amp The audio sample buffer. + \param code The GSM 06.10 data. + \param len The number of bytes of GSM 06.10 data to be decoded. + \return The number of samples returned. */ +SPAN_DECLARE(int) gsm0610_decode(gsm0610_state_t *s, int16_t amp[], const uint8_t code[], int len); + +SPAN_DECLARE(int) gsm0610_pack_none(uint8_t c[], const gsm0610_frame_t *s); + +/*! Pack a pair of GSM 06.10 frames in the format used for wave files (wave type 49). + \param c The buffer for the packed data. This must be at least 65 bytes long. + \param s A pointer to the frames to be packed. + \return The number of bytes generated. */ +SPAN_DECLARE(int) gsm0610_pack_wav49(uint8_t c[], const gsm0610_frame_t *s); + +/*! Pack a GSM 06.10 frames in the format used for VoIP. + \param c The buffer for the packed data. This must be at least 33 bytes long. + \param s A pointer to the frame to be packed. + \return The number of bytes generated. */ +SPAN_DECLARE(int) gsm0610_pack_voip(uint8_t c[], const gsm0610_frame_t *s); + +SPAN_DECLARE(int) gsm0610_unpack_none(gsm0610_frame_t *s, const uint8_t c[]); + +/*! Unpack a pair of GSM 06.10 frames from the format used for wave files (wave type 49). + \param s A pointer to a buffer into which the frames will be packed. + \param c The buffer containing the data to be unpacked. This must be at least 65 bytes long. + \return The number of bytes absorbed. */ +SPAN_DECLARE(int) gsm0610_unpack_wav49(gsm0610_frame_t *s, const uint8_t c[]); + +/*! Unpack a GSM 06.10 frame from the format used for VoIP. + \param s A pointer to a buffer into which the frame will be packed. + \param c The buffer containing the data to be unpacked. This must be at least 33 bytes long. + \return The number of bytes absorbed. */ +SPAN_DECLARE(int) gsm0610_unpack_voip(gsm0610_frame_t *s, const uint8_t c[]); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of include ---------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/hdlc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/hdlc.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,252 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * hdlc.h + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: hdlc.h,v 1.45 2009/06/02 16:03:56 steveu Exp $ + */ + +/*! \file */ + +/*! \page hdlc_page HDLC + +\section hdlc_page_sec_1 What does it do? +The HDLC module provides bit stuffing, destuffing, framing and deframing, +according to the HDLC protocol. It also provides 16 and 32 bit CRC generation +and checking services for HDLC frames. + +HDLC may not be a DSP function, but is needed to accompany several DSP components. + +\section hdlc_page_sec_2 How does it work? +*/ + +#if !defined(_SPANDSP_HDLC_H_) +#define _SPANDSP_HDLC_H_ + +/*! + HDLC_MAXFRAME_LEN is the maximum length of a stuffed HDLC frame, excluding the CRC. +*/ +#define HDLC_MAXFRAME_LEN 400 + +typedef void (*hdlc_frame_handler_t)(void *user_data, const uint8_t *pkt, int len, int ok); +typedef void (*hdlc_underflow_handler_t)(void *user_data); + +/*! + HDLC receive descriptor. This contains all the state information for an HDLC receiver. + */ +typedef struct hdlc_rx_state_s hdlc_rx_state_t; + +/*! + HDLC received data statistics. + */ +typedef struct +{ + /*! \brief The number of bytes of good frames received (CRC not included). */ + unsigned long int bytes; + /*! \brief The number of good frames received. */ + unsigned long int good_frames; + /*! \brief The number of frames with CRC errors received. */ + unsigned long int crc_errors; + /*! \brief The number of too short and too long frames received. */ + unsigned long int length_errors; + /*! \brief The number of HDLC aborts received. */ + unsigned long int aborts; +} hdlc_rx_stats_t; + +/*! + HDLC transmit descriptor. This contains all the state information for an + HDLC transmitter. + */ +typedef struct hdlc_tx_state_s hdlc_tx_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! \brief Initialise an HDLC receiver context. + \param s A pointer to an HDLC receiver context. + \param crc32 TRUE to use ITU CRC32. FALSE to use ITU CRC16. + \param report_bad_frames TRUE to request the reporting of bad frames. + \param framing_ok_threshold The number of back-to-back flags needed to + start the framing OK condition. This may be used where a series of + flag octets is used as a preamble, such as in the T.30 protocol. + \param handler The function to be called when a good HDLC frame is received. + \param user_data An opaque parameter for the callback routine. + \return A pointer to the HDLC receiver context. +*/ +SPAN_DECLARE(hdlc_rx_state_t *) hdlc_rx_init(hdlc_rx_state_t *s, + int crc32, + int report_bad_frames, + int framing_ok_threshold, + hdlc_frame_handler_t handler, + void *user_data); + +/*! Change the put_bit function associated with an HDLC receiver context. + \brief Change the put_bit function associated with an HDLC receiver context. + \param s A pointer to an HDLC receiver context. + \param handler The function to be called when a good HDLC frame is received. + \param user_data An opaque parameter for the callback routine. +*/ +SPAN_DECLARE(void) hdlc_rx_set_frame_handler(hdlc_rx_state_t *s, hdlc_frame_handler_t handler, void *user_data); + +/*! Change the status report function associated with an HDLC receiver context. + \brief Change the status report function associated with an HDLC receiver context. + \param s A pointer to an HDLC receiver context. + \param handler The callback routine used to report status changes. + \param user_data An opaque parameter for the callback routine. +*/ +SPAN_DECLARE(void) hdlc_rx_set_status_handler(hdlc_rx_state_t *s, modem_rx_status_func_t handler, void *user_data); + +/*! Release an HDLC receiver context. + \brief Release an HDLC receiver context. + \param s A pointer to an HDLC receiver context. + \return 0 for OK */ +SPAN_DECLARE(int) hdlc_rx_release(hdlc_rx_state_t *s); + +/*! Free an HDLC receiver context. + \brief Free an HDLC receiver context. + \param s A pointer to an HDLC receiver context. + \return 0 for OK */ +SPAN_DECLARE(int) hdlc_rx_free(hdlc_rx_state_t *s); + +/*! \brief Set the maximum frame length for an HDLC receiver context. + \param s A pointer to an HDLC receiver context. + \param max_len The maximum permitted length of a frame. +*/ +SPAN_DECLARE(void) hdlc_rx_set_max_frame_len(hdlc_rx_state_t *s, size_t max_len); + +/*! \brief Set the octet counting report interval. + \param s A pointer to an HDLC receiver context. + \param interval The interval, in octets. +*/ +SPAN_DECLARE(void) hdlc_rx_set_octet_counting_report_interval(hdlc_rx_state_t *s, + int interval); + +/*! \brief Get the current receive statistics. + \param s A pointer to an HDLC receiver context. + \param t A pointer to the buffer for the statistics. + \return 0 for OK, else -1. +*/ +SPAN_DECLARE(int) hdlc_rx_get_stats(hdlc_rx_state_t *s, + hdlc_rx_stats_t *t); + +/*! \brief Put a single bit of data to an HDLC receiver. + \param s A pointer to an HDLC receiver context. + \param new_bit The bit. +*/ +SPAN_DECLARE_NONSTD(void) hdlc_rx_put_bit(hdlc_rx_state_t *s, int new_bit); + +/*! \brief Put a byte of data to an HDLC receiver. + \param s A pointer to an HDLC receiver context. + \param new_byte The byte of data. +*/ +SPAN_DECLARE_NONSTD(void) hdlc_rx_put_byte(hdlc_rx_state_t *s, int new_byte); + +/*! \brief Put a series of bytes of data to an HDLC receiver. + \param s A pointer to an HDLC receiver context. + \param buf The buffer of data. + \param len The length of the data in the buffer. +*/ +SPAN_DECLARE_NONSTD(void) hdlc_rx_put(hdlc_rx_state_t *s, const uint8_t buf[], int len); + +/*! \brief Initialise an HDLC transmitter context. + \param s A pointer to an HDLC transmitter context. + \param crc32 TRUE to use ITU CRC32. FALSE to use ITU CRC16. + \param inter_frame_flags The minimum flag octets to insert between frames (usually one). + \param progressive TRUE if frame creation works in progressive mode. + \param handler The callback function called when the HDLC transmitter underflows. + \param user_data An opaque parameter for the callback routine. + \return A pointer to the HDLC transmitter context. +*/ +SPAN_DECLARE(hdlc_tx_state_t *) hdlc_tx_init(hdlc_tx_state_t *s, + int crc32, + int inter_frame_flags, + int progressive, + hdlc_underflow_handler_t handler, + void *user_data); + +SPAN_DECLARE(int) hdlc_tx_release(hdlc_tx_state_t *s); + +SPAN_DECLARE(int) hdlc_tx_free(hdlc_tx_state_t *s); + +/*! \brief Set the maximum frame length for an HDLC transmitter context. + \param s A pointer to an HDLC transmitter context. + \param max_len The maximum length. +*/ +SPAN_DECLARE(void) hdlc_tx_set_max_frame_len(hdlc_tx_state_t *s, size_t max_len); + +/*! \brief Transmit a frame. + \param s A pointer to an HDLC transmitter context. + \param frame A pointer to the frame to be transmitted. + \param len The length of the frame to be transmitted. + \return 0 if the frame was accepted for transmission, else -1. +*/ +SPAN_DECLARE(int) hdlc_tx_frame(hdlc_tx_state_t *s, const uint8_t *frame, size_t len); + +/*! \brief Corrupt the frame currently being transmitted, by giving it the wrong CRC. + \param s A pointer to an HDLC transmitter context. + \return 0 if the frame was corrupted, else -1. +*/ +SPAN_DECLARE(int) hdlc_tx_corrupt_frame(hdlc_tx_state_t *s); + +/*! \brief Transmit a specified quantity of flag octets, typically as a preamble. + \param s A pointer to an HDLC transmitter context. + \param len The length of the required period of flags, in flag octets. If len is zero this + requests that HDLC transmission be terminated when the buffers have fully + drained. + \return 0 if the flags were accepted for transmission, else -1. +*/ +SPAN_DECLARE(int) hdlc_tx_flags(hdlc_tx_state_t *s, int len); + +/*! \brief Send an abort. + \param s A pointer to an HDLC transmitter context. + \return 0 if the frame was aborted, else -1. +*/ +SPAN_DECLARE(int) hdlc_tx_abort(hdlc_tx_state_t *s); + +/*! \brief Get the next bit for transmission. + \param s A pointer to an HDLC transmitter context. + \return The next bit for transmission. +*/ +SPAN_DECLARE_NONSTD(int) hdlc_tx_get_bit(hdlc_tx_state_t *s); + +/*! \brief Get the next byte for transmission. + \param s A pointer to an HDLC transmitter context. + \return The next byte for transmission. +*/ +SPAN_DECLARE_NONSTD(int) hdlc_tx_get_byte(hdlc_tx_state_t *s); + +/*! \brief Get the next sequence of bytes for transmission. + \param s A pointer to an HDLC transmitter context. + \param buf The buffer for the data. + \param max_len The number of bytes to get. + \return The number of bytes actually got. +*/ +SPAN_DECLARE_NONSTD(int) hdlc_tx_get(hdlc_tx_state_t *s, uint8_t buf[], size_t max_len); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/ima_adpcm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/ima_adpcm.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,117 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * ima_adpcm.c - Conversion routines between linear 16 bit PCM data and + * IMA/DVI/Intel ADPCM format. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Based on a bit from here, a bit from there, eye of toad, + * ear of bat, etc - plus, of course, my own 2 cents. + * + * $Id: ima_adpcm.h,v 1.25 2009/04/11 18:11:19 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_IMA_ADPCM_H_) +#define _SPANDSP_IMA_ADPCM_H_ + +/*! \page ima_adpcm_page IMA/DVI/Intel ADPCM encoding and decoding +\section ima_adpcm_page_sec_1 What does it do? +IMA ADPCM offers a good balance of simplicity and quality at a rate of +32kbps. + +\section ima_adpcm_page_sec_2 How does it work? + +\section ima_adpcm_page_sec_3 How do I use it? +*/ + +enum +{ + /*! IMA4 is the original IMA ADPCM variant */ + IMA_ADPCM_IMA4 = 0, + /*! DVI4 is the IMA ADPCM variant defined in RFC3551 */ + IMA_ADPCM_DVI4 = 1, + /*! VDVI is the variable bit rate IMA ADPCM variant defined in RFC3551 */ + IMA_ADPCM_VDVI = 2 +}; + +/*! + IMA (DVI/Intel) ADPCM conversion state descriptor. This defines the state of + a single working instance of the IMA ADPCM converter. This is used for + either linear to ADPCM or ADPCM to linear conversion. +*/ +typedef struct ima_adpcm_state_s ima_adpcm_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Initialise an IMA ADPCM encode or decode context. + \param s The IMA ADPCM context. + \param variant IMA_ADPCM_IMA4, IMA_ADPCM_DVI4, or IMA_ADPCM_VDVI. + \param chunk_size The size of a chunk, in samples. A chunk size of + zero sample samples means treat each encode or decode operation + as a chunk. + \return A pointer to the IMA ADPCM context, or NULL for error. */ +SPAN_DECLARE(ima_adpcm_state_t *) ima_adpcm_init(ima_adpcm_state_t *s, + int variant, + int chunk_size); + +/*! Release an IMA ADPCM encode or decode context. + \param s The IMA ADPCM context. + \return 0 for OK. */ +SPAN_DECLARE(int) ima_adpcm_release(ima_adpcm_state_t *s); + +/*! Free an IMA ADPCM encode or decode context. + \param s The IMA ADPCM context. + \return 0 for OK. */ +SPAN_DECLARE(int) ima_adpcm_free(ima_adpcm_state_t *s); + +/*! Encode a buffer of linear PCM data to IMA ADPCM. + \param s The IMA ADPCM context. + \param ima_data The IMA ADPCM data produced. + \param amp The audio sample buffer. + \param len The number of samples in the buffer. + \return The number of bytes of IMA ADPCM data produced. */ +SPAN_DECLARE(int) ima_adpcm_encode(ima_adpcm_state_t *s, + uint8_t ima_data[], + const int16_t amp[], + int len); + +/*! Decode a buffer of IMA ADPCM data to linear PCM. + \param s The IMA ADPCM context. + \param amp The audio sample buffer. + \param ima_data The IMA ADPCM data + \param ima_bytes The number of bytes of IMA ADPCM data + \return The number of samples returned. */ +SPAN_DECLARE(int) ima_adpcm_decode(ima_adpcm_state_t *s, + int16_t amp[], + const uint8_t ima_data[], + int ima_bytes); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/logging.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/logging.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,141 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * logging.h - definitions for error and debug logging. + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: logging.h,v 1.20 2009/02/10 17:44:18 steveu Exp $ + */ + +/*! \file */ + +/*! \page logging_page Logging +\section logging_page_sec_1 What does it do? +???. +*/ + +#if !defined(_SPANDSP_LOGGING_H_) +#define _SPANDSP_LOGGING_H_ + +/*! General logging function for spandsp logging. */ +typedef void (*message_handler_func_t)(int level, const char *text); + +/*! Error logging function for spandsp logging. */ +typedef void (*error_handler_func_t)(const char *text); + +/* Logging elements */ +enum +{ + SPAN_LOG_SEVERITY_MASK = 0x00FF, + SPAN_LOG_SHOW_DATE = 0x0100, + SPAN_LOG_SHOW_SAMPLE_TIME = 0x0200, + SPAN_LOG_SHOW_SEVERITY = 0x0400, + SPAN_LOG_SHOW_PROTOCOL = 0x0800, + SPAN_LOG_SHOW_VARIANT = 0x1000, + SPAN_LOG_SHOW_TAG = 0x2000, + SPAN_LOG_SUPPRESS_LABELLING = 0x8000 +}; + +/* Logging severity levels */ +enum +{ + SPAN_LOG_NONE = 0, + SPAN_LOG_ERROR = 1, + SPAN_LOG_WARNING = 2, + SPAN_LOG_PROTOCOL_ERROR = 3, + SPAN_LOG_PROTOCOL_WARNING = 4, + SPAN_LOG_FLOW = 5, + SPAN_LOG_FLOW_2 = 6, + SPAN_LOG_FLOW_3 = 7, + SPAN_LOG_DEBUG = 8, + SPAN_LOG_DEBUG_2 = 9, + SPAN_LOG_DEBUG_3 = 10 +}; + +/*! + Logging descriptor. This defines the working state for a single instance of + the logging facility for spandsp. +*/ +typedef struct logging_state_s logging_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Test if logging of a specified severity level is enabled. + \brief Test if logging of a specified severity level is enabled. + \param s The logging context. + \param level The severity level to be tested. + \return TRUE if logging is enable, else FALSE. +*/ +SPAN_DECLARE(int) span_log_test(logging_state_t *s, int level); + +/*! Generate a log entry. + \brief Generate a log entry. + \param s The logging context. + \param level The severity level of the entry. + \param format ??? + \return 0 if no output generated, else 1. +*/ +SPAN_DECLARE(int) span_log(logging_state_t *s, int level, const char *format, ...); + +/*! Generate a log entry displaying the contents of a buffer. + \brief Generate a log entry displaying the contents of a buffer + \param s The logging context. + \param level The severity level of the entry. + \param tag A label for the log entry. + \param buf The buffer to be dumped to the log. + \param len The length of buf. + \return 0 if no output generated, else 1. +*/ +SPAN_DECLARE(int) span_log_buf(logging_state_t *s, int level, const char *tag, const uint8_t *buf, int len); + +SPAN_DECLARE(int) span_log_set_level(logging_state_t *s, int level); + +SPAN_DECLARE(int) span_log_set_tag(logging_state_t *s, const char *tag); + +SPAN_DECLARE(int) span_log_set_protocol(logging_state_t *s, const char *protocol); + +SPAN_DECLARE(int) span_log_set_sample_rate(logging_state_t *s, int samples_per_second); + +SPAN_DECLARE(int) span_log_bump_samples(logging_state_t *s, int samples); + +SPAN_DECLARE(void) span_log_set_message_handler(logging_state_t *s, message_handler_func_t func); + +SPAN_DECLARE(void) span_log_set_error_handler(logging_state_t *s, error_handler_func_t func); + +SPAN_DECLARE(void) span_set_message_handler(message_handler_func_t func); + +SPAN_DECLARE(void) span_set_error_handler(error_handler_func_t func); + +SPAN_DECLARE(logging_state_t *) span_log_init(logging_state_t *s, int level, const char *tag); + +SPAN_DECLARE(int) span_log_release(logging_state_t *s); + +SPAN_DECLARE(int) span_log_free(logging_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/lpc10.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/lpc10.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,120 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * lpc10.h - LPC10 low bit rate speech codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: lpc10.h,v 1.22 2009/04/11 18:11:19 steveu Exp $ + */ + +#if !defined(_SPANDSP_LPC10_H_) +#define _SPANDSP_LPC10_H_ + +/*! \page lpc10_page LPC10 encoding and decoding +\section lpc10_page_sec_1 What does it do? +The LPC10 module implements the US Department of Defense LPC10 +codec. This codec produces compressed data at 2400bps. At such +a low rate high fidelity cannot be expected. However, the speech +clarity is quite good, and this codec is unencumbered by patent +or other restrictions. + +\section lpc10_page_sec_2 How does it work? +???. +*/ + +#define LPC10_SAMPLES_PER_FRAME 180 +#define LPC10_BITS_IN_COMPRESSED_FRAME 54 + +/*! + LPC10 codec unpacked frame. +*/ +typedef struct +{ + /*! Pitch */ + int32_t ipitch; + /*! Energy */ + int32_t irms; + /*! Reflection coefficients */ + int32_t irc[10]; +} lpc10_frame_t; + +/*! + LPC10 codec encoder state descriptor. This defines the state of + a single working instance of the LPC10 encoder. +*/ +typedef struct lpc10_encode_state_s lpc10_encode_state_t; + +/*! + LPC10 codec decoder state descriptor. This defines the state of + a single working instance of the LPC10 decoder. +*/ +typedef struct lpc10_decode_state_s lpc10_decode_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Initialise an LPC10e encode context. + \param s The LPC10e context + \param error_correction ??? + \return A pointer to the LPC10e context, or NULL for error. */ +SPAN_DECLARE(lpc10_encode_state_t *) lpc10_encode_init(lpc10_encode_state_t *s, int error_correction); + +SPAN_DECLARE(int) lpc10_encode_release(lpc10_encode_state_t *s); + +SPAN_DECLARE(int) lpc10_encode_free(lpc10_encode_state_t *s); + +/*! Encode a buffer of linear PCM data to LPC10e. + \param s The LPC10e context. + \param ima_data The LPC10e data produced. + \param amp The audio sample buffer. + \param len The number of samples in the buffer. This must be a multiple of 180, as + this is the number of samples on a frame. + \return The number of bytes of LPC10e data produced. */ +SPAN_DECLARE(int) lpc10_encode(lpc10_encode_state_t *s, uint8_t code[], const int16_t amp[], int len); + +/*! Initialise an LPC10e decode context. + \param s The LPC10e context + \param error_correction ??? + \return A pointer to the LPC10e context, or NULL for error. */ +SPAN_DECLARE(lpc10_decode_state_t *) lpc10_decode_init(lpc10_decode_state_t *st, int error_correction); + +SPAN_DECLARE(int) lpc10_decode_release(lpc10_decode_state_t *s); + +SPAN_DECLARE(int) lpc10_decode_free(lpc10_decode_state_t *s); + +/*! Decode a buffer of LPC10e data to linear PCM. + \param s The LPC10e context. + \param amp The audio sample buffer. + \param code The LPC10e data. + \param len The number of bytes of LPC10e data to be decoded. This must be a multiple of 7, + as each frame is packed into 7 bytes. + \return The number of samples returned. */ +SPAN_DECLARE(int) lpc10_decode(lpc10_decode_state_t *s, int16_t amp[], const uint8_t code[], int len); + + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of include ---------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/modem_connect_tones.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/modem_connect_tones.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,177 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * modem_connect_tones.c - Generation and detection of tones + * associated with modems calling and + * answering calls. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: modem_connect_tones.h,v 1.24 2009/06/02 16:03:56 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_MODEM_CONNECT_TONES_H_) +#define _SPANDSP_MODEM_CONNECT_TONES_H_ + +/*! \page modem_connect_tones_page Modem connect tone detection + +\section modem_connect_tones_page_sec_1 What does it do? +Some telephony terminal equipment, such as modems, require a channel which is as +clear as possible. They use their own echo cancellation. If the network is also +performing echo cancellation the two cancellors can end up squabbling about the +nature of the channel, with bad results. A special tone is defined which should +cause the network to disable any echo cancellation processes. This is the echo +canceller disable tone. + +The tone detector's design assumes the channel is free of any DC component. + +\section modem_connect_tones_page_sec_2 How does it work? +A sharp notch filter is implemented as a single bi-quad section. The presence of +the 2100Hz disable tone is detected by comparing the notched filtered energy +with the unfiltered energy. If the notch filtered energy is much lower than the +unfiltered energy, then a large proportion of the energy must be at the notch +frequency. This type of detector may seem less intuitive than using a narrow +bandpass filter to isolate the energy at the notch freqency. However, a sharp +bandpass implemented as an IIR filter rings badly. The reciprocal notch filter +is very well behaved for our purpose. +*/ + +enum +{ + /*! \brief This is reported when a tone stops. */ + MODEM_CONNECT_TONES_NONE = 0, + /*! \brief CNG tone is a pure 1100Hz tone, in 0.5s bursts, with 3s silences in between. The + bursts repeat for as long as is required. */ + MODEM_CONNECT_TONES_FAX_CNG = 1, + /*! \brief ANS tone is a pure continuous 2100Hz+-15Hz tone for 3.3s+-0.7s. */ + MODEM_CONNECT_TONES_ANS = 2, + /*! \brief ANS with phase reversals tone is a 2100Hz+-15Hz tone for 3.3s+-0.7s, with a 180 degree + phase jump every 450ms+-25ms. */ + MODEM_CONNECT_TONES_ANS_PR = 3, + /*! \brief The ANSam tone is a version of ANS with 20% of 15Hz+-0.1Hz AM modulation, as per V.8 */ + MODEM_CONNECT_TONES_ANSAM = 4, + /*! \brief The ANSam with phase reversals tone is a version of ANS_PR with 20% of 15Hz+-0.1Hz AM + modulation, as per V.8 */ + MODEM_CONNECT_TONES_ANSAM_PR = 5, + /*! \brief FAX preamble in a string of V.21 HDLC flag octets. */ + MODEM_CONNECT_TONES_FAX_PREAMBLE = 6, + /*! \brief CED tone is the same as ANS tone. FAX preamble in a string of V.21 HDLC flag octets. + This is only valid as a tone type to receive. It is never reported as a detected tone + type. The report will either be for FAX preamble or CED/ANS tone. */ + MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE = 7 +}; + +/*! \brief FAX CED tone is the same as ANS tone. */ +#define MODEM_CONNECT_TONES_FAX_CED MODEM_CONNECT_TONES_ANS + +/*! + Modem connect tones generator descriptor. This defines the state + of a single working instance of the tone generator. +*/ +typedef struct modem_connect_tones_tx_state_s modem_connect_tones_tx_state_t; + +/*! + Modem connect tones receiver descriptor. This defines the state + of a single working instance of the tone detector. +*/ +typedef struct modem_connect_tones_rx_state_s modem_connect_tones_rx_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! \brief Initialise an instance of the modem connect tones generator. + \param s The context. +*/ +SPAN_DECLARE(modem_connect_tones_tx_state_t *) modem_connect_tones_tx_init(modem_connect_tones_tx_state_t *s, + int tone_type); + +/*! \brief Release an instance of the modem connect tones generator. + \param s The context. + \return 0 for OK, else -1. +*/ +SPAN_DECLARE(int) modem_connect_tones_tx_release(modem_connect_tones_tx_state_t *s); + +/*! \brief Free an instance of the modem connect tones generator. + \param s The context. + \return 0 for OK, else -1. +*/ +SPAN_DECLARE(int) modem_connect_tones_tx_free(modem_connect_tones_tx_state_t *s); + +/*! \brief Generate a block of modem connect tones samples. + \param s The context. + \param amp An array of signal samples. + \param len The number of samples to generate. + \return The number of samples generated. +*/ +SPAN_DECLARE_NONSTD(int) modem_connect_tones_tx(modem_connect_tones_tx_state_t *s, + int16_t amp[], + int len); + +/*! \brief Process a block of samples through an instance of the modem connect + tones detector. + \param s The context. + \param amp An array of signal samples. + \param len The number of samples in the array. + \return The number of unprocessed samples. +*/ +SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *s, + const int16_t amp[], + int len); + +/*! \brief Test if a modem_connect tone has been detected. + \param s The context. + \return TRUE if tone is detected, else FALSE. +*/ +SPAN_DECLARE(int) modem_connect_tones_rx_get(modem_connect_tones_rx_state_t *s); + +/*! \brief Initialise an instance of the modem connect tones detector. + \param s The context. + \param tone_type The type of connect tone being tested for. + \param tone_callback An optional callback routine, used to report tones + \param user_data An opaque pointer passed to the callback routine, + \return A pointer to the context. +*/ +SPAN_DECLARE(modem_connect_tones_rx_state_t *) modem_connect_tones_rx_init(modem_connect_tones_rx_state_t *s, + int tone_type, + tone_report_func_t tone_callback, + void *user_data); + +/*! \brief Release an instance of the modem connect tones detector. + \param s The context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) modem_connect_tones_rx_release(modem_connect_tones_rx_state_t *s); + +/*! \brief Free an instance of the modem connect tones detector. + \param s The context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) modem_connect_tones_rx_free(modem_connect_tones_rx_state_t *s); + +SPAN_DECLARE(const char *) modem_connect_tone_to_str(int tone); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/modem_echo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/modem_echo.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,129 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * modem_echo.h - An echo cancellor, suitable for electrical echos in GSTN modems + * + * Written by Steve Underwood + * + * Copyright (C) 2001, 2004 Steve Underwood + * + * Based on a bit from here, a bit from there, eye of toad, + * ear of bat, etc - plus, of course, my own 2 cents. + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: modem_echo.h,v 1.14 2009/09/22 13:11:04 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_MODEM_ECHO_H_) +#define _SPANDSP_MODEM_ECHO_H_ + +/*! \page modem_echo_can_page Line echo cancellation for modems + +\section modem_echo_can_page_sec_1 What does it do? +This module aims to cancel electrical echoes (e.g. from 2-4 wire hybrids) +in modem applications. It is not very suitable for speech applications, which +require additional refinements for satisfactory performance. It is, however, more +efficient and better suited to modem applications. + +\section modem_echo_can_page_sec_2 How does it work? +The heart of the echo cancellor is an adaptive FIR filter. This is adapted to +match the impulse response of the environment being cancelled. It must be long +enough to adequately cover the duration of that impulse response. The signal +being transmitted into the environment being cancelled is passed through the +FIR filter. The resulting output is an estimate of the echo signal. This is +then subtracted from the received signal, and the result should be an estimate +of the signal which originates within the environment being cancelled (people +talking in the room, or the signal from the far end of a telephone line) free +from the echos of our own transmitted signal. + +The FIR filter is adapted using the least mean squares (LMS) algorithm. This +algorithm is attributed to Widrow and Hoff, and was introduced in 1960. It is +the commonest form of filter adaption used in things like modem line equalisers +and line echo cancellers. It works very well if the signal level is constant, +which is true for a modem signal. To ensure good performa certain conditions must +be met: + + - The transmitted signal has weak self-correlation. + - There is no signal being generated within the environment being cancelled. + +The difficulty is that neither of these can be guaranteed. If the adaption is +performed while transmitting noise (or something fairly noise like, such as +voice) the adaption works very well. If the adaption is performed while +transmitting something highly correlative (e.g. tones, like DTMF), the adaption +can go seriously wrong. The reason is there is only one solution for the +adaption on a near random signal. For a repetitive signal, there are a number of +solutions which converge the adaption, and nothing guides the adaption to choose +the correct one. + +\section modem_echo_can_page_sec_3 How do I use it? +The echo cancellor processes both the transmit and receive streams sample by +sample. The processing function is not declared inline. Unfortunately, +cancellation requires many operations per sample, so the call overhead is only a +minor burden. +*/ + +#include "fir.h" + +/*! + Modem line echo canceller descriptor. This defines the working state for a line + echo canceller. +*/ +typedef struct modem_echo_can_state_s modem_echo_can_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Create a modem echo canceller context. + \param len The length of the canceller, in samples. + eturn The new canceller context, or NULL if the canceller could not be created. +*/ +SPAN_DECLARE(modem_echo_can_state_t *) modem_echo_can_create(int len); + +/*! Free a modem echo canceller context. + \param ec The echo canceller context. +*/ +SPAN_DECLARE(void) modem_echo_can_free(modem_echo_can_state_t *ec); + +/*! Flush (reinitialise) a modem echo canceller context. + \param ec The echo canceller context. +*/ +SPAN_DECLARE(void) modem_echo_can_flush(modem_echo_can_state_t *ec); + +/*! Set the adaption mode of a modem echo canceller context. + \param ec The echo canceller context. + \param adapt The mode. +*/ +SPAN_DECLARE(void) modem_echo_can_adaption_mode(modem_echo_can_state_t *ec, int adapt); + +/*! Process a sample through a modem echo canceller. + \param ec The echo canceller context. + \param tx The transmitted audio sample. + \param rx The received audio sample. + eturn The clean (echo cancelled) received sample. +*/ +SPAN_DECLARE(int16_t) modem_echo_can_update(modem_echo_can_state_t *ec, int16_t tx, int16_t rx); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/noise.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/noise.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,131 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * noise.h - A low complexity audio noise generator, suitable for + * real time generation (current just approx AWGN) + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: noise.h,v 1.17 2009/02/10 13:06:47 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_NOISE_H_) +#define _SPANDSP_NOISE_H_ + +/*! \page noise_page Noise generation + +\section noise_page_sec_1 What does it do? +It generates audio noise. Currently it only generates reasonable quality +AWGN. It is designed to be of sufficiently low complexity to generate large +volumes of reasonable quality noise, in real time. + +Hoth noise is used to model indoor ambient noise when evaluating communications +systems such as telephones. It is named after D.F. Hoth, who made the first +systematic study of this. The official definition of Hoth noise is IEEE +standard 269-2001 (revised from 269-1992), "Draft Standard Methods for Measuring +Transmission Performance of Analog and Digital Telephone Sets, Handsets and Headsets." + +The table below gives the spectral density of Hoth noise, adjusted in level to produce +a reading of 50 dBA. + +Freq (Hz) Spectral Bandwidth Total power in + density 10 log_f each 1/3 octave band + (dB SPL/Hz) (dB) (dB SPL) + 100 32.4 13.5 45.9 + 125 30.9 14.7 45.5 + 160 29.1 15.7 44.9 + 200 27.6 16.5 44.1 + 250 26.0 17.6 43.6 + 315 24.4 18.7 43.1 + 400 22.7 19.7 42.3 + 500 21.1 20.6 41.7 + 630 19.5 21.7 41.2 + 800 17.8 22.7 40.4 +1000 16.2 23.5 39.7 +1250 14.6 24.7 39.3 +1600 12.9 25.7 38.7 +2000 11.3 26.5 37.8 +2500 9.6 27.6 37.2 +3150 7.8 28.7 36.5 +4000 5.4 29.7 34.8 +5000 2.6 30.6 33.2 +6300 -1.3 31.7 30.4 +8000 -6.6 32.7 26.0 + +The tolerance for each 1/3rd octave band is ¡Ó3dB. + +\section awgn_page_sec_2 How does it work? +The central limit theorem says if you add a few random numbers together, +the result starts to look Gaussian. In this case we sum 8 random numbers. +The result is fast, and perfectly good as a noise source for many purposes. +It should not be trusted as a high quality AWGN generator, for elaborate +modelling purposes. +*/ + +enum +{ + NOISE_CLASS_AWGN = 1, + NOISE_CLASS_HOTH +}; + +/*! + Noise generator descriptor. This contains all the state information for an instance + of the noise generator. + */ +typedef struct noise_state_s noise_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Initialise an audio noise generator. + \brief Initialise an audio noise generator. + \param s The noise generator context. + \param seed A seed for the underlying random number generator. + \param level The noise power level in dBmO. + \param class_of_noise The class of noise (e.g. AWGN). + \param quality A parameter which permits speed and accuracy of the noise + generation to be adjusted. + \return A pointer to the noise generator context. +*/ +SPAN_DECLARE(noise_state_t *) noise_init_dbm0(noise_state_t *s, int seed, float level, int class_of_noise, int quality); + +SPAN_DECLARE(noise_state_t *) noise_init_dbov(noise_state_t *s, int seed, float level, int class_of_noise, int quality); + +SPAN_DECLARE(int) noise_release(noise_state_t *s); + +SPAN_DECLARE(int) noise_free(noise_state_t *s); + +/*! Generate a sample of audio noise. + \brief Generate a sample of audio noise. + \param s The noise generator context. + \return The generated sample. +*/ +SPAN_DECLARE(int16_t) noise(noise_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/oki_adpcm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/oki_adpcm.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,104 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * oki_adpcm.h - Conversion routines between linear 16 bit PCM data and + * OKI (Dialogic) ADPCM format. + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: oki_adpcm.h,v 1.24 2009/02/10 13:06:47 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_OKI_ADPCM_H_) +#define _SPANDSP_OKI_ADPCM_H_ + +/*! \page okiadpcm_page OKI (Dialogic) ADPCM encoding and decoding +\section okiadpcm_page_sec_1 What does it do? +OKI ADPCM is widely used in the CTI industry because it is the principal format +supported by Dialogic. As the market leader, they tend to define "common +practice". It offers a good balance of simplicity and quality at rates of +24kbps or 32kbps. 32kbps is obtained by ADPCM compressing 8k samples/second linear +PCM. 24kbps is obtained by resampling to 6k samples/second and using the same ADPCM +compression algorithm on the slower samples. + +The algorithms for this ADPCM codec can be found in "PC Telephony - The complete guide +to designing, building and programming systems using Dialogic and Related Hardware" +by Bob Edgar. pg 272-276. */ + +/*! + Oki (Dialogic) ADPCM conversion state descriptor. This defines the state of + a single working instance of the Oki ADPCM converter. This is used for + either linear to ADPCM or ADPCM to linear conversion. +*/ +typedef struct oki_adpcm_state_s oki_adpcm_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Initialise an Oki ADPCM encode or decode context. + \param s The Oki ADPCM context. + \param bit_rate The required bit rate for the ADPCM data. + The valid rates are 24000 and 32000. + \return A pointer to the Oki ADPCM context, or NULL for error. */ +SPAN_DECLARE(oki_adpcm_state_t *) oki_adpcm_init(oki_adpcm_state_t *s, + int bit_rate); + +/*! Release an Oki ADPCM encode or decode context. + \param s The Oki ADPCM context. + \return 0 for OK. */ +SPAN_DECLARE(int) oki_adpcm_release(oki_adpcm_state_t *s); + +/*! Free an Oki ADPCM encode or decode context. + \param s The Oki ADPCM context. + \return 0 for OK. */ +SPAN_DECLARE(int) oki_adpcm_free(oki_adpcm_state_t *s); + +/*! Decode a buffer of Oki ADPCM data to linear PCM. + \param s The Oki ADPCM context. + \param amp The audio sample buffer. + \param oki_data + \param oki_bytes + \return The number of samples returned. */ +SPAN_DECLARE(int) oki_adpcm_decode(oki_adpcm_state_t *s, + int16_t amp[], + const uint8_t oki_data[], + int oki_bytes); + +/*! Encode a buffer of linear PCM data to Oki ADPCM. + \param s The Oki ADPCM context. + \param oki_data The Oki ADPCM data produced + \param amp The audio sample buffer. + \param len The number of samples in the buffer. + \return The number of bytes of Oki ADPCM data produced. */ +SPAN_DECLARE(int) oki_adpcm_encode(oki_adpcm_state_t *s, + uint8_t oki_data[], + const int16_t amp[], + int len); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/playout.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/playout.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,216 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * playout.h + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: playout.h,v 1.14 2009/02/10 13:06:47 steveu Exp $ + */ + +#if !defined(_SPANDSP_PLAYOUT_H_) +#define _SPANDSP_PLAYOUT_H_ + +/*! \page playout_page Play-out (jitter buffering) +\section playout_page_sec_1 What does it do? +The play-out module provides a static or dynamic length buffer for received frames of +audio or video data. It's goal is to maximise the receiver's tolerance of jitter in the +timing of the received frames. + +Dynamic buffers are generally good for speech, since they adapt to provide the smallest delay +consistent with a low rate of packets arriving too late to be used. For things like FoIP and +MoIP, a static length of buffer is normally necessary. Any attempt to elastically change the +buffer length would wreck a modem's data flow. +*/ + +/* Return codes */ +enum +{ + PLAYOUT_OK = 0, + PLAYOUT_ERROR, + PLAYOUT_EMPTY, + PLAYOUT_NOFRAME, + PLAYOUT_FILLIN, + PLAYOUT_DROP +}; + +/* Frame types */ +#define PLAYOUT_TYPE_CONTROL 0 +#define PLAYOUT_TYPE_SILENCE 1 +#define PLAYOUT_TYPE_SPEECH 2 + +typedef int timestamp_t; + +typedef struct playout_frame_s +{ + /*! The actual frame data */ + void *data; + /*! The type of frame */ + int type; + /*! The timestamp assigned by the sending end */ + timestamp_t sender_stamp; + /*! The timespan covered by the data in this frame */ + timestamp_t sender_len; + /*! The timestamp assigned by the receiving end */ + timestamp_t receiver_stamp; + /*! Pointer to the next earlier frame */ + struct playout_frame_s *earlier; + /*! Pointer to the next later frame */ + struct playout_frame_s *later; +} playout_frame_t; + +/*! + Playout (jitter buffer) descriptor. This defines the working state + for a single instance of playout buffering. +*/ +typedef struct +{ + /*! TRUE if the buffer is dynamically sized */ + int dynamic; + /*! The minimum length (dynamic) or fixed length (static) of the buffer */ + int min_length; + /*! The maximum length (dynamic) or fixed length (static) of the buffer */ + int max_length; + /*! The target filter threshold for adjusting dynamic buffering. */ + int dropable_threshold; + + int start; + + /*! The queued frame list */ + playout_frame_t *first_frame; + playout_frame_t *last_frame; + /*! The free frame pool */ + playout_frame_t *free_frames; + + /*! The total frames input to the buffer, to date. */ + int frames_in; + /*! The total frames output from the buffer, to date. */ + int frames_out; + /*! The number of frames received out of sequence. */ + int frames_oos; + /*! The number of frames which were discarded, due to late arrival. */ + int frames_late; + /*! The number of frames which were never received. */ + int frames_missing; + /*! The number of frames trimmed from the stream, due to buffer shrinkage. */ + int frames_trimmed; + + timestamp_t latest_expected; + /*! The present jitter adjustment */ + timestamp_t current; + /*! The sender_stamp of the last speech frame */ + timestamp_t last_speech_sender_stamp; + /*! The duration of the last speech frame */ + timestamp_t last_speech_sender_len; + + int not_first; + /*! The time since the target buffer length was last changed. */ + timestamp_t since_last_step; + /*! Filter state for tracking the packets arriving just in time */ + int32_t state_just_in_time; + /*! Filter state for tracking the packets arriving late */ + int32_t state_late; + /*! The current target length of the buffer */ + int target_buffer_length; + /*! The current actual length of the buffer, which may lag behind the target value */ + int actual_buffer_length; +} playout_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Queue a frame + \param s The play-out context. + \param data The frame data. + \param sender_len Length of frame (for voice) in timestamp units. + \param sender_stamp Sending end's time stamp. + \param receiver_stamp Local time at which packet was received, in timestamp units. + \return One of + PLAYOUT_OK: Frame queued OK. + PLAYOUT_ERROR: Some problem occured - e.g. out of memory. */ +SPAN_DECLARE(int) playout_put(playout_state_t *s, void *data, int type, timestamp_t sender_len, timestamp_t sender_stamp, timestamp_t receiver_stamp); + +/*! Get the next frame. + \param s The play-out context. + \param frame The frame. + \param sender_stamp The sender's timestamp. + \return One of + PLAYOUT_OK: Suitable frame found. + PLAYOUT_DROP: A frame which should be dropped was found (e.g. it arrived too late). + The caller should request the same time again when this occurs. + PLAYOUT_NOFRAME: There's no frame scheduled for this time. + PLAYOUT_FILLIN: Synthetic signal must be generated, as no real data is available for + this time (either we need to grow, or there was a lost frame). + PLAYOUT_EMPTY: The buffer is empty. + */ +SPAN_DECLARE(int) playout_get(playout_state_t *s, playout_frame_t *frame, timestamp_t sender_stamp); + +/*! Unconditionally get the first buffered frame. This may be used to clear out the queue, and free + all its contents, before the context is freed. + \param s The play-out context. + \return The frame, or NULL is the queue is empty. */ +SPAN_DECLARE(playout_frame_t *) playout_get_unconditional(playout_state_t *s); + +/*! Find the current length of the buffer. + \param s The play-out context. + \return The length of the buffer. */ +SPAN_DECLARE(timestamp_t) playout_current_length(playout_state_t *s); + +/*! Find the time at which the next queued frame is due to play. + Note: This value may change backwards as freshly received out of order frames are + added to the buffer. + \param s The play-out context. + \return The next timestamp. */ +SPAN_DECLARE(timestamp_t) playout_next_due(playout_state_t *s); + +/*! Reset an instance of play-out buffering. + NOTE: The buffer should be empty before you call this function, otherwise + you will leak queued frames, and some internal structures + \param s The play-out context. + \param min_length Minimum length of the buffer, in samples. + \param max_length Maximum length of the buffer, in samples. If this equals min_length, static + length buffering is used. */ +SPAN_DECLARE(void) playout_restart(playout_state_t *s, int min_length, int max_length); + +/*! Create a new instance of play-out buffering. + \param min_length Minimum length of the buffer, in samples. + \param max_length Maximum length of the buffer, in samples. If this equals min_length, static + length buffering is used. + \return The new context */ +SPAN_DECLARE(playout_state_t *) playout_init(int min_length, int max_length); + +/*! Release an instance of play-out buffering. + \param s The play-out context to be releaased + \return 0 if OK, else -1 */ +SPAN_DECLARE(int) playout_release(playout_state_t *s); + +/*! Free an instance of play-out buffering. + \param s The play-out context to be destroyed + \return 0 if OK, else -1 */ +SPAN_DECLARE(int) playout_free(playout_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/plc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/plc.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,173 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * plc.h + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: plc.h,v 1.21 2009/02/10 13:06:47 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_PLC_H_) +#define _SPANDSP_PLC_H_ + +/*! \page plc_page Packet loss concealment +\section plc_page_sec_1 What does it do? +The packet loss concealment module provides a synthetic fill-in signal, to minimise +the audible effect of lost packets in VoIP applications. It is not tied to any +particular codec, and could be used with almost any codec which does not +specify its own procedure for packet loss concealment. + +Where a codec specific concealment procedure exists, that algorithm is usually built +around knowledge of the characteristics of the particular codec. It will, therefore, +generally give better results for that particular codec than this generic concealer will. + +The PLC code implements an algorithm similar to the one described in Appendix 1 of G.711. +However, the G.711 algorithm is optimised for 10ms packets. Few people use such small +packets. 20ms is a much more common value, and longer packets are also quite common. The +algorithm has been adjusted with this in mind. Also, the G.711 approach causes an +algorithmic delay, and requires significant buffer manipulation when there is no packet +loss. The algorithm used here avoids this. It causes no delay, and achieves comparable +quality with normal speech. + +Note that both this algorithm, and the one in G.711 are optimised for speech. For most kinds +of music a much slower decay on bursts of lost packets give better results. + +\section plc_page_sec_2 How does it work? +While good packets are being received, the plc_rx() routine keeps a record of the trailing +section of the known speech signal. If a packet is missed, plc_fillin() is called to produce +a synthetic replacement for the real speech signal. The average mean difference function +(AMDF) is applied to the last known good signal, to determine its effective pitch. +Based on this, the last pitch period of signal is saved. Essentially, this cycle of speech +will be repeated over and over until the real speech resumes. However, several refinements +are needed to obtain smooth pleasant sounding results. + +- The two ends of the stored cycle of speech will not always fit together smoothly. This can + cause roughness, or even clicks, at the joins between cycles. To soften this, the + 1/4 pitch period of real speech preceeding the cycle to be repeated is blended with the last + 1/4 pitch period of the cycle to be repeated, using an overlap-add (OLA) technique (i.e. + in total, the last 5/4 pitch periods of real speech are used). + +- The start of the synthetic speech will not always fit together smoothly with the tail of + real speech passed on before the erasure was identified. Ideally, we would like to modify + the last 1/4 pitch period of the real speech, to blend it into the synthetic speech. However, + it is too late for that. We could have delayed the real speech a little, but that would + require more buffer manipulation, and hurt the efficiency of the no-lost-packets case + (which we hope is the dominant case). Instead we use a degenerate form of OLA to modify + the start of the synthetic data. The last 1/4 pitch period of real speech is time reversed, + and OLA is used to blend it with the first 1/4 pitch period of synthetic speech. The result + seems quite acceptable. + +- As we progress into the erasure, the chances of the synthetic signal being anything like + correct steadily fall. Therefore, the volume of the synthesized signal is made to decay + linearly, such that after 50ms of missing audio it is reduced to silence. + +- When real speech resumes, an extra 1/4 pitch period of synthetic speech is blended with the + start of the real speech. If the erasure is small, this smoothes the transition. If the erasure + is long, and the synthetic signal has faded to zero, the blending softens the start up of the + real signal, avoiding a kind of "click" or "pop" effect that might occur with a sudden onset. + +\section plc_page_sec_3 How do I use it? +Before audio is processed, call plc_init() to create an instance of the packet loss +concealer. For each received audio packet that is acceptable (i.e. not including those being +dropped for being too late) call plc_rx() to record the content of the packet. Note this may +modify the packet a little after a period of packet loss, to blend real synthetic data smoothly. +When a real packet is not available in time, call plc_fillin() to create a sythetic substitute. +That's it! +*/ + +/*! Minimum allowed pitch (66 Hz) */ +#define PLC_PITCH_MIN 120 +/*! Maximum allowed pitch (200 Hz) */ +#define PLC_PITCH_MAX 40 +/*! Maximum pitch OLA window */ +#define PLC_PITCH_OVERLAP_MAX (PLC_PITCH_MIN >> 2) +/*! The length over which the AMDF function looks for similarity (20 ms) */ +#define CORRELATION_SPAN 160 +/*! History buffer length. The buffer much also be at leat 1.25 times + PLC_PITCH_MIN, but that is much smaller than the buffer needs to be for + the pitch assessment. */ +#define PLC_HISTORY_LEN (CORRELATION_SPAN + PLC_PITCH_MIN) + +/*! + The generic packet loss concealer context. +*/ +typedef struct +{ + /*! Consecutive erased samples */ + int missing_samples; + /*! Current offset into pitch period */ + int pitch_offset; + /*! Pitch estimate */ + int pitch; + /*! Buffer for a cycle of speech */ + float pitchbuf[PLC_PITCH_MIN]; + /*! History buffer */ + int16_t history[PLC_HISTORY_LEN]; + /*! Current pointer into the history buffer */ + int buf_ptr; +} plc_state_t; + + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Process a block of received audio samples for PLC. + \brief Process a block of received audio samples for PLC. + \param s The packet loss concealer context. + \param amp The audio sample buffer. + \param len The number of samples in the buffer. + \return The number of samples in the buffer. */ +SPAN_DECLARE(int) plc_rx(plc_state_t *s, int16_t amp[], int len); + +/*! Fill-in a block of missing audio samples. + \brief Fill-in a block of missing audio samples. + \param s The packet loss concealer context. + \param amp The audio sample buffer. + \param len The number of samples to be synthesised. + \return The number of samples synthesized. */ +SPAN_DECLARE(int) plc_fillin(plc_state_t *s, int16_t amp[], int len); + +/*! Initialise a packet loss concealer context. + \brief Initialise a PLC context. + \param s The packet loss concealer context. + \return A pointer to the the packet loss concealer context. */ +SPAN_DECLARE(plc_state_t *) plc_init(plc_state_t *s); + +/*! Release a packet loss concealer context. + \param s The packet loss concealer context. + \return 0 for OK. */ +SPAN_DECLARE(int) plc_release(plc_state_t *s); + +/*! Free a packet loss concealer context. + \param s The packet loss concealer context. + \return 0 for OK. */ +SPAN_DECLARE(int) plc_free(plc_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/power_meter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/power_meter.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,154 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * power_meter.h + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: power_meter.h,v 1.19 2009/05/19 14:15:09 steveu Exp $ + */ + +#if !defined(_POWER_METER_H_) +#define _POWER_METER_H_ + +/*! \page power_meter_page Power metering + +\section power_meter_page_sec_1 What does it do? +The power metering module implements a simple IIR type running power meter. The damping +factor of the IIR is selectable when the meter instance is created. + +Note that the definition of dBOv is quite vague in most places - is it peak since wave, +peak square wave, etc.? This code is based on the well defined wording in RFC3389: + +"For example, in the case of a u-law system, the reference would be a square wave with +values +/-8031, and this square wave represents 0dBov. This translates into 6.18dBm0". + +\section power_meter_page_sec_2 How does it work? +*/ + +/*! + Power meter descriptor. This defines the working state for a + single instance of a power measurement device. +*/ +typedef struct +{ + /*! The shift factor, which controls the damping of the power meter. */ + int shift; + + /*! The current power reading. */ + int32_t reading; +} power_meter_t; + +typedef struct +{ + power_meter_t short_term; + power_meter_t medium_term; + int signal_present; + int32_t surge; + int32_t sag; + int32_t min; +} power_surge_detector_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Initialise a power meter context. + \brief Initialise a power meter context. + \param s The power meter context. + \param shift The shift to be used by the IIR filter. + \return The power meter context. */ +SPAN_DECLARE(power_meter_t *) power_meter_init(power_meter_t *s, int shift); + +SPAN_DECLARE(int) power_meter_release(power_meter_t *s); + +SPAN_DECLARE(int) power_meter_free(power_meter_t *s); + +/*! Change the damping factor of a power meter context. + \brief Change the damping factor of a power meter context. + \param s The power meter context. + \param shift The new shift to be used by the IIR filter. + \return The power meter context. */ +SPAN_DECLARE(power_meter_t *) power_meter_damping(power_meter_t *s, int shift); + +/*! Update a power meter. + \brief Update a power meter. + \param s The power meter context. + \param amp The amplitude of the new audio sample. + \return The current power meter reading. */ +SPAN_DECLARE(int32_t) power_meter_update(power_meter_t *s, int16_t amp); + +/*! Get the current power meter reading. + \brief Get the current power meter reading. + \param s The power meter context. + \return The current power meter reading. */ +SPAN_DECLARE(int32_t) power_meter_current(power_meter_t *s); + +/*! Get the current power meter reading, in dBm0. + \brief Get the current power meter reading, in dBm0. + \param s The power meter context. + \return The current power meter reading, in dBm0. */ +SPAN_DECLARE(float) power_meter_current_dbm0(power_meter_t *s); + +/*! Get the current power meter reading, in dBOv. + \brief Get the current power meter reading, in dBOv. + \param s The power meter context. + \return The current power meter reading, in dBOv. */ +SPAN_DECLARE(float) power_meter_current_dbov(power_meter_t *s); + +/*! Get the power meter reading which represents a specified power level in dBm0. + \brief Get the current power meter reading, in dBm0. + \param level A power level, in dB0m. + \return The equivalent power meter reading. */ +SPAN_DECLARE(int32_t) power_meter_level_dbm0(float level); + +/*! Get the power meter reading which represents a specified power level in dBOv. + \brief Get the current power meter reading, in dBOv. + \param level A power level, in dBOv. + \return The equivalent power meter reading. */ +SPAN_DECLARE(int32_t) power_meter_level_dbov(float level); + +SPAN_DECLARE(int32_t) power_surge_detector(power_surge_detector_state_t *s, int16_t amp); + +/*! Get the current surge detector short term meter reading, in dBm0. + \brief Get the current surge detector meter reading, in dBm0. + \param s The power surge detector context. + \return The current power surge detector power reading, in dBm0. */ +SPAN_DECLARE(float) power_surge_detector_current_dbm0(power_surge_detector_state_t *s); + +/*! Get the current surge detector short term meter reading, in dBOv. + \brief Get the current surge detector meter reading, in dBOv. + \param s The power surge detector context. + \return The current power surge detector power reading, in dBOv. */ +SPAN_DECLARE(float) power_surge_detector_current_dbov(power_surge_detector_state_t *s); + +SPAN_DECLARE(power_surge_detector_state_t *) power_surge_detector_init(power_surge_detector_state_t *s, float min, float surge); + +SPAN_DECLARE(int) power_surge_detector_release(power_surge_detector_state_t *s); + +SPAN_DECLARE(int) power_surge_detector_free(power_surge_detector_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/README Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,3 @@ +The header files in this directory should only be used by code tightly integrating itself with the +spandsp library to maximise performance. To maximise compatibility with futures revisions of spandsp, +most users should avoid using these headers, or probing into the spandsp data structures in other ways. \ No newline at end of file diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/adsi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/adsi.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,120 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/adsi.h - Analogue display services interface and other call ID related handling. + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: adsi.h,v 1.4 2009/04/12 04:20:01 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_PRIVATE_ADSI_H_) +#define _SPANDSP_PRIVATE_ADSI_H_ + +/*! + ADSI transmitter descriptor. This contains all the state information for an ADSI + (caller ID, CLASS, CLIP, ACLIP) transmit channel. + */ +struct adsi_tx_state_s +{ + /*! */ + int standard; + + /*! */ + tone_gen_descriptor_t alert_tone_desc; + /*! */ + tone_gen_state_t alert_tone_gen; + /*! */ + fsk_tx_state_t fsktx; + /*! */ + dtmf_tx_state_t dtmftx; + /*! */ + async_tx_state_t asynctx; + + /*! */ + int tx_signal_on; + + /*! */ + int byte_no; + /*! */ + int bit_pos; + /*! */ + int bit_no; + /*! */ + uint8_t msg[256]; + /*! */ + int msg_len; + /*! */ + int preamble_len; + /*! */ + int preamble_ones_len; + /*! */ + int postamble_ones_len; + /*! */ + int stop_bits; + /*! */ + int baudot_shift; + + /*! */ + logging_state_t logging; +}; + +/*! + ADSI receiver descriptor. This contains all the state information for an ADSI + (caller ID, CLASS, CLIP, ACLIP, JCLIP) receive channel. + */ +struct adsi_rx_state_s +{ + /*! */ + int standard; + /*! */ + put_msg_func_t put_msg; + /*! */ + void *user_data; + + /*! */ + fsk_rx_state_t fskrx; + /*! */ + dtmf_rx_state_t dtmfrx; + + /*! */ + int consecutive_ones; + /*! */ + int bit_pos; + /*! */ + int in_progress; + /*! */ + uint8_t msg[256]; + /*! */ + int msg_len; + /*! */ + int baudot_shift; + + /*! A count of the framing errors. */ + int framing_errors; + + /*! */ + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/async.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/async.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,91 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/async.h - Asynchronous serial bit stream encoding and decoding + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: async.h,v 1.1 2008/11/30 10:17:31 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_ASYNC_H_) +#define _SPANDSP_PRIVATE_ASYNC_H_ + +/*! + Asynchronous data transmit descriptor. This defines the state of a single + working instance of a byte to asynchronous serial converter, for use + in FSK modems. +*/ +struct async_tx_state_s +{ + /*! \brief The number of data bits per character. */ + int data_bits; + /*! \brief The type of parity. */ + int parity; + /*! \brief The number of stop bits per character. */ + int stop_bits; + /*! \brief A pointer to the callback routine used to get characters to be transmitted. */ + get_byte_func_t get_byte; + /*! \brief An opaque pointer passed when calling get_byte. */ + void *user_data; + + /*! \brief A current, partially transmitted, character. */ + int byte_in_progress; + /*! \brief The current bit position within a partially transmitted character. */ + int bitpos; + /*! \brief Parity bit. */ + int parity_bit; +}; + +/*! + Asynchronous data receive descriptor. This defines the state of a single + working instance of an asynchronous serial to byte converter, for use + in FSK modems. +*/ +struct async_rx_state_s +{ + /*! \brief The number of data bits per character. */ + int data_bits; + /*! \brief The type of parity. */ + int parity; + /*! \brief The number of stop bits per character. */ + int stop_bits; + /*! \brief TRUE if V.14 rate adaption processing should be performed. */ + int use_v14; + /*! \brief A pointer to the callback routine used to handle received characters. */ + put_byte_func_t put_byte; + /*! \brief An opaque pointer passed when calling put_byte. */ + void *user_data; + + /*! \brief A current, partially complete, character. */ + int byte_in_progress; + /*! \brief The current bit position within a partially complete character. */ + int bitpos; + /*! \brief Parity bit. */ + int parity_bit; + + /*! A count of the number of parity errors seen. */ + int parity_errors; + /*! A count of the number of character framing errors seen. */ + int framing_errors; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/at_interpreter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/at_interpreter.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,130 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/at_interpreter.h - AT command interpreter to V.251, V.252, V.253, T.31 and the 3GPP specs. + * + * Written by Steve Underwood + * + * Copyright (C) 2004, 2005, 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: at_interpreter.h,v 1.1 2008/11/30 05:43:37 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_PRIVATE_AT_INTERPRETER_H_) +#define _SPANDSP_PRIVATE_AT_INTERPRETER_H_ + +typedef struct at_call_id_s at_call_id_t; + +struct at_call_id_s +{ + char *id; + char *value; + at_call_id_t *next; +}; + +/*! + AT descriptor. This defines the working state for a single instance of + the AT interpreter. +*/ +struct at_state_s +{ + at_profile_t p; + /*! Value set by +GCI */ + int country_of_installation; + /*! Value set by +FIT */ + int dte_inactivity_timeout; + /*! Value set by +FIT */ + int dte_inactivity_action; + /*! Value set by L */ + int speaker_volume; + /*! Value set by M */ + int speaker_mode; + /*! This is no real DTE rate. This variable is for compatibility this serially + connected modems. */ + /*! Value set by +IPR/+FPR */ + int dte_rate; + /*! Value set by +ICF */ + int dte_char_format; + /*! Value set by +ICF */ + int dte_parity; + /*! Value set by &C */ + int rlsd_behaviour; + /*! Value set by &D */ + int dtr_behaviour; + /*! Value set by +FCL */ + int carrier_loss_timeout; + /*! Value set by X */ + int result_code_mode; + /*! Value set by +IDSR */ + int dsr_option; + /*! Value set by +ILSD */ + int long_space_disconnect_option; + /*! Value set by +ICLOK */ + int sync_tx_clock_source; + /*! Value set by +EWIND */ + int rx_window; + /*! Value set by +EWIND */ + int tx_window; + + int v8bis_signal; + int v8bis_1st_message; + int v8bis_2nd_message; + int v8bis_sig_en; + int v8bis_msg_en; + int v8bis_supp_delay; + + uint8_t rx_data[256]; + int rx_data_bytes; + + int display_call_info; + int call_info_displayed; + at_call_id_t *call_id; + char *local_id; + /*! The currently select FAX modem class. 0 = data modem mode. */ + int fclass_mode; + int at_rx_mode; + int rings_indicated; + int do_hangup; + int silent_dial; + int command_dial; + int ok_is_pending; + int dte_is_waiting; + /*! \brief TRUE if a carrier is presnt. Otherwise FALSE. */ + int rx_signal_present; + /*! \brief TRUE if a modem has trained, Otherwise FALSE. */ + int rx_trained; + int transmit; + + char line[256]; + int line_ptr; + + at_modem_control_handler_t *modem_control_handler; + void *modem_control_user_data; + at_tx_handler_t *at_tx_handler; + void *at_tx_user_data; + at_class1_handler_t *class1_handler; + void *class1_user_data; + + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/awgn.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/awgn.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,46 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/awgn.h - An additive Gaussian white noise generator + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: awgn.h,v 1.1 2008/11/30 12:38:27 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_AWGN_H_) +#define _SPANDSP_PRIVATE_AWGN_H_ + +/*! + AWGN generator descriptor. This contains all the state information for an AWGN generator. + */ +struct awgn_state_s +{ + double rms; + long int ix1; + long int ix2; + long int ix3; + double r[98]; + double gset; + int iset; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/bell_r2_mf.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/bell_r2_mf.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,104 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * bell_r2_mf.h - Bell MF and MFC/R2 tone generation and detection. + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: bell_r2_mf.h,v 1.2 2008/10/13 14:19:18 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_BELL_R2_MF_H_) +#define _SPANDSP_PRIVATE_BELL_R2_MF_H_ + +/*! + Bell MF generator state descriptor. This defines the state of a single + working instance of a Bell MF generator. +*/ +struct bell_mf_tx_state_s +{ + /*! The tone generator. */ + tone_gen_state_t tones; + int current_sample; + union + { + queue_state_t queue; + uint8_t buf[QUEUE_STATE_T_SIZE(MAX_BELL_MF_DIGITS)]; + } queue; +}; + +/*! + Bell MF digit detector descriptor. +*/ +struct bell_mf_rx_state_s +{ + /*! Optional callback funcion to deliver received digits. */ + digits_rx_callback_t digits_callback; + /*! An opaque pointer passed to the callback function. */ + void *digits_callback_data; + /*! Tone detector working states */ + goertzel_state_t out[6]; + /*! Short term history of results from the tone detection, using in persistence checking */ + uint8_t hits[5]; + /*! The current sample number within a processing block. */ + int current_sample; + + /*! The number of digits which have been lost due to buffer overflows. */ + int lost_digits; + /*! The number of digits currently in the digit buffer. */ + int current_digits; + /*! The received digits buffer. This is a NULL terminated string. */ + char digits[MAX_BELL_MF_DIGITS + 1]; +}; + +/*! + MFC/R2 tone detector descriptor. +*/ +struct r2_mf_tx_state_s +{ + /*! The tone generator. */ + tone_gen_state_t tone; + /*! TRUE if generating forward tones, otherwise generating reverse tones. */ + int fwd; + /*! The current digit being generated. */ + int digit; +}; + +/*! + MFC/R2 tone detector descriptor. +*/ +struct r2_mf_rx_state_s +{ + /*! Optional callback funcion to deliver received digits. */ + tone_report_func_t callback; + /*! An opaque pointer passed to the callback function. */ + void *callback_data; + /*! TRUE is we are detecting forward tones. FALSE if we are detecting backward tones */ + int fwd; + /*! Tone detector working states */ + goertzel_state_t out[6]; + /*! The current sample number within a processing block. */ + int current_sample; + /*! The currently detected digit. */ + int current_digit; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/bert.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/bert.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,92 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/bert.h - Bit error rate tests. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: bert.h,v 1.2 2009/04/14 16:04:54 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_BERT_H_) +#define _SPANDSP_PRIVATE_BERT_H_ + +typedef struct +{ + uint32_t reg; + int step; + int step_bit; + int bits; + int zeros; +} bert_tx_state_t; + +typedef struct +{ + uint32_t reg; + uint32_t ref_reg; + uint32_t master_reg; + int step; + int step_bit; + int resync; + int bits; + int zeros; + int resync_len; + int resync_percent; + int resync_bad_bits; + int resync_cnt; + int report_countdown; + int measurement_step; +} bert_rx_state_t; + +/*! + Bit error rate tester (BERT) descriptor. This defines the working state for a + single instance of the BERT. +*/ +struct bert_state_s +{ + int pattern; + int pattern_class; + bert_report_func_t reporter; + void *user_data; + int report_frequency; + int limit; + + uint32_t mask; + int shift; + int shift2; + int max_zeros; + int invert; + int resync_time; + + int decade_ptr[9]; + int decade_bad[9][10]; + int error_rate; + + bert_tx_state_t tx; + bert_rx_state_t rx; + + bert_results_t results; + + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/bitstream.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/bitstream.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,44 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/bitstream.h - Bitstream composition and decomposition routines. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: bitstream.h,v 1.1.4.1 2009/12/28 12:20:47 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_BITSTREAM_H_) +#define _SPANDSP_PRIVATE_BITSTREAM_H_ + +/*! Bitstream handler state */ +struct bitstream_state_s +{ + /*! The bit stream. */ + uint32_t bitstream; + /*! The residual bits in bitstream. */ + int residue; + /*! TRUE if the stream is LSB first, else MSB first */ + int lsb_first; +}; + + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/dtmf.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/dtmf.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,111 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/dtmf.h - DTMF tone generation and detection + * + * Written by Steve Underwood + * + * Copyright (C) 2001, 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: dtmf.h,v 1.1 2008/10/13 13:14:01 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_DTMF_H_) +#define _SPANDSP_PRIVATE_DTMF_H_ + +/*! + DTMF generator state descriptor. This defines the state of a single + working instance of a DTMF generator. +*/ +struct dtmf_tx_state_s +{ + tone_gen_state_t tones; + float low_level; + float high_level; + int on_time; + int off_time; + union + { + queue_state_t queue; + uint8_t buf[QUEUE_STATE_T_SIZE(MAX_DTMF_DIGITS)]; + } queue; +}; + +/*! + DTMF digit detector descriptor. +*/ +struct dtmf_rx_state_s +{ + /*! Optional callback funcion to deliver received digits. */ + digits_rx_callback_t digits_callback; + /*! An opaque pointer passed to the callback function. */ + void *digits_callback_data; + /*! Optional callback funcion to deliver real time digit state changes. */ + tone_report_func_t realtime_callback; + /*! An opaque pointer passed to the real time callback function. */ + void *realtime_callback_data; + /*! TRUE if dialtone should be filtered before processing */ + int filter_dialtone; +#if defined(SPANDSP_USE_FIXED_POINT) + /*! 350Hz filter state for the optional dialtone filter. */ + float z350[2]; + /*! 440Hz filter state for the optional dialtone filter. */ + float z440[2]; + /*! Maximum acceptable "normal" (lower bigger than higher) twist ratio. */ + float normal_twist; + /*! Maximum acceptable "reverse" (higher bigger than lower) twist ratio. */ + float reverse_twist; + /*! Minimum acceptable tone level for detection. */ + int32_t threshold; + /*! The accumlating total energy on the same period over which the Goertzels work. */ + int32_t energy; +#else + /*! 350Hz filter state for the optional dialtone filter. */ + float z350[2]; + /*! 440Hz filter state for the optional dialtone filter. */ + float z440[2]; + /*! Maximum acceptable "normal" (lower bigger than higher) twist ratio. */ + float normal_twist; + /*! Maximum acceptable "reverse" (higher bigger than lower) twist ratio. */ + float reverse_twist; + /*! Minimum acceptable tone level for detection. */ + float threshold; + /*! The accumlating total energy on the same period over which the Goertzels work. */ + float energy; +#endif + /*! Tone detector working states for the row tones. */ + goertzel_state_t row_out[4]; + /*! Tone detector working states for the column tones. */ + goertzel_state_t col_out[4]; + /*! The result of the last tone analysis. */ + uint8_t last_hit; + /*! The confirmed digit we are currently receiving */ + uint8_t in_digit; + /*! The current sample number within a processing block. */ + int current_sample; + + /*! The number of digits which have been lost due to buffer overflows. */ + int lost_digits; + /*! The number of digits currently in the digit buffer. */ + int current_digits; + /*! The received digits buffer. This is a NULL terminated string. */ + char digits[MAX_DTMF_DIGITS + 1]; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/echo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/echo.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,94 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/echo.h - An echo cancellor, suitable for electrical and acoustic + * cancellation. This code does not currently comply with + * any relevant standards (e.g. G.164/5/7/8). + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: echo.h,v 1.1 2009/09/22 13:11:04 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_PRIVATE_ECHO_H_) +#define _SPANDSP_PRIVATE_ECHO_H_ + +/*! + G.168 echo canceller descriptor. This defines the working state for a line + echo canceller. +*/ +struct echo_can_state_s +{ + int tx_power[4]; + int rx_power[3]; + int clean_rx_power; + + int rx_power_threshold; + int nonupdate_dwell; + + int curr_pos; + + int taps; + int tap_mask; + int adaption_mode; + + int32_t supp_test1; + int32_t supp_test2; + int32_t supp1; + int32_t supp2; + int vad; + int cng; + + int16_t geigel_max; + int geigel_lag; + int dtd_onset; + int tap_set; + int tap_rotate_counter; + + int32_t latest_correction; /* Indication of the magnitude of the latest + adaption, or a code to indicate why adaption + was skipped, for test purposes */ + int32_t last_acf[28]; + int narrowband_count; + int narrowband_score; + + fir16_state_t fir_state; + /*! Echo FIR taps (16 bit version) */ + int16_t *fir_taps16[4]; + /*! Echo FIR taps (32 bit version) */ + int32_t *fir_taps32; + + /* DC and near DC blocking filter states */ + int32_t tx_hpf[2]; + int32_t rx_hpf[2]; + + /* Parameters for the optional Hoth noise generator */ + int cng_level; + int cng_rndnum; + int cng_filter; + + /* Snapshot sample of coeffs used for development */ + int16_t *snapshot; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/fax.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/fax.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,50 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/fax.h - private definitions for analogue line ITU T.30 fax processing + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: fax.h,v 1.1 2008/10/13 13:14:01 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_PRIVATE_FAX_H_) +#define _SPANDSP_PRIVATE_FAX_H_ + +/*! + Analogue line T.30 FAX channel descriptor. This defines the state of a single working + instance of an analogue line soft-FAX machine. +*/ +struct fax_state_s +{ + /*! \brief The T.30 back-end */ + t30_state_t t30; + + /*! \brief The analogue modem front-end */ + fax_modems_state_t modems; + + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/fax_modems.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/fax_modems.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,127 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/fax_modems.h - definitions for the analogue modem set for fax processing + * + * Written by Steve Underwood + * + * Copyright (C) 2008 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: fax_modems.h,v 1.4 2009/09/04 14:38:47 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_PRIVATE_FAX_MODEMS_H_) +#define _SPANDSP_PRIVATE_FAX_MODEMS_H_ + +/*! + The set of modems needed for FAX, plus the auxilliary stuff, like tone generation. +*/ +struct fax_modems_state_s +{ + /*! TRUE is talker echo protection should be sent for the image modems */ + int use_tep; + + /*! If TRUE, transmit silence when there is nothing else to transmit. If FALSE return only + the actual generated audio. Note that this only affects untimed silences. Timed silences + (e.g. the 75ms silence between V.21 and a high speed modem) will alway be transmitted as + silent audio. */ + int transmit_on_idle; + + /*! \brief An HDLC context used when transmitting HDLC messages. */ + hdlc_tx_state_t hdlc_tx; + /*! \brief An HDLC context used when receiving HDLC messages. */ + hdlc_rx_state_t hdlc_rx; + /*! \brief A V.21 FSK modem context used when transmitting HDLC over V.21 + messages. */ + fsk_tx_state_t v21_tx; + /*! \brief A V.21 FSK modem context used when receiving HDLC over V.21 + messages. */ + fsk_rx_state_t v21_rx; + /*! \brief A V.17 modem context used when sending FAXes at 7200bps, 9600bps + 12000bps or 14400bps */ + v17_tx_state_t v17_tx; + /*! \brief A V.29 modem context used when receiving FAXes at 7200bps, 9600bps + 12000bps or 14400bps */ + v17_rx_state_t v17_rx; + /*! \brief A V.29 modem context used when sending FAXes at 7200bps or + 9600bps */ + v29_tx_state_t v29_tx; + /*! \brief A V.29 modem context used when receiving FAXes at 7200bps or + 9600bps */ + v29_rx_state_t v29_rx; + /*! \brief A V.27ter modem context used when sending FAXes at 2400bps or + 4800bps */ + v27ter_tx_state_t v27ter_tx; + /*! \brief A V.27ter modem context used when receiving FAXes at 2400bps or + 4800bps */ + v27ter_rx_state_t v27ter_rx; + /*! \brief Used to insert timed silences. */ + silence_gen_state_t silence_gen; + /*! \brief CED or CNG generator */ + modem_connect_tones_tx_state_t connect_tx; + /*! \brief CED or CNG detector */ + modem_connect_tones_rx_state_t connect_rx; + /*! \brief */ + dc_restore_state_t dc_restore; + + /*! \brief The currently select receiver type */ + int current_rx_type; + /*! \brief The currently select transmitter type */ + int current_tx_type; + + /*! \brief TRUE if a carrier is present. Otherwise FALSE. */ + int rx_signal_present; + /*! \brief TRUE if a modem has trained correctly. */ + int rx_trained; + /*! \brief TRUE if an HDLC frame has been received correctly. */ + int rx_frame_received; + + /*! The current receive signal handler */ + span_rx_handler_t *rx_handler; + /*! The current receive missing signal fill-in handler */ + span_rx_fillin_handler_t *rx_fillin_handler; + void *rx_user_data; + + /*! The current transmit signal handler */ + span_tx_handler_t *tx_handler; + void *tx_user_data; + + /*! The next transmit signal handler, for two stage transmit operations. + E.g. a short silence followed by a modem signal. */ + span_tx_handler_t *next_tx_handler; + void *next_tx_user_data; + + /*! The current bit rate of the transmitter. */ + int tx_bit_rate; + /*! The current bit rate of the receiver. */ + int rx_bit_rate; + + /*! If TRUE, transmission is in progress */ + int transmit; + /*! \brief Audio logging file handle for received audio. */ + int audio_rx_log; + /*! \brief Audio logging file handle for transmitted audio. */ + int audio_tx_log; + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/fsk.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/fsk.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,100 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/fsk.h - FSK modem transmit and receive parts + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: fsk.h,v 1.5 2009/04/01 13:22:40 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_FSK_H_) +#define _SPANDSP_PRIVATE_FSK_H_ + +/*! + FSK modem transmit descriptor. This defines the state of a single working + instance of an FSK modem transmitter. +*/ +struct fsk_tx_state_s +{ + int baud_rate; + /*! \brief The callback function used to get the next bit to be transmitted. */ + get_bit_func_t get_bit; + /*! \brief A user specified opaque pointer passed to the get_bit function. */ + void *get_bit_user_data; + + /*! \brief The callback function used to report modem status changes. */ + modem_tx_status_func_t status_handler; + /*! \brief A user specified opaque pointer passed to the status function. */ + void *status_user_data; + + int32_t phase_rates[2]; + int16_t scaling; + int32_t current_phase_rate; + uint32_t phase_acc; + int baud_frac; + int shutdown; +}; + +/*! + FSK modem receive descriptor. This defines the state of a single working + instance of an FSK modem receiver. +*/ +struct fsk_rx_state_s +{ + int baud_rate; + /*! \brief Synchronous/asynchronous framing control */ + int framing_mode; + /*! \brief The callback function used to put each bit received. */ + put_bit_func_t put_bit; + /*! \brief A user specified opaque pointer passed to the put_bit routine. */ + void *put_bit_user_data; + + /*! \brief The callback function used to report modem status changes. */ + modem_tx_status_func_t status_handler; + /*! \brief A user specified opaque pointer passed to the status function. */ + void *status_user_data; + + int32_t carrier_on_power; + int32_t carrier_off_power; + power_meter_t power; + /*! \brief The value of the last signal sample, using the a simple HPF for signal power estimation. */ + int16_t last_sample; + /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.29 signal. */ + int signal_present; + + int32_t phase_rate[2]; + uint32_t phase_acc[2]; + + int correlation_span; + + complexi32_t window[2][FSK_MAX_WINDOW_LEN]; + complexi32_t dot[2]; + int buf_ptr; + + int frame_state; + int frame_bits; + int baud_phase; + int last_bit; + int scaling_shift; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/g711.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/g711.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,41 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/g711.h - In line A-law and u-law conversion routines + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: g711.h,v 1.2 2009/04/12 09:12:11 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_G711_H_) +#define _SPANDSP_PRIVATE_G711_H_ + +/*! + G.711 state + */ +struct g711_state_s +{ + /*! One of the G.711_xxx options */ + int mode; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/g722.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/g722.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,111 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/g722.h - The ITU G.722 codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Based on a single channel G.722 codec which is: + * + ***** Copyright (c) CMU 1993 ***** + * Computer Science, Speech Group + * Chengxiang Lu and Alex Hauptmann + * + * $Id: g722.h,v 1.2 2009/04/12 09:12:11 steveu Exp $ + */ + + +/*! \file */ + +#if !defined(_SPANDSP_PRIVATE_G722_H_) +#define _SPANDSP_PRIVATE_G722_H_ + +/*! The per band parameters for both encoding and decoding G.722 */ +typedef struct +{ + int16_t nb; + int16_t det; + int16_t s; + int16_t sz; + int16_t r; + int16_t p[2]; + int16_t a[2]; + int16_t b[6]; + int16_t d[7]; +} g722_band_t; + +/*! + G.722 encode state + */ +struct g722_encode_state_s +{ + /*! TRUE if the operating in the special ITU test mode, with the band split filters + disabled. */ + int itu_test_mode; + /*! TRUE if the G.722 data is packed */ + int packed; + /*! TRUE if encode from 8k samples/second */ + int eight_k; + /*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */ + int bits_per_sample; + + /*! Signal history for the QMF */ + int16_t x[12]; + int16_t y[12]; + int ptr; + + g722_band_t band[2]; + + uint32_t in_buffer; + int in_bits; + uint32_t out_buffer; + int out_bits; +}; + +/*! + G.722 decode state + */ +struct g722_decode_state_s +{ + /*! TRUE if the operating in the special ITU test mode, with the band split filters + disabled. */ + int itu_test_mode; + /*! TRUE if the G.722 data is packed */ + int packed; + /*! TRUE if decode to 8k samples/second */ + int eight_k; + /*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */ + int bits_per_sample; + + /*! Signal history for the QMF */ + int16_t x[12]; + int16_t y[12]; + int ptr; + + g722_band_t band[2]; + + uint32_t in_buffer; + int in_bits; + uint32_t out_buffer; + int out_bits; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/g726.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/g726.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,87 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/g726.h - ITU G.726 codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: g726.h,v 1.4 2009/04/12 09:12:11 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_G726_H_) +#define _SPANDSP_PRIVATE_G726_H_ + +/*! + * The following is the definition of the state structure + * used by the G.726 encoder and decoder to preserve their internal + * state between successive calls. The meanings of the majority + * of the state structure fields are explained in detail in the + * ITU Recommendation G.726. The field names are essentially indentical + * to variable names in the bit level description of the coding algorithm + * included in this recommendation. + */ +struct g726_state_s +{ + /*! The bit rate */ + int rate; + /*! The external coding, for tandem operation */ + int ext_coding; + /*! The number of bits per sample */ + int bits_per_sample; + /*! One of the G.726_PACKING_xxx options */ + int packing; + + /*! Locked or steady state step size multiplier. */ + int32_t yl; + /*! Unlocked or non-steady state step size multiplier. */ + int16_t yu; + /*! int16_t term energy estimate. */ + int16_t dms; + /*! Long term energy estimate. */ + int16_t dml; + /*! Linear weighting coefficient of 'yl' and 'yu'. */ + int16_t ap; + + /*! Coefficients of pole portion of prediction filter. */ + int16_t a[2]; + /*! Coefficients of zero portion of prediction filter. */ + int16_t b[6]; + /*! Signs of previous two samples of a partially reconstructed signal. */ + int16_t pk[2]; + /*! Previous 6 samples of the quantized difference signal represented in + an internal floating point format. */ + int16_t dq[6]; + /*! Previous 2 samples of the quantized difference signal represented in an + internal floating point format. */ + int16_t sr[2]; + /*! Delayed tone detect */ + int td; + + /*! \brief The bit stream processing context. */ + bitstream_state_t bs; + + /*! \brief The current encoder function. */ + g726_encoder_func_t enc_func; + /*! \brief The current decoder function. */ + g726_decoder_func_t dec_func; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/gsm0610.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/gsm0610.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,65 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/gsm0610.h - GSM 06.10 full rate speech codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: gsm0610.h,v 1.2 2008/11/15 14:27:29 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_GSM0610_H_) +#define _SPANDSP_PRIVATE_GSM0610_H_ + +/*! + GSM 06.10 FR codec state descriptor. This defines the state of + a single working instance of the GSM 06.10 FR encoder or decoder. +*/ +struct gsm0610_state_s +{ + /*! \brief One of the packing modes */ + int packing; + + int16_t dp0[280]; + + /*! Preprocessing */ + int16_t z1; + int32_t L_z2; + /*! Pre-emphasis */ + int16_t mp; + + /*! Short term delay filter */ + int16_t u[8]; + int16_t LARpp[2][8]; + int16_t j; + + /*! Long term synthesis */ + int16_t nrp; + /*! Short term synthesis */ + int16_t v[9]; + /*! Decoder postprocessing */ + int16_t msr; + + /*! Encoder data */ + int16_t e[50]; +}; + +#endif +/*- End of include ---------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/hdlc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/hdlc.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,140 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/hdlc.h + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: hdlc.h,v 1.3 2009/02/12 12:38:39 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_HDLC_H_) +#define _SPANDSP_PRIVATE_HDLC_H_ + +/*! + HDLC receive descriptor. This contains all the state information for an HDLC receiver. + */ +struct hdlc_rx_state_s +{ + /*! 2 for CRC-16, 4 for CRC-32 */ + int crc_bytes; + /*! \brief Maximum permitted frame length. */ + size_t max_frame_len; + /*! \brief The callback routine called to process each good received frame. */ + hdlc_frame_handler_t frame_handler; + /*! \brief An opaque parameter passed to the frame callback routine. */ + void *frame_user_data; + /*! \brief The callback routine called to report status changes. */ + modem_rx_status_func_t status_handler; + /*! \brief An opaque parameter passed to the status callback routine. */ + void *status_user_data; + /*! \brief TRUE if bad frames are to be reported. */ + int report_bad_frames; + /*! \brief The number of consecutive flags which must be seen before framing is + declared OK. */ + int framing_ok_threshold; + /*! \brief TRUE if framing OK has been announced. */ + int framing_ok_announced; + /*! \brief Number of consecutive flags seen so far. */ + int flags_seen; + + /*! \brief The raw (stuffed) bit stream buffer. */ + unsigned int raw_bit_stream; + /*! \brief The destuffed bit stream buffer. */ + unsigned int byte_in_progress; + /*! \brief The current number of bits in byte_in_progress. */ + int num_bits; + /*! \brief TRUE if in octet counting mode (e.g. for MTP). */ + int octet_counting_mode; + /*! \brief Octet count, to achieve the functionality needed for things + like MTP. */ + int octet_count; + /*! \brief The number of octets to be allowed between octet count reports. */ + int octet_count_report_interval; + + /*! \brief Buffer for a frame in progress. */ + uint8_t buffer[HDLC_MAXFRAME_LEN + 4]; + /*! \brief Length of a frame in progress. */ + size_t len; + + /*! \brief The number of bytes of good frames received (CRC not included). */ + unsigned long int rx_bytes; + /*! \brief The number of good frames received. */ + unsigned long int rx_frames; + /*! \brief The number of frames with CRC errors received. */ + unsigned long int rx_crc_errors; + /*! \brief The number of too short and too long frames received. */ + unsigned long int rx_length_errors; + /*! \brief The number of HDLC aborts received. */ + unsigned long int rx_aborts; +}; + +/*! + HDLC transmit descriptor. This contains all the state information for an + HDLC transmitter. + */ +struct hdlc_tx_state_s +{ + /*! 2 for CRC-16, 4 for CRC-32 */ + int crc_bytes; + /*! \brief The callback routine called to indicate transmit underflow. */ + hdlc_underflow_handler_t underflow_handler; + /*! \brief An opaque parameter passed to the callback routine. */ + void *user_data; + /*! \brief The minimum flag octets to insert between frames. */ + int inter_frame_flags; + /*! \brief TRUE if frame creation works in progressive mode. */ + int progressive; + /*! \brief Maximum permitted frame length. */ + size_t max_frame_len; + + /*! \brief The stuffed bit stream being created. */ + uint32_t octets_in_progress; + /*! \brief The number of bits currently in octets_in_progress. */ + int num_bits; + /*! \brief The currently rotated state of the flag octet. */ + int idle_octet; + /*! \brief The number of flag octets to send for a timed burst of flags. */ + int flag_octets; + /*! \brief The number of abort octets to send for a timed burst of aborts. */ + int abort_octets; + /*! \brief TRUE if the next underflow of timed flag octets should be reported */ + int report_flag_underflow; + + /*! \brief The current message being transmitted, with its CRC attached. */ + uint8_t buffer[HDLC_MAXFRAME_LEN + 4]; + /*! \brief The length of the message in the buffer. */ + size_t len; + /*! \brief The current send position within the buffer. */ + size_t pos; + /*! \brief The running CRC, as data fills the frame buffer. */ + uint32_t crc; + + /*! \brief The current byte being broken into bits for transmission. */ + int byte; + /*! \brief The number of bits remaining in byte. */ + int bits; + + /*! \brief TRUE if transmission should end on buffer underflow .*/ + int tx_end; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/ima_adpcm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/ima_adpcm.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,55 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/ima_adpcm.c - Conversion routines between linear 16 bit PCM data + * and IMA/DVI/Intel ADPCM format. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Based on a bit from here, a bit from there, eye of toad, + * ear of bat, etc - plus, of course, my own 2 cents. + * + * $Id: ima_adpcm.h,v 1.1 2008/11/30 10:17:31 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_IMA_ADPCM_H_) +#define _SPANDSP_PRIVATE_IMA_ADPCM_H_ + +/*! + IMA (DVI/Intel) ADPCM conversion state descriptor. This defines the state of + a single working instance of the IMA ADPCM converter. This is used for + either linear to ADPCM or ADPCM to linear conversion. +*/ +struct ima_adpcm_state_s +{ + int variant; + /*! \brief The size of a chunk, in samples. */ + int chunk_size; + /*! \brief The last state of the ADPCM algorithm. */ + int last; + /*! \brief Current index into the step size table. */ + int step_index; + /*! \brief The current IMA code byte in progress. */ + uint16_t ima_byte; + int bits; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/logging.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/logging.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,48 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/logging.h - definitions for error and debug logging. + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: logging.h,v 1.1 2008/11/30 13:44:35 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_LOGGING_H_) +#define _SPANDSP_PRIVATE_LOGGING_H_ + +/*! + Logging descriptor. This defines the working state for a single instance of + the logging facility for spandsp. +*/ +struct logging_state_s +{ + int level; + int samples_per_second; + int64_t elapsed_samples; + const char *tag; + const char *protocol; + + message_handler_func_t span_message; + error_handler_func_t span_error; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/lpc10.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/lpc10.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,220 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/lpc10.h - LPC10 low bit rate speech codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: lpc10.h,v 1.3 2009/04/12 09:12:11 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_LPC10_H_) +#define _SPANDSP_PRIVATE_LPC10_H_ + +/*! + LPC10 codec encoder state descriptor. This defines the state of + a single working instance of the LPC10 encoder. +*/ +struct lpc10_encode_state_s +{ + /*! \brief ??? */ + int error_correction; + + /* State used only by function high_pass_100hz */ + /*! \brief ??? */ + float z11; + /*! \brief ??? */ + float z21; + /*! \brief ??? */ + float z12; + /*! \brief ??? */ + float z22; + + /* State used by function lpc10_analyse */ + /*! \brief ??? */ + float inbuf[LPC10_SAMPLES_PER_FRAME*3]; + /*! \brief ??? */ + float pebuf[LPC10_SAMPLES_PER_FRAME*3]; + /*! \brief ??? */ + float lpbuf[696]; + /*! \brief ??? */ + float ivbuf[312]; + /*! \brief ??? */ + float bias; + /*! \brief No initial value necessary */ + int32_t osbuf[10]; + /*! \brief Initial value 1 */ + int32_t osptr; + /*! \brief ??? */ + int32_t obound[3]; + /*! \brief Initial value vwin[2][0] = 307; vwin[2][1] = 462; */ + int32_t vwin[3][2]; + /*! \brief Initial value awin[2][0] = 307; awin[2][1] = 462; */ + int32_t awin[3][2]; + /*! \brief ??? */ + int32_t voibuf[4][2]; + /*! \brief ??? */ + float rmsbuf[3]; + /*! \brief ??? */ + float rcbuf[3][10]; + /*! \brief ??? */ + float zpre; + + /* State used by function onset */ + /*! \brief ??? */ + float n; + /*! \brief Initial value 1.0f */ + float d__; + /*! \brief No initial value necessary */ + float fpc; + /*! \brief ??? */ + float l2buf[16]; + /*! \brief ??? */ + float l2sum1; + /*! \brief Initial value 1 */ + int32_t l2ptr1; + /*! \brief Initial value 9 */ + int32_t l2ptr2; + /*! \brief No initial value necessary */ + int32_t lasti; + /*! \brief Initial value FALSE */ + int hyst; + + /* State used by function lpc10_voicing */ + /*! \brief Initial value 20.0f */ + float dither; + /*! \brief ??? */ + float snr; + /*! \brief ??? */ + float maxmin; + /*! \brief Initial value is probably unnecessary */ + float voice[3][2]; + /*! \brief ??? */ + int32_t lbve; + /*! \brief ??? */ + int32_t lbue; + /*! \brief ??? */ + int32_t fbve; + /*! \brief ??? */ + int32_t fbue; + /*! \brief ??? */ + int32_t ofbue; + /*! \brief ??? */ + int32_t sfbue; + /*! \brief ??? */ + int32_t olbue; + /*! \brief ??? */ + int32_t slbue; + + /* State used by function dynamic_pitch_tracking */ + /*! \brief ??? */ + float s[60]; + /*! \brief ??? */ + int32_t p[2][60]; + /*! \brief ??? */ + int32_t ipoint; + /*! \brief ??? */ + float alphax; + + /* State used by function lpc10_pack */ + /*! \brief ??? */ + int32_t isync; +}; + +/*! + LPC10 codec decoder state descriptor. This defines the state of + a single working instance of the LPC10 decoder. +*/ +struct lpc10_decode_state_s +{ + /*! \brief ??? */ + int error_correction; + + /* State used by function decode */ + /*! \brief Initial value 60 */ + int32_t iptold; + /*! \brief Initial value TRUE */ + int first; + /*! \brief ??? */ + int32_t ivp2h; + /*! \brief ??? */ + int32_t iovoic; + /*! \brief Initial value 60. */ + int32_t iavgp; + /*! \brief ??? */ + int32_t erate; + /*! \brief ??? */ + int32_t drc[10][3]; + /*! \brief ??? */ + int32_t dpit[3]; + /*! \brief ??? */ + int32_t drms[3]; + + /* State used by function synths */ + /*! \brief ??? */ + float buf[LPC10_SAMPLES_PER_FRAME*2]; + /*! \brief Initial value LPC10_SAMPLES_PER_FRAME */ + int32_t buflen; + + /* State used by function pitsyn */ + /*! \brief No initial value necessary as long as first_pitsyn is initially TRUE */ + int32_t ivoico; + /*! \brief No initial value necessary as long as first_pitsyn is initially TRUE */ + int32_t ipito; + /*! \brief Initial value 1.0f */ + float rmso; + /*! \brief No initial value necessary as long as first_pitsyn is initially TRUE */ + float rco[10]; + /*! \brief No initial value necessary as long as first_pitsyn is initially TRUE */ + int32_t jsamp; + /*! \brief Initial value TRUE */ + int first_pitsyn; + + /* State used by function bsynz */ + /*! \brief ??? */ + int32_t ipo; + /*! \brief ??? */ + float exc[166]; + /*! \brief ??? */ + float exc2[166]; + /*! \brief ??? */ + float lpi[3]; + /*! \brief ??? */ + float hpi[3]; + /*! \brief ??? */ + float rmso_bsynz; + + /* State used by function random */ + /*! \brief ??? */ + int32_t j; + /*! \brief ??? */ + int32_t k; + /*! \brief ??? */ + int16_t y[5]; + + /* State used by function deemp */ + /*! \brief ??? */ + float dei[2]; + /*! \brief ??? */ + float deo[3]; +}; + +#endif +/*- End of include ---------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/modem_connect_tones.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/modem_connect_tones.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,105 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/modem_connect_tones.c - Generation and detection of tones + * associated with modems calling and + * answering calls. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: modem_connect_tones.h,v 1.3 2009/11/02 13:25:20 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_PRIVATE_MODEM_CONNECT_TONES_H_) +#define _SPANDSP_PRIVATE_MODEM_CONNECT_TONES_H_ + +/*! + Modem connect tones generator descriptor. This defines the state + of a single working instance of the tone generator. +*/ +struct modem_connect_tones_tx_state_s +{ + int tone_type; + + int32_t tone_phase_rate; + uint32_t tone_phase; + int16_t level; + /*! \brief Countdown to the next phase hop */ + int hop_timer; + /*! \brief Maximum duration timer */ + int duration_timer; + uint32_t mod_phase; + int32_t mod_phase_rate; + int16_t mod_level; +}; + +/*! + Modem connect tones receiver descriptor. This defines the state + of a single working instance of the tone detector. +*/ +struct modem_connect_tones_rx_state_s +{ + /*! \brief The tone type being detected. */ + int tone_type; + /*! \brief Callback routine, using to report detection of the tone. */ + tone_report_func_t tone_callback; + /*! \brief An opaque pointer passed to tone_callback. */ + void *callback_data; + + /*! \brief The notch filter state. */ + float znotch_1; + float znotch_2; + /*! \brief The 15Hz AM filter state. */ + float z15hz_1; + float z15hz_2; + /*! \brief The in notch power estimate */ + int32_t notch_level; + /*! \brief The total channel power estimate */ + int32_t channel_level; + /*! \brief The 15Hz AM power estimate */ + int32_t am_level; + /*! \brief Sample counter for the small chunks of samples, after which a test is conducted. */ + int chunk_remainder; + /*! \brief TRUE is the tone is currently confirmed present in the audio. */ + int tone_present; + /*! \brief */ + int tone_on; + /*! \brief A millisecond counter, to time the duration of tone sections. */ + int tone_cycle_duration; + /*! \brief A count of the number of good cycles of tone reversal seen. */ + int good_cycles; + /*! \brief TRUE if the tone has been seen since the last time the user tested for it */ + int hit; + /*! \brief A V.21 FSK modem context used when searching for FAX preamble. */ + fsk_rx_state_t v21rx; + /*! \brief The raw (stuffed) bit stream buffer. */ + unsigned int raw_bit_stream; + /*! \brief The current number of bits in the octet in progress. */ + int num_bits; + /*! \brief Number of consecutive flags seen so far. */ + int flags_seen; + /*! \brief TRUE if framing OK has been announced. */ + int framing_ok_announced; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/modem_echo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/modem_echo.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,58 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/modem_echo.h - An echo cancellor, suitable for electrical echos in GSTN modems + * + * Written by Steve Underwood + * + * Copyright (C) 2001, 2004 Steve Underwood + * + * Based on a bit from here, a bit from there, eye of toad, + * ear of bat, etc - plus, of course, my own 2 cents. + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: modem_echo.h,v 1.1 2009/09/22 13:11:04 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_PRIVATE_MODEM_ECHO_H_) +#define _SPANDSP_PRIVATE_MODEM_ECHO_H_ + +/*! + Modem line echo canceller descriptor. This defines the working state for a line + echo canceller. +*/ +struct modem_echo_can_state_s +{ + int adapt; + int taps; + + fir16_state_t fir_state; + /*! Echo FIR taps (16 bit version) */ + int16_t *fir_taps16; + /*! Echo FIR taps (32 bit version) */ + int32_t *fir_taps32; + + int tx_power; + int rx_power; + + int curr_pos; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/noise.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/noise.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,48 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/noise.h - A low complexity audio noise generator, suitable for + * real time generation (current just approx AWGN) + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: noise.h,v 1.1 2008/11/30 12:45:09 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_PRIVATE_NOISE_H_) +#define _SPANDSP_PRIVATE_NOISE_H_ + +/*! + Noise generator descriptor. This contains all the state information for an instance + of the noise generator. + */ +struct noise_state_s +{ + int class_of_noise; + int quality; + int32_t rms; + uint32_t rndnum; + int32_t state; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/oki_adpcm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/oki_adpcm.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,60 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/oki_adpcm.h - Conversion routines between linear 16 bit PCM data + * and OKI (Dialogic) ADPCM format. + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: oki_adpcm.h,v 1.1 2008/11/30 10:17:31 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_PRIVATE_OKI_ADPCM_H_) +#define _SPANDSP_PRIVATE_OKI_ADPCM_H_ + +/*! + Oki (Dialogic) ADPCM conversion state descriptor. This defines the state of + a single working instance of the Oki ADPCM converter. This is used for + either linear to ADPCM or ADPCM to linear conversion. +*/ +struct oki_adpcm_state_s +{ + /*! \brief The bit rate - 24000 or 32000. */ + int bit_rate; + /*! \brief The last state of the ADPCM algorithm. */ + int16_t last; + /*! \brief Current index into the step size table. */ + int16_t step_index; + /*! \brief The compressed data byte in progress. */ + uint8_t oki_byte; + /*! \brief The signal history for the sample rate converter. */ + int16_t history[32]; + /*! \brief Pointer into the history buffer. */ + int ptr; + /*! \brief Odd/even sample counter. */ + int mark; + /*! \brief Phase accumulator for the sample rate converter. */ + int phase; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/queue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/queue.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,52 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/queue.h - simple in process message queuing + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: queue.h,v 1.2 2009/01/31 08:48:11 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_QUEUE_H_) +#define _SPANDSP_PRIVATE_QUEUE_H_ + +/*! + Queue descriptor. This defines the working state for a single instance of + a byte stream or message oriented queue. +*/ +struct queue_state_s +{ + /*! \brief Flags indicating the mode of the queue. */ + int flags; + /*! \brief The length of the data buffer. */ + int len; + /*! \brief The buffer input pointer. */ + volatile int iptr; + /*! \brief The buffer output pointer. */ + volatile int optr; +#if defined(SPANDSP_FULLY_DEFINE_QUEUE_STATE_T) + /*! \brief The data buffer, sized at the time the structure is created. */ + uint8_t data[]; +#endif +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/schedule.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/schedule.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,50 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/schedule.h + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: schedule.h,v 1.1 2008/11/30 05:43:37 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_SCHEDULE_H_) +#define _SPANDSP_PRIVATE_SCHEDULE_H_ + +/*! A scheduled event entry. */ +struct span_sched_s +{ + uint64_t when; + span_sched_callback_func_t callback; + void *user_data; +}; + +/*! A scheduled event queue. */ +struct span_sched_state_s +{ + uint64_t ticker; + int allocated; + int max_to_date; + span_sched_t *sched; + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/sig_tone.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/sig_tone.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,219 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/sig_tone.h - Signalling tone processing for the 2280Hz, 2400Hz, 2600Hz + * and similar signalling tone used in older protocols. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: sig_tone.h,v 1.4 2009/09/04 14:38:47 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_SIG_TONE_H_) +#define _SPANDSP_PRIVATE_SIG_TONE_H_ + +/*! + Signaling tone descriptor. This defines the working state for a + single instance of the transmit and receive sides of a signaling + tone processor. +*/ +struct sig_tone_descriptor_s +{ + /*! \brief The tones used. */ + int tone_freq[2]; + /*! \brief The high and low tone amplitudes for each of the tones. */ + int tone_amp[2][2]; + + /*! \brief The delay, in audio samples, before the high level tone drops + to a low level tone. */ + int high_low_timeout; + + /*! \brief Some signaling tone detectors use a sharp initial filter, + changing to a broader band filter after some delay. This + parameter defines the delay. 0 means it never changes. */ + int sharp_flat_timeout; + + /*! \brief Parameters to control the behaviour of the notch filter, used + to remove the tone from the voice path in some protocols. */ + int notch_lag_time; + /*! \brief TRUE if the notch may be used in the media flow. */ + int notch_allowed; + + /*! \brief The tone on persistence check, in audio samples. */ + int tone_on_check_time; + /*! \brief The tone off persistence check, in audio samples. */ + int tone_off_check_time; + + /*! \brief ??? */ + int tones; + /*! \brief The coefficients for the cascaded bi-quads notch filter. */ + struct + { +#if defined(SPANDSP_USE_FIXED_POINT) + int32_t notch_a1[3]; + int32_t notch_b1[3]; + int32_t notch_a2[3]; + int32_t notch_b2[3]; + int notch_postscale; +#else + float notch_a1[3]; + float notch_b1[3]; + float notch_a2[3]; + float notch_b2[3]; +#endif + } tone[2]; + +#if defined(SPANDSP_USE_FIXED_POINT) + /*! \brief Flat mode bandpass bi-quad parameters */ + int32_t broad_a[3]; + /*! \brief Flat mode bandpass bi-quad parameters */ + int32_t broad_b[3]; + /*! \brief Post filter scaling */ + int broad_postscale; +#else + /*! \brief Flat mode bandpass bi-quad parameters */ + float broad_a[3]; + /*! \brief Flat mode bandpass bi-quad parameters */ + float broad_b[3]; +#endif + /*! \brief The coefficients for the post notch leaky integrator. */ + int32_t notch_slugi; + /*! \brief ??? */ + int32_t notch_slugp; + + /*! \brief The coefficients for the post modulus leaky integrator in the + unfiltered data path. The prescale value incorporates the + detection ratio. This is called the guard ratio in some + protocols. */ + int32_t unfiltered_slugi; + /*! \brief ??? */ + int32_t unfiltered_slugp; + + /*! \brief The coefficients for the post modulus leaky integrator in the + bandpass filter data path. */ + int32_t broad_slugi; + /*! \brief ??? */ + int32_t broad_slugp; + + /*! \brief Masks which effectively threshold the notched, weighted and + bandpassed data. */ + int32_t notch_threshold; + /*! \brief ??? */ + int32_t unfiltered_threshold; + /*! \brief ??? */ + int32_t broad_threshold; +}; + +/*! + Signaling tone transmit state + */ +struct sig_tone_tx_state_s +{ + /*! \brief The callback function used to handle signaling changes. */ + tone_report_func_t sig_update; + /*! \brief A user specified opaque pointer passed to the callback function. */ + void *user_data; + + /*! \brief Tone descriptor */ + sig_tone_descriptor_t *desc; + + /*! The phase rates for the one or two tones */ + int32_t phase_rate[2]; + /*! The phase accumulators for the one or two tones */ + uint32_t phase_acc[2]; + + /*! The scaling values for the one or two tones, and the high and low level of each tone */ + int16_t tone_scaling[2][2]; + /*! The sample timer, used to switch between the high and low level tones. */ + int high_low_timer; + + /*! \brief Current transmit tone */ + int current_tx_tone; + /*! \brief Current transmit timeout */ + int current_tx_timeout; + /*! \brief Time in current signaling state, in samples. */ + int signaling_state_duration; +}; + +/*! + Signaling tone receive state + */ +struct sig_tone_rx_state_s +{ + /*! \brief The callback function used to handle signaling changes. */ + tone_report_func_t sig_update; + /*! \brief A user specified opaque pointer passed to the callback function. */ + void *user_data; + + /*! \brief Tone descriptor */ + sig_tone_descriptor_t *desc; + + /*! \brief The current receive tone */ + int current_rx_tone; + /*! \brief The timeout for switching from the high level to low level tone detector. */ + int high_low_timer; + + struct + { +#if defined(SPANDSP_USE_FIXED_POINT) + /*! \brief The z's for the notch filter */ + int32_t notch_z1[3]; + /*! \brief The z's for the notch filter */ + int32_t notch_z2[3]; +#else + /*! \brief The z's for the notch filter */ + float notch_z1[3]; + /*! \brief The z's for the notch filter */ + float notch_z2[3]; +#endif + + /*! \brief The z's for the notch integrators. */ + int32_t notch_zl; + } tone[2]; + +#if defined(SPANDSP_USE_FIXED_POINT) + /*! \brief The z's for the weighting/bandpass filter. */ + int32_t broad_z[3]; +#else + /*! \brief The z's for the weighting/bandpass filter. */ + float broad_z[3]; +#endif + /*! \brief The z for the broadband integrator. */ + int32_t broad_zl; + + /*! \brief ??? */ + int flat_mode; + /*! \brief ??? */ + int tone_present; + /*! \brief ??? */ + int notch_enabled; + /*! \brief ??? */ + int flat_mode_timeout; + /*! \brief ??? */ + int notch_insertion_timeout; + /*! \brief ??? */ + int tone_persistence_timeout; + + /*! \brief ??? */ + int signaling_state_duration; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/silence_gen.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/silence_gen.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,43 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/silence_gen.c - A silence generator, for inserting timed silences. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: silence_gen.h,v 1.1 2009/04/12 03:29:58 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_SILENCE_GEN_H_) +#define _SPANDSP_PRIVATE_SILENCE_GEN_H_ + +struct silence_gen_state_s +{ + /*! \brief The callback function used to report status changes. */ + modem_tx_status_func_t status_handler; + /*! \brief A user specified opaque pointer passed to the status function. */ + void *status_user_data; + + int remaining_samples; + int total_samples; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/super_tone_rx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/super_tone_rx.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,67 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/super_tone_rx.h - Flexible telephony supervisory tone detection. + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: super_tone_rx.h,v 1.1 2008/11/30 10:17:31 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_SUPER_TONE_RX_H_) +#define _SPANDSP_PRIVATE_SUPER_TONE_RX_H_ + +#define BINS 128 + +struct super_tone_rx_segment_s +{ + int f1; + int f2; + int recognition_duration; + int min_duration; + int max_duration; +}; + +struct super_tone_rx_descriptor_s +{ + int used_frequencies; + int monitored_frequencies; + int pitches[BINS/2][2]; + int tones; + super_tone_rx_segment_t **tone_list; + int *tone_segs; + goertzel_descriptor_t *desc; +}; + +struct super_tone_rx_state_s +{ + super_tone_rx_descriptor_t *desc; + float energy; + int detected_tone; + int rotation; + tone_report_func_t tone_callback; + void (*segment_callback)(void *data, int f1, int f2, int duration); + void *callback_data; + super_tone_rx_segment_t segments[11]; + goertzel_state_t state[]; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/super_tone_tx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/super_tone_tx.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,52 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/super_tone_tx.h - Flexible telephony supervisory tone generation. + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: super_tone_tx.h,v 1.1 2008/11/30 10:22:19 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_SUPER_TONE_TX_H_) +#define _SPANDSP_PRIVATE_SUPER_TONE_TX_H_ + +struct super_tone_tx_step_s +{ + tone_gen_tone_descriptor_t tone[4]; + int tone_on; + int length; + int cycles; + super_tone_tx_step_t *next; + super_tone_tx_step_t *nest; +}; + +struct super_tone_tx_state_s +{ + tone_gen_tone_descriptor_t tone[4]; + uint32_t phase[4]; + int current_position; + int level; + super_tone_tx_step_t *levels[4]; + int cycles[4]; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/swept_tone.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/swept_tone.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,44 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/swept_tone.h - Swept tone generation + * + * Written by Steve Underwood + * + * Copyright (C) 2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: swept_tone.h,v 1.1 2009/09/22 12:54:33 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_SWEPT_TONE_H_) +#define _SPANDSP_PRIVATE_SWEPT_TONE_H_ + +struct swept_tone_state_s +{ + int32_t starting_phase_inc; + int32_t phase_inc_step; + int scale; + int duration; + int repeating; + int pos; + int32_t current_phase_inc; + uint32_t phase; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/t30.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/t30.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,286 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/t30.h - definitions for T.30 fax processing + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t30.h,v 1.5.4.1 2009/12/19 09:47:56 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_PRIVATE_T30_H_) +#define _SPANDSP_PRIVATE_T30_H_ + +/*! + T.30 FAX channel descriptor. This defines the state of a single working + instance of a T.30 FAX channel. +*/ +struct t30_state_s +{ + /* This must be kept the first thing in the structure, so it can be pointed + to reliably as the structures change over time. */ + /*! \brief T.4 context for reading or writing image data. */ + t4_state_t t4; + + /*! \brief The type of FAX operation currently in progress */ + int operation_in_progress; + + /*! \brief TRUE if behaving as the calling party */ + int calling_party; + + /*! \brief The received DCS, formatted as an ASCII string, for inclusion + in the TIFF file. */ + char rx_dcs_string[T30_MAX_DIS_DTC_DCS_LEN*3 + 1]; + /*! \brief The text which will be used in FAX page header. No text results + in no header line. */ + char header_info[T30_MAX_PAGE_HEADER_INFO + 1]; + /*! \brief The information fields received. */ + t30_exchanged_info_t rx_info; + /*! \brief The information fields to be transmitted. */ + t30_exchanged_info_t tx_info; + /*! \brief The country of origin of the remote machine, if known, else NULL. */ + const char *country; + /*! \brief The vendor of the remote machine, if known, else NULL. */ + const char *vendor; + /*! \brief The model of the remote machine, if known, else NULL. */ + const char *model; + + /*! \brief A pointer to a callback routine to be called when phase B events + occur. */ + t30_phase_b_handler_t *phase_b_handler; + /*! \brief An opaque pointer supplied in event B callbacks. */ + void *phase_b_user_data; + /*! \brief A pointer to a callback routine to be called when phase D events + occur. */ + t30_phase_d_handler_t *phase_d_handler; + /*! \brief An opaque pointer supplied in event D callbacks. */ + void *phase_d_user_data; + /*! \brief A pointer to a callback routine to be called when phase E events + occur. */ + t30_phase_e_handler_t *phase_e_handler; + /*! \brief An opaque pointer supplied in event E callbacks. */ + void *phase_e_user_data; + /*! \brief A pointer to a callback routine to be called when frames are + exchanged. */ + t30_real_time_frame_handler_t *real_time_frame_handler; + /*! \brief An opaque pointer supplied in real time frame callbacks. */ + void *real_time_frame_user_data; + + /*! \brief A pointer to a callback routine to be called when document events + (e.g. end of transmitted document) occur. */ + t30_document_handler_t *document_handler; + /*! \brief An opaque pointer supplied in document callbacks. */ + void *document_user_data; + + /*! \brief The handler for changes to the receive mode */ + t30_set_handler_t *set_rx_type_handler; + /*! \brief An opaque pointer passed to the handler for changes to the receive mode */ + void *set_rx_type_user_data; + /*! \brief The handler for changes to the transmit mode */ + t30_set_handler_t *set_tx_type_handler; + /*! \brief An opaque pointer passed to the handler for changes to the transmit mode */ + void *set_tx_type_user_data; + + /*! \brief The transmitted HDLC frame handler. */ + t30_send_hdlc_handler_t *send_hdlc_handler; + /*! \brief An opaque pointer passed to the transmitted HDLC frame handler. */ + void *send_hdlc_user_data; + + /*! \brief The DIS code for the minimum scan row time we require. This is usually 0ms, + but if we are trying to simulate another type of FAX machine, we may need a non-zero + value here. */ + uint8_t local_min_scan_time_code; + + /*! \brief The current T.30 phase. */ + int phase; + /*! \brief The T.30 phase to change to when the current phase ends. */ + int next_phase; + /*! \brief The current state of the T.30 state machine. */ + int state; + /*! \brief The step in sending a sequence of HDLC frames. */ + int step; + + /*! \brief The preparation buffer for the DCS message to be transmitted. */ + uint8_t dcs_frame[T30_MAX_DIS_DTC_DCS_LEN]; + /*! \brief The length of the DCS message to be transmitted. */ + int dcs_len; + /*! \brief The preparation buffer for DIS or DTC message to be transmitted. */ + uint8_t local_dis_dtc_frame[T30_MAX_DIS_DTC_DCS_LEN]; + /*! \brief The length of the DIS or DTC message to be transmitted. */ + int local_dis_dtc_len; + /*! \brief The last DIS or DTC message received form the far end. */ + uint8_t far_dis_dtc_frame[T30_MAX_DIS_DTC_DCS_LEN]; + /*! \brief The length of the last DIS or DTC message received form the far end. */ + int far_dis_dtc_len; + /*! \brief TRUE if a valid DIS has been received from the far end. */ + int dis_received; + + /*! \brief A flag to indicate a message is in progress. */ + int in_message; + + /*! \brief TRUE if the short training sequence should be used. */ + int short_train; + + /*! \brief A count of the number of bits in the trainability test. This counts down to zero when + sending TCF, and counts up when receiving it. */ + int tcf_test_bits; + /*! \brief The current count of consecutive received zero bits, during the trainability test. */ + int tcf_current_zeros; + /*! \brief The maximum consecutive received zero bits seen to date, during the trainability test. */ + int tcf_most_zeros; + + /*! \brief The current fallback step for the fast message transfer modem. */ + int current_fallback; + /*! \brief The subset of supported modems allowed at the current time, allowing for negotiation. */ + int current_permitted_modems; + /*! \brief TRUE if a carrier is present. Otherwise FALSE. */ + int rx_signal_present; + /*! \brief TRUE if a modem has trained correctly. */ + int rx_trained; + /*! \brief TRUE if a valid HDLC frame has been received in the current reception period. */ + int rx_frame_received; + + /*! \brief Current reception mode. */ + int current_rx_type; + /*! \brief Current transmission mode. */ + int current_tx_type; + + /*! \brief T0 is the answer timeout when calling another FAX machine. + Placing calls is handled outside the FAX processing, but this timeout keeps + running until V.21 modulation is sent or received. + T1 is the remote terminal identification timeout (in audio samples). */ + int timer_t0_t1; + /*! \brief T2, T2A and T2B are the HDLC command timeouts. + T4, T4A and T4B are the HDLC response timeouts (in audio samples). */ + int timer_t2_t4; + /*! \brief A value specifying which of the possible timers is currently running in timer_t2_t4 */ + int timer_t2_t4_is; + /*! \brief Procedural interrupt timeout (in audio samples). */ + int timer_t3; + /*! \brief This is only used in error correcting mode. */ + int timer_t5; + /*! \brief This is only used in full duplex (e.g. ISDN) modes. */ + int timer_t6; + /*! \brief This is only used in full duplex (e.g. ISDN) modes. */ + int timer_t7; + /*! \brief This is only used in full duplex (e.g. ISDN) modes. */ + int timer_t8; + + /*! \brief TRUE once the far end FAX entity has been detected. */ + int far_end_detected; + + /*! \brief TRUE if a local T.30 interrupt is pending. */ + int local_interrupt_pending; + /*! \brief The image coding being used on the line. */ + int line_encoding; + /*! \brief The image coding being used for output files. */ + int output_encoding; + /*! \brief The current DCS message minimum scan time code. */ + uint8_t min_scan_time_code; + /*! \brief The X direction resolution of the current image, in pixels per metre. */ + int x_resolution; + /*! \brief The Y direction resolution of the current image, in pixels per metre. */ + int y_resolution; + /*! \brief The width of the current image, in pixels. */ + t4_image_width_t image_width; + /*! \brief Current number of retries of the action in progress. */ + int retries; + /*! \brief TRUE if error correcting mode is used. */ + int error_correcting_mode; + /*! \brief The number of HDLC frame retries, if error correcting mode is used. */ + int error_correcting_mode_retries; + /*! \brief The current count of consecutive T30_PPR messages. */ + int ppr_count; + /*! \brief The current count of consecutive T30_RNR messages. */ + int receiver_not_ready_count; + /*! \brief The number of octets to be used per ECM frame. */ + int octets_per_ecm_frame; + /*! \brief The ECM partial page buffer. */ + uint8_t ecm_data[256][260]; + /*! \brief The lengths of the frames in the ECM partial page buffer. */ + int16_t ecm_len[256]; + /*! \brief A bit map of the OK ECM frames, constructed as a PPR frame. */ + uint8_t ecm_frame_map[3 + 32]; + + /*! \brief The current page number for receiving, in ECM or non-ECM mode. This is reset at the start of a call. */ + int rx_page_number; + /*! \brief The current page number for sending, in ECM or non-ECM mode. This is reset at the start of a call. */ + int tx_page_number; + /*! \brief The current block number, in ECM mode */ + int ecm_block; + /*! \brief The number of frames in the current block number, in ECM mode */ + int ecm_frames; + /*! \brief The number of frames sent in the current burst of image transmission, in ECM mode */ + int ecm_frames_this_tx_burst; + /*! \brief The current ECM frame, during ECM transmission. */ + int ecm_current_tx_frame; + /*! \brief TRUE if we are at the end of an ECM page to se sent - i.e. there are no more + partial pages still to come. */ + int ecm_at_page_end; + + /*! \brief The transmission step queued to follow the one in progress. */ + int next_tx_step; + /*! \brief The FCF for the next receive step. */ + uint8_t next_rx_step; + /*! \brief Image file name for image reception. */ + char rx_file[256]; + /*! \brief The last page we are prepared accept for a received image file. -1 means no restriction. */ + int rx_stop_page; + /*! \brief Image file name to be sent. */ + char tx_file[256]; + /*! \brief The first page to be sent from the image file. -1 means no restriction. */ + int tx_start_page; + /*! \brief The last page to be sent from the image file. -1 means no restriction. */ + int tx_stop_page; + /*! \brief The current completion status. */ + int current_status; + /*! \brief Internet aware FAX mode bit mask. */ + int iaf; + /*! \brief A bit mask of the currently supported modem types. */ + int supported_modems; + /*! \brief A bit mask of the currently supported image compression modes. */ + int supported_compressions; + /*! \brief A bit mask of the currently supported image resolutions. */ + int supported_resolutions; + /*! \brief A bit mask of the currently supported image sizes. */ + int supported_image_sizes; + /*! \brief A bit mask of the currently supported T.30 special features. */ + int supported_t30_features; + /*! \brief TRUE is ECM mode handling is enabled. */ + int ecm_allowed; + + /*! \brief the FCF2 field of the last PPS message we received. */ + uint8_t last_pps_fcf2; + /*! \brief The number of the first ECM frame which we do not currently received correctly. For + a partial page received correctly, this will be one greater than the number of frames it + contains. */ + int ecm_first_bad_frame; + /*! \brief A count of successfully received ECM frames, to assess progress as a basis for + deciding whether to continue error correction when PPRs keep repeating. */ + int ecm_progress; + + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/t30_dis_dtc_dcs_bits.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/t30_dis_dtc_dcs_bits.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,387 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t30_dis_dtc_dcs_bits.h - ITU T.30 fax control bits definitions + * + * Written by Steve Underwood + * + * Copyright (C) 2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t30_dis_dtc_dcs_bits.h,v 1.1.4.1 2009/12/19 09:47:57 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_PRIVATE_T30_DIS_DTC_DCS_BITS_H_) +#define _SPANDSP_PRIVATE_T30_DIS_DTC_DCS_BITS_H_ + +/* Indicates that the terminal has the Simple mode capability defined in ITU-T Rec. T.37. + Internet address signals CIA, TSA or CSA can be sent and received. The recipient terminal + may process or ignore this signal. */ +#define T30_DIS_BIT_T37 1 +#define T30_DCS_BIT_T37 1 + +/* Indicates that the terminal has the capability to communicate using ITU-T Rec. T.38. + Internet address signals CIA, TSA or CSA can be sent and received. The recipient terminal + may process or ignore this signal. */ +#define T30_DIS_BIT_T38 3 +#define T30_DCS_BIT_T38 3 + +/* Bit 4 set to "1" indicates 3rd Generation Mobile Network Access to the GSTN Connection. + Bit 4 set to "0" conveys no information about the type of connection. */ +#define T30_DIS_BIT_3G_MOBILE 4 +#define T30_DCS_BIT_3G_MOBILE 4 + +/* When ISDN mode is used, in DIS/DTC bit 6 shall be set to "0". */ +#define T30_DIS_BIT_V8_CAPABILITY 6 + +/* When ISDN mode is used, in DIS/DTC bit 7 shall be set to "0". */ +#define T30_DIS_BIT_64_OCTET_ECM_FRAMES_PREFERRED 7 + +/* Bit 9 indicates that there is a facsimile document ready to be polled from the answering + terrminal. It is not an indication of a capability. */ +#define T30_DIS_BIT_READY_TO_TRANSMIT_FAX_DOCUMENT 9 + +/* In DIS/DTC bit 10 indicates that the answering terminal has receiving capabilities. + In DCS it is a command to the receiving terminal to set itself in the receive mode. */ +#define T30_DIS_BIT_READY_TO_RECEIVE_FAX_DOCUMENT 10 +#define T30_DCS_BIT_RECEIVE_FAX_DOCUMENT 10 + +/* Bits 11, 12, 13, 14 - modem type */ + +#define T30_DIS_BIT_200_200_CAPABLE 15 +#define T30_DCS_BIT_200_200 15 + +#define T30_DIS_BIT_2D_CAPABLE 16 +#define T30_DCS_BIT_2D_CODING 16 + +/* Standard facsimile terminals conforming to ITU-T Rec. T.4 must have the following capability: + Paper length = 297 mm. */ + +/* Bits 17, 18 - recording width */ + +/* Bits 19, 20 - paper length */ + +/* Bits 21, 22, 23 - min scan line time */ + +/* When ISDN mode is used, in DIS/DTC bits 21 to 23 shall be set to "1". */ + +#define T30_DIS_BIT_UNCOMPRESSED_CAPABLE 26 +#define T30_DCS_BIT_UNCOMPRESSED_MODE 26 + +/* When ISDN mode is used, in DIS/DTC bit 27 shall be set to "1". */ +#define T30_DIS_BIT_ECM_CAPABLE 27 +#define T30_DCS_BIT_ECM 27 + +/* The value of bit 28 in the DCS command is only valid when ECM is selected. */ +#define T30_DCS_BIT_64_OCTET_ECM_FRAMES 28 + +/* The value of bit 31 in the DCS command is only valid when ECM is selected. */ +#define T30_DIS_BIT_T6_CAPABLE 31 +#define T30_DCS_BIT_T6_MODE 31 + +#define T30_DIS_BIT_FNV_CAPABLE 33 +#define T30_DCS_BIT_FNV_CAPABLE 33 + +#define T30_DIS_BIT_MULTIPLE_SELECTIVE_POLLING_CAPABLE 34 + +#define T30_DIS_BIT_POLLED_SUBADDRESSING_CAPABLE 35 + +#define T30_DIS_BIT_T43_CAPABLE 36 +#define T30_DCS_BIT_T43_CODING 36 + +#define T30_DIS_BIT_PLANE_INTERLEAVE_CAPABLE 37 +#define T30_DCS_BIT_PLANE_INTERLEAVE 37 + +#define T30_DIS_BIT_G726_CAPABLE 38 +#define T30_DCS_BIT_G726 38 + +#define T30_DIS_BIT_200_400_CAPABLE 41 +#define T30_DCS_BIT_200_400 41 + +#define T30_DIS_BIT_300_300_CAPABLE 42 +#define T30_DCS_BIT_300_300 42 + +#define T30_DIS_BIT_400_400_CAPABLE 43 +#define T30_DCS_BIT_400_400 43 + +/* Bits 44 and 45 are used only in conjunction with bits 15 and 43. Bit 44 in DCS, when used, + shall correctly indicate the resolution of the transmitted document, which means that bit 44 in DCS may + not always match the indication of bits 44 and 45 in DIS/DTC. Cross selection will cause the distortion + and reduction of reproducible area. + If a receiver indicates in DIS that it prefers to receive metric-based information, but the transmitter has + only the equivalent inch-based information (or vice versa), then communication shall still take place. + Bits 44 and 45 do not require the provision of any additional features on the terminal to + indicate to the sending or receiving user whether the information was transmitted or received on a metric-metric, + inch-inch, metric-inch, inch-metric basis. */ + +#define T30_DIS_BIT_INCH_RESOLUTION_PREFERRED 44 +#define T30_DCS_BIT_INCH_RESOLUTION 44 + +#define T30_DIS_BIT_METRIC_RESOLUTION_PREFERRED 45 + +#define T30_DIS_BIT_MIN_SCAN_TIME_HALVES 46 + +#define T30_DIS_BIT_SELECTIVE_POLLING_CAPABLE 47 + +#define T30_DIS_BIT_SUBADDRESSING_CAPABLE 49 +#define T30_DCS_BIT_SUBADDRESS_TRANSMISSION 49 + +#define T30_DIS_BIT_PASSWORD 50 +#define T30_DCS_BIT_SENDER_ID_TRANSMISSION 50 + +/* Bit 51 indicates that there is a data file ready to be polled from the answering terminal. It is + not an indication of a capability. This bit is used in conjunction with bits 53, 54, 55 and 57. */ +#define T30_DIS_BIT_READY_TO_TRANSMIT_DATA_FILE 51 + +/* The binary file transfer protocol is described in ITU-T Rec. T.434. */ +#define T30_DIS_BIT_BFT_CAPABLE 53 +#define T30_DCS_BIT_BFT 53 + +#define T30_DIS_BIT_DTM_CAPABLE 54 +#define T30_DCS_BIT_DTM 54 + +#define T30_DIS_BIT_EDI_CAPABLE 55 +#define T30_DCS_BIT_EDI 55 + +#define T30_DIS_BIT_BTM_CAPABLE 57 +#define T30_DCS_BIT_BTM 57 + +/* Bit 59 indicates that there is a character-coded or mixed-mode document ready to be polled + from the answering terminal. It is not an indication of a capability. This bit is used in + conjunction with bits 60, 62 and 65. */ +#define T30_DIS_BIT_READY_TO_TRANSMIT_MIXED_MODE_DOCUMENT 59 + +#define T30_DIS_BIT_CHARACTER_MODE 60 +#define T30_DCS_BIT_CHARACTER_MODE 60 + +#define T30_DIS_BIT_MIXED_MODE 62 +#define T30_DCS_BIT_MIXED_MODE 62 + +#define T30_DIS_BIT_PROCESSABLE_MODE_26 65 + +#define T30_DIS_BIT_DIGITAL_NETWORK_CAPABLE 66 +#define T30_DCS_BIT_DIGITAL_NETWORK_CAPABLE 66 + +#define T30_DIS_BIT_DUPLEX_CAPABLE 67 +#define T30_DCS_BIT_DUPLEX_CAPABLE 67 + +#define T30_DIS_BIT_T81_CAPABLE 68 +#define T30_DCS_BIT_FULL_COLOUR_MODEX 68 + +#define T30_DIS_BIT_FULL_COLOUR_CAPABLE 69 +#define T30_DCS_BIT_FULL_COLOUR_MODE 69 + +/* In a DIS/DTC frame, setting bit 71 to "0" indicates that the called terminal can only accept + image data which has been digitized to 8 bits/pel/component for JPEG mode. This is also true for T.43 + mode if bit 36 is also set to "1". Setting bit 71 to "1" indicates that the called terminal can also accept + image data that are digitized to 12 bits/pel/component for JPEG mode. This is also true for T.43 mode if + bit 36 is also set to "1". In a DCS frame, setting bit 71 to "0" indicates that the calling terminal's image + data are digitized to 8 bits/pel/component for JPEG mode. This is also true for T.43 mode if bit 36 is also + set to "1". Setting bit 71 to "1" indicates that the calling terminal transmits image data which has been + digitized to 12 bits/pel/component for JPEG mode. This is also true for T.43 mode if bit 36 is also set + to "1". */ +#define T30_DIS_BIT_12BIT_CAPABLE 71 +#define T30_DCS_BIT_12BIT_COMPONENT 71 + +#define T30_DIS_BIT_NO_SUBSAMPLING 73 +#define T30_DCS_BIT_NO_SUBSAMPLING 73 + +#define T30_DIS_BIT_CUSTOM_ILLUMINANT 74 +#define T30_DCS_BIT_CUSTOM_ILLUMINANT 74 + +#define T30_DIS_BIT_CUSTOM_GAMUT_RANGE 75 +#define T30_DCS_BIT_CUSTOM_GAMUT_RANGE 75 + +#define T30_DIS_BIT_NORTH_AMERICAN_LETTER_CAPABLE 76 +#define T30_DCS_BIT_NORTH_AMERICAN_LETTER 76 + +#define T30_DIS_BIT_NORTH_AMERICAN_LEGAL_CAPABLE 77 +#define T30_DCS_BIT_NORTH_AMERICAN_LEGAL 77 + +#define T30_DIS_BIT_T85_CAPABLE 78 +#define T30_DCS_BIT_T85_MODE 78 + +#define T30_DIS_BIT_T85_L0_CAPABLE 79 +#define T30_DCS_BIT_T85_L0_MODE 79 + +/* In a DIS/DTC frame, setting bit 97 to "0" indicates that the called terminal does not have the + capability to accept 300 pels/25.4 mm x 300 lines/25.4 mm or 400 pels/25.4 mm x 400 lines/25.4 mm + resolutions for colour/gray-scale images or T.44 Mixed Raster Content (MRC) mask layer. + + Setting bit 97 to "1" indicates that the called terminal does have the capability to accept + 300 pels/25.4 mm x 300 lines/25.4 mm or 400 pels/25.4 mm x 400 lines/25.4 mm resolutions for + colour/gray-scale images and MRC mask layer. Bit 97 is valid only when bits 68 and 42 or 43 + (300 pels/25.4 mm x 300 lines/25.4 mm or 400 pels/25.4 mm x 400 lines/25.4 mm) are set to "1". + + In a DCS frame, setting bit 97 to "0" indicates that the calling terminal does not use + 300 pels/25.4 mm x 300 lines/25.4 mm or 400 pels/25.4 mm x 400 lines/25.4 mm resolutions + for colour/gray-scale images and mask layer. + + Setting bit 97 to "1" indicates that the calling terminal uses 300 pels/25.4 mm x 300 lines/25.4 mm + or 400 pels/25.4 mm x 400 lines/25.4 mm resolutions for colour/gray-scale images and MRC mask layer. + Bit 97 is valid only when bits 68 and 42 or 43 (300 pels/25.4 mm x 300 lines/25.4 mm and + 400 pels/25.4 mm x 400 lines/25.4 mm) are set to "1". + + In a DIS/DTC frame, combinations of bit 42, bit 43 and bit 97 indicate that the called terminal + has higher resolution capabilities as follows: + + Resolution capabilities (pels/25.4 mm) + DIS/DTC Monochrome Colour/gray-scale + 42 43 97 300 x 300 400 x 400 300 x 300 400 x 400 + 0 0 0 no no no no + 1 0 0 yes no no no + 0 1 0 no yes no no + 1 1 0 yes yes no no + 0 0 1 (invalid) + 1 0 1 yes no yes no + 0 1 1 no yes no yes + 1 1 1 yes yes yes yes + "yes" means that the called terminal has the corresponding capability. + "no" means that the called terminal does not have the corresponding capability. */ +#define T30_DIS_BIT_COLOUR_GREY_300_300_400_400_CAPABLE 97 +#define T30_DCS_BIT_COLOUR_GREY_300_300_400_400 97 + +/* In a DIS/DTC frame, setting bit 98 to "0" indicates that the called terminal does not have the + capability to accept 100 pels/25.4 mm x 100 lines/25.4 mm spatial resolution for colour or gray-scale + images. Setting bit 98 to "1" indicates that the called terminal does have the capability to accept + 100 pels/25.4 mm x 100 lines/25.4 mm spatial resolution for colour or gray-scale images. Bit 98 is valid + only when bit 68 is set to "1". In a DCS frame, setting bit 98 to "0" indicates that the calling terminal does + not use 100 pels/25.4 mm x 100 lines/25.4 mm spatial resolution for colour or gray-scale images. Setting + bit 98 to "1" indicates that the calling terminal uses 100 pels/25.4 mm x 100 lines/25.4 mm spatial + resolution for colour or gray-scale images. */ +#define T30_DIS_BIT_COLOUR_GREY_100_100_CAPABLE 98 +#define T30_DCS_BIT_COLOUR_GREY_100_100 98 + +/* To provide an error recovery mechanism, when PWD/SEP/SUB/SID/PSA/IRA/ISP frames are sent with DCS or DTC, + bits 49, 102 and 50 in DCS or bits 47, 101, 50 and 35 in DTC shall be set to "1" with the following + meaning: + Bit DIS DTC DCS + 35 Polled SubAddress capability Polled SubAddress transmission Not allowed – set to "0" + 47 Selective polling capability Selective polling transmission Not allowed – set to "0" + 49 Subaddressing capability Not allowed (Set to "0") Subaddressing transmission + 50 Password Password transmission Sender Identification transmission + 101 Internet Selective Polling Address capability Internet Selective Polling Address transmission Not allowed – set to "0" + 102 Internet Routing Address capability Not allowed (Set to "0") Internet Routing Address transmission + + Terminals conforming to the 1993 version of T.30 may set the above bits to "0" even though PWD/SEP/SUB + frames are transmitted. */ +#define T30_DIS_BIT_INTERNET_SELECTIVE_POLLING_ADDRESS 101 + +#define T30_DIS_BIT_INTERNET_ROUTING_ADDRESS 102 +#define T30_DCS_BIT_INTERNET_ROUTING_ADDRESS_TRANSMISSION 102 + +#define T30_DIS_BIT_600_600_CAPABLE 105 +#define T30_DCS_BIT_600_600 105 + +#define T30_DIS_BIT_1200_1200_CAPABLE 106 +#define T30_DCS_BIT_1200_1200 106 + +#define T30_DIS_BIT_300_600_CAPABLE 107 +#define T30_DCS_BIT_300_600 107 + +#define T30_DIS_BIT_400_800_CAPABLE 108 +#define T30_DCS_BIT_400_800 108 + +#define T30_DIS_BIT_600_1200_CAPABLE 109 +#define T30_DCS_BIT_600_1200 109 + +#define T30_DIS_BIT_COLOUR_GREY_600_600_CAPABLE 110 +#define T30_DCS_BIT_COLOUR_GREY_600_600 110 + +#define T30_DIS_BIT_COLOUR_GREY_1200_1200_CAPABLE 111 +#define T30_DCS_BIT_COLOUR_GREY_1200_1200 111 + +#define T30_DIS_BIT_ALTERNATE_DOUBLE_SIDED_CAPABLE 113 +#define T30_DCS_BIT_ALTERNATE_DOUBLE_SIDED_CAPABLE 113 + +#define T30_DIS_BIT_CONTINUOUS_DOUBLE_SIDED_CAPABLE 114 +#define T30_DCS_BIT_CONTINUOUS_DOUBLE_SIDED_CAPABLE 114 + +#define T30_DIS_BIT_BLACK_AND_WHITE_MRC 115 + +#define T30_DIS_BIT_T45_CAPABLE 116 +#define T30_DCS_BIT_T45_MODE 116 + +/* This bit defines the available colour space, when bit 92, 93 or 94 is set to "1". + Available colour space for all combinations of bits 92, 93, 94 and 119 are shown in the following table. + It should be noted that terminals which conform to the 2003 and earlier versions of this Recommendation + will send LAB with "1" in bit 92, 93 or 94 even if bit 119 is set to "1". + + Available colour space for DIS/DTC bits 92, 93, 94 and 119 + + 92 93 94 119 Mode of T.44 Available colour space + 0 0 0 x Not available - + 1 0 0 0 Mode 1 LAB only + 1 0 0 1 Mode 1 YCC only + x 1 x 0 Mode 2 or higher LAB only + x x 1 0 Mode 2 or higher LAB only + x 1 x 1 Mode 2 or higher LAB and YCC + x x 1 1 Mode 2 or higher LAB and YCC + + Colour space for DCS bits 92, 93, 94 and 119 + + 92 93 94 119 Mode of T.44 Colour space + 0 0 0 x* Not available - + 1 0 0 0 Mode 1 LAB + 1 0 0 1 Mode 1 YCC + x 1 x 0 Mode 2 or higher LAB + x x 1 0 Mode 2 or higher LAB + x 1 x 1 Mode 2 or higher YCC or mixing of YCC and LAB + x x 1 1 Mode 2 or higher YCC or mixing of YCC and LAB */ +#define T30_DIS_BIT_T44_COLOUR_SPACE 119 +#define T30_DCS_BIT_T44_COLOUR_SPACE 119 + +/* Can only be set in the communication through the T.38 gateway, to cope with delay of network. + T.x timer (12+-1s) should be used after emitting RNR or TNR. However, after receiving + PPS signal in ECM mode, T.5 timer should be used. */ +#define T30_DIS_BIT_T38_FLOW_CONTROL_CAPABLE 121 +#define T30_DCS_BIT_T38_FLOW_CONTROL_CAPABLE 121 + +/* For resolutions greater than 200 lines/25.4 mm, 4.2.1.1/T.4 specifies the use of specific K + factors for each standardized vertical resolution. To ensure backward compatibility with earlier + versions of ITU-T Rec. T.4, bit 122 indicates when such K factors are being used. */ +#define T30_DIS_BIT_K_GREATER_THAN_4 122 + +/* This bit should be set to "1" if the fax device is an Internet-Aware Fax Device as defined in + ITU-T Rec. T.38 and if it is not affected by the data signal rate indicated by the DIS and DTC + signals when communicating with another Internet-Aware Fax Device operating in T.38 mode. This + bit shall not be used in GSTN mode. */ +#define T30_DIS_BIT_T38_FAX_CAPABLE 123 +/* This bit should be set to "1" if the fax device elects to operate in an Internet-Aware Fax mode + as defined in ITU-T Rec. T.38 in response to a device which has set the related DIS bit to "1". + When this bit is set to "1", the data signal rate of the modem (bits 11-14) should be set to "0". */ +#define T30_DCS_BIT_T38_FAX_MODE 123 + +/* When either bit of 31, 36, 38, 51, 53, 54, 55, 57, 59, 60, 62, 65, 68, 78, 79, 115, 116 and 127 is + set to "1", ECM must be used. If the value of bit field 92 to 94 is non-zero, then ECM must be used. + + Annex K describes the optional continuous-tone colour and gray scale images mode + (sYCC-JPEG mode) protocol. When bit 127 in DIS/DTC frame is set to "1", the called terminal has the + capability to accept sYCC-JPEG mode. This is defined with complete independent in the colour space + CIELAB. In addition, when bit 127 in DCS frame is set to "1", ECM must be used and bits 15, 17, 18, + 19, 20, 41, 42, 43, 45, 46, 68, 69, 71, 73, 74, 75, 76, 77, 97, 98, 105, 106, 107, 108, + 109, 110 and 111 in DCS frame are "Don't care", and should be set to "0". In the case of + transmission of multiple images, a post message signal PPS-MPS between pages, PPS-NULL between + partial pages and PPS-EOP following the last page should be sent from the calling terminal to the + called terminal. */ +#define T30_DIS_BIT_SYCC_T81_CAPABLE 127 +#define T30_DCS_BIT_SYCC_T81_MODE 127 + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/t31.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/t31.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,199 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/t31.h - A T.31 compatible class 1 FAX modem interface. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t31.h,v 1.7 2009/02/12 12:38:39 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_T31_H_) +#define _SPANDSP_PRIVATE_T31_H_ + +/*! + Analogue FAX front end channel descriptor. This defines the state of a single working + instance of an analogue line FAX front end. +*/ +typedef struct +{ + fax_modems_state_t modems; + + /*! The transmit signal handler to be used when the current one has finished sending. */ + span_tx_handler_t *next_tx_handler; + void *next_tx_user_data; + + /*! \brief No of data bits in current_byte. */ + int bit_no; + /*! \brief The current data byte in progress. */ + int current_byte; + + /*! \brief Rx power meter, used to detect silence. */ + power_meter_t rx_power; + /*! \brief Last sample, used for an elementary HPF for the power meter. */ + int16_t last_sample; + /*! \brief The current silence threshold. */ + int32_t silence_threshold_power; + + /*! \brief Samples of silence heard */ + int silence_heard; +} t31_audio_front_end_state_t; + +/*! + Analogue FAX front end channel descriptor. This defines the state of a single working + instance of an analogue line FAX front end. +*/ +typedef struct +{ + /*! \brief Internet Aware FAX mode bit mask. */ + int iaf; + /*! \brief Required time between T.38 transmissions, in ms. */ + int ms_per_tx_chunk; + /*! \brief Bit fields controlling the way data is packed into chunked for transmission. */ + int chunking_modes; + + /*! \brief Core T.38 IFP support */ + t38_core_state_t t38; + + /*! \brief The current transmit step being timed */ + int timed_step; + + /*! \brief TRUE is there has been some T.38 data missed */ + int rx_data_missing; + + /*! \brief The number of octets to send in each image packet (non-ECM or ECM) at the current + rate and the current specified packet interval. */ + int octets_per_data_packet; + + /*! \brief An HDLC context used when sending HDLC messages to the terminal port + (ECM mode support). */ + hdlc_tx_state_t hdlc_tx_term; + /*! \brief An HDLC context used when receiving HDLC messages from the terminal port. + (ECM mode support). */ + hdlc_rx_state_t hdlc_rx_term; + + struct + { + uint8_t buf[T31_T38_MAX_HDLC_LEN]; + int len; + } hdlc_rx; + + struct + { + /*! \brief The number of extra bits in a fully stuffed version of the + contents of the HDLC transmit buffer. This is needed to accurately + estimate the playout time for this frame, through an analogue modem. */ + int extra_bits; + } hdlc_tx; + + /*! \brief TRUE if we are using ECM mode. This is used to select HDLC faking, necessary + with clunky class 1 modems. */ + int ecm_mode; + + /*! \brief Counter for trailing non-ECM bytes, used to flush out the far end's modem. */ + int non_ecm_trailer_bytes; + + /*! \brief The next queued tramsit indicator */ + int next_tx_indicator; + /*! \brief The current T.38 data type being transmitted */ + int current_tx_data_type; + + /*! \brief The current operating mode of the receiver. */ + int current_rx_type; + /*! \brief The current operating mode of the transmitter. */ + int current_tx_type; + + /*! \brief Current transmission bit rate. */ + int tx_bit_rate; + /*! \brief A "sample" count, used to time events. */ + int32_t samples; + /*! \brief The value for samples at the next transmission point. */ + int32_t next_tx_samples; + /*! \brief The current receive timeout. */ + int32_t timeout_rx_samples; +} t31_t38_front_end_state_t; + +/*! + T.31 descriptor. This defines the working state for a single instance of + a T.31 FAX modem. +*/ +struct t31_state_s +{ + at_state_t at_state; + t31_modem_control_handler_t *modem_control_handler; + void *modem_control_user_data; + + t31_audio_front_end_state_t audio; + t31_t38_front_end_state_t t38_fe; + /*! TRUE if working in T.38 mode. */ + int t38_mode; + + /*! HDLC buffer, for composing an HDLC frame from the computer to the channel. */ + struct + { + uint8_t buf[T31_MAX_HDLC_LEN]; + int len; + int ptr; + /*! \brief TRUE when the end of HDLC data from the computer has been detected. */ + int final; + } hdlc_tx; + /*! Buffer for data from the computer to the channel. */ + struct + { + uint8_t data[T31_TX_BUF_LEN]; + /*! \brief The number of bytes stored in transmit buffer. */ + int in_bytes; + /*! \brief The number of bytes sent from the transmit buffer. */ + int out_bytes; + /*! \brief TRUE if the flow of real data has started. */ + int data_started; + /*! \brief TRUE if holding up further data into the buffer, for flow control. */ + int holding; + /*! \brief TRUE when the end of non-ECM data from the computer has been detected. */ + int final; + } tx; + + /*! TRUE if DLE prefix just used */ + int dled; + + /*! \brief Samples of silence awaited, as specified in a "wait for silence" command */ + int silence_awaited; + + /*! \brief The current bit rate for the FAX fast message transfer modem. */ + int bit_rate; + /*! \brief TRUE if a valid HDLC frame has been received in the current reception period. */ + int rx_frame_received; + + /*! \brief Samples elapsed in the current call */ + int64_t call_samples; + int64_t dte_data_timeout; + + /*! \brief The currently queued modem type. */ + int modem; + /*! \brief TRUE when short training mode has been selected by the computer. */ + int short_train; + queue_state_t *rx_queue; + + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/t38_core.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/t38_core.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,135 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/t38_core.h - An implementation of T.38, less the packet exchange part + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t38_core.h,v 1.4 2009/07/14 13:54:22 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_T38_CORE_H_) +#define _SPANDSP_PRIVATE_T38_CORE_H_ + +/*! + Core T.38 state, common to all modes of T.38. +*/ +struct t38_core_state_s +{ + /*! \brief Handler routine to transmit IFP packets generated by the T.38 protocol engine */ + t38_tx_packet_handler_t *tx_packet_handler; + /*! \brief An opaque pointer passed to tx_packet_handler */ + void *tx_packet_user_data; + + /*! \brief Handler routine to process received indicator packets */ + t38_rx_indicator_handler_t *rx_indicator_handler; + /*! \brief Handler routine to process received data packets */ + t38_rx_data_handler_t *rx_data_handler; + /*! \brief Handler routine to process the missing packet condition */ + t38_rx_missing_handler_t *rx_missing_handler; + /*! \brief An opaque pointer passed to any of the above receive handling routines */ + void *rx_user_data; + + /*! NOTE - Bandwidth reduction shall only be done on suitable Phase C data, i.e., MH, MR + and - in the case of transcoding to JBIG - MMR. MMR and JBIG require reliable data + transport such as that provided by TCP. When transcoding is selected, it shall be + applied to every suitable page in a call. */ + + /*! \brief Method 1: Local generation of TCF (required for use with TCP). + Method 2: Transfer of TCF is required for use with UDP (UDPTL or RTP). + Method 2 is not recommended for use with TCP. */ + int data_rate_management_method; + + /*! \brief The emitting gateway may indicate a preference for either UDP/UDPTL, or + UDP/RTP, or TCP for transport of T.38 IFP Packets. The receiving device + selects the transport protocol. */ + int data_transport_protocol; + + /*! \brief Indicates the capability to remove and insert fill bits in Phase C, non-ECM + data to reduce bandwidth in the packet network. */ + int fill_bit_removal; + + /*! \brief Indicates the ability to convert to/from MMR from/to the line format to + improve the compression of the data, and reduce the bandwidth, in the + packet network. */ + int mmr_transcoding; + + /*! \brief Indicates the ability to convert to/from JBIG to reduce bandwidth. */ + int jbig_transcoding; + + /*! \brief For UDP (UDPTL or RTP) modes, this option indicates the maximum + number of octets that can be stored on the remote device before an + overflow condition occurs. It is the responsibility of the transmitting + application to limit the transfer rate to prevent an overflow. The + negotiated data rate should be used to determine the rate at which + data is being removed from the buffer. */ + int max_buffer_size; + + /*! \brief This option indicates the maximum size of a UDPTL packet or the + maximum size of the payload within an RTP packet that can be accepted + by the remote device. */ + int max_datagram_size; + + /*! \brief This is the version number of ITU-T Rec. T.38. New versions shall be + compatible with previous versions. */ + int t38_version; + + /*! \brief Allow time for TEP playout */ + int allow_for_tep; + + /*! \brief The fastest data rate supported by the T.38 channel. */ + int fastest_image_data_rate; + + /*! \brief The number of times each packet type will be sent (low byte). The + depth of redundancy (2nd byte). Higher numbers may increase reliability + for UDP transmission. Zero is valid for the indicator packet category, + to suppress all indicator packets (typicaly for TCP transmission). */ + int category_control[5]; + + /*! \brief TRUE if IFP packet sequence numbers are relevant. For some transports, like TPKT + over TCP they are not relevent. */ + int check_sequence_numbers; + + /*! \brief The sequence number for the next packet to be transmitted */ + int tx_seq_no; + /*! \brief The sequence number expected in the next received packet */ + int rx_expected_seq_no; + + /*! \brief The current receive indicator - i.e. the last indicator received */ + int current_rx_indicator; + /*! \brief The current receive data type - i.e. the last data type received */ + int current_rx_data_type; + /*! \brief The current receive field type - i.e. the last field_type received */ + int current_rx_field_type; + /*! \brief The current transmit indicator - i.e. the last indicator transmitted */ + int current_tx_indicator; + /*! \brief The bit rate for V.34 operation */ + int v34_rate; + + /*! A count of missing receive packets. This count might not be accurate if the + received packet numbers jump wildly. */ + int missing_packets; + + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/t38_gateway.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/t38_gateway.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,207 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/t38_gateway.h - A T.38, less the packet exchange part + * + * Written by Steve Underwood + * + * Copyright (C) 2005, 2006, 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t38_gateway.h,v 1.5 2009/11/07 08:58:58 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_PRIVATE_T38_GATEWAY_H_) +#define _SPANDSP_PRIVATE_T38_GATEWAY_H_ + +/*! + T.38 gateway T.38 side channel descriptor. +*/ +typedef struct +{ + /*! Core T.38 IFP support */ + t38_core_state_t t38; + + /*! \brief TRUE if the NSF, NSC, and NSS are to be suppressed by altering + their contents to something the far end will not recognise. */ + int suppress_nsx_len[2]; + /*! \brief TRUE if we need to corrupt the HDLC frame in progress, so the receiver cannot + interpret it. The two values are for the two directions. */ + int corrupt_current_frame[2]; + + /*! \brief the current class of field being received - i.e. none, non-ECM or HDLC */ + int current_rx_field_class; + /*! \brief The T.38 indicator currently in use */ + int in_progress_rx_indicator; + + /*! \brief The current T.38 data type being sent. */ + int current_tx_data_type; +} t38_gateway_t38_state_t; + +/*! + T.38 gateway audio side channel descriptor. +*/ +typedef struct +{ + /*! \brief The FAX modem set for the audio side fo the gateway. */ + fax_modems_state_t modems; + /*! \brief The current receive signal handler. Actual receiving hop between this + and a dummy receive routine. */ + span_rx_handler_t *base_rx_handler; +} t38_gateway_audio_state_t; + +/*! + T.38 gateway T.38 side state. +*/ +typedef struct +{ + /*! \brief non-ECM and HDLC modem receive data buffer. */ + uint8_t data[T38_RX_BUF_LEN]; + /*! \brief Current pointer into the data buffer. */ + int data_ptr; + /*! \brief The current octet being received as non-ECM data. */ + unsigned int bit_stream; + /*! \brief The number of bits taken from the modem for the current scan row. This + is used during non-ECM transmission will fill bit removal to see that + T.38 packet transmissions do not stretch too far apart. */ + int bits_absorbed; + /*! \brief The current bit number in the current non-ECM octet. */ + int bit_no; + /*! \brief Progressively calculated CRC for HDLC messages received from a modem. */ + uint16_t crc; + /*! \brief TRUE if non-ECM fill bits are to be stripped when sending image data. */ + int fill_bit_removal; + /*! \brief The number of octets to send in each image packet (non-ECM or ECM) at the current + rate and the current specified packet interval. */ + int octets_per_data_packet; + + /*! \brief Bits into the non-ECM buffer */ + int in_bits; + /*! \brief Octets fed out from the non-ECM buffer */ + int out_octets; +} t38_gateway_to_t38_state_t; + +/*! + T.38 gateway HDLC buffer. +*/ +typedef struct +{ + /*! \brief HDLC message buffers. */ + uint8_t buf[T38_MAX_HDLC_LEN]; + /*! \brief HDLC message lengths. */ + int len; + /*! \brief HDLC message status flags. */ + int flags; + /*! \brief HDLC buffer contents. */ + int contents; +} t38_gateway_hdlc_buf_t; + +/*! + T.38 gateway HDLC state. +*/ +typedef struct +{ + /*! \brief HDLC message buffers. */ + t38_gateway_hdlc_buf_t buf[T38_TX_HDLC_BUFS]; +#if 0 + /*! \brief HDLC message buffers. */ + uint8_t buf[T38_TX_HDLC_BUFS][T38_MAX_HDLC_LEN]; + /*! \brief HDLC message lengths. */ + int len[T38_TX_HDLC_BUFS]; + /*! \brief HDLC message status flags. */ + int flags[T38_TX_HDLC_BUFS]; + /*! \brief HDLC buffer contents. */ + int contents[T38_TX_HDLC_BUFS]; +#endif + /*! \brief HDLC buffer number for input. */ + int in; + /*! \brief HDLC buffer number for output. */ + int out; +} t38_gateway_hdlc_state_t; + +/*! + T.38 gateway core descriptor. +*/ +typedef struct +{ + /*! \brief A bit mask of the currently supported modem types. */ + int supported_modems; + /*! \brief TRUE if ECM FAX mode is allowed through the gateway. */ + int ecm_allowed; + + /*! \brief TRUE if in image data modem is to use short training. This usually + follows image_data_mode, but in ECM mode T.30 defines recovery + conditions in which long training is used for image data. */ + int short_train; + /*! \brief TRUE if in image data mode, as opposed to TCF mode. */ + int image_data_mode; + /*! \brief The minimum permitted bits per FAX scan line row. */ + int min_row_bits; + + /*! \brief TRUE if we should count the next MCF as a page end, else FALSE */ + int count_page_on_mcf; + /*! \brief The number of pages for which a confirm (MCF) message was returned. */ + int pages_confirmed; + + /*! \brief TRUE if we are in error correcting (ECM) mode */ + int ecm_mode; + /*! \brief The current bit rate for the fast modem. */ + int fast_bit_rate; + /*! \brief The current fast receive modem type. */ + int fast_rx_modem; + /*! \brief The type of fast receive modem currently active, which may be T38_NONE */ + int fast_rx_active; + + /*! \brief The current timed operation. */ + int timed_mode; + /*! \brief The number of samples until the next timeout event */ + int samples_to_timeout; + + /*! Buffer for HDLC and non-ECM data going to the T.38 channel */ + t38_gateway_to_t38_state_t to_t38; + /*! Buffer for data going to an HDLC modem. */ + t38_gateway_hdlc_state_t hdlc_to_modem; + /*! Buffer for data going to a non-ECM mode modem. */ + t38_non_ecm_buffer_state_t non_ecm_to_modem; + + /*! \brief A pointer to a callback routine to be called when frames are + exchanged. */ + t38_gateway_real_time_frame_handler_t *real_time_frame_handler; + /*! \brief An opaque pointer supplied in real time frame callbacks. */ + void *real_time_frame_user_data; +} t38_gateway_core_state_t; + +/*! + T.38 gateway state. +*/ +struct t38_gateway_state_s +{ + /*! T.38 side state */ + t38_gateway_t38_state_t t38x; + /*! Audio side state */ + t38_gateway_audio_state_t audio; + /*! T.38 core state */ + t38_gateway_core_state_t core; + + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/t38_non_ecm_buffer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/t38_non_ecm_buffer.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,86 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/t38_non_ecm_buffer.h - A rate adapting buffer for T.38 non-ECM image + * and TCF data + * + * Written by Steve Underwood + * + * Copyright (C) 2005, 2006, 2007, 2008 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t38_non_ecm_buffer.h,v 1.2.4.1 2009/12/19 06:43:28 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_T38_NON_ECM_BUFFER_H_) +#define _SPANDSP_PRIVATE_T38_NON_ECM_BUFFER_H_ + +/*! \brief A flow controlled non-ECM image data buffer, for buffering T.38 to analogue + modem data. +*/ +struct t38_non_ecm_buffer_state_s +{ + /*! \brief Minimum number of bits per row, used when fill bits are being deleted on the + link, and restored at the emitting gateway. */ + int min_bits_per_row; + + /*! \brief non-ECM modem transmit data buffer. */ + uint8_t data[T38_NON_ECM_TX_BUF_LEN]; + /*! \brief The current write point in the buffer. */ + int in_ptr; + /*! \brief The current read point in the buffer. */ + int out_ptr; + /*! \brief The location of the most recent EOL marker in the buffer. */ + int latest_eol_ptr; + /*! \brief The number of bits to date in the current row, used when min_row_bits is + to be applied. */ + int row_bits; + + /*! \brief The bit stream entering the buffer, used to detect EOLs */ + unsigned int bit_stream; + /*! \brief The non-ECM flow control fill octet (0xFF before the first data, and 0x00 + once data has started). */ + uint8_t flow_control_fill_octet; + /*! \brief A code for the phase of input buffering, from initial all ones to completion. */ + int input_phase; + /*! \brief TRUE is the end of non-ECM data indication has been received. */ + int data_finished; + /*! \brief The current octet being transmitted from the buffer. */ + unsigned int octet; + /*! \brief The current bit number in the current non-ECM octet. */ + int bit_no; + /*! \brief TRUE if in image data mode, as opposed to TCF mode. */ + int image_data_mode; + + /*! \brief The number of octets input to the buffer. */ + int in_octets; + /*! \brief The number of rows input to the buffer. */ + int in_rows; + /*! \brief The number of non-ECM fill octets generated for minimum row bits + purposes. */ + int min_row_bits_fill_octets; + /*! \brief The number of octets output from the buffer. */ + int out_octets; + /*! \brief The number of rows output from the buffer. */ + int out_rows; + /*! \brief The number of non-ECM fill octets generated for flow control + purposes. */ + int flow_control_fill_octets; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/t38_terminal.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/t38_terminal.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,120 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/t38_terminal.h - T.38 termination, less the packet exchange part + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t38_terminal.h,v 1.2 2008/12/31 13:57:13 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_PRIVATE_T38_TERMINAL_H_) +#define _SPANDSP_PRIVATE_T38_TERMINAL_H_ + +typedef struct +{ + /*! \brief Internet Aware FAX mode bit mask. */ + int iaf; + /*! \brief Required time between T.38 transmissions, in ms. */ + int ms_per_tx_chunk; + /*! \brief Bit fields controlling the way data is packed into chunked for transmission. */ + int chunking_modes; + + /*! \brief Core T.38 IFP support */ + t38_core_state_t t38; + + /*! \brief The current transmit step being timed */ + int timed_step; + + /*! \brief TRUE is there has been some T.38 data missed (i.e. lost packets) in the current + reception period. */ + int rx_data_missing; + + /*! \brief The number of octets to send in each image packet (non-ECM or ECM) at the current + rate and the current specified packet interval. */ + int octets_per_data_packet; + + struct + { + /*! \brief HDLC receive buffer */ + uint8_t buf[T38_MAX_HDLC_LEN]; + /*! \brief The length of the contents of the HDLC receive buffer */ + int len; + } hdlc_rx; + + struct + { + /*! \brief HDLC transmit buffer */ + uint8_t buf[T38_MAX_HDLC_LEN]; + /*! \brief The length of the contents of the HDLC transmit buffer */ + int len; + /*! \brief Current pointer within the contents of the HDLC transmit buffer */ + int ptr; + /*! \brief The number of extra bits in a fully stuffed version of the + contents of the HDLC transmit buffer. This is needed to accurately + estimate the playout time for this frame, through an analogue modem. */ + int extra_bits; + } hdlc_tx; + + /*! \brief Counter for trailing non-ECM bytes, used to flush out the far end's modem. */ + int non_ecm_trailer_bytes; + + /*! \brief The next T.38 indicator queued for transmission. */ + int next_tx_indicator; + /*! \brief The current T.38 data type being transmitted. */ + int current_tx_data_type; + + /*! \brief TRUE if a carrier is present. Otherwise FALSE. */ + int rx_signal_present; + + /*! \brief The current operating mode of the receiver. */ + int current_rx_type; + /*! \brief The current operating mode of the transmitter. */ + int current_tx_type; + + /*! \brief Current transmission bit rate. */ + int tx_bit_rate; + /*! \brief A "sample" count, used to time events. */ + int32_t samples; + /*! \brief The value for samples at the next transmission point. */ + int32_t next_tx_samples; + /*! \brief The current receive timeout. */ + int32_t timeout_rx_samples; +} t38_terminal_front_end_state_t; + +/*! + T.38 terminal state. +*/ +struct t38_terminal_state_s +{ + /*! \brief The T.30 back-end */ + t30_state_t t30; + + /*! \brief The T.38 front-end */ + t38_terminal_front_end_state_t t38_fe; + + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/t4_rx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/t4_rx.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,131 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/t4_rx.h - definitions for T.4 FAX receive processing + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t4_rx.h,v 1.6.2.8 2009/12/21 17:18:40 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_T4_RX_H_) +#define _SPANDSP_PRIVATE_T4_RX_H_ + +/*! + TIFF specific state information to go with T.4 compression or decompression handling. +*/ +typedef struct +{ + /*! \brief The current file name. */ + const char *file; + /*! \brief The libtiff context for the current TIFF file */ + TIFF *tiff_file; + + /*! \brief The number of pages in the current image file. */ + int pages_in_file; + + /*! \brief The compression type for output to the TIFF file. */ + int32_t output_compression; + /*! \brief The TIFF photometric setting for the current page. */ + uint16_t photo_metric; + /*! \brief The TIFF fill order setting for the current page. */ + uint16_t fill_order; + /*! \brief The TIFF G3 FAX options. */ + int32_t output_t4_options; + + /* "Background" information about the FAX, which can be stored in the image file. */ + /*! \brief The vendor of the machine which produced the file. */ + const char *vendor; + /*! \brief The model of machine which produced the file. */ + const char *model; + /*! \brief The local ident string. */ + const char *local_ident; + /*! \brief The remote end's ident string. */ + const char *far_ident; + /*! \brief The FAX sub-address. */ + const char *sub_address; + /*! \brief The FAX DCS information, as an ASCII string. */ + const char *dcs; + + /*! \brief The first page to transfer. -1 to start at the beginning of the file. */ + int start_page; + /*! \brief The last page to transfer. -1 to continue to the end of the file. */ + int stop_page; +} t4_tiff_state_t; + +typedef struct t4_t6_decode_state_s t4_t6_decode_state_t; + +/*! + T.4 1D, T4 2D and T6 decompressor state. +*/ +struct t4_t6_decode_state_s +{ + /*! \brief Callback function to write a row of pixels to the image destination. */ + t4_row_write_handler_t row_write_handler; + /*! \brief Opaque pointer passed to row_write_handler. */ + void *row_write_user_data; + + /*! \brief Incoming bit buffer for decompression. */ + uint32_t rx_bitstream; + /*! \brief The number of bits currently in rx_bitstream. */ + int rx_bits; + /*! \brief The number of bits to be skipped before trying to match the next code word. */ + int rx_skip_bits; + + /*! \brief This variable is used to count the consecutive EOLS we have seen. If it + reaches six, this is the end of the image. It is initially set to -1 for + 1D and 2D decoding, as an indicator that we must wait for the first EOL, + before decoding any image data. */ + int consecutive_eols; + + /*! \brief The reference or starting changing element on the coding line. At the + start of the coding line, a0 is set on an imaginary white changing element + situated just before the first element on the line. During the coding of + the coding line, the position of a0 is defined by the previous coding mode. + (See T.4/4.2.1.3.2.). */ + int a0; + /*! \brief The first changing element on the reference line to the right of a0 and of + opposite colour to a0. */ + int b1; + /*! \brief The length of the in-progress run of black or white. */ + int run_length; + /*! \brief 2D horizontal mode control. */ + int black_white; + /*! \brief TRUE if the current run is black */ + int its_black; + + /*! \brief The current step into the current row run-lengths buffer. */ + int a_cursor; + /*! \brief The current step into the reference row run-lengths buffer. */ + int b_cursor; + + /*! \brief A pointer into the image buffer indicating where the last row begins */ + int last_row_starts_at; + + /*! \brief The current number of consecutive bad rows. */ + int curr_bad_row_run; + /*! \brief The longest run of consecutive bad rows seen in the current page. */ + int longest_bad_row_run; + /*! \brief The total number of bad rows in the current page. */ + int bad_rows; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/t4_tx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/t4_tx.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,142 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/t4_tx.h - definitions for T.4 FAX transmit processing + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t4_tx.h,v 1.7.2.4 2009/12/21 17:18:40 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_T4_TX_H_) +#define _SPANDSP_PRIVATE_T4_TX_H_ + +typedef struct t4_t6_encode_state_s t4_t6_encode_state_t; + +/*! + T.4 1D, T4 2D and T6 compressor state. +*/ +struct t4_t6_encode_state_s +{ + /*! \brief The minimum number of encoded bits per row. This is a timing thing + for hardware FAX machines. */ + int min_bits_per_row; + /*! \brief The current maximum contiguous rows that may be 2D encoded. */ + int max_rows_to_next_1d_row; + + /*! \brief The text which will be used in FAX page header. No text results + in no header line. */ + const char *header_info; + + /*! \brief Number of rows left that can be 2D encoded, before a 1D encoded row + must be used. */ + int rows_to_next_1d_row; + + /*! \brief The number of runs currently in the reference row. */ + int ref_steps; + + /*! \brief Pointer to the byte containing the next image bit to transmit. */ + int bit_pos; + /*! \brief Pointer to the bit within the byte containing the next image bit to transmit. */ + int bit_ptr; + + /*! \brief Callback function to read a row of pixels from the image source. */ + t4_row_read_handler_t row_read_handler; + /*! \brief Opaque pointer passed to row_read_handler. */ + void *row_read_user_data; +}; + +/*! + T.4 FAX compression/decompression descriptor. This defines the working state + for a single instance of a T.4 FAX compression or decompression channel. +*/ +struct t4_state_s +{ + /*! \brief The same structure is used for T.4 transmit and receive. This variable + records which mode is in progress. */ + int rx; + + /*! \brief The type of compression used between the FAX machines. */ + int line_encoding; + + /*! \brief The time at which handling of the current page began. */ + time_t page_start_time; + + /*! \brief The size of the compressed image on the line side, in bits. */ + int line_image_size; + + /*! \brief The current number of bytes per row of uncompressed image data. */ + int bytes_per_row; + /*! \brief The size of the image in the image buffer, in bytes. */ + int image_size; + /*! \brief The current size of the image buffer. */ + int image_buffer_size; + /*! \brief A point to the image buffer. */ + uint8_t *image_buffer; + + /*! \brief The number of pages transferred to date. */ + int current_page; + /*! \brief Column-to-column (X) resolution in pixels per metre. */ + int x_resolution; + /*! \brief Row-to-row (Y) resolution in pixels per metre. */ + int y_resolution; + /*! \brief Width of the current page, in pixels. */ + int image_width; + /*! \brief Length of the current page, in pixels. */ + int image_length; + /*! \brief Current pixel row number. */ + int row; + + /*! \brief This variable is set if we are treating the current row as a 2D encoded + one. */ + int row_is_2d; + /*! \brief The current length of the current row. */ + int row_len; + + /*! \brief Black and white run-lengths for the current row. */ + uint32_t *cur_runs; + /*! \brief Black and white run-lengths for the reference row. */ + uint32_t *ref_runs; + /*! \brief Pointer to the buffer for the current pixel row. */ + uint8_t *row_buf; + + /*! \brief Encoded data bits buffer. */ + uint32_t tx_bitstream; + /*! \brief The number of bits currently in tx_bitstream. */ + int tx_bits; + + /*! \brief The current number of bits in the current encoded row. */ + int row_bits; + /*! \brief The minimum bits in any row of the current page. For monitoring only. */ + int min_row_bits; + /*! \brief The maximum bits in any row of the current page. For monitoring only. */ + int max_row_bits; + + /*! \brief Error and flow logging control */ + logging_state_t logging; + + /*! \brief All TIFF file specific state information for the T.4 context. */ + t4_tiff_state_t tiff; + t4_t6_decode_state_t t4_t6_rx; + t4_t6_encode_state_t t4_t6_tx; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/time_scale.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/time_scale.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,52 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/time_scale.h - Time scaling for linear speech data + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: time_scale.h,v 1.1 2008/11/15 14:27:29 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_TIME_SCALE_H_) +#define _SPANDSP_PRIVATE_TIME_SCALE_H_ + +#define TIME_SCALE_MAX_SAMPLE_RATE 48000 +#define TIME_SCALE_MIN_PITCH 60 +#define TIME_SCALE_MAX_PITCH 250 +#define TIME_SCALE_BUF_LEN (2*TIME_SCALE_MAX_SAMPLE_RATE/TIME_SCALE_MIN_PITCH) + +/*! Audio time scaling descriptor. */ +struct time_scale_state_s +{ + int sample_rate; + int min_pitch; + int max_pitch; + int buf_len; + float playout_rate; + double rcomp; + double rate_nudge; + int fill; + int lcp; + int16_t buf[TIME_SCALE_BUF_LEN]; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/tone_detect.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/tone_detect.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,32 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/tone_detect.h - General telephony tone detection. + * + * Written by Steve Underwood + * + * Copyright (C) 2001, 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: tone_detect.h,v 1.1 2008/11/30 10:17:31 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_TONE_DETECT_H_) +#define _SPANDSP_PRIVATE_TONE_DETECT_H_ + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/tone_generate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/tone_generate.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,68 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/tone_generate.h - General telephony tone generation. + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: tone_generate.h,v 1.1 2008/11/30 10:17:31 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_TONE_GENERATE_H_) +#define _SPANDSP_PRIVATE_TONE_GENERATE_H_ + +struct tone_gen_tone_descriptor_s +{ + int32_t phase_rate; +#if defined(SPANDSP_USE_FIXED_POINT) + int16_t gain; +#else + float gain; +#endif +}; + +/*! + Cadenced multi-tone generator descriptor. +*/ +struct tone_gen_descriptor_s +{ + tone_gen_tone_descriptor_t tone[4]; + int duration[4]; + int repeat; +}; + +/*! + Cadenced multi-tone generator state descriptor. This defines the state of + a single working instance of a generator. +*/ +struct tone_gen_state_s +{ + tone_gen_tone_descriptor_t tone[4]; + + uint32_t phase[4]; + int duration[4]; + int repeat; + + int current_section; + int current_position; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/v17rx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/v17rx.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,232 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/v17rx.h - ITU V.17 modem receive part + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v17rx.h,v 1.2.4.1 2009/12/24 16:52:30 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_V17RX_H_) +#define _SPANDSP_PRIVATE_V17RX_H_ + +/* Target length for the equalizer is about 63 taps, to deal with the worst stuff + in V.56bis. */ +/*! Samples before the target position in the equalizer buffer */ +#define V17_EQUALIZER_PRE_LEN 8 +/*! Samples after the target position in the equalizer buffer */ +#define V17_EQUALIZER_POST_LEN 8 + +/*! The number of taps in the pulse shaping/bandpass filter */ +#define V17_RX_FILTER_STEPS 27 + +/* We can store more trellis depth that we look back over, so that we can push out a group + of symbols in one go, giving greater processing efficiency, at the expense of a bit more + latency through the modem. */ +/* Right now we don't take advantage of this optimisation. */ +/*! The depth of the trellis buffer */ +#define V17_TRELLIS_STORAGE_DEPTH 16 +/*! How far we look back into history for trellis decisions */ +#define V17_TRELLIS_LOOKBACK_DEPTH 16 + +/*! + V.17 modem receive side descriptor. This defines the working state for a + single instance of a V.17 modem receiver. +*/ +struct v17_rx_state_s +{ + /*! \brief The bit rate of the modem. Valid values are 7200 9600, 12000 and 14400. */ + int bit_rate; + /*! \brief The callback function used to put each bit received. */ + put_bit_func_t put_bit; + /*! \brief A user specified opaque pointer passed to the put_but routine. */ + void *put_bit_user_data; + + /*! \brief The callback function used to report modem status changes. */ + modem_rx_status_func_t status_handler; + /*! \brief A user specified opaque pointer passed to the status function. */ + void *status_user_data; + + /*! \brief A callback function which may be enabled to report every symbol's + constellation position. */ + qam_report_handler_t qam_report; + /*! \brief A user specified opaque pointer passed to the qam_report callback + routine. */ + void *qam_user_data; + + /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */ +#if defined(SPANDSP_USE_FIXED_POINT) + int16_t rrc_filter[V17_RX_FILTER_STEPS]; +#else + float rrc_filter[V17_RX_FILTER_STEPS]; +#endif + /*! \brief Current offset into the RRC pulse shaping filter buffer. */ + int rrc_filter_step; + + /*! \brief The state of the differential decoder */ + int diff; + /*! \brief The register for the data scrambler. */ + uint32_t scramble_reg; + /*! \brief Scrambler tap */ + //int scrambler_tap; + + /*! \brief TRUE if the short training sequence is to be used. */ + int short_train; + /*! \brief The section of the training data we are currently in. */ + int training_stage; + /*! \brief A count of how far through the current training step we are. */ + int training_count; + /*! \brief A measure of how much mismatch there is between the real constellation, + and the decoded symbol positions. */ + float training_error; + /*! \brief The value of the last signal sample, using the a simple HPF for signal power estimation. */ + int16_t last_sample; + /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.17 signal. */ + int signal_present; + /*! \brief Whether or not a carrier drop was detected and the signal delivery is pending. */ + int carrier_drop_pending; + /*! \brief A count of the current consecutive samples below the carrier off threshold. */ + int low_samples; + /*! \brief A highest magnitude sample seen. */ + int16_t high_sample; + + /*! \brief The current phase of the carrier (i.e. the DDS parameter). */ + uint32_t carrier_phase; + /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */ + int32_t carrier_phase_rate; + /*! \brief The carrier update rate saved for reuse when using short training. */ + int32_t carrier_phase_rate_save; +#if defined(SPANDSP_USE_FIXED_POINTx) + /*! \brief The proportional part of the carrier tracking filter. */ + float carrier_track_p; + /*! \brief The integral part of the carrier tracking filter. */ + float carrier_track_i; +#else + /*! \brief The proportional part of the carrier tracking filter. */ + float carrier_track_p; + /*! \brief The integral part of the carrier tracking filter. */ + float carrier_track_i; +#endif + + /*! \brief A power meter, to measure the HPF'ed signal power in the channel. */ + power_meter_t power; + /*! \brief The power meter level at which carrier on is declared. */ + int32_t carrier_on_power; + /*! \brief The power meter level at which carrier off is declared. */ + int32_t carrier_off_power; + + /*! \brief Current read offset into the equalizer buffer. */ + int eq_step; + /*! \brief Current write offset into the equalizer buffer. */ + int eq_put_step; + /*! \brief Symbol counter to the next equalizer update. */ + int eq_skip; + + /*! \brief The current half of the baud. */ + int baud_half; + +#if defined(SPANDSP_USE_FIXED_POINTx) + /*! \brief The scaling factor accessed by the AGC algorithm. */ + float agc_scaling; + /*! \brief The previous value of agc_scaling, needed to reuse old training. */ + float agc_scaling_save; + + /*! \brief The current delta factor for updating the equalizer coefficients. */ + float eq_delta; + /*! \brief The adaptive equalizer coefficients. */ + complexi16_t eq_coeff[V17_EQUALIZER_PRE_LEN + 1 + V17_EQUALIZER_POST_LEN]; + /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */ + complexi16_t eq_coeff_save[V17_EQUALIZER_PRE_LEN + 1 + V17_EQUALIZER_POST_LEN]; + /*! \brief The equalizer signal buffer. */ + complexi16_t eq_buf[V17_EQUALIZER_PRE_LEN + 1 + V17_EQUALIZER_POST_LEN]; + + /*! Low band edge filter for symbol sync. */ + int32_t symbol_sync_low[2]; + /*! High band edge filter for symbol sync. */ + int32_t symbol_sync_high[2]; + /*! DC filter for symbol sync. */ + int32_t symbol_sync_dc_filter[2]; + /*! Baud phase for symbol sync. */ + int32_t baud_phase; +#else + /*! \brief The scaling factor accessed by the AGC algorithm. */ + float agc_scaling; + /*! \brief The previous value of agc_scaling, needed to reuse old training. */ + float agc_scaling_save; + + /*! \brief The current delta factor for updating the equalizer coefficients. */ + float eq_delta; + /*! \brief The adaptive equalizer coefficients. */ + complexf_t eq_coeff[V17_EQUALIZER_PRE_LEN + 1 + V17_EQUALIZER_POST_LEN]; + /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */ + complexf_t eq_coeff_save[V17_EQUALIZER_PRE_LEN + 1 + V17_EQUALIZER_POST_LEN]; + /*! \brief The equalizer signal buffer. */ + complexf_t eq_buf[V17_EQUALIZER_PRE_LEN + 1 + V17_EQUALIZER_POST_LEN]; + + /*! Low band edge filter for symbol sync. */ + float symbol_sync_low[2]; + /*! High band edge filter for symbol sync. */ + float symbol_sync_high[2]; + /*! DC filter for symbol sync. */ + float symbol_sync_dc_filter[2]; + /*! Baud phase for symbol sync. */ + float baud_phase; +#endif + + /*! \brief The total symbol timing correction since the carrier came up. + This is only for performance analysis purposes. */ + int total_baud_timing_correction; + + /*! \brief Starting phase angles for the coarse carrier aquisition step. */ + int32_t start_angles[2]; + /*! \brief History list of phase angles for the coarse carrier aquisition step. */ + int32_t angles[16]; + /*! \brief A pointer to the current constellation. */ +#if defined(SPANDSP_USE_FIXED_POINTx) + const complexi16_t *constellation; +#else + const complexf_t *constellation; +#endif + /*! \brief A pointer to the current space map. There is a space map for + each trellis state. */ + int space_map; + /*! \brief The number of bits in each symbol at the current bit rate. */ + int bits_per_symbol; + + /*! \brief Current pointer to the trellis buffers */ + int trellis_ptr; + /*! \brief The trellis. */ + int full_path_to_past_state_locations[V17_TRELLIS_STORAGE_DEPTH][8]; + /*! \brief The trellis. */ + int past_state_locations[V17_TRELLIS_STORAGE_DEPTH][8]; + /*! \brief Euclidean distances (actually the squares of the distances) + from the last states of the trellis. */ +#if defined(SPANDSP_USE_FIXED_POINTx) + uint32_t distances[8]; +#else + float distances[8]; +#endif + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/v17tx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/v17tx.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,111 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/v17tx.h - ITU V.17 modem transmit part + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v17tx.h,v 1.2.4.1 2009/12/24 16:52:30 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_PRIVATE_V17TX_H_) +#define _SPANDSP_PRIVATE_V17TX_H_ + +/*! The number of taps in the pulse shaping/bandpass filter */ +#define V17_TX_FILTER_STEPS 9 + +/*! + V.17 modem transmit side descriptor. This defines the working state for a + single instance of a V.17 modem transmitter. +*/ +struct v17_tx_state_s +{ + /*! \brief The bit rate of the modem. Valid values are 4800, 7200 and 9600. */ + int bit_rate; + /*! \brief The callback function used to get the next bit to be transmitted. */ + get_bit_func_t get_bit; + /*! \brief A user specified opaque pointer passed to the get_bit function. */ + void *get_bit_user_data; + + /*! \brief The callback function used to report modem status changes. */ + modem_tx_status_func_t status_handler; + /*! \brief A user specified opaque pointer passed to the status function. */ + void *status_user_data; + + /*! \brief The gain factor needed to achieve the specified output power. */ +#if defined(SPANDSP_USE_FIXED_POINT) + int32_t gain; +#else + float gain; +#endif + + /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */ +#if defined(SPANDSP_USE_FIXED_POINT) + complexi16_t rrc_filter[2*V17_TX_FILTER_STEPS]; +#else + complexf_t rrc_filter[2*V17_TX_FILTER_STEPS]; +#endif + /*! \brief Current offset into the RRC pulse shaping filter buffer. */ + int rrc_filter_step; + + /*! \brief The current state of the differential encoder. */ + int diff; + /*! \brief The current state of the convolutional encoder. */ + int convolution; + /*! \brief The code number for the current position in the constellation. */ + int constellation_state; + + /*! \brief The register for the data scrambler. */ + uint32_t scramble_reg; + /*! \brief Scrambler tap */ + //int scrambler_tap; + /*! \brief TRUE if transmitting the training sequence. FALSE if transmitting user data. */ + int in_training; + /*! \brief TRUE if the short training sequence is to be used. */ + int short_train; + /*! \brief A counter used to track progress through sending the training sequence. */ + int training_step; + + /*! \brief The current phase of the carrier (i.e. the DDS parameter). */ + uint32_t carrier_phase; + /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */ + int32_t carrier_phase_rate; + /*! \brief The current fractional phase of the baud timing. */ + int baud_phase; + + /*! \brief A pointer to the constellation currently in use. */ +#if defined(SPANDSP_USE_FIXED_POINT) + const complexi16_t *constellation; +#else + const complexf_t *constellation; +#endif + /*! \brief The current number of data bits per symbol. This does not include + the redundant bit. */ + int bits_per_symbol; + /*! \brief The get_bit function in use at any instant. */ + get_bit_func_t current_get_bit; + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/v18.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/v18.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,67 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/v18.h - V.18 text telephony for the deaf. + * + * Written by Steve Underwood + * + * Copyright (C) 2004-2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v18.h,v 1.5 2009/11/04 15:52:06 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_V18_H_) +#define _SPANDSP_PRIVATE_V18_H_ + +struct v18_state_s +{ + /*! \brief TRUE if we are the calling modem */ + int calling_party; + int mode; + put_msg_func_t put_msg; + void *user_data; + + union + { + queue_state_t queue; + uint8_t buf[QUEUE_STATE_T_SIZE(128)]; + } queue; + tone_gen_descriptor_t alert_tone_desc; + tone_gen_state_t alert_tone_gen; + fsk_tx_state_t fsktx; + dtmf_tx_state_t dtmftx; + async_tx_state_t asynctx; + int baudot_tx_shift; + int tx_signal_on; + int byte_no; + + fsk_rx_state_t fskrx; + dtmf_rx_state_t dtmfrx; + int baudot_rx_shift; + int consecutive_ones; + uint8_t rx_msg[256 + 1]; + int rx_msg_len; + int bit_pos; + int in_progress; + + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/v22bis.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/v22bis.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,244 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/v22bis.h - ITU V.22bis modem + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v22bis.h,v 1.12 2009/11/04 15:52:06 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_V22BIS_H_) +#define _SPANDSP_PRIVATE_V22BIS_H_ + +/*! The number of steps to the left and to the right of the target position in the equalizer buffer. */ +#define V22BIS_EQUALIZER_LEN 7 +/*! One less than a power of 2 >= (2*V22BIS_EQUALIZER_LEN + 1) */ +#define V22BIS_EQUALIZER_MASK 15 + +/*! The number of taps in the transmit pulse shaping filter */ +#define V22BIS_TX_FILTER_STEPS 9 + +/*! The number of taps in the receive pulse shaping/bandpass filter */ +#define V22BIS_RX_FILTER_STEPS 37 + +/*! Segments of the training sequence on the receive side */ +enum +{ + V22BIS_RX_TRAINING_STAGE_NORMAL_OPERATION, + V22BIS_RX_TRAINING_STAGE_SYMBOL_ACQUISITION, + V22BIS_RX_TRAINING_STAGE_LOG_PHASE, + V22BIS_RX_TRAINING_STAGE_UNSCRAMBLED_ONES, + V22BIS_RX_TRAINING_STAGE_UNSCRAMBLED_ONES_SUSTAINING, + V22BIS_RX_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200, + V22BIS_RX_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200_SUSTAINING, + V22BIS_RX_TRAINING_STAGE_WAIT_FOR_SCRAMBLED_ONES_AT_2400, + V22BIS_RX_TRAINING_STAGE_PARKED +}; + +/*! Segments of the training sequence on the transmit side */ +enum +{ + V22BIS_TX_TRAINING_STAGE_NORMAL_OPERATION = 0, + V22BIS_TX_TRAINING_STAGE_INITIAL_TIMED_SILENCE, + V22BIS_TX_TRAINING_STAGE_INITIAL_SILENCE, + V22BIS_TX_TRAINING_STAGE_U11, + V22BIS_TX_TRAINING_STAGE_U0011, + V22BIS_TX_TRAINING_STAGE_S11, + V22BIS_TX_TRAINING_STAGE_TIMED_S11, + V22BIS_TX_TRAINING_STAGE_S1111, + V22BIS_TX_TRAINING_STAGE_PARKED +}; + +/*! + V.22bis modem descriptor. This defines the working state for a single instance + of a V.22bis modem. +*/ +struct v22bis_state_s +{ + /*! \brief The maximum permitted bit rate of the modem. Valid values are 1200 and 2400. */ + int bit_rate; + /*! \brief TRUE is this is the calling side modem. */ + int calling_party; + /*! \brief The callback function used to get the next bit to be transmitted. */ + get_bit_func_t get_bit; + /*! \brief A user specified opaque pointer passed to the get_bit callback routine. */ + void *get_bit_user_data; + /*! \brief The callback function used to put each bit received. */ + put_bit_func_t put_bit; + /*! \brief A user specified opaque pointer passed to the put_bit callback routine. */ + void *put_bit_user_data; + /*! \brief The callback function used to report modem status changes. */ + modem_rx_status_func_t status_handler; + /*! \brief A user specified opaque pointer passed to the status function. */ + void *status_user_data; + + int negotiated_bit_rate; + + /* Receive section */ + struct + { + /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */ + float rrc_filter[2*V22BIS_RX_FILTER_STEPS]; + /*! \brief Current offset into the RRC pulse shaping filter buffer. */ + int rrc_filter_step; + + /*! \brief The register for the data scrambler. */ + unsigned int scramble_reg; + /*! \brief A counter for the number of consecutive bits of repeating pattern through + the scrambler. */ + int scrambler_pattern_count; + + /*! \brief 0 if receiving user data. A training stage value during training */ + int training; + /*! \brief A count of how far through the current training step we are. */ + int training_count; + + /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.22bis signal. */ + int signal_present; + + /*! \brief A measure of how much mismatch there is between the real constellation, + and the decoded symbol positions. */ + float training_error; + + /*! \brief The current phase of the carrier (i.e. the DDS parameter). */ + uint32_t carrier_phase; + /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */ + int32_t carrier_phase_rate; + /*! \brief The proportional part of the carrier tracking filter. */ + float carrier_track_p; + /*! \brief The integral part of the carrier tracking filter. */ + float carrier_track_i; + + /*! \brief A callback function which may be enabled to report every symbol's + constellation position. */ + qam_report_handler_t qam_report; + /*! \brief A user specified opaque pointer passed to the qam_report callback + routine. */ + void *qam_user_data; + + /*! \brief A power meter, to measure the HPF'ed signal power in the channel. */ + power_meter_t rx_power; + /*! \brief The power meter level at which carrier on is declared. */ + int32_t carrier_on_power; + /*! \brief The power meter level at which carrier off is declared. */ + int32_t carrier_off_power; + /*! \brief The scaling factor accessed by the AGC algorithm. */ + float agc_scaling; + + int constellation_state; + + /*! \brief The current delta factor for updating the equalizer coefficients. */ + float eq_delta; +#if defined(SPANDSP_USE_FIXED_POINTx) + /*! \brief The adaptive equalizer coefficients. */ + complexi_t eq_coeff[2*V22BIS_EQUALIZER_LEN + 1]; + /*! \brief The equalizer signal buffer. */ + complexi_t eq_buf[V22BIS_EQUALIZER_MASK + 1]; +#else + complexf_t eq_coeff[2*V22BIS_EQUALIZER_LEN + 1]; + complexf_t eq_buf[V22BIS_EQUALIZER_MASK + 1]; +#endif + /*! \brief Current offset into the equalizer buffer. */ + int eq_step; + /*! \brief Current write offset into the equalizer buffer. */ + int eq_put_step; + + /*! \brief Integration variable for damping the Gardner algorithm tests. */ + int gardner_integrate; + /*! \brief Current step size of Gardner algorithm integration. */ + int gardner_step; + /*! \brief The total symbol timing correction since the carrier came up. + This is only for performance analysis purposes. */ + int total_baud_timing_correction; + /*! \brief The current fractional phase of the baud timing. */ + int baud_phase; + + int sixteen_way_decisions; + + int pattern_repeats; + int last_raw_bits; + } rx; + + /* Transmit section */ + struct + { + /*! \brief The gain factor needed to achieve the specified output power. */ + float gain; + + /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */ + complexf_t rrc_filter[2*V22BIS_TX_FILTER_STEPS]; + /*! \brief Current offset into the RRC pulse shaping filter buffer. */ + int rrc_filter_step; + + /*! \brief The register for the data scrambler. */ + unsigned int scramble_reg; + /*! \brief A counter for the number of consecutive bits of repeating pattern through + the scrambler. */ + int scrambler_pattern_count; + + /*! \brief 0 if transmitting user data. A training stage value during training */ + int training; + /*! \brief A counter used to track progress through sending the training sequence. */ + int training_count; + /*! \brief The current phase of the carrier (i.e. the DDS parameter). */ + uint32_t carrier_phase; + /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */ + int32_t carrier_phase_rate; + /*! \brief The current phase of the guard tone (i.e. the DDS parameter). */ + uint32_t guard_phase; + /*! \brief The update rate for the phase of the guard tone (i.e. the DDS increment). */ + int32_t guard_phase_rate; + float guard_level; + /*! \brief The current fractional phase of the baud timing. */ + int baud_phase; + /*! \brief The code number for the current position in the constellation. */ + int constellation_state; + /*! \brief An indicator to mark that we are tidying up to stop transmission. */ + int shutdown; + /*! \brief The get_bit function in use at any instant. */ + get_bit_func_t current_get_bit; + } tx; + + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Reinitialise an existing V.22bis modem receive context. + \brief Reinitialise an existing V.22bis modem receive context. + \param s The modem context. + \return 0 for OK, -1 for bad parameter */ +int v22bis_rx_restart(v22bis_state_t *s); + +void v22bis_report_status_change(v22bis_state_t *s, int status); + +void v22bis_equalizer_coefficient_reset(v22bis_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/v27ter_rx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/v27ter_rx.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,196 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/v27ter_rx.h - ITU V.27ter modem receive part + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v27ter_rx.h,v 1.2 2009/07/09 13:52:09 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_V27TER_RX_H_) +#define _SPANDSP_PRIVATE_V27TER_RX_H_ + +/* Target length for the equalizer is about 43 taps for 4800bps and 32 taps for 2400bps + to deal with the worst stuff in V.56bis. */ +/*! Samples before the target position in the equalizer buffer */ +#define V27TER_EQUALIZER_PRE_LEN 16 /* This much before the real event */ +/*! Samples after the target position in the equalizer buffer */ +#define V27TER_EQUALIZER_POST_LEN 14 /* This much after the real event (must be even) */ + +/*! The number of taps in the 4800bps pulse shaping/bandpass filter */ +#define V27TER_RX_4800_FILTER_STEPS 27 +/*! The number of taps in the 2400bps pulse shaping/bandpass filter */ +#define V27TER_RX_2400_FILTER_STEPS 27 + +#if V27TER_RX_4800_FILTER_STEPS > V27TER_RX_2400_FILTER_STEPS +#define V27TER_RX_FILTER_STEPS V27TER_RX_4800_FILTER_STEPS +#else +#define V27TER_RX_FILTER_STEPS V27TER_RX_2400_FILTER_STEPS +#endif + +/*! + V.27ter modem receive side descriptor. This defines the working state for a + single instance of a V.27ter modem receiver. +*/ +struct v27ter_rx_state_s +{ + /*! \brief The bit rate of the modem. Valid values are 2400 and 4800. */ + int bit_rate; + /*! \brief The callback function used to put each bit received. */ + put_bit_func_t put_bit; + /*! \brief A user specified opaque pointer passed to the put_bit routine. */ + void *put_bit_user_data; + + /*! \brief The callback function used to report modem status changes. */ + modem_rx_status_func_t status_handler; + /*! \brief A user specified opaque pointer passed to the status function. */ + void *status_user_data; + + /*! \brief A callback function which may be enabled to report every symbol's + constellation position. */ + qam_report_handler_t qam_report; + /*! \brief A user specified opaque pointer passed to the qam_report callback + routine. */ + void *qam_user_data; + + /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */ +#if defined(SPANDSP_USE_FIXED_POINT) + int16_t rrc_filter[V27TER_RX_FILTER_STEPS]; +#else + float rrc_filter[V27TER_RX_FILTER_STEPS]; +#endif + /*! \brief Current offset into the RRC pulse shaping filter buffer. */ + int rrc_filter_step; + + /*! \brief The register for the training and data scrambler. */ + unsigned int scramble_reg; + /*! \brief A counter for the number of consecutive bits of repeating pattern through + the scrambler. */ + int scrambler_pattern_count; + /*! \brief The current step in the table of BC constellation positions. */ + int training_bc; + /*! \brief TRUE if the previous trained values are to be reused. */ + int old_train; + /*! \brief The section of the training data we are currently in. */ + int training_stage; + /*! \brief A count of how far through the current training step we are. */ + int training_count; + /*! \brief A measure of how much mismatch there is between the real constellation, + and the decoded symbol positions. */ + float training_error; + /*! \brief The value of the last signal sample, using the a simple HPF for signal power estimation. */ + int16_t last_sample; + /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.27ter signal. */ + int signal_present; + /*! \brief Whether or not a carrier drop was detected and the signal delivery is pending. */ + int carrier_drop_pending; + /*! \brief A count of the current consecutive samples below the carrier off threshold. */ + int low_samples; + /*! \brief A highest magnitude sample seen. */ + int16_t high_sample; + + /*! \brief The position of the current symbol in the constellation, used for + differential decoding. */ + int constellation_state; + + /*! \brief The current phase of the carrier (i.e. the DDS parameter). */ + uint32_t carrier_phase; + /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */ + int32_t carrier_phase_rate; + /*! \brief The carrier update rate saved for reuse when using short training. */ + int32_t carrier_phase_rate_save; +#if defined(SPANDSP_USE_FIXED_POINTx) + /*! \brief The proportional part of the carrier tracking filter. */ + float carrier_track_p; + /*! \brief The integral part of the carrier tracking filter. */ + float carrier_track_i; +#else + /*! \brief The proportional part of the carrier tracking filter. */ + float carrier_track_p; + /*! \brief The integral part of the carrier tracking filter. */ + float carrier_track_i; +#endif + + /*! \brief A power meter, to measure the HPF'ed signal power in the channel. */ + power_meter_t power; + /*! \brief The power meter level at which carrier on is declared. */ + int32_t carrier_on_power; + /*! \brief The power meter level at which carrier off is declared. */ + int32_t carrier_off_power; + + /*! \brief Current read offset into the equalizer buffer. */ + int eq_step; + /*! \brief Current write offset into the equalizer buffer. */ + int eq_put_step; + /*! \brief Symbol counter to the next equalizer update. */ + int eq_skip; + + /*! \brief The current half of the baud. */ + int baud_half; + +#if defined(SPANDSP_USE_FIXED_POINT) + /*! \brief The scaling factor accessed by the AGC algorithm. */ + int16_t agc_scaling; + /*! \brief The previous value of agc_scaling, needed to reuse old training. */ + int16_t agc_scaling_save; + + /*! \brief The current delta factor for updating the equalizer coefficients. */ + float eq_delta; + /*! \brief The adaptive equalizer coefficients. */ + /*complexi16_t*/ complexf_t eq_coeff[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN]; + /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */ + /*complexi16_t*/ complexf_t eq_coeff_save[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN]; + /*! \brief The equalizer signal buffer. */ + /*complexi16_t*/ complexf_t eq_buf[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN]; +#else + /*! \brief The scaling factor accessed by the AGC algorithm. */ + float agc_scaling; + /*! \brief The previous value of agc_scaling, needed to reuse old training. */ + float agc_scaling_save; + + /*! \brief The current delta factor for updating the equalizer coefficients. */ + float eq_delta; + /*! \brief The adaptive equalizer coefficients. */ + complexf_t eq_coeff[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN]; + /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */ + complexf_t eq_coeff_save[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN]; + /*! \brief The equalizer signal buffer. */ + complexf_t eq_buf[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN]; +#endif + + /*! \brief Integration variable for damping the Gardner algorithm tests. */ + int gardner_integrate; + /*! \brief Current step size of Gardner algorithm integration. */ + int gardner_step; + /*! \brief The total symbol timing correction since the carrier came up. + This is only for performance analysis purposes. */ + int total_baud_timing_correction; + + /*! \brief Starting phase angles for the coarse carrier aquisition step. */ + int32_t start_angles[2]; + /*! \brief History list of phase angles for the coarse carrier aquisition step. */ + int32_t angles[16]; + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/v27ter_tx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/v27ter_tx.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,98 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/v27ter_tx.h - ITU V.27ter modem transmit part + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v27ter_tx.h,v 1.3 2009/07/09 13:52:09 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_V27TER_TX_H_) +#define _SPANDSP_PRIVATE_V27TER_TX_H_ + +/*! The number of taps in the pulse shaping/bandpass filter */ +#define V27TER_TX_FILTER_STEPS 9 + +/*! + V.27ter modem transmit side descriptor. This defines the working state for a + single instance of a V.27ter modem transmitter. +*/ +struct v27ter_tx_state_s +{ + /*! \brief The bit rate of the modem. Valid values are 2400 and 4800. */ + int bit_rate; + /*! \brief The callback function used to get the next bit to be transmitted. */ + get_bit_func_t get_bit; + /*! \brief A user specified opaque pointer passed to the get_bit function. */ + void *get_bit_user_data; + + /*! \brief The callback function used to report modem status changes. */ + modem_tx_status_func_t status_handler; + /*! \brief A user specified opaque pointer passed to the status function. */ + void *status_user_data; + +#if defined(SPANDSP_USE_FIXED_POINT) + /*! \brief The gain factor needed to achieve the specified output power at 2400bps. */ + int32_t gain_2400; + /*! \brief The gain factor needed to achieve the specified output power at 4800bps. */ + int32_t gain_4800; +#else + /*! \brief The gain factor needed to achieve the specified output power at 2400bps. */ + float gain_2400; + /*! \brief The gain factor needed to achieve the specified output power at 4800bps. */ + float gain_4800; +#endif + /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */ +#if defined(SPANDSP_USE_FIXED_POINT) + complexi16_t rrc_filter[2*V27TER_TX_FILTER_STEPS]; +#else + complexf_t rrc_filter[2*V27TER_TX_FILTER_STEPS]; +#endif + /*! \brief Current offset into the RRC pulse shaping filter buffer. */ + int rrc_filter_step; + + /*! \brief The register for the training and data scrambler. */ + unsigned int scramble_reg; + /*! \brief A counter for the number of consecutive bits of repeating pattern through + the scrambler. */ + int scrambler_pattern_count; + /*! \brief TRUE if transmitting the training sequence, or shutting down transmission. + FALSE if transmitting user data. */ + int in_training; + /*! \brief A counter used to track progress through sending the training sequence. */ + int training_step; + + /*! \brief The current phase of the carrier (i.e. the DDS parameter). */ + uint32_t carrier_phase; + /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */ + int32_t carrier_phase_rate; + /*! \brief The current fractional phase of the baud timing. */ + int baud_phase; + /*! \brief The code number for the current position in the constellation. */ + int constellation_state; + /*! \brief The get_bit function in use at any instant. */ + get_bit_func_t current_get_bit; + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/v29rx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/v29rx.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,201 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/v29rx.h - ITU V.29 modem receive part + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v29rx.h,v 1.2 2009/07/09 13:52:09 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_V29RX_H_) +#define _SPANDSP_PRIVATE_V29RX_H_ + +/* Target length for the equalizer is about 63 taps, to deal with the worst stuff + in V.56bis. */ +/*! Samples before the target position in the equalizer buffer */ +#define V29_EQUALIZER_PRE_LEN 16 +/*! Samples after the target position in the equalizer buffer */ +#define V29_EQUALIZER_POST_LEN 14 + +/*! The number of taps in the pulse shaping/bandpass filter */ +#define V29_RX_FILTER_STEPS 27 + +/*! + V.29 modem receive side descriptor. This defines the working state for a + single instance of a V.29 modem receiver. +*/ +struct v29_rx_state_s +{ + /*! \brief The bit rate of the modem. Valid values are 4800, 7200 and 9600. */ + int bit_rate; + /*! \brief The callback function used to put each bit received. */ + put_bit_func_t put_bit; + /*! \brief A user specified opaque pointer passed to the put_bit routine. */ + void *put_bit_user_data; + + /*! \brief The callback function used to report modem status changes. */ + modem_rx_status_func_t status_handler; + /*! \brief A user specified opaque pointer passed to the status function. */ + void *status_user_data; + + /*! \brief A callback function which may be enabled to report every symbol's + constellation position. */ + qam_report_handler_t qam_report; + /*! \brief A user specified opaque pointer passed to the qam_report callback + routine. */ + void *qam_user_data; + + /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */ +#if defined(SPANDSP_USE_FIXED_POINT) + int16_t rrc_filter[V29_RX_FILTER_STEPS]; +#else + float rrc_filter[V29_RX_FILTER_STEPS]; +#endif + /*! \brief Current offset into the RRC pulse shaping filter buffer. */ + int rrc_filter_step; + + /*! \brief The register for the data scrambler. */ + unsigned int scramble_reg; + /*! \brief The register for the training scrambler. */ + uint8_t training_scramble_reg; + /*! \brief The current step in the table of CD constellation positions. */ + int training_cd; + /*! \brief TRUE if the previous trained values are to be reused. */ + int old_train; + /*! \brief The section of the training data we are currently in. */ + int training_stage; + /*! \brief A count of how far through the current training step we are. */ + int training_count; + /*! \brief A measure of how much mismatch there is between the real constellation, + and the decoded symbol positions. */ + float training_error; + /*! \brief The value of the last signal sample, using the a simple HPF for signal power estimation. */ + int16_t last_sample; + /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.29 signal. */ + int signal_present; + /*! \brief Whether or not a carrier drop was detected and the signal delivery is pending. */ + int carrier_drop_pending; + /*! \brief A count of the current consecutive samples below the carrier off threshold. */ + int low_samples; + /*! \brief A highest magnitude sample seen. */ + int16_t high_sample; + + /*! \brief The position of the current symbol in the constellation, used for + differential decoding. */ + int constellation_state; + + /*! \brief The current phase of the carrier (i.e. the DDS parameter). */ + uint32_t carrier_phase; + /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */ + int32_t carrier_phase_rate; + /*! \brief The carrier update rate saved for reuse when using short training. */ + int32_t carrier_phase_rate_save; +#if defined(SPANDSP_USE_FIXED_POINT) + /*! \brief The proportional part of the carrier tracking filter. */ + int32_t carrier_track_p; + /*! \brief The integral part of the carrier tracking filter. */ + int32_t carrier_track_i; +#else + /*! \brief The proportional part of the carrier tracking filter. */ + float carrier_track_p; + /*! \brief The integral part of the carrier tracking filter. */ + float carrier_track_i; +#endif + + /*! \brief A power meter, to measure the HPF'ed signal power in the channel. */ + power_meter_t power; + /*! \brief The power meter level at which carrier on is declared. */ + int32_t carrier_on_power; + /*! \brief The power meter level at which carrier off is declared. */ + int32_t carrier_off_power; + + /*! \brief Current read offset into the equalizer buffer. */ + int eq_step; + /*! \brief Current write offset into the equalizer buffer. */ + int eq_put_step; + /*! \brief Symbol counter to the next equalizer update. */ + int eq_skip; + + /*! \brief The current half of the baud. */ + int baud_half; + +#if defined(SPANDSP_USE_FIXED_POINT) + /*! \brief The scaling factor accessed by the AGC algorithm. */ + int16_t agc_scaling; + /*! \brief The previous value of agc_scaling, needed to reuse old training. */ + int16_t agc_scaling_save; + + /*! \brief The current delta factor for updating the equalizer coefficients. */ + int16_t eq_delta; + /*! \brief The adaptive equalizer coefficients. */ + complexi16_t eq_coeff[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN]; + /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */ + complexi16_t eq_coeff_save[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN]; + /*! \brief The equalizer signal buffer. */ + complexi16_t eq_buf[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN]; + + /*! Low band edge filter for symbol sync. */ + int32_t symbol_sync_low[2]; + /*! High band edge filter for symbol sync. */ + int32_t symbol_sync_high[2]; + /*! DC filter for symbol sync. */ + int32_t symbol_sync_dc_filter[2]; + /*! Baud phase for symbol sync. */ + int32_t baud_phase; +#else + /*! \brief The scaling factor accessed by the AGC algorithm. */ + float agc_scaling; + /*! \brief The previous value of agc_scaling, needed to reuse old training. */ + float agc_scaling_save; + + /*! \brief The current delta factor for updating the equalizer coefficients. */ + float eq_delta; + /*! \brief The adaptive equalizer coefficients. */ + complexf_t eq_coeff[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN]; + /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */ + complexf_t eq_coeff_save[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN]; + /*! \brief The equalizer signal buffer. */ + complexf_t eq_buf[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN]; + + /*! Low band edge filter for symbol sync. */ + float symbol_sync_low[2]; + /*! High band edge filter for symbol sync. */ + float symbol_sync_high[2]; + /*! DC filter for symbol sync. */ + float symbol_sync_dc_filter[2]; + /*! Baud phase for symbol sync. */ + float baud_phase; +#endif + + /*! \brief The total symbol timing correction since the carrier came up. + This is only for performance analysis purposes. */ + int total_baud_timing_correction; + + /*! \brief Starting phase angles for the coarse carrier aquisition step. */ + int32_t start_angles[2]; + /*! \brief History list of phase angles for the coarse carrier aquisition step. */ + int32_t angles[16]; + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/v29tx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/v29tx.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,100 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/v29tx.h - ITU V.29 modem transmit part + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v29tx.h,v 1.2 2009/07/09 13:52:09 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_V29TX_H_) +#define _SPANDSP_PRIVATE_V29TX_H_ + +/*! The number of taps in the pulse shaping/bandpass filter */ +#define V29_TX_FILTER_STEPS 9 + +/*! + V.29 modem transmit side descriptor. This defines the working state for a + single instance of a V.29 modem transmitter. +*/ +struct v29_tx_state_s +{ + /*! \brief The bit rate of the modem. Valid values are 4800, 7200 and 9600. */ + int bit_rate; + /*! \brief The callback function used to get the next bit to be transmitted. */ + get_bit_func_t get_bit; + /*! \brief A user specified opaque pointer passed to the get_bit function. */ + void *get_bit_user_data; + + /*! \brief The callback function used to report modem status changes. */ + modem_tx_status_func_t status_handler; + /*! \brief A user specified opaque pointer passed to the status function. */ + void *status_user_data; + + /*! \brief Gain required to achieve the specified output power, not allowing + for the size of the current constellation. */ + float base_gain; + /*! \brief Gain required to achieve the specified output power, allowing + for the size of the current constellation. */ +#if defined(SPANDSP_USE_FIXED_POINT) + int32_t gain; +#else + float gain; +#endif + + /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */ +#if defined(SPANDSP_USE_FIXED_POINT) + complexi16_t rrc_filter[2*V29_TX_FILTER_STEPS]; +#else + complexf_t rrc_filter[2*V29_TX_FILTER_STEPS]; +#endif + /*! \brief Current offset into the RRC pulse shaping filter buffer. */ + int rrc_filter_step; + + /*! \brief The register for the data scrambler. */ + unsigned int scramble_reg; + /*! \brief The register for the training scrambler. */ + uint8_t training_scramble_reg; + /*! \brief TRUE if transmitting the training sequence, or shutting down transmission. + FALSE if transmitting user data. */ + int in_training; + /*! \brief A counter used to track progress through sending the training sequence. */ + int training_step; + /*! \brief An offset value into the table of training parameters, used to match the + training pattern to the bit rate. */ + int training_offset; + + /*! \brief The current phase of the carrier (i.e. the DDS parameter). */ + uint32_t carrier_phase; + /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */ + int32_t carrier_phase_rate; + /*! \brief The current fractional phase of the baud timing. */ + int baud_phase; + /*! \brief The code number for the current position in the constellation. */ + int constellation_state; + /*! \brief The get_bit function in use at any instant. */ + get_bit_func_t current_get_bit; + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/v42.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/v42.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,119 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/v42.h + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v42.h,v 1.2 2009/11/04 15:52:06 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_V42_H_) +#define _SPANDSP_PRIVATE_V42_H_ + +/*! + LAP-M descriptor. This defines the working state for a single instance of LAP-M. +*/ +struct lapm_state_s +{ + int handle; + hdlc_rx_state_t hdlc_rx; + hdlc_tx_state_t hdlc_tx; + + v42_frame_handler_t iframe_receive; + void *iframe_receive_user_data; + + v42_status_func_t status_callback; + void *status_callback_user_data; + + int state; + int tx_waiting; + int debug; + /*! TRUE if originator. FALSE if answerer */ + int we_are_originator; + /*! Remote network type (unknown, answerer. originator) */ + int peer_is_originator; + /*! Next N(S) for transmission */ + int next_tx_frame; + /*! The last of our frames which the peer acknowledged */ + int last_frame_peer_acknowledged; + /*! Next N(R) for reception */ + int next_expected_frame; + /*! The last of the peer's frames which we acknowledged */ + int last_frame_we_acknowledged; + /*! TRUE if we sent an I or S frame with the F-bit set */ + int solicit_f_bit; + /*! Retransmission count */ + int retransmissions; + /*! TRUE if peer is busy */ + int busy; + + /*! Acknowledgement timer */ + int t401_timer; + /*! Reply delay timer - optional */ + int t402_timer; + /*! Inactivity timer - optional */ + int t403_timer; + /*! Maximum number of octets in an information field */ + int n401; + /*! Window size */ + int window_size_k; + + lapm_frame_queue_t *txqueue; + lapm_frame_queue_t *tx_next; + lapm_frame_queue_t *tx_last; + queue_state_t *tx_queue; + + span_sched_state_t sched; + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +/*! + V.42 descriptor. This defines the working state for a single instance of V.42. +*/ +struct v42_state_s +{ + /*! TRUE if we are the calling party, otherwise FALSE */ + int calling_party; + /*! TRUE if we should detect whether the far end is V.42 capable. FALSE if we go + directly to protocol establishment */ + int detect; + + /*! Stage in negotiating V.42 support */ + int rx_negotiation_step; + int rxbits; + int rxstream; + int rxoks; + int odp_seen; + int txbits; + int txstream; + int txadps; + /*! The LAP.M context */ + lapm_state_t lapm; + + /*! V.42 support detection timer */ + int t400_timer; + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/v42bis.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/v42bis.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,151 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/v42bis.h + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v42bis.h,v 1.1 2008/11/15 14:43:08 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_V42BIS_H_) +#define _SPANDSP_PRIVATE_V42BIS_H_ + +/*! + V.42bis dictionary node. +*/ +typedef struct +{ + /*! \brief The prior code for each defined code. */ + uint16_t parent_code; + /*! \brief The number of leaf nodes this node has */ + int16_t leaves; + /*! \brief This leaf octet for each defined code. */ + uint8_t node_octet; + /*! \brief Bit map of the children which exist */ + uint32_t children[8]; +} v42bis_dict_node_t; + +/*! + V.42bis compression. This defines the working state for a single instance + of V.42bis compression. +*/ +typedef struct +{ + /*! \brief Compression mode. */ + int compression_mode; + /*! \brief Callback function to handle received frames. */ + v42bis_frame_handler_t handler; + /*! \brief An opaque pointer passed in calls to frame_handler. */ + void *user_data; + /*! \brief The maximum frame length allowed */ + int max_len; + + uint32_t string_code; + uint32_t latest_code; + int string_length; + uint32_t output_bit_buffer; + int output_bit_count; + int output_octet_count; + uint8_t output_buf[1024]; + v42bis_dict_node_t dict[V42BIS_MAX_CODEWORDS]; + /*! \brief TRUE if we are in transparent (i.e. uncompressable) mode */ + int transparent; + int change_transparency; + /*! \brief IIR filter state, used in assessing compressibility. */ + int compressibility_filter; + int compressibility_persistence; + + /*! \brief Next empty dictionary entry */ + uint32_t v42bis_parm_c1; + /*! \brief Current codeword size */ + int v42bis_parm_c2; + /*! \brief Threshold for codeword size change */ + uint32_t v42bis_parm_c3; + + /*! \brief Mark that this is the first octet/code to be processed */ + int first; + uint8_t escape_code; +} v42bis_compress_state_t; + +/*! + V.42bis decompression. This defines the working state for a single instance + of V.42bis decompression. +*/ +typedef struct +{ + /*! \brief Callback function to handle decompressed data. */ + v42bis_data_handler_t handler; + /*! \brief An opaque pointer passed in calls to data_handler. */ + void *user_data; + /*! \brief The maximum decompressed data block length allowed */ + int max_len; + + uint32_t old_code; + uint32_t last_old_code; + uint32_t input_bit_buffer; + int input_bit_count; + int octet; + int last_length; + int output_octet_count; + uint8_t output_buf[1024]; + v42bis_dict_node_t dict[V42BIS_MAX_CODEWORDS]; + /*! \brief TRUE if we are in transparent (i.e. uncompressable) mode */ + int transparent; + + int last_extra_octet; + + /*! \brief Next empty dictionary entry */ + uint32_t v42bis_parm_c1; + /*! \brief Current codeword size */ + int v42bis_parm_c2; + /*! \brief Threshold for codeword size change */ + uint32_t v42bis_parm_c3; + + /*! \brief Mark that this is the first octet/code to be processed */ + int first; + uint8_t escape_code; + int escaped; +} v42bis_decompress_state_t; + +/*! + V.42bis compression/decompression descriptor. This defines the working state for a + single instance of V.42bis compress/decompression. +*/ +struct v42bis_state_s +{ + /*! \brief V.42bis data compression directions. */ + int v42bis_parm_p0; + + /*! \brief Compression state. */ + v42bis_compress_state_t compress; + /*! \brief Decompression state. */ + v42bis_decompress_state_t decompress; + + /*! \brief Maximum codeword size (bits) */ + int v42bis_parm_n1; + /*! \brief Total number of codewords */ + uint32_t v42bis_parm_n2; + /*! \brief Maximum string length */ + int v42bis_parm_n7; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/private/v8.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/private/v8.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,78 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/v8.h - V.8 modem negotiation processing. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v8.h,v 1.3.4.1 2009/12/28 12:20:47 steveu Exp $ + */ + +#if !defined(_SPANDSP_PRIVATE_V8_H_) +#define _SPANDSP_PRIVATE_V8_H_ + +struct v8_state_s +{ + /*! \brief TRUE if we are the calling modem */ + int calling_party; + + v8_result_handler_t *result_handler; + void *result_handler_user_data; + + /*! \brief The current state of the V.8 protocol */ + int state; + int fsk_tx_on; + int modem_connect_tone_tx_on; + int negotiation_timer; + int ci_timer; + int ci_count; + fsk_tx_state_t v21tx; + fsk_rx_state_t v21rx; + queue_state_t *tx_queue; + modem_connect_tones_tx_state_t ansam_tx; + modem_connect_tones_rx_state_t ansam_rx; + + /*! \brief Modulation schemes available at this end. */ + unsigned int far_end_modulations; + + v8_parms_t parms; + v8_parms_t result; + + /* V.8 data parsing */ + uint32_t bit_stream; + int bit_cnt; + /* Indicates the type of message coming up */ + int preamble_type; + uint8_t rx_data[64]; + int rx_data_ptr; + + /*! \brief a reference copy of the last CM or JM message, used when + testing for matches. */ + uint8_t cm_jm_data[64]; + int cm_jm_len; + int got_cm_jm; + int got_cj; + int zero_byte_count; + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/queue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/queue.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,180 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * queue.h - simple in process message queuing + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: queue.h,v 1.21 2009/02/10 13:06:47 steveu Exp $ + */ + +/*! \file */ + +/*! \page queue_page Queuing +\section queue_page_sec_1 What does it do? +This module provides lock free queuing for either octet streams or messages. +Specifically, lock free means one thread can write and another can read without +locking the queue. It does NOT means a free-for-all is possible, with many +threads writing or many threads reading. Those things would require locking, +to avoid conflicts between the multiple threads acting on one end of the queue. + +\section queue_page_sec_2 How does it work? +???. +*/ + +#if !defined(_SPANDSP_QUEUE_H_) +#define _SPANDSP_QUEUE_H_ + +/*! Flag bit to indicate queue reads are atomic operations. This must be set + if the queue is to be used with the message oriented functions. */ +#define QUEUE_READ_ATOMIC 0x0001 +/*! Flag bit to indicate queue writes are atomic operations. This must be set + if the queue is to be used with the message oriented functions. */ +#define QUEUE_WRITE_ATOMIC 0x0002 + +/*! + Queue descriptor. This defines the working state for a single instance of + a byte stream or message oriented queue. +*/ +typedef struct queue_state_s queue_state_t; + +#define QUEUE_STATE_T_SIZE(len) (sizeof(queue_state_t) + len + 1) + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Check if a queue is empty. + \brief Check if a queue is empty. + \param s The queue context. + \return TRUE if empty, else FALSE. */ +SPAN_DECLARE(int) queue_empty(queue_state_t *s); + +/*! Check the available free space in a queue's buffer. + \brief Check available free space. + \param s The queue context. + \return The number of bytes of free space. */ +SPAN_DECLARE(int) queue_free_space(queue_state_t *s); + +/*! Check the contents of a queue. + \brief Check the contents of a queue. + \param s The queue context. + \return The number of bytes in the queue. */ +SPAN_DECLARE(int) queue_contents(queue_state_t *s); + +/*! Flush the contents of a queue. + \brief Flush the contents of a queue. + \param s The queue context. */ +SPAN_DECLARE(void) queue_flush(queue_state_t *s); + +/*! Copy bytes from a queue. This is similar to queue_read, but + the data remains in the queue. + \brief Copy bytes from a queue. + \param s The queue context. + \param buf The buffer into which the bytes will be read. + \param len The length of the buffer. + \return the number of bytes returned. */ +SPAN_DECLARE(int) queue_view(queue_state_t *s, uint8_t *buf, int len); + +/*! Read bytes from a queue. + \brief Read bytes from a queue. + \param s The queue context. + \param buf The buffer into which the bytes will be read. + \param len The length of the buffer. + \return the number of bytes returned. */ +SPAN_DECLARE(int) queue_read(queue_state_t *s, uint8_t *buf, int len); + +/*! Read a byte from a queue. + \brief Read a byte from a queue. + \param s The queue context. + \return the byte, or -1 if the queue is empty. */ +SPAN_DECLARE(int) queue_read_byte(queue_state_t *s); + +/*! Write bytes to a queue. + \brief Write bytes to a queue. + \param s The queue context. + \param buf The buffer containing the bytes to be written. + \param len The length of the buffer. + \return the number of bytes actually written. */ +SPAN_DECLARE(int) queue_write(queue_state_t *s, const uint8_t *buf, int len); + +/*! Write a byte to a queue. + \brief Write a byte to a queue. + \param s The queue context. + \param byte The byte to be written. + \return the number of bytes actually written. */ +SPAN_DECLARE(int) queue_write_byte(queue_state_t *s, uint8_t byte); + +/*! Test the length of the message at the head of a queue. + \brief Test message length. + \param s The queue context. + \return The length of the next message, in byte. If there are + no messages in the queue, -1 is returned. */ +SPAN_DECLARE(int) queue_state_test_msg(queue_state_t *s); + +/*! Read a message from a queue. If the message is longer than the buffer + provided, only the first len bytes of the message will be returned. The + remainder of the message will be discarded. + \brief Read a message from a queue. + \param s The queue context. + \param buf The buffer into which the message will be read. + \param len The length of the buffer. + \return The number of bytes returned. If there are + no messages in the queue, -1 is returned. */ +SPAN_DECLARE(int) queue_read_msg(queue_state_t *s, uint8_t *buf, int len); + +/*! Write a message to a queue. + \brief Write a message to a queue. + \param s The queue context. + \param buf The buffer from which the message will be written. + \param len The length of the message. + \return The number of bytes actually written. */ +SPAN_DECLARE(int) queue_write_msg(queue_state_t *s, const uint8_t *buf, int len); + +/*! Initialise a queue. + \brief Initialise a queue. + \param s The queue context. If is imperative that the context this + points to is immediately followed by a buffer of the required + size + 1 octet. + \param len The length of the queue's buffer. + \param flags Flags controlling the operation of the queue. + Valid flags are QUEUE_READ_ATOMIC and QUEUE_WRITE_ATOMIC. + \return A pointer to the context if OK, else NULL. */ +SPAN_DECLARE(queue_state_t *) queue_init(queue_state_t *s, int len, int flags); + +/*! Release a queue. + \brief Release a queue. + \param s The queue context. + \return 0 if OK, else -1. */ +SPAN_DECLARE(int) queue_release(queue_state_t *s); + +/*! Free a queue. + \brief Delete a queue. + \param s The queue context. + \return 0 if OK, else -1. */ +SPAN_DECLARE(int) queue_free(queue_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/saturated.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/saturated.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,223 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * saturated.h - General saturated arithmetic routines. + * + * Written by Steve Underwood + * + * Copyright (C) 2001, 2008 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: saturated.h,v 1.4 2009/02/05 12:21:36 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_SATURATED_H_) +#define _SPANDSP_SATURATED_H_ + +/*! \page saturated_page Saturated arithmetic + +\section saturated_page_sec_1 What does it do? + + +\section saturated_page_sec_2 How does it work? + +*/ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +static __inline__ int16_t saturate(int32_t amp) +{ + int16_t amp16; + + /* Hopefully this is optimised for the common case - not clipping */ + amp16 = (int16_t) amp; + if (amp == amp16) + return amp16; + if (amp > INT16_MAX) + return INT16_MAX; + return INT16_MIN; +} +/*- End of function --------------------------------------------------------*/ + +/*! Saturate to 15 bits, rather than the usual 16 bits. This is often a useful function. */ +static __inline__ int16_t saturate15(int32_t amp) +{ + if (amp > 16383) + return 16383; + if (amp < -16384) + return -16384; + return (int16_t) amp; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int16_t fsaturatef(float famp) +{ + if (famp > (float) INT16_MAX) + return INT16_MAX; + if (famp < (float) INT16_MIN) + return INT16_MIN; + return (int16_t) lrintf(famp); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int16_t fsaturate(double damp) +{ + if (damp > (double) INT16_MAX) + return INT16_MAX; + if (damp < (double) INT16_MIN) + return INT16_MIN; + return (int16_t) lrint(damp); +} +/*- End of function --------------------------------------------------------*/ + +/* Saturate to a 16 bit integer, using the fastest float to int conversion */ +static __inline__ int16_t ffastsaturatef(float famp) +{ + if (famp > (float) INT16_MAX) + return INT16_MAX; + if (famp < (float) INT16_MIN) + return INT16_MIN; + return (int16_t) lfastrintf(famp); +} +/*- End of function --------------------------------------------------------*/ + +/* Saturate to a 16 bit integer, using the fastest double to int conversion */ +static __inline__ int16_t ffastsaturate(double damp) +{ + if (damp > (double) INT16_MAX) + return INT16_MAX; + if (damp < (double) INT16_MIN) + return INT16_MIN; + return (int16_t) lfastrint(damp); +} +/*- End of function --------------------------------------------------------*/ + +/* Saturate to a 16 bit integer, using the closest float to int conversion */ +static __inline__ float ffsaturatef(float famp) +{ + if (famp > (float) INT16_MAX) + return (float) INT16_MAX; + if (famp < (float) INT16_MIN) + return (float) INT16_MIN; + return famp; +} +/*- End of function --------------------------------------------------------*/ + +/* Saturate to a 16 bit integer, using the closest double to int conversion */ +static __inline__ double ffsaturate(double famp) +{ + if (famp > (double) INT16_MAX) + return (double) INT16_MAX; + if (famp < (double) INT16_MIN) + return (double) INT16_MIN; + return famp; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int16_t saturated_add16(int16_t a, int16_t b) +{ +#if defined(__GNUC__) && defined(__i386__) + __asm__ __volatile__( + " addw %2,%0;\n" + " jno 0f;\n" + " movw $0x7fff,%0;\n" + " adcw $0,%0;\n" + "0:" + : "=r" (a) + : "0" (a), "ir" (b) + : "cc" + ); + return a; +#else + return saturate((int32_t) a + (int32_t) b); +#endif +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int32_t saturated_add32(int32_t a, int32_t b) +{ +#if defined(__GNUC__) && defined(__i386__) + __asm__ __volatile__( + " addl %2,%0;\n" + " jno 0f;\n" + " movl $0x7fffffff,%0;\n" + " adcl $0,%0;\n" + "0:" + : "=r" (a) + : "0" (a), "ir" (b) + : "cc" + ); + return a; +#else + uint32_t A; + + if (a < 0) + { + if (b >= 0) + return a + b; + /*endif*/ + A = (uint32_t) -(a + 1) + (uint32_t) -(b + 1); + return (A >= INT32_MAX) ? INT32_MIN : -(int32_t) A - 2; + } + /*endif*/ + if (b <= 0) + return a + b; + /*endif*/ + A = (uint32_t) a + (uint32_t) b; + return (A > INT32_MAX) ? INT32_MAX : A; +#endif +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int16_t saturated_sub16(int16_t a, int16_t b) +{ + return saturate((int32_t) a - (int32_t) b); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int16_t saturated_mul16(int16_t a, int16_t b) +{ + if (a == INT16_MIN && b == INT16_MIN) + return INT16_MAX; + /*endif*/ + return (int16_t) (((int32_t) a*(int32_t) b) >> 15); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int32_t saturated_mul_16_32(int16_t a, int16_t b) +{ + return ((int32_t) a*(int32_t) b) << 1; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int16_t saturated_abs16(int16_t a) +{ + return (a == INT16_MIN) ? INT16_MAX : (int16_t) abs(a); +} +/*- End of function --------------------------------------------------------*/ + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/schedule.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/schedule.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,70 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * schedule.h + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: schedule.h,v 1.20 2009/02/10 13:06:47 steveu Exp $ + */ + +/*! \file */ + +/*! \page schedule_page Scheduling +\section schedule_page_sec_1 What does it do? +???. + +\section schedule_page_sec_2 How does it work? +???. +*/ + +#if !defined(_SPANDSP_SCHEDULE_H_) +#define _SPANDSP_SCHEDULE_H_ + +/*! A scheduled event entry. */ +typedef struct span_sched_s span_sched_t; + +/*! A scheduled event queue. */ +typedef struct span_sched_state_s span_sched_state_t; + +typedef void (*span_sched_callback_func_t)(span_sched_state_t *s, void *user_data); + +#if defined(__cplusplus) +extern "C" +{ +#endif + +SPAN_DECLARE(uint64_t) span_schedule_next(span_sched_state_t *s); +SPAN_DECLARE(uint64_t) span_schedule_time(span_sched_state_t *s); + +SPAN_DECLARE(int) span_schedule_event(span_sched_state_t *s, int us, span_sched_callback_func_t function, void *user_data); +SPAN_DECLARE(void) span_schedule_update(span_sched_state_t *s, int us); +SPAN_DECLARE(void) span_schedule_del(span_sched_state_t *s, int id); + +SPAN_DECLARE(span_sched_state_t *) span_schedule_init(span_sched_state_t *s); +SPAN_DECLARE(int) span_schedule_release(span_sched_state_t *s); +SPAN_DECLARE(int) span_schedule_free(span_sched_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/sig_tone.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/sig_tone.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,187 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * sig_tone.h - Signalling tone processing for the 2280Hz, 2400Hz, 2600Hz + * and similar signalling tone used in older protocols. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: sig_tone.h,v 1.20 2009/09/04 14:38:46 steveu Exp $ + */ + +/*! \file */ + +/*! \page sig_tone_page The signaling tone processor +\section sig_tone_sec_1 What does it do? +The signaling tone processor handles the 2280Hz, 2400Hz and 2600Hz tones, used +in many analogue signaling procotols, and digital ones derived from them. + +\section sig_tone_sec_2 How does it work? +Most single and two voice frequency signalling systems share many features, as these +features have developed in similar ways over time, to address the limitations of +early tone signalling systems. + +The usual practice is to start the generation of tone at a high energy level, so a +strong signal is available at the receiver, for crisp tone detection. If the tone +remains on for a significant period, the energy level is reduced, to minimise crosstalk. +During the signalling transitions, only the tone is sent through the channel, and the media +signal is suppressed. This means the signalling receiver has a very clean signal to work with, +allowing for crisp detection of the signalling tone. However, when the signalling tone is on +for extended periods, there may be supervisory information in the media signal, such as voice +announcements. To allow these to pass through the system, the signalling tone is mixed with +the media signal. It is the job of the signalling receiver to separate the signalling tone +and the media. The necessary filtering may degrade the quality of the voice signal, but at +least supervisory information may be heard. +*/ + +#if !defined(_SPANDSP_SIG_TONE_H_) +#define _SPANDSP_SIG_TONE_H_ + +/* The optional tone sets */ +enum +{ + /*! European 2280Hz signaling tone. Tone 1 is 2280Hz. Tone 2 is not used. */ + SIG_TONE_2280HZ = 1, + /*! US 2600Hz signaling tone. Tone 1 is 2600Hz. Tone 2 is not used. */ + SIG_TONE_2600HZ, + /*! US 2400Hz + 2600Hz signaling tones. Tone 1 is 2600Hz. Tone 2 is 2400Hz. */ + SIG_TONE_2400HZ_2600HZ +}; + +/* Mode control and report bits for transmit and receive */ +enum +{ + /*! Signaling tone 1 is present */ + SIG_TONE_1_PRESENT = 0x001, + /*! Signaling tone 1 has changed state (ignored when setting tx mode) */ + SIG_TONE_1_CHANGE = 0x002, + /*! Signaling tone 2 is present */ + SIG_TONE_2_PRESENT = 0x004, + /*! Signaling tone 2 has changed state (ignored when setting tx mode) */ + SIG_TONE_2_CHANGE = 0x008, + /*! The media signal is passing through. Tones might be added to it. */ + SIG_TONE_TX_PASSTHROUGH = 0x010, + /*! The media signal is passing through. Tones might be extracted from it, if detected. */ + SIG_TONE_RX_PASSTHROUGH = 0x040, + /*! Force filtering of the signaling tone, whether signaling is being detected or not. + This is mostly useful for test purposes. */ + SIG_TONE_RX_FILTER_TONE = 0x080, + /*! Request an update of the transmit status, upon timeout of the previous status. */ + SIG_TONE_TX_UPDATE_REQUEST = 0x100, + /*! Request an update of the receiver status, upon timeout of the previous status. */ + SIG_TONE_RX_UPDATE_REQUEST = 0x200 +}; + +/*! + Signaling tone descriptor. This defines the working state for a + single instance of the transmit and receive sides of a signaling + tone processor. +*/ +typedef struct sig_tone_descriptor_s sig_tone_descriptor_t; + +typedef struct sig_tone_tx_state_s sig_tone_tx_state_t; + +typedef struct sig_tone_rx_state_s sig_tone_rx_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Process a block of received audio samples. + \brief Process a block of received audio samples. + \param s The signaling tone context. + \param amp The audio sample buffer. + \param len The number of samples in the buffer. + \return The number of samples unprocessed. */ +SPAN_DECLARE(int) sig_tone_rx(sig_tone_rx_state_t *s, int16_t amp[], int len); + +/*! Set the receive mode. + \brief Set the receive mode. + \param s The signaling tone context. + \param mode The new mode for the receiver. + \param duration The duration for this mode, before an update is requested. + A duration of zero means forever. */ +SPAN_DECLARE(void) sig_tone_rx_set_mode(sig_tone_rx_state_t *s, int mode, int duration); + +/*! Initialise a signaling tone receiver context. + \brief Initialise a signaling tone context. + \param s The signaling tone context. + \param tone_type The type of signaling tone. + \param sig_update Callback function to handle signaling updates. + \param user_data An opaque pointer. + \return A pointer to the signalling tone context, or NULL if there was a problem. */ +SPAN_DECLARE(sig_tone_rx_state_t *) sig_tone_rx_init(sig_tone_rx_state_t *s, int tone_type, tone_report_func_t sig_update, void *user_data); + +/*! Release a signaling tone receiver context. + \brief Release a signaling tone receiver context. + \param s The signaling tone context. + \return 0 for OK */ +SPAN_DECLARE(int) sig_tone_rx_release(sig_tone_rx_state_t *s); + +/*! Free a signaling tone receiver context. + \brief Free a signaling tone receiver context. + \param s The signaling tone context. + \return 0 for OK */ +SPAN_DECLARE(int) sig_tone_rx_free(sig_tone_rx_state_t *s); + +/*! Generate a block of signaling tone audio samples. + \brief Generate a block of signaling tone audio samples. + \param s The signaling tone context. + \param amp The audio sample buffer. + \param len The number of samples to be generated. + \return The number of samples actually generated. */ +SPAN_DECLARE(int) sig_tone_tx(sig_tone_tx_state_t *s, int16_t amp[], int len); + +/*! Set the tone mode. + \brief Set the tone mode. + \param s The signaling tone context. + \param mode The new mode for the transmitted tones. + \param duration The duration for this mode, before an update is requested. + A duration of zero means forever. */ +SPAN_DECLARE(void) sig_tone_tx_set_mode(sig_tone_tx_state_t *s, int mode, int duration); + +/*! Initialise a signaling tone transmitter context. + \brief Initialise a signaling tone context. + \param s The signaling tone context. + \param tone_type The type of signaling tone. + \param sig_update Callback function to handle signaling updates. + \param user_data An opaque pointer. + \return A pointer to the signalling tone context, or NULL if there was a problem. */ +SPAN_DECLARE(sig_tone_tx_state_t *) sig_tone_tx_init(sig_tone_tx_state_t *s, int tone_type, tone_report_func_t sig_update, void *user_data); + +/*! Release a signaling tone transmitter context. + \brief Release a signaling tone transmitter context. + \param s The signaling tone context. + \return 0 for OK */ +SPAN_DECLARE(int) sig_tone_tx_release(sig_tone_tx_state_t *s); + +/*! Free a signaling tone transmitter context. + \brief Free a signaling tone transmitter context. + \param s The signaling tone context. + \return 0 for OK */ +SPAN_DECLARE(int) sig_tone_tx_free(sig_tone_tx_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/silence_gen.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/silence_gen.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,143 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * silence_gen.c - A silence generator, for inserting timed silences. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: silence_gen.h,v 1.19 2009/09/04 14:38:47 steveu Exp $ + */ + +#if !defined(_SPANDSP_SILENCE_GEN_H_) +#define _SPANDSP_SILENCE_GEN_H_ + +typedef struct silence_gen_state_s silence_gen_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Generate a block of silent audio samples. + \brief Generate a block of silent audio samples. + \param s The silence generator context. + \param amp The audio sample buffer. + \param max_len The number of samples to be generated. + \return The number of samples actually generated. This will be zero when + there is nothing to send. +*/ +SPAN_DECLARE_NONSTD(int) silence_gen(silence_gen_state_t *s, int16_t *amp, int max_len); + +/*! Set a silence generator context to output continuous silence. + \brief Set a silence generator context to output continuous silence. + \param s The silence generator context. +*/ +SPAN_DECLARE(void) silence_gen_always(silence_gen_state_t *s); + +/*! Set a silence generator context to output a specified period of silence. + \brief Set a silence generator context to output a specified period of silence. + \param s The silence generator context. + \param silent_samples The number of samples to be generated. +*/ +SPAN_DECLARE(void) silence_gen_set(silence_gen_state_t *s, int silent_samples); + +/*! Alter the period of a silence generator context by a specified amount. + \brief Alter the period of a silence generator context by a specified amount. + \param s The silence generator context. + \param silent_samples The number of samples to change the setting by. A positive number + increases the duration. A negative number reduces it. The duration + is prevented from going negative. +*/ +SPAN_DECLARE(void) silence_gen_alter(silence_gen_state_t *s, int silent_samples); + +/*! Find how long a silence generator context has to run. + \brief Find how long a silence generator context has to run. + \param s The silence generator context. + \return The number of samples remaining. +*/ +SPAN_DECLARE(int) silence_gen_remainder(silence_gen_state_t *s); + +/*! Find the total silence generated to date by a silence generator context. + \brief Find the total silence generated to date. + \param s The silence generator context. + \return The number of samples generated. +*/ +SPAN_DECLARE(int) silence_gen_generated(silence_gen_state_t *s); + +/*! Change the status reporting function associated with a silence generator context. + \brief Change the status reporting function associated with a silence generator context. + \param s The silence generator context. + \param handler The callback routine used to report status changes. + \param user_data An opaque pointer. */ +SPAN_DECLARE(void) silence_gen_status_handler(silence_gen_state_t *s, modem_tx_status_func_t handler, void *user_data); + +/*! Initialise a timed silence generator context. + \brief Initialise a timed silence generator context. + \param s The silence generator context. + \param silent_samples The initial number of samples to set the silence to. + \return A pointer to the silence generator context. +*/ +SPAN_DECLARE(silence_gen_state_t *) silence_gen_init(silence_gen_state_t *s, int silent_samples); + +SPAN_DECLARE(int) silence_gen_release(silence_gen_state_t *s); + +SPAN_DECLARE(int) silence_gen_free(silence_gen_state_t *s); + +/* The following dummy routines, to absorb data, don't really have a proper home, + so they have been put here. */ + +/*! A dummy routine to use as a receive callback, when we aren't really + trying to process what is received. It just absorbs and ignores the + data. + \brief Dummy receive callback. + \param user_data The context. + \param amp The signal.buffer + \param len The length of the signal buffer + \return 0. +*/ +SPAN_DECLARE_NONSTD(int) span_dummy_rx(void *user_data, const int16_t amp[], int len); + +/*! A dummy routine to use as a signal modifier callback, when we aren't + really trying to process the signal. It just returns without affecting + anything. + \brief Dummy signal modifier callback. + \param user_data The context. + \param amp The signal.buffer + \param len The length of the signal buffer + \return 0. +*/ +SPAN_DECLARE(int) span_dummy_mod(void *user_data, int16_t amp[], int len); + +/*! A dummy routine to use as a receive fillin callback, when we aren't really + trying to process what is received. It just absorbs and ignores the + request. + \brief Dummy receive fillin callback. + \param user_data The context. + \param len The length of the signal buffer + \return 0. +*/ +SPAN_DECLARE_NONSTD(int) span_dummy_rx_fillin(void *user_data, int len); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/super_tone_rx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/super_tone_rx.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,152 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * super_tone_rx.h - Flexible telephony supervisory tone detection. + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: super_tone_rx.h,v 1.21 2009/02/10 13:06:47 steveu Exp $ + */ + +#if !defined(_SPANDSP_SUPER_TONE_RX_H_) +#define _SPANDSP_SUPER_TONE_RX_H_ + +/*! \page super_tone_rx_page Supervisory tone detection + +\section super_tone_rx_page_sec_1 What does it do? + +The supervisory tone detector may be configured to detect most of the world's +telephone supervisory tones - things like ringback, busy, number unobtainable, +and so on. + +\section super_tone_rx_page_sec_2 How does it work? + +The supervisory tone detector is passed a series of data structures describing +the tone patterns - the frequencies and cadencing - of the tones to be searched +for. It constructs one or more Goertzel filters to monitor the required tones. +If tones are close in frequency a single Goertzel set to the centre of the +frequency range will be used. This optimises the efficiency of the detector. The +Goertzel filters are applied without applying any special window functional +(i.e. they use a rectangular window), so they have a sinc like response. +However, for most tone patterns their rejection qualities are adequate. + +The detector aims to meet the need of the standard call progress tones, to +ITU-T E.180/Q.35 (busy, dial, ringback, reorder). Also, the extended tones, +to ITU-T E.180, Supplement 2 and EIA/TIA-464-A (recall dial tone, special +ringback tone, intercept tone, call waiting tone, busy verification tone, +executive override tone, confirmation tone). +*/ + +/*! Tone detection indication callback routine */ +typedef void (*tone_report_func_t)(void *user_data, int code, int level, int delay); + +typedef struct super_tone_rx_segment_s super_tone_rx_segment_t; + +typedef struct super_tone_rx_descriptor_s super_tone_rx_descriptor_t; + +typedef struct super_tone_rx_state_s super_tone_rx_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Create a new supervisory tone detector descriptor. + \param desc The supervisory tone set desciptor. If NULL, the routine will allocate space for a + descriptor. + \return The supervisory tone set descriptor. +*/ +SPAN_DECLARE(super_tone_rx_descriptor_t *) super_tone_rx_make_descriptor(super_tone_rx_descriptor_t *desc); + +/*! Free a supervisory tone detector descriptor. + \param desc The supervisory tone set desciptor. + \return 0 for OK, -1 for fail. +*/ +SPAN_DECLARE(int) super_tone_rx_free_descriptor(super_tone_rx_descriptor_t *desc); + +/*! Add a new tone pattern to a supervisory tone detector set. + \param desc The supervisory tone set descriptor. + \return The new tone ID. */ +SPAN_DECLARE(int) super_tone_rx_add_tone(super_tone_rx_descriptor_t *desc); + +/*! Add a new tone pattern element to a tone pattern in a supervisory tone detector. + \param desc The supervisory tone set desciptor. + \param tone The tone ID within the descriptor. + \param f1 Frequency 1 (-1 for a silent period). + \param f2 Frequency 2 (-1 for a silent period, or only one frequency). + \param min The minimum duration, in ms. + \param max The maximum duration, in ms. + \return The new number of elements in the tone description. +*/ +SPAN_DECLARE(int) super_tone_rx_add_element(super_tone_rx_descriptor_t *desc, + int tone, + int f1, + int f2, + int min, + int max); + +/*! Initialise a supervisory tone detector. + \param s The supervisory tone detector context. + \param desc The tone descriptor. + \param callback The callback routine called to report the valid detection or termination of + one of the monitored tones. + \param user_data An opaque pointer passed when calling the callback routine. + \return The supervisory tone detector context. +*/ +SPAN_DECLARE(super_tone_rx_state_t *) super_tone_rx_init(super_tone_rx_state_t *s, + super_tone_rx_descriptor_t *desc, + tone_report_func_t callback, + void *user_data); + +/*! Release a supervisory tone detector. + \param s The supervisory tone context. + \return 0 for OK, -1 for fail. +*/ +SPAN_DECLARE(int) super_tone_rx_release(super_tone_rx_state_t *s); + +/*! Free a supervisory tone detector. + \param s The supervisory tone context. + \return 0 for OK, -1 for fail. +*/ +SPAN_DECLARE(int) super_tone_rx_free(super_tone_rx_state_t *s); + +/*! Define a callback routine to be called each time a tone pattern element is complete. This is + mostly used when analysing a tone. + \param s The supervisory tone context. + \param callback The callback routine. +*/ +SPAN_DECLARE(void) super_tone_rx_segment_callback(super_tone_rx_state_t *s, + void (*callback)(void *data, int f1, int f2, int duration)); + +/*! Apply supervisory tone detection processing to a block of audio samples. + \brief Apply supervisory tone detection processing to a block of audio samples. + \param super The supervisory tone context. + \param amp The audio sample buffer. + \param samples The number of samples in the buffer. + \return The number of samples processed. +*/ +SPAN_DECLARE(int) super_tone_rx(super_tone_rx_state_t *super, const int16_t amp[], int samples); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/super_tone_tx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/super_tone_tx.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,87 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * super_tone_tx.h - Flexible telephony supervisory tone generation. + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: super_tone_tx.h,v 1.17 2009/02/10 13:06:47 steveu Exp $ + */ + +#if !defined(_SPANDSP_SUPER_TONE_TX_H_) +#define _SPANDSP_SUPER_TONE_TX_H_ + +/*! \page super_tone_tx_page Supervisory tone generation + +\section super_tone_tx_page_sec_1 What does it do? + +The supervisory tone generator may be configured to generate most of the world's +telephone supervisory tones - things like ringback, busy, number unobtainable, +and so on. It uses tree structure tone descriptions, which can deal with quite +complex cadence patterns. + +\section super_tone_tx_page_sec_2 How does it work? + +*/ + +typedef struct super_tone_tx_step_s super_tone_tx_step_t; + +typedef struct super_tone_tx_state_s super_tone_tx_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +SPAN_DECLARE(super_tone_tx_step_t *) super_tone_tx_make_step(super_tone_tx_step_t *s, + float f1, + float l1, + float f2, + float l2, + int length, + int cycles); + +SPAN_DECLARE(int) super_tone_tx_free_tone(super_tone_tx_step_t *s); + +/*! Initialise a supervisory tone generator. + \brief Initialise a supervisory tone generator. + \param s The supervisory tone generator context. + \param tree The supervisory tone tree to be generated. + \return The supervisory tone generator context. */ +SPAN_DECLARE(super_tone_tx_state_t *) super_tone_tx_init(super_tone_tx_state_t *s, super_tone_tx_step_t *tree); + +SPAN_DECLARE(int) super_tone_tx_release(super_tone_tx_state_t *s); + +SPAN_DECLARE(int) super_tone_tx_free(super_tone_tx_state_t *s); + +/*! Generate a block of audio samples for a supervisory tone pattern. + \brief Generate a block of audio samples for a supervisory tone pattern. + \param s The supervisory tone context. + \param amp The audio sample buffer. + \param max_samples The maximum number of samples to be generated. + \return The number of samples generated. */ +SPAN_DECLARE(int) super_tone_tx(super_tone_tx_state_t *s, int16_t amp[], int max_samples); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/swept_tone.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/swept_tone.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,59 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * swept_tone.h - Swept tone generation + * + * Written by Steve Underwood + * + * Copyright (C) 2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: swept_tone.h,v 1.1 2009/09/22 12:54:33 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_SWEPT_TONE_H_) +#define _SPANDSP_SWEPT_TONE_H_ + +/*! \page swept_tone_page The swept tone generator +\section swept_tone_page_sec_1 What does it do? +*/ + +typedef struct swept_tone_state_s swept_tone_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +SPAN_DECLARE(swept_tone_state_t *) swept_tone_init(swept_tone_state_t *s, float start, float end, float level, int duration, int repeating); + +SPAN_DECLARE(int) swept_tone(swept_tone_state_t *s, int16_t amp[], int len); + +SPAN_DECLARE(float) swept_tone_current_frequency(swept_tone_state_t *s); + +SPAN_DECLARE(int) swept_tone_release(swept_tone_state_t *s); + +SPAN_DECLARE(int) swept_tone_free(swept_tone_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/t30.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/t30.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,683 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t30.h - definitions for T.30 fax processing + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t30.h,v 1.126.4.1 2009/12/19 09:47:56 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_T30_H_) +#define _SPANDSP_T30_H_ + +/*! \page t30_page T.30 FAX protocol handling + +\section t30_page_sec_1 What does it do? +The T.30 protocol is the core protocol used for FAX transmission. This module +implements most of its key featrues. It does not interface to the outside work. +Seperate modules do that for T.38, analogue line, and other forms of FAX +communication. + +Current features of this module include: + + - FAXing to and from multi-page TIFF/F files, whose images are one of the standard + FAX sizes. + - V.27ter, V.29 and V.17 modes (2400bps, to 14,400bps). + - T.4 1D (MH), T.4 2D,(MR) and T.6 (MMR) compression. + - Error correction mode (ECM). + - All standard horizonal resolutions (R8, R16, 300dpi, 600dpi, 800dpi, 1200dpi). + - All standard vertical resolutions (standard, fine, superfine, 300dpi, 600dpi, 800dpi, 1200dpi). + - All standard page widths (A4, B4, A3). + - All standard page lengths (A4, B4, North American letter, North American legal, continuous). + - Monitoring and sending identifier strings (CSI, TSI, and CIG). + - Monitoring and sending sub-address strings (SUB). + - Monitoring and sending polling sub-addresses (SEP). + - Monitoring and sending polled sub-addresses (PSA). + - Monitoring and sending sender identifications (SID). + - Monitoring and sending passwords (PWD). + - Monitoring of non-standard facility frames (NSF, NSC, and NSS). + - Sending custom non-standard facility frames (NSF, NSC, and NSS). + - Analogue modem and T.38 operation. + +\section t30_page_sec_2 How does it work? + +Some of the following is paraphrased from some notes found a while ago on the Internet. +I cannot remember exactly where they came from, but they are useful. + +\subsection t30_page_sec_2a The answer (CED) tone + +The T.30 standard says an answering fax device must send CED (a 2100Hz tone) for +approximately 3 seconds before sending the first handshake message. Some machines +send an 1100Hz or 1850Hz tone, and some send no tone at all. In fact, this answer +tone is so unpredictable, it cannot really be used. It should, however, always be +generated according to the specification. + +\subsection t30_page_sec_2b Common Timing Deviations + +The T.30 spec. specifies a number of time-outs. For example, after dialing a number, +a calling fax system should listen for a response for 35 seconds before giving up. +These time-out periods are as follows: + + - T1 - 35+-5s: the maximum time for which two fax system will attempt to identify each other + - T2 - 6+-1s: a time-out used to start the sequence for changing transmit parameters + - T3 - 10+-5s: a time-out used in handling operator interrupts + - T5 - 60+-5s: a time-out used in error correction mode + +These time-outs are sometimes misinterpreted. In addition, they are routinely +ignored, sometimes with good reason. For example, after placing a call, the +calling fax system is supposed to wait for 35 seconds before giving up. If the +answering unit does not answer on the first ring or if a voice answering machine +is connected to the line, or if there are many delays through the network, +the delay before answer can be much longer than 35 seconds. + +Fax units that support error correction mode (ECM) can respond to a post-image +handshake message with a receiver not ready (RNR) message. The calling unit then +queries the receiving fax unit with a receiver ready (RR) message. If the +answering unit is still busy (printing for example), it will repeat the RNR +message. According to the T.30 standard, this sequence (RR/RNR RR/RNR) can be +repeated for up to the end of T5 (60+-5s). However, many fax systems +ignore the time-out and will continue the sequence indefinitely, unless the user +manually overrides. + +All the time-outs are subject to alteration, and sometimes misuse. Good T.30 +implementations must do the right thing, and tolerate others doing the wrong thing. + +\subsection t30_page_sec_2c Variations in the inter-carrier gap + +T.30 specifies 75+-20ms of silence between signals using different modulation +schemes. Examples are between the end of a DCS signal and the start of a TCF signal, +and between the end of an image and the start of a post-image signal. Many fax systems +violate this requirement, especially for the silent period between DCS and TCF. +This may be stretched to well over 100ms. If this period is too long, it can interfere with +handshake signal error recovery, should a packet be corrupted on the line. Systems +should ensure they stay within the prescribed T.30 limits, and be tolerant of others +being out of spec.. + +\subsection t30_page_sec_2d Other timing variations + +Testing is required to determine the ability of a fax system to handle +variations in the duration of pauses between unacknowledged handshake message +repetitions, and also in the pauses between the receipt of a handshake command and +the start of a response to that command. In order to reduce the total +transmission time, many fax systems start sending a response message before the +end of the command has been received. + +\subsection t30_page_sec_2e Other deviations from the T.30 standard + +There are many other commonly encountered variations between machines, including: + + - frame sequence deviations + - preamble and flag sequence variations + - improper EOM usage + - unusual data rate fallback sequences + - common training pattern detection algorithms + - image transmission deviations + - use of the talker echo protect tone + - image padding and short lines + - RTP/RTN handshake message usage + - long duration lines + - nonstandard disconnect sequences + - DCN usage +*/ + +/*! The maximum length of a DIS, DTC or DCS frame */ +#define T30_MAX_DIS_DTC_DCS_LEN 22 +/*! The maximum length of the body of an ident string */ +#define T30_MAX_IDENT_LEN 20 +/*! The maximum length of the user string to insert in page headers */ +#define T30_MAX_PAGE_HEADER_INFO 50 + +typedef struct t30_state_s t30_state_t; + +/*! + T.30 phase B callback handler. This handler can be used to process addition + information available in some FAX calls, such as passwords. The callback handler + can access whatever additional information might have been received, using + t30_get_received_info(). + \brief T.30 phase B callback handler. + \param s The T.30 context. + \param user_data An opaque pointer. + \param result The phase B event code. + \return The new status. Normally, T30_ERR_OK is returned. +*/ +typedef int (t30_phase_b_handler_t)(t30_state_t *s, void *user_data, int result); + +/*! + T.30 phase D callback handler. + \brief T.30 phase D callback handler. + \param s The T.30 context. + \param user_data An opaque pointer. + \param result The phase D event code. + \return The new status. Normally, T30_ERR_OK is returned. +*/ +typedef int (t30_phase_d_handler_t)(t30_state_t *s, void *user_data, int result); + +/*! + T.30 phase E callback handler. + \brief T.30 phase E callback handler. + \param s The T.30 context. + \param user_data An opaque pointer. + \param completion_code The phase E completion code. +*/ +typedef void (t30_phase_e_handler_t)(t30_state_t *s, void *user_data, int completion_code); + +/*! + T.30 real time frame handler. + \brief T.30 real time frame handler. + \param s The T.30 context. + \param user_data An opaque pointer. + \param direction TRUE for incoming, FALSE for outgoing. + \param msg The HDLC message. + \param len The length of the message. +*/ +typedef void (t30_real_time_frame_handler_t)(t30_state_t *s, + void *user_data, + int direction, + const uint8_t msg[], + int len); + +/*! + T.30 document handler. + \brief T.30 document handler. + \param s The T.30 context. + \param user_data An opaque pointer. + \param result The document event code. +*/ +typedef int (t30_document_handler_t)(t30_state_t *s, void *user_data, int status); + +/*! + T.30 set a receive or transmit type handler. + \brief T.30 set a receive or transmit type handler. + \param user_data An opaque pointer. + \param type The modem, tone or silence to be sent or received. + \param bit_rate The bit rate of the modem to be sent or received. + \param short_train TRUE if the short training sequence should be used (where one exists). + \param use_hdlc FALSE for bit stream, TRUE for HDLC framing. +*/ +typedef void (t30_set_handler_t)(void *user_data, int type, int bit_rate, int short_train, int use_hdlc); + +/*! + T.30 send HDLC handler. + \brief T.30 send HDLC handler. + \param user_data An opaque pointer. + \param msg The HDLC message. + \param len The length of the message. +*/ +typedef void (t30_send_hdlc_handler_t)(void *user_data, const uint8_t msg[], int len); + +/*! + T.30 protocol completion codes, at phase E. +*/ +enum +{ + T30_ERR_OK = 0, /*! OK */ + + /* Link problems */ + T30_ERR_CEDTONE, /*! The CED tone exceeded 5s */ + T30_ERR_T0_EXPIRED, /*! Timed out waiting for initial communication */ + T30_ERR_T1_EXPIRED, /*! Timed out waiting for the first message */ + T30_ERR_T3_EXPIRED, /*! Timed out waiting for procedural interrupt */ + T30_ERR_HDLC_CARRIER, /*! The HDLC carrier did not stop in a timely manner */ + T30_ERR_CANNOT_TRAIN, /*! Failed to train with any of the compatible modems */ + T30_ERR_OPER_INT_FAIL, /*! Operator intervention failed */ + T30_ERR_INCOMPATIBLE, /*! Far end is not compatible */ + T30_ERR_RX_INCAPABLE, /*! Far end is not able to receive */ + T30_ERR_TX_INCAPABLE, /*! Far end is not able to transmit */ + T30_ERR_NORESSUPPORT, /*! Far end cannot receive at the resolution of the image */ + T30_ERR_NOSIZESUPPORT, /*! Far end cannot receive at the size of image */ + T30_ERR_UNEXPECTED, /*! Unexpected message received */ + + /* Phase E status values returned to a transmitter */ + T30_ERR_TX_BADDCS, /*! Received bad response to DCS or training */ + T30_ERR_TX_BADPG, /*! Received a DCN from remote after sending a page */ + T30_ERR_TX_ECMPHD, /*! Invalid ECM response received from receiver */ + T30_ERR_TX_GOTDCN, /*! Received a DCN while waiting for a DIS */ + T30_ERR_TX_INVALRSP, /*! Invalid response after sending a page */ + T30_ERR_TX_NODIS, /*! Received other than DIS while waiting for DIS */ + T30_ERR_TX_PHBDEAD, /*! Received no response to DCS, training or TCF */ + T30_ERR_TX_PHDDEAD, /*! No response after sending a page */ + T30_ERR_TX_T5EXP, /*! Timed out waiting for receiver ready (ECM mode) */ + + /* Phase E status values returned to a receiver */ + T30_ERR_RX_ECMPHD, /*! Invalid ECM response received from transmitter */ + T30_ERR_RX_GOTDCS, /*! DCS received while waiting for DTC */ + T30_ERR_RX_INVALCMD, /*! Unexpected command after page received */ + T30_ERR_RX_NOCARRIER, /*! Carrier lost during fax receive */ + T30_ERR_RX_NOEOL, /*! Timed out while waiting for EOL (end Of line) */ + T30_ERR_RX_NOFAX, /*! Timed out while waiting for first line */ + T30_ERR_RX_T2EXPDCN, /*! Timer T2 expired while waiting for DCN */ + T30_ERR_RX_T2EXPD, /*! Timer T2 expired while waiting for phase D */ + T30_ERR_RX_T2EXPFAX, /*! Timer T2 expired while waiting for fax page */ + T30_ERR_RX_T2EXPMPS, /*! Timer T2 expired while waiting for next fax page */ + T30_ERR_RX_T2EXPRR, /*! Timer T2 expired while waiting for RR command */ + T30_ERR_RX_T2EXP, /*! Timer T2 expired while waiting for NSS, DCS or MCF */ + T30_ERR_RX_DCNWHY, /*! Unexpected DCN while waiting for DCS or DIS */ + T30_ERR_RX_DCNDATA, /*! Unexpected DCN while waiting for image data */ + T30_ERR_RX_DCNFAX, /*! Unexpected DCN while waiting for EOM, EOP or MPS */ + T30_ERR_RX_DCNPHD, /*! Unexpected DCN after EOM or MPS sequence */ + T30_ERR_RX_DCNRRD, /*! Unexpected DCN after RR/RNR sequence */ + T30_ERR_RX_DCNNORTN, /*! Unexpected DCN after requested retransmission */ + + /* TIFF file problems */ + T30_ERR_FILEERROR, /*! TIFF/F file cannot be opened */ + T30_ERR_NOPAGE, /*! TIFF/F page not found */ + T30_ERR_BADTIFF, /*! TIFF/F format is not compatible */ + T30_ERR_BADPAGE, /*! TIFF/F page number tag missing */ + T30_ERR_BADTAG, /*! Incorrect values for TIFF/F tags */ + T30_ERR_BADTIFFHDR, /*! Bad TIFF/F header - incorrect values in fields */ + T30_ERR_NOMEM, /*! Cannot allocate memory for more pages */ + + /* General problems */ + T30_ERR_RETRYDCN, /*! Disconnected after permitted retries */ + T30_ERR_CALLDROPPED, /*! The call dropped prematurely */ + + /* Feature negotiation issues */ + T30_ERR_NOPOLL, /*! Poll not accepted */ + T30_ERR_IDENT_UNACCEPTABLE, /*! Far end's ident is not acceptable */ + T30_ERR_SUB_UNACCEPTABLE, /*! Far end's sub-address is not acceptable */ + T30_ERR_SEP_UNACCEPTABLE, /*! Far end's selective polling address is not acceptable */ + T30_ERR_PSA_UNACCEPTABLE, /*! Far end's polled sub-address is not acceptable */ + T30_ERR_SID_UNACCEPTABLE, /*! Far end's sender identification is not acceptable */ + T30_ERR_PWD_UNACCEPTABLE, /*! Far end's password is not acceptable */ + T30_ERR_TSA_UNACCEPTABLE, /*! Far end's transmitting subscriber internet address is not acceptable */ + T30_ERR_IRA_UNACCEPTABLE, /*! Far end's internet routing address is not acceptable */ + T30_ERR_CIA_UNACCEPTABLE, /*! Far end's calling subscriber internet address is not acceptable */ + T30_ERR_ISP_UNACCEPTABLE, /*! Far end's internet selective polling address is not acceptable */ + T30_ERR_CSA_UNACCEPTABLE /*! Far end's called subscriber internet address is not acceptable */ +}; + +/*! + I/O modes for the T.30 protocol. + These are allocated such that the lower 4 bits represents the variant of the modem - e.g. the + particular bit rate selected. +*/ +enum +{ + T30_MODEM_NONE = 0, + T30_MODEM_PAUSE, + T30_MODEM_CED, + T30_MODEM_CNG, + T30_MODEM_V21, + T30_MODEM_V27TER, + T30_MODEM_V29, + T30_MODEM_V17, + T30_MODEM_DONE +}; + +enum +{ + T30_FRONT_END_SEND_STEP_COMPLETE = 0, + /*! The current receive has completed. This is only needed to report an + unexpected end of the receive operation, as might happen with T.38 + dying. */ + T30_FRONT_END_RECEIVE_COMPLETE, + T30_FRONT_END_SIGNAL_PRESENT, + T30_FRONT_END_SIGNAL_ABSENT, + T30_FRONT_END_CED_PRESENT, + T30_FRONT_END_CNG_PRESENT +}; + +enum +{ + /*! Support the V.27ter modem (2400, and 4800bps) for image transfer. */ + T30_SUPPORT_V27TER = 0x01, + /*! Support the V.29 modem (9600, and 7200bps) for image transfer. */ + T30_SUPPORT_V29 = 0x02, + /*! Support the V.17 modem (14400, 12000, 9600 and 7200bps) for image transfer. */ + T30_SUPPORT_V17 = 0x04, + /*! Support the V.34 modem (up to 33,600bps) for image transfer. */ + T30_SUPPORT_V34 = 0x08, + /*! Support the Internet aware FAX mode (no bit rate limit) for image transfer. */ + T30_SUPPORT_IAF = 0x10 +}; + +enum +{ + /*! No compression */ + T30_SUPPORT_NO_COMPRESSION = 0x01, + /*! T.1 1D compression */ + T30_SUPPORT_T4_1D_COMPRESSION = 0x02, + /*! T.4 2D compression */ + T30_SUPPORT_T4_2D_COMPRESSION = 0x04, + /*! T.6 2D compression */ + T30_SUPPORT_T6_COMPRESSION = 0x08, + /*! T.85 monochrome JBIG compression */ + T30_SUPPORT_T85_COMPRESSION = 0x10, + /*! T.43 colour JBIG compression */ + T30_SUPPORT_T43_COMPRESSION = 0x20, + /*! T.45 run length colour compression */ + T30_SUPPORT_T45_COMPRESSION = 0x40, + /*! T.81 + T.30 Annex E colour JPEG compression */ + T30_SUPPORT_T81_COMPRESSION = 0x80, + /*! T.81 + T.30 Annex K colour sYCC-JPEG compression */ + T30_SUPPORT_SYCC_T81_COMPRESSION = 0x100, + /*! T.88 monochrome JBIG2 compression */ + T30_SUPPORT_T88_COMPRESSION = 0x200 +}; + +enum +{ + /*! Support standard FAX Y-resolution 98/100dpi */ + T30_SUPPORT_STANDARD_RESOLUTION = 0x01, + /*! Support fine FAX Y-resolution 196/200dpi */ + T30_SUPPORT_FINE_RESOLUTION = 0x02, + /*! Support super-fine FAX Y-resolution 392/400dpi */ + T30_SUPPORT_SUPERFINE_RESOLUTION = 0x04, + + /*! Support half FAX X-resolution 100/102dpi */ + T30_SUPPORT_R4_RESOLUTION = 0x10000, + /*! Support standard FAX X-resolution 200/204dpi */ + T30_SUPPORT_R8_RESOLUTION = 0x20000, + /*! Support double FAX X-resolution 400dpi */ + T30_SUPPORT_R16_RESOLUTION = 0x40000, + + /*! Support 300dpi x 300 dpi */ + T30_SUPPORT_300_300_RESOLUTION = 0x100000, + /*! Support 400dpi x 400 dpi */ + T30_SUPPORT_400_400_RESOLUTION = 0x200000, + /*! Support 600dpi x 600 dpi */ + T30_SUPPORT_600_600_RESOLUTION = 0x400000, + /*! Support 1200dpi x 1200 dpi */ + T30_SUPPORT_1200_1200_RESOLUTION = 0x800000, + /*! Support 300dpi x 600 dpi */ + T30_SUPPORT_300_600_RESOLUTION = 0x1000000, + /*! Support 400dpi x 800 dpi */ + T30_SUPPORT_400_800_RESOLUTION = 0x2000000, + /*! Support 600dpi x 1200 dpi */ + T30_SUPPORT_600_1200_RESOLUTION = 0x4000000 +}; + +enum +{ + T30_SUPPORT_215MM_WIDTH = 0x01, + T30_SUPPORT_255MM_WIDTH = 0x02, + T30_SUPPORT_303MM_WIDTH = 0x04, + + T30_SUPPORT_UNLIMITED_LENGTH = 0x10000, + T30_SUPPORT_A4_LENGTH = 0x20000, + T30_SUPPORT_B4_LENGTH = 0x40000, + T30_SUPPORT_US_LETTER_LENGTH = 0x80000, + T30_SUPPORT_US_LEGAL_LENGTH = 0x100000 +}; + +enum +{ + /*! Enable support of identification, through the SID and/or PWD frames. */ + T30_SUPPORT_IDENTIFICATION = 0x01, + /*! Enable support of selective polling, through the SEP frame. */ + T30_SUPPORT_SELECTIVE_POLLING = 0x02, + /*! Enable support of polling sub-addressing, through the PSA frame. */ + T30_SUPPORT_POLLED_SUB_ADDRESSING = 0x04, + /*! Enable support of multiple selective polling, through repeated used of the SEP and PSA frames. */ + T30_SUPPORT_MULTIPLE_SELECTIVE_POLLING = 0x08, + /*! Enable support of sub-addressing, through the SUB frame. */ + T30_SUPPORT_SUB_ADDRESSING = 0x10, + /*! Enable support of transmitting subscriber internet address, through the TSA frame. */ + T30_SUPPORT_TRANSMITTING_SUBSCRIBER_INTERNET_ADDRESS = 0x20, + /*! Enable support of internet routing address, through the IRA frame. */ + T30_SUPPORT_INTERNET_ROUTING_ADDRESS = 0x40, + /*! Enable support of calling subscriber internet address, through the CIA frame. */ + T30_SUPPORT_CALLING_SUBSCRIBER_INTERNET_ADDRESS = 0x80, + /*! Enable support of internet selective polling address, through the ISP frame. */ + T30_SUPPORT_INTERNET_SELECTIVE_POLLING_ADDRESS = 0x100, + /*! Enable support of called subscriber internet address, through the CSA frame. */ + T30_SUPPORT_CALLED_SUBSCRIBER_INTERNET_ADDRESS = 0x200, + /*! Enable support of the field not valid (FNV) frame. */ + T30_SUPPORT_FIELD_NOT_VALID = 0x400, + /*! Enable support of the command repeat (CRP) frame. */ + T30_SUPPORT_COMMAND_REPEAT = 0x800 +}; + +enum +{ + T30_IAF_MODE_T37 = 0x01, + T30_IAF_MODE_T38 = 0x02, + T30_IAF_MODE_FLOW_CONTROL = 0x04, + /*! Continuous flow mode means data is sent as fast as possible, usually across + the Internet, where speed is not constrained by a PSTN modem. */ + T30_IAF_MODE_CONTINUOUS_FLOW = 0x08, + /*! No TCF means TCF is not exchanged. The end points must sort out usable speed + issues locally. */ + T30_IAF_MODE_NO_TCF = 0x10, + /*! No fill bits means do not insert fill bits, even if the T.30 messages request + them. */ + T30_IAF_MODE_NO_FILL_BITS = 0x20, + /*! No indicators means do not send indicator messages when using T.38. */ + T30_IAF_MODE_NO_INDICATORS = 0x40, + /*! Use relaxed timers for T.38. This is appropriate when using TCP/TPKT for T.38, + as there is no point in anything but a long backstop timeout in such a mode. */ + T30_IAF_MODE_RELAXED_TIMERS = 0x80 +}; + +typedef struct +{ + /*! \brief The identifier string (CSI, TSI, CIG). */ + char ident[T30_MAX_IDENT_LEN + 1]; + /*! \brief The sub-address string (SUB). */ + char sub_address[T30_MAX_IDENT_LEN + 1]; + /*! \brief The selective polling sub-address (SEP). */ + char selective_polling_address[T30_MAX_IDENT_LEN + 1]; + /*! \brief The polled sub-address (PSA). */ + char polled_sub_address[T30_MAX_IDENT_LEN + 1]; + /*! \brief The sender identification (SID). */ + char sender_ident[T30_MAX_IDENT_LEN + 1]; + /*! \brief The password (PWD). */ + char password[T30_MAX_IDENT_LEN + 1]; + /*! \brief Non-standard facilities (NSF). */ + uint8_t *nsf; + size_t nsf_len; + /*! \brief Non-standard facilities command (NSC). */ + uint8_t *nsc; + size_t nsc_len; + /*! \brief Non-standard facilities set-up (NSS). */ + uint8_t *nss; + size_t nss_len; + /*! \brief Transmitting subscriber internet address (TSA). */ + int tsa_type; + char *tsa; + size_t tsa_len; + /*! \brief Internet routing address (IRA). */ + int ira_type; + char *ira; + size_t ira_len; + /*! \brief Calling subscriber internet address (CIA). */ + int cia_type; + char *cia; + size_t cia_len; + /*! \brief Internet selective polling address (ISP). */ + int isp_type; + char *isp; + size_t isp_len; + /*! \brief Called subscriber internet address (CSA). */ + int csa_type; + char *csa; + size_t csa_len; +} t30_exchanged_info_t; + +typedef struct +{ + /*! \brief The current bit rate for image transfer. */ + int bit_rate; + /*! \brief TRUE if error correcting mode is used. */ + int error_correcting_mode; + /*! \brief The number of pages sent so far. */ + int pages_tx; + /*! \brief The number of pages received so far. */ + int pages_rx; + /*! \brief The number of pages in the file (<0 if not known). */ + int pages_in_file; + /*! \brief The horizontal column-to-column resolution of the most recent page, in pixels per metre */ + int x_resolution; + /*! \brief The vertical row-to-row resolution of the most recent page, in pixels per metre */ + int y_resolution; + /*! \brief The number of horizontal pixels in the most recent page. */ + int width; + /*! \brief The number of vertical pixels in the most recent page. */ + int length; + /*! \brief The size of the image, in bytes */ + int image_size; + /*! \brief The type of compression used between the FAX machines */ + int encoding; + /*! \brief The number of bad pixel rows in the most recent page. */ + int bad_rows; + /*! \brief The largest number of bad pixel rows in a block in the most recent page. */ + int longest_bad_row_run; + /*! \brief The number of HDLC frame retries, if error correcting mode is used. */ + int error_correcting_mode_retries; + /*! \brief Current status */ + int current_status; +} t30_stats_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Initialise a T.30 context. + \brief Initialise a T.30 context. + \param s The T.30 context. + \param calling_party TRUE if the context is for a calling party. FALSE if the + context is for an answering party. + \param set_rx_type_handler + \param set_rx_type_user_data + \param set_tx_type_handler + \param set_tx_type_user_data + \param send_hdlc_handler + \param send_hdlc_user_data + \return A pointer to the context, or NULL if there was a problem. */ +SPAN_DECLARE(t30_state_t *) t30_init(t30_state_t *s, + int calling_party, + t30_set_handler_t *set_rx_type_handler, + void *set_rx_type_user_data, + t30_set_handler_t *set_tx_type_handler, + void *set_tx_type_user_data, + t30_send_hdlc_handler_t *send_hdlc_handler, + void *send_hdlc_user_data); + +/*! Release a T.30 context. + \brief Release a T.30 context. + \param s The T.30 context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t30_release(t30_state_t *s); + +/*! Free a T.30 context. + \brief Free a T.30 context. + \param s The T.30 context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t30_free(t30_state_t *s); + +/*! Restart a T.30 context. + \brief Restart a T.30 context. + \param s The T.30 context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t30_restart(t30_state_t *s); + +/*! Check if a T.30 call is still active. This may be used to regularly poll + if the job has finished. + \brief Check if a T.30 call is still active. + \param s The T.30 context. + \return TRUE for call still active, or FALSE for call completed. */ +SPAN_DECLARE(int) t30_call_active(t30_state_t *s); + +/*! Cleanup a T.30 context if the call terminates. + \brief Cleanup a T.30 context if the call terminates. + \param s The T.30 context. */ +SPAN_DECLARE(void) t30_terminate(t30_state_t *s); + +/*! Inform the T.30 engine of a status change in the front end (end of tx, rx signal change, etc.). + \brief Inform the T.30 engine of a status change in the front end (end of tx, rx signal change, etc.). + \param user_data The T.30 context. + \param status The type of status change which occured. */ +SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status); + +/*! Get a bit of received non-ECM image data. + \brief Get a bit of received non-ECM image data. + \param user_data An opaque pointer, which must point to the T.30 context. + \return The next bit to transmit. */ +SPAN_DECLARE_NONSTD(int) t30_non_ecm_get_bit(void *user_data); + +/*! Get a byte of received non-ECM image data. + \brief Get a byte of received non-ECM image data. + \param user_data An opaque pointer, which must point to the T.30 context. + \return The next byte to transmit. */ +SPAN_DECLARE(int) t30_non_ecm_get_byte(void *user_data); + +/*! Get a chunk of received non-ECM image data. + \brief Get a bit of received non-ECM image data. + \param user_data An opaque pointer, which must point to the T.30 context. + \param buf The buffer to contain the data. + \param max_len The maximum length of the chunk. + \return The actual length of the chunk. */ +SPAN_DECLARE(int) t30_non_ecm_get_chunk(void *user_data, uint8_t buf[], int max_len); + +/*! Process a bit of received non-ECM image data. + \brief Process a bit of received non-ECM image data + \param user_data An opaque pointer, which must point to the T.30 context. + \param bit The received bit. */ +SPAN_DECLARE_NONSTD(void) t30_non_ecm_put_bit(void *user_data, int bit); + +/*! Process a byte of received non-ECM image data. + \brief Process a byte of received non-ECM image data + \param user_data An opaque pointer, which must point to the T.30 context. + \param byte The received byte. */ +SPAN_DECLARE(void) t30_non_ecm_put_byte(void *user_data, int byte); + +/*! Process a chunk of received non-ECM image data. + \brief Process a chunk of received non-ECM image data + \param user_data An opaque pointer, which must point to the T.30 context. + \param buf The buffer containing the received data. + \param len The length of the data in buf. */ +SPAN_DECLARE(void) t30_non_ecm_put_chunk(void *user_data, const uint8_t buf[], int len); + +/*! Process a received HDLC frame. + \brief Process a received HDLC frame. + \param user_data The T.30 context. + \param msg The HDLC message. + \param len The length of the message, in octets. + \param ok TRUE if the frame was received without error. */ +SPAN_DECLARE_NONSTD(void) t30_hdlc_accept(void *user_data, const uint8_t msg[], int len, int ok); + +/*! Report the passage of time to the T.30 engine. + \brief Report the passage of time to the T.30 engine. + \param s The T.30 context. + \param samples The time change in 1/8000th second steps. */ +SPAN_DECLARE(void) t30_timer_update(t30_state_t *s, int samples); + +/*! Get the current transfer statistics for the file being sent or received. + \brief Get the current transfer statistics. + \param s The T.30 context. + \param t A pointer to a buffer for the statistics. */ +SPAN_DECLARE(void) t30_get_transfer_statistics(t30_state_t *s, t30_stats_t *t); + +/*! Request a local interrupt of FAX exchange. + \brief Request a local interrupt of FAX exchange. + \param s The T.30 context. + \param state TRUE to enable interrupt request, else FALSE. */ +SPAN_DECLARE(void) t30_local_interrupt_request(t30_state_t *s, int state); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/t30_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/t30_api.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,547 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t30_api.h - definitions for T.30 fax processing + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t30_api.h,v 1.10 2009/04/12 09:12:10 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_T30_API_H_) +#define _SPANDSP_T30_API_H_ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Set the transmitted NSF frame to be associated with a T.30 context. + \brief Set the transmitted NSF frame to be associated with a T.30 context. + \param s The T.30 context. + \param nsf A pointer to the frame. + \param len The length of the frame. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t30_set_tx_nsf(t30_state_t *s, const uint8_t *nsf, int len); + +/*! Get an NSF frame to be associated with a T.30 context. + \brief Set an NSF frame to be associated with a T.30 context. + \param s The T.30 context. + \param nsf A pointer to the frame. + \return the length of the NSF message. */ +SPAN_DECLARE(size_t) t30_get_tx_nsf(t30_state_t *s, const uint8_t *nsf[]); + +/*! Get an NSF frame to be associated with a T.30 context. + \brief Set an NSF frame to be associated with a T.30 context. + \param s The T.30 context. + \param nsf A pointer to the frame. + \return the length of the NSF message. */ +SPAN_DECLARE(size_t) t30_get_rx_nsf(t30_state_t *s, const uint8_t *nsf[]); + +/*! Set the transmitted NSC frame to be associated with a T.30 context. + \brief Set the transmitted NSC frame to be associated with a T.30 context. + \param s The T.30 context. + \param nsc A pointer to the frame. + \param len The length of the frame. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t30_set_tx_nsc(t30_state_t *s, const uint8_t *nsc, int len); + +/*! Get an NSC frame to be associated with a T.30 context. + \brief Set an NSC frame to be associated with a T.30 context. + \param s The T.30 context. + \param nsc A pointer to the frame. + \return the length of the NSC message. */ +SPAN_DECLARE(size_t) t30_get_tx_nsc(t30_state_t *s, const uint8_t *nsc[]); + +/*! Get an NSC frame to be associated with a T.30 context. + \brief Set an NSC frame to be associated with a T.30 context. + \param s The T.30 context. + \param nsc A pointer to the frame. + \return the length of the NSC message. */ +SPAN_DECLARE(size_t) t30_get_rx_nsc(t30_state_t *s, const uint8_t *nsc[]); + +/*! Set the transmitted NSS frame to be associated with a T.30 context. + \brief Set the transmitted NSS frame to be associated with a T.30 context. + \param s The T.30 context. + \param nss A pointer to the frame. + \param len The length of the frame. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t30_set_tx_nss(t30_state_t *s, const uint8_t *nss, int len); + +/*! Get an NSS frame to be associated with a T.30 context. + \brief Set an NSS frame to be associated with a T.30 context. + \param s The T.30 context. + \param nss A pointer to the frame. + \return the length of the NSS message. */ +SPAN_DECLARE(size_t) t30_get_tx_nss(t30_state_t *s, const uint8_t *nss[]); + +/*! Get an NSS frame to be associated with a T.30 context. + \brief Set an NSS frame to be associated with a T.30 context. + \param s The T.30 context. + \param nss A pointer to the frame. + \return the length of the NSS message. */ +SPAN_DECLARE(size_t) t30_get_rx_nss(t30_state_t *s, const uint8_t *nss[]); + +/*! Set the transmitted identifier associated with a T.30 context. + \brief Set the transmitted identifier associated with a T.30 context. + \param s The T.30 context. + \param id A pointer to the identifier. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t30_set_tx_ident(t30_state_t *s, const char *id); + +/*! Get the transmitted identifier associated with a T.30 context. + \brief Set the transmitted identifier associated with a T.30 context. + \param s The T.30 context. + \return A pointer to the identifier. */ +SPAN_DECLARE(const char *) t30_get_tx_ident(t30_state_t *s); + +/*! Get the transmitted identifier associated with a T.30 context. + \brief Set the transmitted identifier associated with a T.30 context. + \param s The T.30 context. + \return A pointer to the identifier. */ +SPAN_DECLARE(const char *) t30_get_rx_ident(t30_state_t *s); + +/*! Set the transmitted sub-address associated with a T.30 context. + \brief Set the transmitted sub-address associated with a T.30 context. + \param s The T.30 context. + \param sub_address A pointer to the sub-address. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t30_set_tx_sub_address(t30_state_t *s, const char *sub_address); + +/*! Get the received sub-address associated with a T.30 context. + \brief Get the received sub-address associated with a T.30 context. + \param s The T.30 context. + \return A pointer to the sub-address. */ +SPAN_DECLARE(const char *) t30_get_tx_sub_address(t30_state_t *s); + +/*! Get the received sub-address associated with a T.30 context. + \brief Get the received sub-address associated with a T.30 context. + \param s The T.30 context. + \return A pointer to the sub-address. */ +SPAN_DECLARE(const char *) t30_get_rx_sub_address(t30_state_t *s); + +/*! Set the transmitted selective polling address (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Set the transmitted selective polling address associated with a T.30 context. + \param s The T.30 context. + \param selective_polling_address A pointer to the selective polling address. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t30_set_tx_selective_polling_address(t30_state_t *s, const char *selective_polling_address); + +/*! Get the received selective polling address (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Get the received selective polling address associated with a T.30 context. + \param s The T.30 context. + \return A pointer to the selective polling address. */ +SPAN_DECLARE(const char *) t30_get_tx_selective_polling_address(t30_state_t *s); + +/*! Get the received selective polling address (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Get the received selective polling address associated with a T.30 context. + \param s The T.30 context. + \return A pointer to the selective polling address. */ +SPAN_DECLARE(const char *) t30_get_rx_selective_polling_address(t30_state_t *s); + +/*! Set the transmitted polled sub-address (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Set the transmitted polled sub-address associated with a T.30 context. + \param s The T.30 context. + \param polled_sub_address A pointer to the polled sub-address. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t30_set_tx_polled_sub_address(t30_state_t *s, const char *polled_sub_address); + +/*! Get the received polled sub-address (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Get the received polled sub-address associated with a T.30 context. + \param s The T.30 context. + \return A pointer to the polled sub-address. */ +SPAN_DECLARE(const char *) t30_get_tx_polled_sub_address(t30_state_t *s); + +/*! Get the received polled sub-address (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Get the received polled sub-address associated with a T.30 context. + \param s The T.30 context. + \return A pointer to the polled sub-address. */ +SPAN_DECLARE(const char *) t30_get_rx_polled_sub_address(t30_state_t *s); + +/*! Set the transmitted sender ident (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Set the transmitted sender ident associated with a T.30 context. + \param s The T.30 context. + \param sender_ident A pointer to the sender ident. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t30_set_tx_sender_ident(t30_state_t *s, const char *sender_ident); + +/*! Get the received sender ident (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Get the received sender ident associated with a T.30 context. + \param s The T.30 context. + \return A pointer to the sender ident. */ +SPAN_DECLARE(const char *) t30_get_tx_sender_ident(t30_state_t *s); + +/*! Get the received sender ident (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Get the received sender ident associated with a T.30 context. + \param s The T.30 context. + \return A pointer to the sender ident. */ +SPAN_DECLARE(const char *) t30_get_rx_sender_ident(t30_state_t *s); + +/*! Set the transmitted password (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Set the transmitted password associated with a T.30 context. + \param s The T.30 context. + \param password A pointer to the password. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t30_set_tx_password(t30_state_t *s, const char *password); + +/*! Get the received password (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Get the received password associated with a T.30 context. + \param s The T.30 context. + \return A pointer to the password. */ +SPAN_DECLARE(const char *) t30_get_tx_password(t30_state_t *s); + +/*! Get the received password (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Get the received password associated with a T.30 context. + \param s The T.30 context. + \return A pointer to the password. */ +SPAN_DECLARE(const char *) t30_get_rx_password(t30_state_t *s); + +/*! Set the transmitted ??? (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Set the transmitted ??? associated with a T.30 context. + \param s The T.30 context. + \param type The type of address. + \param address A pointer to the address. + \param len The length of the address. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t30_set_tx_tsa(t30_state_t *s, int type, const char *address, int len); + +/*! Get the received ??? (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Get the received ??? associated with a T.30 context. + \param s The T.30 context. + \param type The type of address. + \param address A pointer to the address. + \return The length of the address. */ +SPAN_DECLARE(size_t) t30_get_tx_tsa(t30_state_t *s, int *type, const char *address[]); + +/*! Get the received ??? (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Get the received ??? associated with a T.30 context. + \param s The T.30 context. + \param type The type of address. + \param address A pointer to the address. + \return The length of the address. */ +SPAN_DECLARE(size_t) t30_get_rx_tsa(t30_state_t *s, int *type, const char *address[]); + +/*! Set the transmitted ??? (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Set the transmitted ??? associated with a T.30 context. + \param s The T.30 context. + \param type The type of address. + \param address A pointer to the address. + \param len The length of the address. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t30_set_tx_ira(t30_state_t *s, int type, const char *address, int len); + +/*! Get the received ??? (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Get the received ??? associated with a T.30 context. + \param s The T.30 context. + \param type The type of address. + \param address A pointer to the address. + \return The length of the address. */ +SPAN_DECLARE(size_t) t30_get_tx_ira(t30_state_t *s, int *type, const char *address[]); + +/*! Get the received ??? (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Get the received ??? associated with a T.30 context. + \param s The T.30 context. + \param type The type of address. + \param address A pointer to the address. + \return The length of the address. */ +SPAN_DECLARE(size_t) t30_get_rx_ira(t30_state_t *s, int *type, const char *address[]); + +/*! Set the transmitted ??? (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Set the transmitted ??? associated with a T.30 context. + \param s The T.30 context. + \param type The type of address. + \param address A pointer to the address. + \param len The length of the address. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t30_set_tx_cia(t30_state_t *s, int type, const char *address, int len); + +/*! Get the received ??? (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Get the received ??? associated with a T.30 context. + \param s The T.30 context. + \param type The type of address. + \param address A pointer to the address. + \return The length of the address. */ +SPAN_DECLARE(size_t) t30_get_tx_cia(t30_state_t *s, int *type, const char *address[]); + +/*! Get the received ??? (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Get the received ??? associated with a T.30 context. + \param s The T.30 context. + \param type The type of address. + \param address A pointer to the address. + \return 0 for OK, else -1. */ +SPAN_DECLARE(size_t) t30_get_rx_cia(t30_state_t *s, int *type, const char *address[]); + +/*! Set the transmitted ??? (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Set the transmitted ??? associated with a T.30 context. + \param s The T.30 context. + \param type The type of address. + \param address A pointer to the address. + \param len The length of the address. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t30_set_tx_isp(t30_state_t *s, int type, const char *address, int len); + +/*! Get the received ??? (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Get the received ??? associated with a T.30 context. + \param s The T.30 context. + \param type The type of address. + \param address A pointer to the address. + \return 0 for OK, else -1. */ +SPAN_DECLARE(size_t) t30_get_tx_isp(t30_state_t *s, int *type, const char *address[]); + +/*! Get the received ??? (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Get the received ??? associated with a T.30 context. + \param s The T.30 context. + \param type The type of address. + \param address A pointer to the address. + \return 0 for OK, else -1. */ +SPAN_DECLARE(size_t) t30_get_rx_isp(t30_state_t *s, int *type, const char *address[]); + +/*! Set the transmitted ??? (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Set the transmitted ??? associated with a T.30 context. + \param s The T.30 context. + \param type The type of address. + \param address A pointer to the address. + \param len The length of the address. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t30_set_tx_csa(t30_state_t *s, int type, const char *address, int len); + +/*! Get the received ??? (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Get the received ??? associated with a T.30 context. + \param s The T.30 context. + \param type The type of address. + \param address A pointer to the address. + \return The length of the address. */ +SPAN_DECLARE(size_t) t30_get_tx_csa(t30_state_t *s, int *type, const char *address[]); + +/*! Get the received ??? (i.e. the one we will send to the far + end) associated with a T.30 context. + \brief Get the received ??? associated with a T.30 context. + \param s The T.30 context. + \param type The type of address. + \param address A pointer to the address. + \return 0 for OK, else -1. */ +SPAN_DECLARE(size_t) t30_get_rx_csa(t30_state_t *s, int *type, const char *address[]); + +/*! Set the transmitted header information associated with a T.30 context. + \brief Set the transmitted header information associated with a T.30 context. + \param s The T.30 context. + \param info A pointer to the information string. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t30_set_tx_page_header_info(t30_state_t *s, const char *info); + +/*! Get the header information associated with a T.30 context. + \brief Get the header information associated with a T.30 context. + \param s The T.30 context. + \param info A pointer to a buffer for the header information. The buffer + should be at least 51 bytes long. + \return the length of the string. */ +SPAN_DECLARE(size_t) t30_get_tx_page_header_info(t30_state_t *s, char *info); + +/*! Get the country of origin of the remote FAX machine associated with a T.30 context. + \brief Get the country of origin of the remote FAX machine associated with a T.30 context. + \param s The T.30 context. + \return a pointer to the country name, or NULL if the country is not known. */ +SPAN_DECLARE(const char *) t30_get_rx_country(t30_state_t *s); + +/*! Get the name of the vendor of the remote FAX machine associated with a T.30 context. + \brief Get the name of the vendor of the remote FAX machine associated with a T.30 context. + \param s The T.30 context. + \return a pointer to the vendor name, or NULL if the vendor is not known. */ +SPAN_DECLARE(const char *) t30_get_rx_vendor(t30_state_t *s); + +/*! Get the name of the model of the remote FAX machine associated with a T.30 context. + \brief Get the name of the model of the remote FAX machine associated with a T.30 context. + \param s The T.30 context. + \return a pointer to the model name, or NULL if the model is not known. */ +SPAN_DECLARE(const char *) t30_get_rx_model(t30_state_t *s); + +/*! Specify the file name of the next TIFF file to be received by a T.30 + context. + \brief Set next receive file name. + \param s The T.30 context. + \param file The file name + \param stop_page The maximum page to receive. -1 for no restriction. */ +SPAN_DECLARE(void) t30_set_rx_file(t30_state_t *s, const char *file, int stop_page); + +/*! Specify the file name of the next TIFF file to be transmitted by a T.30 + context. + \brief Set next transmit file name. + \param s The T.30 context. + \param file The file name + \param start_page The first page to send. -1 for no restriction. + \param stop_page The last page to send. -1 for no restriction. */ +SPAN_DECLARE(void) t30_set_tx_file(t30_state_t *s, const char *file, int start_page, int stop_page); + +/*! Set Internet aware FAX (IAF) mode. + \brief Set Internet aware FAX (IAF) mode. + \param s The T.30 context. + \param iaf TRUE for IAF, or FALSE for non-IAF. */ +SPAN_DECLARE(void) t30_set_iaf_mode(t30_state_t *s, int iaf); + +/*! Specify if error correction mode (ECM) is allowed by a T.30 context. + \brief Select ECM capability. + \param s The T.30 context. + \param enabled TRUE for ECM capable, FALSE for not ECM capable. + \return 0 if OK, else -1. */ +SPAN_DECLARE(int) t30_set_ecm_capability(t30_state_t *s, int enabled); + +/*! Specify the output encoding for TIFF files created during FAX reception. + \brief Specify the output encoding for TIFF files created during FAX reception. + \param s The T.30 context. + \param encoding The coding required. The options are T4_COMPRESSION_ITU_T4_1D, + T4_COMPRESSION_ITU_T4_2D, T4_COMPRESSION_ITU_T6. T6 is usually the + densest option, but support for it is broken in a number of software + packages. + \return 0 if OK, else -1. */ +SPAN_DECLARE(int) t30_set_rx_encoding(t30_state_t *s, int encoding); + +/*! Specify the minimum scan line time supported by a T.30 context. + \brief Specify minimum scan line time. + \param s The T.30 context. + \param min_time The minimum permitted scan line time, in milliseconds. + \return 0 if OK, else -1. */ +SPAN_DECLARE(int) t30_set_minimum_scan_line_time(t30_state_t *s, int min_time); + +/*! Specify which modem types are supported by a T.30 context. + \brief Specify supported modems. + \param s The T.30 context. + \param supported_modems Bit field list of the supported modems. + \return 0 if OK, else -1. */ +SPAN_DECLARE(int) t30_set_supported_modems(t30_state_t *s, int supported_modems); + +/*! Specify which compression types are supported by a T.30 context. + \brief Specify supported compression types. + \param s The T.30 context. + \param supported_compressions Bit field list of the supported compression types. + \return 0 if OK, else -1. */ +SPAN_DECLARE(int) t30_set_supported_compressions(t30_state_t *s, int supported_compressions); + +/*! Specify which resolutions are supported by a T.30 context. + \brief Specify supported resolutions. + \param s The T.30 context. + \param supported_resolutions Bit field list of the supported resolutions. + \return 0 if OK, else -1. */ +SPAN_DECLARE(int) t30_set_supported_resolutions(t30_state_t *s, int supported_resolutions); + +/*! Specify which images sizes are supported by a T.30 context. + \brief Specify supported image sizes. + \param s The T.30 context. + \param supported_image_sizes Bit field list of the supported widths and lengths. + \return 0 if OK, else -1. */ +SPAN_DECLARE(int) t30_set_supported_image_sizes(t30_state_t *s, int supported_image_sizes); + +/*! Specify which special T.30 features are supported by a T.30 context. + \brief Specify supported T.30 features. + \param s The T.30 context. + \param supported_t30_features Bit field list of the supported features. + \return 0 if OK, else -1. */ +SPAN_DECLARE(int) t30_set_supported_t30_features(t30_state_t *s, int supported_t30_features); + +/*! Set T.30 status. This may be used to adjust the status from within + the phase B and phase D callbacks. + \brief Set T.30 status. + \param s The T.30 context. + \param status The new status. */ +SPAN_DECLARE(void) t30_set_status(t30_state_t *s, int status); + +/*! Specify a period of responding with receiver not ready. + \brief Specify a period of responding with receiver not ready. + \param s The T.30 context. + \param count The number of times to report receiver not ready. + \return 0 if OK, else -1. */ +SPAN_DECLARE(int) t30_set_receiver_not_ready(t30_state_t *s, int count); + +/*! Set a callback function for T.30 phase B handling. + \brief Set a callback function for T.30 phase B handling. + \param s The T.30 context. + \param handler The callback function. + \param user_data An opaque pointer passed to the callback function. */ +SPAN_DECLARE(void) t30_set_phase_b_handler(t30_state_t *s, t30_phase_b_handler_t *handler, void *user_data); + +/*! Set a callback function for T.30 phase D handling. + \brief Set a callback function for T.30 phase D handling. + \param s The T.30 context. + \param handler The callback function. + \param user_data An opaque pointer passed to the callback function. */ +SPAN_DECLARE(void) t30_set_phase_d_handler(t30_state_t *s, t30_phase_d_handler_t *handler, void *user_data); + +/*! Set a callback function for T.30 phase E handling. + \brief Set a callback function for T.30 phase E handling. + \param s The T.30 context. + \param handler The callback function. + \param user_data An opaque pointer passed to the callback function. */ +SPAN_DECLARE(void) t30_set_phase_e_handler(t30_state_t *s, t30_phase_e_handler_t *handler, void *user_data); + +/*! Set a callback function for T.30 end of document handling. + \brief Set a callback function for T.30 end of document handling. + \param s The T.30 context. + \param handler The callback function. + \param user_data An opaque pointer passed to the callback function. */ +SPAN_DECLARE(void) t30_set_document_handler(t30_state_t *s, t30_document_handler_t *handler, void *user_data); + +/*! Set a callback function for T.30 frame exchange monitoring. This is called from the heart + of the signal processing, so don't take too long in the handler routine. + \brief Set a callback function for T.30 frame exchange monitoring. + \param s The T.30 context. + \param handler The callback function. + \param user_data An opaque pointer passed to the callback function. */ +SPAN_DECLARE(void) t30_set_real_time_frame_handler(t30_state_t *s, t30_real_time_frame_handler_t *handler, void *user_data); + +/*! Get a pointer to the logging context associated with a T.30 context. + \brief Get a pointer to the logging context associated with a T.30 context. + \param s The T.30 context. + \return A pointer to the logging context, or NULL. +*/ +SPAN_DECLARE(logging_state_t *) t30_get_logging_state(t30_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/t30_fcf.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/t30_fcf.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,123 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t30_fcf.h - ITU T.30 fax control field definitions + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t30_fcf.h,v 1.18 2009/10/08 15:14:31 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_T30_FCF_H_) +#define _SPANDSP_T30_FCF_H_ + +enum +{ + /*! Initial identification messages */ + /*! From the called to the calling terminal. */ + T30_DIS = 0x80, /*! [0000 0001] Digital identification signal */ + T30_CSI = 0x40, /*! [0000 0010] Called subscriber identification */ + T30_NSF = 0x20, /*! [0000 0100] Non-standard facilities */ + + /*! Commands to send */ + /*! From a calling terminal wishing to be a receiver, to a called terminal + which is capable of transmitting. */ + T30_DTC = 0x81, /*! [1000 0001] Digital transmit command */ + T30_CIG = 0x41, /*! [1000 0010] Calling subscriber identification */ + T30_NSC = 0x21, /*! [1000 0100] Non-standard facilities command */ + T30_PWD = 0xC1, /*! [1000 0011] Password */ + T30_SEP = 0xA1, /*! [1000 0101] Selective polling */ + T30_PSA = 0x61, /*! [1000 0110] Polled subaddress */ + T30_CIA = 0xE1, /*! [1000 0111] Calling subscriber internet address */ + T30_ISP = 0x11, /*! [1000 1000] Internet selective polling address */ + + /*! Commands to receive */ + /*! From a calling terminal wishing to be a transmitter, to a called terminal + which is capable of receiving. */ + T30_DCS = 0x82, /*! [X100 0001] Digital command signal */ + T30_TSI = 0x42, /*! [X100 0010] Transmitting subscriber information */ + T30_NSS = 0x22, /*! [X100 0100] Non-standard facilities set-up */ + T30_SUB = 0xC2, /*! [X100 0011] Sub-address */ + T30_SID = 0xA2, /*! [X100 0101] Sender identification */ + /*! T30_TCF - Training check is a burst of 1.5s of zeros sent using the image modem */ + T30_CTC = 0x12, /*! [X100 1000] Continue to correct */ + T30_TSA = 0x62, /*! [X100 0110] Transmitting subscriber internet address */ + T30_IRA = 0xE2, /*! [X100 0111] Internet routing address */ + + /*! Pre-message response signals */ + /*! From the receiver to the transmitter. */ + T30_CFR = 0x84, /*! [X010 0001] Confirmation to receive */ + T30_FTT = 0x44, /*! [X010 0010] Failure to train */ + T30_CTR = 0xC4, /*! [X010 0011] Response for continue to correct */ + T30_CSA = 0x24, /*! [X010 0100] Called subscriber internet address */ + + /*! Post-message commands */ + T30_EOM = 0x8E, /*! [X111 0001] End of message */ + T30_MPS = 0x4E, /*! [X111 0010] Multipage signal */ + T30_EOP = 0x2E, /*! [X111 0100] End of procedure */ + T30_PRI_EOM = 0x9E, /*! [X111 1001] Procedure interrupt - end of procedure */ + T30_PRI_MPS = 0x5E, /*! [X111 1010] Procedure interrupt - multipage signal */ + T30_PRI_EOP = 0x3E, /*! [X111 1100] Procedure interrupt - end of procedure */ + T30_EOS = 0x1E, /*! [X111 1000] End of selection */ + T30_PPS = 0xBE, /*! [X111 1101] Partial page signal */ + T30_EOR = 0xCE, /*! [X111 0011] End of retransmission */ + T30_RR = 0x6E, /*! [X111 0110] Receiver ready */ + + /*! Post-message responses */ + T30_MCF = 0x8C, /*! [X011 0001] Message confirmation */ + T30_RTP = 0xCC, /*! [X011 0011] Retrain positive */ + T30_RTN = 0x4C, /*! [X011 0010] Retrain negative */ + T30_PIP = 0xAC, /*! [X011 0101] Procedure interrupt positive */ + T30_PIN = 0x2C, /*! [X011 0100] Procedure interrupt negative */ + T30_PPR = 0xBC, /*! [X011 1101] Partial page request */ + T30_RNR = 0xEC, /*! [X011 0111] Receive not ready */ + T30_ERR = 0x1C, /*! [X011 1000] Response for end of retransmission */ + T30_FDM = 0xFC, /*! [X011 1111] File diagnostics message */ + + /*! Other line control signals */ + T30_DCN = 0xFA, /*! [X101 1111] Disconnect */ + T30_CRP = 0x1A, /*! [X101 1000] Command repeat */ + T30_FNV = 0xCA, /*! [X101 0011] Field not valid */ + T30_TNR = 0xEA, /*! [X101 0111] Transmitter not ready */ + T30_TR = 0x6A, /*! [X101 0110] Transmitter ready */ + T30_TK = 0x4B, /*! [1101 0010] Transmitter keys */ + T30_RK = 0x4A, /*! [0101 0010] Receiver keys */ + T30_PSS = 0x1F, /*! [1111 1000] Present signature signal (used only as FCF2) */ + T30_DES = 0xA0, /*! [0000 0101] Digital extended signal */ + T30_DEC = 0x93, /*! [1100 1001] Digital extended command */ + T30_DER = 0x53, /*! [1100 1010] Digital extended request */ + T30_DTR = 0x11, /*! [1000 1000] Digital turnaround request (conflicts with ISP) */ + T30_DNK = 0x9A, /*! [X101 1001] Digital not acknowledge */ + T30_PID = 0x6C, /*! [X011 0110] Procedure interrupt disconnect */ + T30_SPI = 0x10, /*! [0000 1000] Security page indicator */ + T30_SPT = 0x80, /*! [0000 0001] Security page type */ + + /*! Something only use as a secondary value in error correcting mode */ + T30_NULL = 0x00, /*! [0000 0000] Nothing to say */ + + /*! Information frame types used for error correction mode, in T.4 */ + T4_FCD = 0x06, /*! [0110 0000] Facsimile coded data */ + T4_RCP = 0x86 /*! [0110 0001] Return to control for partial page */ +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/t30_logging.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/t30_logging.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,63 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t30_logging.h - definitions for T.30 fax processing + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t30_logging.h,v 1.4 2009/02/03 16:28:41 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_T30_LOGGING_H_) +#define _SPANDSP_T30_LOGGING_H_ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Return a text name for a T.30 frame type. + \brief Return a text name for a T.30 frame type. + \param x The frametype octet. + \return A pointer to the text name for the frame type. If the frame type is + not value, the string "???" is returned. */ +SPAN_DECLARE(const char *) t30_frametype(uint8_t x); + +/*! Decode a DIS, DTC or DCS frame, and log the contents. + \brief Decode a DIS, DTC or DCS frame, and log the contents. + \param s The T.30 context. + \param dis A pointer to the frame to be decoded. + \param len The length of the frame. */ +SPAN_DECLARE(void) t30_decode_dis_dtc_dcs(t30_state_t *s, const uint8_t *dis, int len); + +/*! Convert a phase E completion code to a short text description. + \brief Convert a phase E completion code to a short text description. + \param result The result code. + \return A pointer to the description. */ +SPAN_DECLARE(const char *) t30_completion_code_to_str(int result); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/t31.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/t31.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,162 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t31.h - A T.31 compatible class 1 FAX modem interface. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t31.h,v 1.59 2009/03/13 12:59:26 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_T31_H_) +#define _SPANDSP_T31_H_ + +/*! \page t31_page T.31 Class 1 FAX modem protocol handling +\section t31_page_sec_1 What does it do? +The T.31 class 1 FAX modem modules implements a class 1 interface to the FAX +modems in spandsp. + +\section t31_page_sec_2 How does it work? +*/ + +/*! + T.31 descriptor. This defines the working state for a single instance of + a T.31 FAX modem. +*/ +typedef struct t31_state_s t31_state_t; + +typedef int (t31_modem_control_handler_t)(t31_state_t *s, void *user_data, int op, const char *num); + +#define T31_TX_BUF_LEN (4096) +#define T31_TX_BUF_HIGH_TIDE (4096 - 1024) +#define T31_TX_BUF_LOW_TIDE (1024) +#define T31_MAX_HDLC_LEN 284 +#define T31_T38_MAX_HDLC_LEN 260 + +#if defined(__cplusplus) +extern "C" +{ +#endif + +SPAN_DECLARE(void) t31_call_event(t31_state_t *s, int event); + +SPAN_DECLARE(int) t31_at_rx(t31_state_t *s, const char *t, int len); + +/*! Process a block of received T.31 modem audio samples. + \brief Process a block of received T.31 modem audio samples. + \param s The T.31 modem context. + \param amp The audio sample buffer. + \param len The number of samples in the buffer. + \return The number of samples unprocessed. */ +SPAN_DECLARE(int) t31_rx(t31_state_t *s, int16_t amp[], int len); + +/*! Fake processing of a missing block of received T.31 modem audio samples + (e.g due to packet loss). + \brief Fake processing of a missing block of received T.31 modem audio samples. + \param s The T.31 modem context. + \param len The number of samples to fake. + \return The number of samples unprocessed. */ +SPAN_DECLARE(int) t31_rx_fillin(t31_state_t *s, int len); + +/*! Generate a block of T.31 modem audio samples. + \brief Generate a block of T.31 modem audio samples. + \param s The T.31 modem context. + \param amp The audio sample buffer. + \param max_len The number of samples to be generated. + \return The number of samples actually generated. +*/ +SPAN_DECLARE(int) t31_tx(t31_state_t *s, int16_t amp[], int max_len); + +SPAN_DECLARE(int) t31_t38_send_timeout(t31_state_t *s, int samples); + +/*! Select whether silent audio will be sent when transmit is idle. + \brief Select whether silent audio will be sent when transmit is idle. + \param s The T.31 modem context. + \param transmit_on_idle TRUE if silent audio should be output when the transmitter is + idle. FALSE to transmit zero length audio when the transmitter is idle. The default + behaviour is FALSE. +*/ +SPAN_DECLARE(void) t31_set_transmit_on_idle(t31_state_t *s, int transmit_on_idle); + +/*! Select whether TEP mode will be used (or time allowed for it (when transmitting). + \brief Select whether TEP mode will be used. + \param s The T.31 modem context. + \param use_tep TRUE if TEP is to be ised. +*/ +SPAN_DECLARE(void) t31_set_tep_mode(t31_state_t *s, int use_tep); + +/*! Select whether T.38 data will be paced as it is transmitted. + \brief Select whether T.38 data will be paced. + \param s The T.31 modem context. + \param without_pacing TRUE if data is to be sent as fast as possible. FALSE if it is + to be paced. +*/ +SPAN_DECLARE(void) t31_set_t38_config(t31_state_t *s, int without_pacing); + +SPAN_DECLARE(void) t31_set_mode(t31_state_t *s, int t38_mode); + +/*! Get a pointer to the logging context associated with a T.31 context. + \brief Get a pointer to the logging context associated with a T.31 context. + \param s The T.31 context. + \return A pointer to the logging context, or NULL. +*/ +SPAN_DECLARE(logging_state_t *) t31_get_logging_state(t31_state_t *s); + +SPAN_DECLARE(t38_core_state_t *) t31_get_t38_core_state(t31_state_t *s); + +/*! Initialise a T.31 context. This must be called before the first + use of the context, to initialise its contents. + \brief Initialise a T.31 context. + \param s The T.31 context. + \param at_tx_handler A callback routine to handle AT interpreter channel output. + \param at_tx_user_data An opaque pointer passed in called to at_tx_handler. + \param modem_control_handler A callback routine to handle control of the modem (off-hook, etc). + \param modem_control_user_data An opaque pointer passed in called to modem_control_handler. + \param tx_t38_packet_handler ??? + \param tx_t38_packet_user_data ??? + \return A pointer to the T.31 context. */ +SPAN_DECLARE(t31_state_t *) t31_init(t31_state_t *s, + at_tx_handler_t *at_tx_handler, + void *at_tx_user_data, + t31_modem_control_handler_t *modem_control_handler, + void *modem_control_user_data, + t38_tx_packet_handler_t *tx_t38_packet_handler, + void *tx_t38_packet_user_data); + +/*! Release a T.31 context. + \brief Release a T.31 context. + \param s The T.31 context. + \return 0 for OK */ +SPAN_DECLARE(int) t31_release(t31_state_t *s); + +/*! Free a T.31 context. + \brief Release a T.31 context. + \param s The T.31 context. + \return 0 for OK */ +SPAN_DECLARE(int) t31_free(t31_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/t35.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/t35.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,73 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t35.h - ITU T.35 FAX non-standard facility processing. + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t35.h,v 1.15 2009/01/31 08:48:11 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_T35_H_) +#define _SPANDSP_T35_H_ + +/*! \page t35_page T.35 manufacturer specific processing for FAX machines +\section t35_page_sec_1 What does it do? +???. + +\section t35_page_sec_2 How does it work? +???. +*/ + +/*! A table of the country names associated with each possible value of the T.35 country code + selector octet. */ +extern const char *t35_country_codes[256]; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Decode an NSF field to try to determine the make and model of the + remote machine. + \brief Decode an NSF field. + \param msg The NSF message. + \param len The length of the NSF message. + \param country A pointer which will be pointed to the identified country of origin. + If a NULL pointer is given, the country of origin will not be returned. + If the country of origin is not identified, NULL will be returned. + \param vendor A pointer which will be pointed to the identified vendor. + If a NULL pointer is given, the vendor ID will not be returned. + If the vendor is not identified, NULL will be returned. + \param model A pointer which will be pointed to the identified model. + If a NULL pointer is given, the model will not be returned. + If the model is not identified, NULL will be returned. + \return TRUE if the machine was identified, otherwise FALSE. +*/ +SPAN_DECLARE(int) t35_decode(const uint8_t *msg, int len, const char **country, const char **vendor, const char **model); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/t38_core.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/t38_core.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,403 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t38_core.h - An implementation of T.38, less the packet exchange part + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t38_core.h,v 1.39 2009/07/14 13:54:22 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_T38_CORE_H_) +#define _SPANDSP_T38_CORE_H_ + +/*! \page t38_core_page T.38 real time FAX over IP message handling +There are two ITU recommendations which address sending FAXes over IP networks. T.37 specifies a +method of encapsulating FAX images in e-mails, and transporting them to the recipient (an e-mail +box, or another FAX machine) in a store-and-forward manner. T.38 defines a protocol for +transmitting a FAX across an IP network in real time. The core T.38 modules implements the basic +message handling for the T.38, real time, FAX over IP (FoIP) protocol. + +The T.38 protocol can operate between: + - Internet-aware FAX terminals, which connect directly to an IP network. The T.38 terminal module + extends this module to provide a complete T.38 terminal. + - FAX gateways, which allow traditional PSTN FAX terminals to communicate through the Internet. + The T.38 gateway module extends this module to provide a T.38 gateway. + - A combination of terminals and gateways. + +T.38 is the only standardised protocol which exists for real-time FoIP. Reliably transporting a +FAX between PSTN FAX terminals, through an IP network, requires use of the T.38 protocol at FAX +gateways. VoIP connections are not robust for modem use, including FAX modem use. Most use low +bit rate codecs, which cannot convey the modem signals accurately. Even when high bit rate +codecs are used, VoIP connections suffer dropouts and timing adjustments, which modems cannot +tolerate. In a LAN environment the dropout rate may be very low, but the timing adjustments which +occur in VoIP connections still make modem operation unreliable. T.38 FAX gateways deal with the +delays, timing jitter, and packet loss experienced in packet networks, and isolate the PSTN FAX +terminals from these as far as possible. In addition, by sending FAXes as image data, rather than +digitised audio, they reduce the required bandwidth of the IP network. + +\section t38_core_page_sec_1 What does it do? + +\section t38_core_page_sec_2 How does it work? + +Timing differences and jitter between two T.38 entities can be a serious problem, if one of those +entities is a PSTN gateway. + +Flow control for non-ECM image data takes advantage of several features of the T.30 specification. +First, an unspecified number of 0xFF octets may be sent at the start of transmission. This means we +can add endless extra 0xFF bytes at this point, without breaking the T.30 spec. In practice, we +cannot add too many, or we will affect the timing tolerance of the T.30 protocol by delaying the +response at the end of each image. Secondly, just before an end of line (EOL) marker we can pad +with zero bits. Again, the number is limited only by need to avoid upsetting the timing of the +step following the non-ECM data. +*/ + +/*! T.38 indicator types */ +enum t30_indicator_types_e +{ + T38_IND_NO_SIGNAL = 0, + T38_IND_CNG, + T38_IND_CED, + T38_IND_V21_PREAMBLE, + T38_IND_V27TER_2400_TRAINING, + T38_IND_V27TER_4800_TRAINING, + T38_IND_V29_7200_TRAINING, + T38_IND_V29_9600_TRAINING, + T38_IND_V17_7200_SHORT_TRAINING, + T38_IND_V17_7200_LONG_TRAINING, + T38_IND_V17_9600_SHORT_TRAINING, + T38_IND_V17_9600_LONG_TRAINING, + T38_IND_V17_12000_SHORT_TRAINING, + T38_IND_V17_12000_LONG_TRAINING, + T38_IND_V17_14400_SHORT_TRAINING, + T38_IND_V17_14400_LONG_TRAINING, + T38_IND_V8_ANSAM, + T38_IND_V8_SIGNAL, + T38_IND_V34_CNTL_CHANNEL_1200, + T38_IND_V34_PRI_CHANNEL, + T38_IND_V34_CC_RETRAIN, + T38_IND_V33_12000_TRAINING, + T38_IND_V33_14400_TRAINING +}; + +/*! T.38 data types */ +enum t38_data_types_e +{ + T38_DATA_NONE = -1, + T38_DATA_V21 = 0, + T38_DATA_V27TER_2400, + T38_DATA_V27TER_4800, + T38_DATA_V29_7200, + T38_DATA_V29_9600, + T38_DATA_V17_7200, + T38_DATA_V17_9600, + T38_DATA_V17_12000, + T38_DATA_V17_14400, + T38_DATA_V8, + T38_DATA_V34_PRI_RATE, + T38_DATA_V34_CC_1200, + T38_DATA_V34_PRI_CH, + T38_DATA_V33_12000, + T38_DATA_V33_14400 +}; + +/*! T.38 data field types */ +enum t38_field_types_e +{ + T38_FIELD_HDLC_DATA = 0, + T38_FIELD_HDLC_SIG_END, + T38_FIELD_HDLC_FCS_OK, + T38_FIELD_HDLC_FCS_BAD, + T38_FIELD_HDLC_FCS_OK_SIG_END, + T38_FIELD_HDLC_FCS_BAD_SIG_END, + T38_FIELD_T4_NON_ECM_DATA, + T38_FIELD_T4_NON_ECM_SIG_END, + T38_FIELD_CM_MESSAGE, + T38_FIELD_JM_MESSAGE, + T38_FIELD_CI_MESSAGE, + T38_FIELD_V34RATE +}; + +/*! T.38 field classes */ +enum t38_field_classes_e +{ + T38_FIELD_CLASS_NONE = 0, + T38_FIELD_CLASS_HDLC, + T38_FIELD_CLASS_NON_ECM +}; + +/*! T.38 message types */ +enum t38_message_types_e +{ + T38_TYPE_OF_MSG_T30_INDICATOR = 0, + T38_TYPE_OF_MSG_T30_DATA +}; + +/*! T.38 transport types */ +enum t38_transport_types_e +{ + T38_TRANSPORT_UDPTL = 0, + T38_TRANSPORT_RTP, + T38_TRANSPORT_TCP +}; + +/*! T.38 TCF management types */ +enum t38_data_rate_management_types_e +{ + T38_DATA_RATE_MANAGEMENT_LOCAL_TCF = 1, + T38_DATA_RATE_MANAGEMENT_TRANSFERRED_TCF = 2 +}; + +/*! T.38 Packet categories used for setting the redundancy level and packet repeat + counts on a packet by packet basis. */ +enum t38_packet_categories_e +{ + /*! \brief Indicator packet */ + T38_PACKET_CATEGORY_INDICATOR = 0, + /*! \brief Control data packet */ + T38_PACKET_CATEGORY_CONTROL_DATA = 1, + /*! \brief Terminating control data packet */ + T38_PACKET_CATEGORY_CONTROL_DATA_END = 2, + /*! \brief Image data packet */ + T38_PACKET_CATEGORY_IMAGE_DATA = 3, + /*! \brief Terminating image data packet */ + T38_PACKET_CATEGORY_IMAGE_DATA_END = 4 +}; + +#define T38_RX_BUF_LEN 2048 +#define T38_TX_BUF_LEN 16384 + +/*! T.38 data field */ +typedef struct +{ + /*! Field type */ + int field_type; + /*! Field contents */ + const uint8_t *field; + /*! Field length */ + int field_len; +} t38_data_field_t; + +/*! + Core T.38 state, common to all modes of T.38. +*/ +typedef struct t38_core_state_s t38_core_state_t; + +typedef int (t38_tx_packet_handler_t)(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count); + +typedef int (t38_rx_indicator_handler_t)(t38_core_state_t *s, void *user_data, int indicator); +typedef int (t38_rx_data_handler_t)(t38_core_state_t *s, void *user_data, int data_type, int field_type, const uint8_t *buf, int len); +typedef int (t38_rx_missing_handler_t)(t38_core_state_t *s, void *user_data, int rx_seq_no, int expected_seq_no); + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! \brief Convert the code for an indicator to a short text name. + \param indicator The type of indicator. + \return A pointer to a short text name for the indicator. */ +SPAN_DECLARE(const char *) t38_indicator_to_str(int indicator); + +/*! \brief Convert the code for a type of data to a short text name. + \param data_type The data type. + \return A pointer to a short text name for the data type. */ +SPAN_DECLARE(const char *) t38_data_type_to_str(int data_type); + +/*! \brief Convert the code for a type of data field to a short text name. + \param field_type The field type. + \return A pointer to a short text name for the field type. */ +SPAN_DECLARE(const char *) t38_field_type_to_str(int field_type); + +/*! \brief Convert the code for a CM profile code to text description. + \param profile The profile code from a CM message. + \return A pointer to a short text description of the profile. */ +SPAN_DECLARE(const char *) t38_cm_profile_to_str(int profile); + +/*! \brief Convert a JM message code to text description. + \param data The data field of the message. + \param len The length of the data field. + \return A pointer to a short text description of the profile. */ +SPAN_DECLARE(const char *) t38_jm_to_str(const uint8_t *data, int len); + +/*! \brief Convert a V34rate message to an actual bit rate. + \param data The data field of the message. + \param len The length of the data field. + \return The bit rate, or -1 for a bad message. */ +SPAN_DECLARE(int) t38_v34rate_to_bps(const uint8_t *data, int len); + +/*! \brief Send an indicator packet + \param s The T.38 context. + \param indicator The indicator to send. + \return The delay to allow after this indicator is sent. */ +SPAN_DECLARE(int) t38_core_send_indicator(t38_core_state_t *s, int indicator); + +/*! \brief Find the delay to allow for HDLC flags after sending an indicator + \param s The T.38 context. + \param indicator The indicator to send. + \return The delay to allow for initial HDLC flags after this indicator is sent. */ +SPAN_DECLARE(int) t38_core_send_flags_delay(t38_core_state_t *s, int indicator); + +/*! \brief Send a data packet + \param s The T.38 context. + \param data_type The packet's data type. + \param field_type The packet's field type. + \param field The message data content for the packet. + \param field_len The length of the message data, in bytes. + \param category The category of the packet being sent. This should be one of the values defined for t38_packet_categories_e. + \return ??? */ +SPAN_DECLARE(int) t38_core_send_data(t38_core_state_t *s, int data_type, int field_type, const uint8_t field[], int field_len, int category); + +/*! \brief Send a data packet + \param s The T.38 context. + \param data_type The packet's data type. + \param field The list of fields. + \param fields The number of fields in the list. + \param category The category of the packet being sent. This should be one of the values defined for t38_packet_categories_e. + \return ??? */ +SPAN_DECLARE(int) t38_core_send_data_multi_field(t38_core_state_t *s, int data_type, const t38_data_field_t field[], int fields, int category); + +/*! \brief Process a received T.38 IFP packet. + \param s The T.38 context. + \param buf The packet contents. + \param len The length of the packet contents. + \param seq_no The packet sequence number. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t38_core_rx_ifp_packet(t38_core_state_t *s, const uint8_t *buf, int len, uint16_t seq_no); + +/*! Set the method to be used for data rate management, as per the T.38 spec. + \param s The T.38 context. + \param method 1 for pass TCF across the T.38 link, 2 for handle TCF locally. +*/ +SPAN_DECLARE(void) t38_set_data_rate_management_method(t38_core_state_t *s, int method); + +/*! Set the data transport protocol. + \param s The T.38 context. + \param data_transport_protocol UDPTL, RTP or TPKT. +*/ +SPAN_DECLARE(void) t38_set_data_transport_protocol(t38_core_state_t *s, int data_transport_protocol); + +/*! Set the non-ECM fill bit removal mode. + \param s The T.38 context. + \param fill_bit_removal TRUE to remove fill bits across the T.38 link, else FALSE. +*/ +SPAN_DECLARE(void) t38_set_fill_bit_removal(t38_core_state_t *s, int fill_bit_removal); + +/*! Set the MMR transcoding mode. + \param s The T.38 context. + \param mmr_transcoding TRUE to transcode to MMR across the T.38 link, else FALSE. +*/ +SPAN_DECLARE(void) t38_set_mmr_transcoding(t38_core_state_t *s, int mmr_transcoding); + +/*! Set the JBIG transcoding mode. + \param s The T.38 context. + \param jbig_transcoding TRUE to transcode to JBIG across the T.38 link, else FALSE. +*/ +SPAN_DECLARE(void) t38_set_jbig_transcoding(t38_core_state_t *s, int jbig_transcoding); + +/*! Set the maximum buffer size for received data at the far end. + \param s The T.38 context. + \param max_buffer_size The maximum buffer size. +*/ +SPAN_DECLARE(void) t38_set_max_buffer_size(t38_core_state_t *s, int max_buffer_size); + +/*! Set the maximum size of an IFP packet that is acceptable by the far end. + \param s The T.38 context. + \param max_datagram_size The maximum IFP packet length, in bytes. +*/ +SPAN_DECLARE(void) t38_set_max_datagram_size(t38_core_state_t *s, int max_datagram_size); + +/*! \brief Send a data packet + \param s The T.38 context. + \param category The category of the packet being sent. This should be one of the values defined for t38_packet_categories_e. + \param setting The repeat count for the category. This should be at least one for all categories other an indicator packets. + Zero is valid for indicator packets, as it suppresses the sending of indicator packets, as an application using + TCP for the transport would require. As the setting is passed through to the transmission channel, additional + information may be encoded in it, such as the redundancy depth for the particular packet category. */ +SPAN_DECLARE(void) t38_set_redundancy_control(t38_core_state_t *s, int category, int setting); + +SPAN_DECLARE(void) t38_set_fastest_image_data_rate(t38_core_state_t *s, int max_rate); + +SPAN_DECLARE(int) t38_get_fastest_image_data_rate(t38_core_state_t *s); + +/*! Set the T.38 version to be emulated. + \param s The T.38 context. + \param t38_version Version number, as in the T.38 spec. +*/ +SPAN_DECLARE(void) t38_set_t38_version(t38_core_state_t *s, int t38_version); + +/*! Set the sequence number handling option. + \param s The T.38 context. + \param check TRUE to check sequence numbers, and handle gaps reasonably. FALSE + for no sequence number processing (e.g. for TPKT over TCP transport). +*/ +SPAN_DECLARE(void) t38_set_sequence_number_handling(t38_core_state_t *s, int check); + +/*! Set the TEP handling option. + \param s The T.38 context. + \param allow_for_tep TRUE to allow for TEP playout, else FALSE. +*/ +SPAN_DECLARE(void) t38_set_tep_handling(t38_core_state_t *s, int allow_for_tep); + +/*! Get a pointer to the logging context associated with a T.38 context. + \brief Get a pointer to the logging context associated with a T.38 context. + \param s The T.38 context. + \return A pointer to the logging context, or NULL. +*/ +SPAN_DECLARE(logging_state_t *) t38_core_get_logging_state(t38_core_state_t *s); + +/*! Initialise a T.38 core context. + \brief Initialise a T.38 core context. + \param s The T.38 context. + \param rx_indicator_handler Receive indicator handling routine. + \param rx_data_handler Receive data packet handling routine. + \param rx_rx_missing_handler Missing receive packet handling routine. + \param rx_packet_user_data An opaque pointer passed to the rx packet handling routines. + \param tx_packet_handler Packet transmit handling routine. + \param tx_packet_user_data An opaque pointer passed to the tx_packet_handler. + \return A pointer to the T.38 context, or NULL if there was a problem. */ +SPAN_DECLARE(t38_core_state_t *) t38_core_init(t38_core_state_t *s, + t38_rx_indicator_handler_t *rx_indicator_handler, + t38_rx_data_handler_t *rx_data_handler, + t38_rx_missing_handler_t *rx_missing_handler, + void *rx_user_data, + t38_tx_packet_handler_t *tx_packet_handler, + void *tx_packet_user_data); + +/*! Release a signaling tone transmitter context. + \brief Release a signaling tone transmitter context. + \param s The T.38 context. + \return 0 for OK */ +SPAN_DECLARE(int) t38_core_release(t38_core_state_t *s); + +/*! Free a signaling tone transmitter context. + \brief Free a signaling tone transmitter context. + \param s The T.38 context. + \return 0 for OK */ +SPAN_DECLARE(int) t38_core_free(t38_core_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/t38_gateway.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/t38_gateway.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,215 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t38_gateway.h - A T.38, less the packet exchange part + * + * Written by Steve Underwood + * + * Copyright (C) 2005, 2006, 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t38_gateway.h,v 1.63 2009/04/12 09:12:10 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_T38_GATEWAY_H_) +#define _SPANDSP_T38_GATEWAY_H_ + +/*! \page t38_gateway_page T.38 real time FAX over IP PSTN gateway +\section t38_gateway_page_sec_1 What does it do? + +The T.38 gateway facility provides a robust interface between T.38 IP packet streams and +and 8k samples/second audio streams. It provides the buffering and flow control features needed +to maximum the tolerance of jitter and packet loss on the IP network. + +\section t38_gateway_page_sec_2 How does it work? +*/ + +/*! The receive buffer length */ +#define T38_RX_BUF_LEN 2048 +/*! The number of HDLC transmit buffers */ +#define T38_TX_HDLC_BUFS 256 +/*! The maximum length of an HDLC frame buffer. This must be big enough for ECM frames. */ +#define T38_MAX_HDLC_LEN 260 + +typedef struct t38_gateway_state_s t38_gateway_state_t; + +/*! + T.30 real time frame handler. + \brief T.30 real time frame handler. + \param s The T.30 context. + \param user_data An opaque pointer. + \param direction TRUE for incoming, FALSE for outgoing. + \param msg The HDLC message. + \param len The length of the message. +*/ +typedef void (t38_gateway_real_time_frame_handler_t)(t38_gateway_state_t *s, + void *user_data, + int direction, + const uint8_t *msg, + int len); + +/*! + T.38 gateway results. + */ +typedef struct +{ + /*! \brief The current bit rate for image transfer. */ + int bit_rate; + /*! \brief TRUE if error correcting mode is used. */ + int error_correcting_mode; + /*! \brief The number of pages transferred so far. */ + int pages_transferred; +} t38_stats_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! \brief Initialise a gateway mode T.38 context. + \param s The T.38 context. + \param tx_packet_handler A callback routine to encapsulate and transmit T.38 packets. + \param tx_packet_user_data An opaque pointer passed to the tx_packet_handler routine. + \return A pointer to the termination mode T.38 context, or NULL if there was a problem. */ +SPAN_DECLARE(t38_gateway_state_t *) t38_gateway_init(t38_gateway_state_t *s, + t38_tx_packet_handler_t *tx_packet_handler, + void *tx_packet_user_data); + +/*! Release a gateway mode T.38 context. + \brief Release a T.38 context. + \param s The T.38 context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t38_gateway_release(t38_gateway_state_t *s); + +/*! Free a gateway mode T.38 context. + \brief Free a T.38 context. + \param s The T.38 context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t38_gateway_free(t38_gateway_state_t *s); + +/*! Process a block of received FAX audio samples. + \brief Process a block of received FAX audio samples. + \param s The T.38 context. + \param amp The audio sample buffer. + \param len The number of samples in the buffer. + \return The number of samples unprocessed. */ +SPAN_DECLARE(int) t38_gateway_rx(t38_gateway_state_t *s, int16_t amp[], int len); + +/*! Generate a block of FAX audio samples. + \brief Generate a block of FAX audio samples. + \param s The T.38 context. + \param amp The audio sample buffer. + \param max_len The number of samples to be generated. + \return The number of samples actually generated. +*/ +SPAN_DECLARE(int) t38_gateway_tx(t38_gateway_state_t *s, int16_t amp[], int max_len); + +/*! Control whether error correcting mode (ECM) is allowed. + \brief Control whether error correcting mode (ECM) is allowed. + \param s The T.38 context. + \param ecm_allowed TRUE is ECM is to be allowed. +*/ +SPAN_DECLARE(void) t38_gateway_set_ecm_capability(t38_gateway_state_t *s, int ecm_allowed); + +/*! Select whether silent audio will be sent when transmit is idle. + \brief Select whether silent audio will be sent when transmit is idle. + \param s The T.38 context. + \param transmit_on_idle TRUE if silent audio should be output when the FAX transmitter is + idle. FALSE to transmit zero length audio when the FAX transmitter is idle. The default + behaviour is FALSE. +*/ +SPAN_DECLARE(void) t38_gateway_set_transmit_on_idle(t38_gateway_state_t *s, int transmit_on_idle); + +/*! Specify which modem types are supported by a T.30 context. + \brief Specify supported modems. + \param s The T.38 context. + \param supported_modems Bit field list of the supported modems. +*/ +SPAN_DECLARE(void) t38_gateway_set_supported_modems(t38_gateway_state_t *s, int supported_modems); + +/*! Select whether NSC, NSF, and NSS should be suppressed. It selected, the contents of + these messages are forced to zero for all octets beyond the message type. This makes + them look like manufacturer specific messages, from a manufacturer which does not exist. + \brief Select whether NSC, NSF, and NSS should be suppressed. + \param s The T.38 context. + \param from_t38 A string of bytes to overwrite the header of any NSC, NSF, and NSS + frames passing through the gateway from T.38 the the modem. + \param from_t38_len The length of the overwrite string. + \param from_modem A string of bytes to overwrite the header of any NSC, NSF, and NSS + frames passing through the gateway from the modem to T.38. + \param from_modem_len The length of the overwrite string. +*/ +SPAN_DECLARE(void) t38_gateway_set_nsx_suppression(t38_gateway_state_t *s, + const uint8_t *from_t38, + int from_t38_len, + const uint8_t *from_modem, + int from_modem_len); + +/*! Select whether talker echo protection tone will be sent for the image modems. + \brief Select whether TEP will be sent for the image modems. + \param s The T.38 context. + \param use_tep TRUE if TEP should be sent. +*/ +SPAN_DECLARE(void) t38_gateway_set_tep_mode(t38_gateway_state_t *s, int use_tep); + +/*! Select whether non-ECM fill bits are to be removed during transmission. + \brief Select whether non-ECM fill bits are to be removed during transmission. + \param s The T.38 context. + \param remove TRUE if fill bits are to be removed. +*/ +SPAN_DECLARE(void) t38_gateway_set_fill_bit_removal(t38_gateway_state_t *s, int remove); + +/*! Get the current transfer statistics for the current T.38 session. + \brief Get the current transfer statistics. + \param s The T.38 context. + \param t A pointer to a buffer for the statistics. */ +SPAN_DECLARE(void) t38_gateway_get_transfer_statistics(t38_gateway_state_t *s, t38_stats_t *t); + +/*! Get a pointer to the T.38 core IFP packet engine associated with a + gateway mode T.38 context. + \brief Get a pointer to the T.38 core IFP packet engine associated + with a T.38 context. + \param s The T.38 context. + \return A pointer to the T.38 core context, or NULL. +*/ +SPAN_DECLARE(t38_core_state_t *) t38_gateway_get_t38_core_state(t38_gateway_state_t *s); + +/*! Get a pointer to the logging context associated with a T.38 context. + \brief Get a pointer to the logging context associated with a T.38 context. + \param s The T.38 context. + \return A pointer to the logging context, or NULL. +*/ +SPAN_DECLARE(logging_state_t *) t38_gateway_get_logging_state(t38_gateway_state_t *s); + +/*! Set a callback function for T.30 frame exchange monitoring. This is called from the heart + of the signal processing, so don't take too long in the handler routine. + \brief Set a callback function for T.30 frame exchange monitoring. + \param s The T.30 context. + \param handler The callback function. + \param user_data An opaque pointer passed to the callback function. */ +SPAN_DECLARE(void) t38_gateway_set_real_time_frame_handler(t38_gateway_state_t *s, + t38_gateway_real_time_frame_handler_t *handler, + void *user_data); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/t38_non_ecm_buffer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/t38_non_ecm_buffer.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,136 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t38_non_ecm_buffer.h - A rate adapting buffer for T.38 non-ECM image + * and TCF data + * + * Written by Steve Underwood + * + * Copyright (C) 2005, 2006, 2007, 2008 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t38_non_ecm_buffer.h,v 1.7.4.1 2009/12/19 06:43:28 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_T38_NON_ECM_BUFFER_H_) +#define _SPANDSP_T38_NON_ECM_BUFFER_H_ + +/*! \page t38_non_ecm_buffer_page T.38 rate adapting non-ECM image data buffer +\section t38_non_ecm_buffer_page_sec_1 What does it do? + +The T.38 rate adapting non-ECM image data buffer is used to buffer TCF and non-ECM +FAX image data being gatewayed from a T.38 link to an analogue FAX modem link. + +As well as rate adapting, the buffer has the ability to impose a minimum on the number +of bits per row of image data. This allows any row padding zeros to be stripped from +the data stream, to minimise the data sent as T.38 packets, and be reinserted before +the data is sent to its final destination. Not all T.38 implementations support this +feature, so it's use must be negotiated. + +\section t38_non_ecm_buffer_page_sec_2 How does it work? + +When inserting padding bits, whether to ensure a minimum row time or for flow control, +it is important the right value is inserted at the right point in the data sequence. +If we are in the optional initial period of all ones, we can insert a byte of extra +ones at any time. Once we pass that initial stage, TCF and image data need separate +handling. + +TCF data is all zeros. Once the period of all zeros has begun it is OK to insert +additional bytes of zeros at any point. + +Image data consists of rows, separated by EOL (end of line) markers. Inserting +zeros at arbitrary times would corrupt the image. However, it is OK to insert a +considerable number of extra zeros just before an EOL. Therefore we track where the +EOL markers occur as we fill the buffer. As we empty the buffer stop outputting real +data, and start outputting bytes of zero, if we reach this last EOL marker location. +The EOL marker is 11 zeros following by 1 (1D mode) or 2 (2D mode) ones. Therefore, it +always spills across 2 bytes in the buffer, and there is always a point where we can +insert our extra zeros between bytes. + +Padding between the group of successive EOL markers which for the RTC (return to control) +marker that ends an image causes some FAX machines not to recognise them as an RTC condition. +Therefore, our padding applies special protection so padding never occurs between two +successive EOL markers, with no pixel data between them. +*/ + +/*! The buffer length much be a power of two. The chosen length is big enough for + over 9s of data at the V.17 14,400bps rate. */ +#define T38_NON_ECM_TX_BUF_LEN 16384 + +/*! \brief A flow controlled non-ECM image data buffer, for buffering T.38 to analogue + modem data. +*/ +typedef struct t38_non_ecm_buffer_state_s t38_non_ecm_buffer_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! \brief Initialise a T.38 rate adapting non-ECM buffer context. + \param s The buffer context. + \param mode TRUE for image data mode, or FALSE for TCF mode. + \param bits The minimum number of bits per FAX image row. + \return A pointer to the buffer context, or NULL if there was a problem. */ +SPAN_DECLARE(t38_non_ecm_buffer_state_t *) t38_non_ecm_buffer_init(t38_non_ecm_buffer_state_t *s, int mode, int min_row_bits); + +SPAN_DECLARE(int) t38_non_ecm_buffer_release(t38_non_ecm_buffer_state_t *s); + +SPAN_DECLARE(int) t38_non_ecm_buffer_free(t38_non_ecm_buffer_state_t *s); + +/*! \brief Set the mode of a T.38 rate adapting non-ECM buffer context. + \param s The buffer context. + \param mode TRUE for image data mode, or FALSE for TCF mode. + \param bits The minimum number of bits per FAX image row. */ +SPAN_DECLARE(void) t38_non_ecm_buffer_set_mode(t38_non_ecm_buffer_state_t *s, int mode, int min_row_bits); + +/*! \brief Inject data to T.38 rate adapting non-ECM buffer context. + \param s The buffer context. + \param buf The data buffer to be injected. + \param len The length of the data to be injected. */ +SPAN_DECLARE(void) t38_non_ecm_buffer_inject(t38_non_ecm_buffer_state_t *s, const uint8_t *buf, int len); + +/*! \brief Inform a T.38 rate adapting non-ECM buffer context that the incoming data has finished, + and the contents of the buffer should be played out as quickly as possible. + \param s The buffer context. */ +SPAN_DECLARE(void) t38_non_ecm_buffer_push(t38_non_ecm_buffer_state_t *s); + +/*! \brief Report the input status of a T.38 rate adapting non-ECM buffer context to the specified + logging context. + \param s The buffer context. + \param logging The logging context. */ +SPAN_DECLARE(void) t38_non_ecm_buffer_report_input_status(t38_non_ecm_buffer_state_t *s, logging_state_t *logging); + +/*! \brief Report the output status of a T.38 rate adapting non-ECM buffer context to the specified + logging context. + \param s The buffer context. + \param logging The logging context. */ +SPAN_DECLARE(void) t38_non_ecm_buffer_report_output_status(t38_non_ecm_buffer_state_t *s, logging_state_t *logging); + +/*! \brief Get the next bit of data from a T.38 rate adapting non-ECM buffer context. + \param user_data The buffer context, cast to a void pointer. + \return The next bit, or one of the values indicating a change of modem status. */ +SPAN_DECLARE_NONSTD(int) t38_non_ecm_buffer_get_bit(void *user_data); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/t38_terminal.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/t38_terminal.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,119 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t38_terminal.h - T.38 termination, less the packet exchange part + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t38_terminal.h,v 1.41 2009/02/03 16:28:41 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_T38_TERMINAL_H_) +#define _SPANDSP_T38_TERMINAL_H_ + +/*! \page t38_terminal_page T.38 real time FAX over IP termination +\section t38_terminal_page_sec_1 What does it do? + +\section t38_terminal_page_sec_2 How does it work? +*/ + +/* Make sure the HDLC frame buffers are big enough for ECM frames. */ +#define T38_MAX_HDLC_LEN 260 + +typedef struct t38_terminal_state_s t38_terminal_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +SPAN_DECLARE(int) t38_terminal_send_timeout(t38_terminal_state_t *s, int samples); + +SPAN_DECLARE(void) t38_terminal_set_config(t38_terminal_state_t *s, int without_pacing); + +/*! Select whether the time for talker echo protection tone will be allowed for when sending. + \brief Select whether TEP time will be allowed for. + \param s The T.38 context. + \param use_tep TRUE if TEP should be allowed for. +*/ +SPAN_DECLARE(void) t38_terminal_set_tep_mode(t38_terminal_state_t *s, int use_tep); + +/*! Select whether non-ECM fill bits are to be removed during transmission. + \brief Select whether non-ECM fill bits are to be removed during transmission. + \param s The T.38 context. + \param remove TRUE if fill bits are to be removed. +*/ +SPAN_DECLARE(void) t38_terminal_set_fill_bit_removal(t38_terminal_state_t *s, int remove); + +/*! Get a pointer to the T.30 engine associated with a termination mode T.38 context. + \brief Get a pointer to the T.30 engine associated with a T.38 context. + \param s The T.38 context. + \return A pointer to the T.30 context, or NULL. +*/ +SPAN_DECLARE(t30_state_t *) t38_terminal_get_t30_state(t38_terminal_state_t *s); + +/*! Get a pointer to the T.38 core IFP packet engine associated with a + termination mode T.38 context. + \brief Get a pointer to the T.38 core IFP packet engine associated + with a T.38 context. + \param s The T.38 context. + \return A pointer to the T.38 core context, or NULL. +*/ +SPAN_DECLARE(t38_core_state_t *) t38_terminal_get_t38_core_state(t38_terminal_state_t *s); + +/*! Get a pointer to the logging context associated with a T.38 context. + \brief Get a pointer to the logging context associated with a T.38 context. + \param s The T.38 context. + \return A pointer to the logging context, or NULL. +*/ +SPAN_DECLARE(logging_state_t *) t38_terminal_get_logging_state(t38_terminal_state_t *s); + +/*! \brief Initialise a termination mode T.38 context. + \param s The T.38 context. + \param calling_party TRUE if the context is for a calling party. FALSE if the + context is for an answering party. + \param tx_packet_handler A callback routine to encapsulate and transmit T.38 packets. + \param tx_packet_user_data An opaque pointer passed to the tx_packet_handler routine. + \return A pointer to the termination mode T.38 context, or NULL if there was a problem. */ +SPAN_DECLARE(t38_terminal_state_t *) t38_terminal_init(t38_terminal_state_t *s, + int calling_party, + t38_tx_packet_handler_t *tx_packet_handler, + void *tx_packet_user_data); + +/*! Release a termination mode T.38 context. + \brief Release a T.38 context. + \param s The T.38 context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t38_terminal_release(t38_terminal_state_t *s); + +/*! Free a a termination mode T.38 context. + \brief Free a T.38 context. + \param s The T.38 context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t38_terminal_free(t38_terminal_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/t4_rx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/t4_rx.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,344 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t4_rx.h - definitions for T.4 FAX receive processing + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t4_rx.h,v 1.3.2.3 2009/12/21 17:18:40 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_T4_RX_H_) +#define _SPANDSP_T4_RX_H_ + +/*! \page t4_page T.4 image compression and decompression + +\section t4_page_sec_1 What does it do? +The T.4 image compression and decompression routines implement the 1D and 2D +encoding methods defined in ITU specification T.4. They also implement the pure +2D encoding method defined in T.6. These are image compression algorithms used +for FAX transmission. + +\section t4_page_sec_1 How does it work? +*/ + +typedef int (*t4_row_write_handler_t)(void *user_data, const uint8_t buf[], size_t len); + +/*! Supported compression modes. */ +typedef enum +{ + /*! No compression */ + T4_COMPRESSION_NONE = 0, + /*! T.1 1D compression */ + T4_COMPRESSION_ITU_T4_1D = 1, + /*! T.4 2D compression */ + T4_COMPRESSION_ITU_T4_2D = 2, + /*! T.6 2D compression */ + T4_COMPRESSION_ITU_T6 = 3, + /*! T.85 monochrome JBIG coding */ + T4_COMPRESSION_ITU_T85 = 4, + /*! T.43 colour JBIG coding */ + T4_COMPRESSION_ITU_T43 = 5, + /*! T.45 run length colour compression */ + T4_COMPRESSION_ITU_T45 = 6, + /*! T.81 + T.30 Annex E colour JPEG coding */ + T4_COMPRESSION_ITU_T81 = 7, + /*! T.81 + T.30 Annex K colour sYCC-JPEG coding */ + T4_COMPRESSION_ITU_SYCC_T81 = 8 +} t4_image_compression_t; + +/*! Supported X resolutions, in pixels per metre. */ +typedef enum +{ + T4_X_RESOLUTION_R4 = 4016, + T4_X_RESOLUTION_R8 = 8031, + T4_X_RESOLUTION_300 = 11811, + T4_X_RESOLUTION_R16 = 16063, + T4_X_RESOLUTION_600 = 23622, + T4_X_RESOLUTION_800 = 31496, + T4_X_RESOLUTION_1200 = 47244 +} t4_image_x_resolution_t; + +/*! Supported Y resolutions, in pixels per metre. */ +typedef enum +{ + T4_Y_RESOLUTION_STANDARD = 3850, + T4_Y_RESOLUTION_FINE = 7700, + T4_Y_RESOLUTION_300 = 11811, + T4_Y_RESOLUTION_SUPERFINE = 15400, /* 400 is 15748 */ + T4_Y_RESOLUTION_600 = 23622, + T4_Y_RESOLUTION_800 = 31496, + T4_Y_RESOLUTION_1200 = 47244 +} t4_image_y_resolution_t; + +/*! + Exact widths in PELs for the difference resolutions, and page widths. + Note: + The A4 widths also apply to North American letter and legal. + The R4 resolution widths are not supported in recent versions of T.30 + Only images of exactly these widths are acceptable for FAX transmisson. + + R4 864 pels/215mm for ISO A4, North American Letter and Legal + R4 1024 pels/255mm for ISO B4 + R4 1216 pels/303mm for ISO A3 + R8 1728 pels/215mm for ISO A4, North American Letter and Legal + R8 2048 pels/255mm for ISO B4 + R8 2432 pels/303mm for ISO A3 + R16 3456 pels/215mm for ISO A4, North American Letter and Legal + R16 4096 pels/255mm for ISO B4 + R16 4864 pels/303mm for ISO A3 +*/ +typedef enum +{ + T4_WIDTH_R4_A4 = 864, + T4_WIDTH_R4_B4 = 1024, + T4_WIDTH_R4_A3 = 1216, + T4_WIDTH_R8_A4 = 1728, + T4_WIDTH_R8_B4 = 2048, + T4_WIDTH_R8_A3 = 2432, + T4_WIDTH_300_A4 = 2592, + T4_WIDTH_300_B4 = 3072, + T4_WIDTH_300_A3 = 3648, + T4_WIDTH_R16_A4 = 3456, + T4_WIDTH_R16_B4 = 4096, + T4_WIDTH_R16_A3 = 4864, + T4_WIDTH_600_A4 = 5184, + T4_WIDTH_600_B4 = 6144, + T4_WIDTH_600_A3 = 7296, + T4_WIDTH_1200_A4 = 10368, + T4_WIDTH_1200_B4 = 12288, + T4_WIDTH_1200_A3 = 14592 +} t4_image_width_t; + +/*! + Length of the various supported paper sizes, in pixels at the various Y resolutions. + Paper sizes are + A4 (215mm x 297mm) + B4 (255mm x 364mm) + A3 (303mm x 418.56mm) + North American Letter (215.9mm x 279.4mm) + North American Legal (215.9mm x 355.6mm) + Unlimited + + T.4 does not accurately define the maximum number of scan lines in a page. A wide + variety of maximum row counts are used in the real world. It is important not to + set our sending limit too high, or a receiving machine might split pages. It is + important not to set it too low, or we might clip pages. + + Values seen for standard resolution A4 pages include 1037, 1045, 1109, 1126 and 1143. + 1109 seems the most-popular. At fine res 2150, 2196, 2200, 2237, 2252-2262, 2264, + 2286, and 2394 are used. 2255 seems the most popular. We try to use balanced choices + here. +*/ +typedef enum +{ + /* A4 is 297mm long */ + T4_LENGTH_STANDARD_A4 = 1143, + T4_LENGTH_FINE_A4 = 2286, + T4_LENGTH_300_A4 = 4665, + T4_LENGTH_SUPERFINE_A4 = 4573, + T4_LENGTH_600_A4 = 6998, + T4_LENGTH_800_A4 = 9330, + T4_LENGTH_1200_A4 = 13996, + /* B4 is 364mm long */ + T4_LENGTH_STANDARD_B4 = 1401, + T4_LENGTH_FINE_B4 = 2802, + T4_LENGTH_300_B4 = 0, + T4_LENGTH_SUPERFINE_B4 = 5605, + T4_LENGTH_600_B4 = 0, + T4_LENGTH_800_B4 = 0, + T4_LENGTH_1200_B4 = 0, + /* North American letter is 279.4mm long */ + T4_LENGTH_STANDARD_US_LETTER = 1075, + T4_LENGTH_FINE_US_LETTER = 2151, + T4_LENGTH_300_US_LETTER = 0, + T4_LENGTH_SUPERFINE_US_LETTER = 4302, + T4_LENGTH_600_US_LETTER = 0, + T4_LENGTH_800_US_LETTER = 0, + T4_LENGTH_1200_US_LETTER = 0, + /* North American legal is 355.6mm long */ + T4_LENGTH_STANDARD_US_LEGAL = 1369, + T4_LENGTH_FINE_US_LEGAL = 2738, + T4_LENGTH_300_US_LEGAL = 0, + T4_LENGTH_SUPERFINE_US_LEGAL = 5476, + T4_LENGTH_600_US_LEGAL = 0, + T4_LENGTH_800_US_LEGAL = 0, + T4_LENGTH_1200_US_LEGAL = 0 +} t4_image_length_t; + +/*! + T.4 FAX compression/decompression descriptor. This defines the working state + for a single instance of a T.4 FAX compression or decompression channel. +*/ +typedef struct t4_state_s t4_state_t; + +/*! + T.4 FAX compression/decompression statistics. +*/ +typedef struct +{ + /*! \brief The number of pages transferred so far. */ + int pages_transferred; + /*! \brief The number of pages in the file (<0 if unknown). */ + int pages_in_file; + /*! \brief The number of horizontal pixels in the most recent page. */ + int width; + /*! \brief The number of vertical pixels in the most recent page. */ + int length; + /*! \brief The number of bad pixel rows in the most recent page. */ + int bad_rows; + /*! \brief The largest number of bad pixel rows in a block in the most recent page. */ + int longest_bad_row_run; + /*! \brief The horizontal resolution of the page in pixels per metre */ + int x_resolution; + /*! \brief The vertical resolution of the page in pixels per metre */ + int y_resolution; + /*! \brief The type of compression used between the FAX machines */ + int encoding; + /*! \brief The size of the image on the line, in bytes */ + int line_image_size; +} t4_stats_t; + +#if defined(__cplusplus) +extern "C" { +#endif + +/*! \brief Prepare for reception of a document. + \param s The T.4 context. + \param file The name of the file to be received. + \param output_encoding The output encoding. + \return A pointer to the context, or NULL if there was a problem. */ +SPAN_DECLARE(t4_state_t *) t4_rx_init(t4_state_t *s, const char *file, int output_encoding); + +/*! \brief Prepare to receive the next page of the current document. + \param s The T.4 context. + \return zero for success, -1 for failure. */ +SPAN_DECLARE(int) t4_rx_start_page(t4_state_t *s); + +/*! \brief Put a bit of the current document page. + \param s The T.4 context. + \param bit The data bit. + \return TRUE when the bit ends the document page, otherwise FALSE. */ +SPAN_DECLARE(int) t4_rx_put_bit(t4_state_t *s, int bit); + +/*! \brief Put a byte of the current document page. + \param s The T.4 context. + \param byte The data byte. + \return TRUE when the byte ends the document page, otherwise FALSE. */ +SPAN_DECLARE(int) t4_rx_put_byte(t4_state_t *s, uint8_t byte); + +/*! \brief Put a byte of the current document page. + \param s The T.4 context. + \param buf The buffer containing the chunk. + \param len The length of the chunk. + \return TRUE when the byte ends the document page, otherwise FALSE. */ +SPAN_DECLARE(int) t4_rx_put_chunk(t4_state_t *s, const uint8_t buf[], int len); + +/*! \brief Complete the reception of a page. + \param s The T.4 receive context. + \return 0 for success, otherwise -1. */ +SPAN_DECLARE(int) t4_rx_end_page(t4_state_t *s); + +/*! \brief End reception of a document. Tidy up and close the file. + This should be used to end T.4 reception started with + t4_rx_init. + \param s The T.4 receive context. + \return 0 for success, otherwise -1. */ +SPAN_DECLARE(int) t4_rx_release(t4_state_t *s); + +/*! \brief End reception of a document. Tidy up, close the file and + free the context. This should be used to end T.4 reception + started with t4_rx_init. + \param s The T.4 receive context. + \return 0 for success, otherwise -1. */ +SPAN_DECLARE(int) t4_rx_free(t4_state_t *s); + +/*! \brief Set the row write handler for a T.4 receive context. + \param s The T.4 receive context. + \param handler A pointer to the handler routine. + \param user_data An opaque pointer passed to the handler routine. + \return 0 for success, otherwise -1. */ +SPAN_DECLARE(int) t4_rx_set_row_write_handler(t4_state_t *s, t4_row_write_handler_t handler, void *user_data); + +/*! \brief Set the encoding for the received data. + \param s The T.4 context. + \param encoding The encoding. */ +SPAN_DECLARE(void) t4_rx_set_rx_encoding(t4_state_t *s, int encoding); + +/*! \brief Set the expected width of the received image, in pixel columns. + \param s The T.4 context. + \param width The number of pixels across the image. */ +SPAN_DECLARE(void) t4_rx_set_image_width(t4_state_t *s, int width); + +/*! \brief Set the row-to-row (y) resolution to expect for a received image. + \param s The T.4 context. + \param resolution The resolution, in pixels per metre. */ +SPAN_DECLARE(void) t4_rx_set_y_resolution(t4_state_t *s, int resolution); + +/*! \brief Set the column-to-column (x) resolution to expect for a received image. + \param s The T.4 context. + \param resolution The resolution, in pixels per metre. */ +SPAN_DECLARE(void) t4_rx_set_x_resolution(t4_state_t *s, int resolution); + +/*! \brief Set the DCS information of the fax, for inclusion in the file. + \param s The T.4 context. + \param dcs The DCS information, formatted as an ASCII string. */ +SPAN_DECLARE(void) t4_rx_set_dcs(t4_state_t *s, const char *dcs); + +/*! \brief Set the sub-address of the fax, for inclusion in the file. + \param s The T.4 context. + \param sub_address The sub-address string. */ +SPAN_DECLARE(void) t4_rx_set_sub_address(t4_state_t *s, const char *sub_address); + +/*! \brief Set the identity of the remote machine, for inclusion in the file. + \param s The T.4 context. + \param ident The identity string. */ +SPAN_DECLARE(void) t4_rx_set_far_ident(t4_state_t *s, const char *ident); + +/*! \brief Set the vendor of the remote machine, for inclusion in the file. + \param s The T.4 context. + \param vendor The vendor string, or NULL. */ +SPAN_DECLARE(void) t4_rx_set_vendor(t4_state_t *s, const char *vendor); + +/*! \brief Set the model of the remote machine, for inclusion in the file. + \param s The T.4 context. + \param model The model string, or NULL. */ +SPAN_DECLARE(void) t4_rx_set_model(t4_state_t *s, const char *model); + +/*! Get the current image transfer statistics. + \brief Get the current transfer statistics. + \param s The T.4 context. + \param t A pointer to a statistics structure. */ +SPAN_DECLARE(void) t4_get_transfer_statistics(t4_state_t *s, t4_stats_t *t); + +/*! Get the short text name of an encoding format. + \brief Get the short text name of an encoding format. + \param encoding The encoding type. + \return A pointer to the string. */ +SPAN_DECLARE(const char *) t4_encoding_to_str(int encoding); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/t4_tx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/t4_tx.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,179 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t4_tx.h - definitions for T.4 FAX transmit processing + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t4_tx.h,v 1.2.2.3 2009/12/21 17:18:40 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_T4_TX_H_) +#define _SPANDSP_T4_TX_H_ + +typedef int (*t4_row_read_handler_t)(void *user_data, uint8_t buf[], size_t len); + +#if defined(__cplusplus) +extern "C" { +#endif + +/*! \brief Prepare for transmission of a document. + \param s The T.4 context. + \param file The name of the file to be sent. + \param start_page The first page to send. -1 for no restriction. + \param stop_page The last page to send. -1 for no restriction. + \return A pointer to the context, or NULL if there was a problem. */ +SPAN_DECLARE(t4_state_t *) t4_tx_init(t4_state_t *s, const char *file, int start_page, int stop_page); + +/*! \brief Prepare to send the next page of the current document. + \param s The T.4 context. + \return zero for success, -1 for failure. */ +SPAN_DECLARE(int) t4_tx_start_page(t4_state_t *s); + +/*! \brief Prepare the current page for a resend. + \param s The T.4 context. + \return zero for success, -1 for failure. */ +SPAN_DECLARE(int) t4_tx_restart_page(t4_state_t *s); + +/*! \brief Check for the existance of the next page, and whether its format is like the + current one. This information can be needed before it is determined that the current + page is finished with. + \param s The T.4 context. + \return 0 for next page found with the same format as the current page. + 1 for next page found with different format from the current page. + -1 for no page found, or file failure. */ +SPAN_DECLARE(int) t4_tx_next_page_has_different_format(t4_state_t *s); + +/*! \brief Complete the sending of a page. + \param s The T.4 context. + \return zero for success, -1 for failure. */ +SPAN_DECLARE(int) t4_tx_end_page(t4_state_t *s); + +/*! \brief Return the next bit of the current document page, without actually + moving forward in the buffer. The document will be padded for the + current minimum scan line time. + \param s The T.4 context. + \return The next bit (i.e. 0 or 1). For the last bit of data, bit 1 is + set (i.e. the returned value is 2 or 3). */ +SPAN_DECLARE(int) t4_tx_check_bit(t4_state_t *s); + +/*! \brief Get the next bit of the current document page. The document will + be padded for the current minimum scan line time. + \param s The T.4 context. + \return The next bit (i.e. 0 or 1). For the last bit of data, bit 1 is + set (i.e. the returned value is 2 or 3). */ +SPAN_DECLARE(int) t4_tx_get_bit(t4_state_t *s); + +/*! \brief Get the next byte of the current document page. The document will + be padded for the current minimum scan line time. + \param s The T.4 context. + \return The next byte. For the last byte of data, bit 8 is + set. In this case, one or more bits of the byte may be padded with + zeros, to complete the byte. */ +SPAN_DECLARE(int) t4_tx_get_byte(t4_state_t *s); + +/*! \brief Get the next chunk of the current document page. The document will + be padded for the current minimum scan line time. + \param s The T.4 context. + \param buf The buffer into which the chunk is to written. + \param max_len The maximum length of the chunk. + \return The actual length of the chunk. If this is less than max_len it + indicates that the end of the document has been reached. */ +SPAN_DECLARE(int) t4_tx_get_chunk(t4_state_t *s, uint8_t buf[], int max_len); + +/*! \brief End the transmission of a document. Tidy up and close the file. + This should be used to end T.4 transmission started with t4_tx_init. + \param s The T.4 context. + \return 0 for success, otherwise -1. */ +SPAN_DECLARE(int) t4_tx_release(t4_state_t *s); + +/*! \brief End the transmission of a document. Tidy up, close the file and + free the context. This should be used to end T.4 transmission + started with t4_tx_init. + \param s The T.4 context. + \return 0 for success, otherwise -1. */ +SPAN_DECLARE(int) t4_tx_free(t4_state_t *s); + +/*! \brief Set the encoding for the encoded data. + \param s The T.4 context. + \param encoding The encoding. */ +SPAN_DECLARE(void) t4_tx_set_tx_encoding(t4_state_t *s, int encoding); + +/*! \brief Set the minimum number of encoded bits per row. This allows the + makes the encoding process to be set to comply with the minimum row + time specified by a remote receiving machine. + \param s The T.4 context. + \param bits The minimum number of bits per row. */ +SPAN_DECLARE(void) t4_tx_set_min_row_bits(t4_state_t *s, int bits); + +/*! \brief Set the identity of the local machine, for inclusion in page headers. + \param s The T.4 context. + \param ident The identity string. */ +SPAN_DECLARE(void) t4_tx_set_local_ident(t4_state_t *s, const char *ident); + +/*! Set the info field, included in the header line included in each page of an encoded + FAX. This is a string of up to 50 characters. Other information (date, local ident, etc.) + are automatically included in the header. If the header info is set to NULL or a zero + length string, no header lines will be added to the encoded FAX. + \brief Set the header info. + \param s The T.4 context. + \param info A string, of up to 50 bytes, which will form the info field. */ +SPAN_DECLARE(void) t4_tx_set_header_info(t4_state_t *s, const char *info); + +/*! \brief Set the row read handler for a T.4 transmit context. + \param s The T.4 transmit context. + \param handler A pointer to the handler routine. + \param user_data An opaque pointer passed to the handler routine. + \return 0 for success, otherwise -1. */ +SPAN_DECLARE(int) t4_tx_set_row_read_handler(t4_state_t *s, t4_row_read_handler_t handler, void *user_data); + +/*! \brief Get the row-to-row (y) resolution of the current page. + \param s The T.4 context. + \return The resolution, in pixels per metre. */ +SPAN_DECLARE(int) t4_tx_get_y_resolution(t4_state_t *s); + +/*! \brief Get the column-to-column (x) resolution of the current page. + \param s The T.4 context. + \return The resolution, in pixels per metre. */ +SPAN_DECLARE(int) t4_tx_get_x_resolution(t4_state_t *s); + +/*! \brief Get the width of the current page, in pixel columns. + \param s The T.4 context. + \return The number of columns. */ +SPAN_DECLARE(int) t4_tx_get_image_width(t4_state_t *s); + +/*! \brief Get the number of pages in the file. + \param s The T.4 context. + \return The number of pages, or -1 if there is an error. */ +SPAN_DECLARE(int) t4_tx_get_pages_in_file(t4_state_t *s); + +/*! \brief Get the currnet page number in the file. + \param s The T.4 context. + \return The page number, or -1 if there is an error. */ +SPAN_DECLARE(int) t4_tx_get_current_page_in_file(t4_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/telephony.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/telephony.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,91 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * telephony.h - some very basic telephony definitions + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: telephony.h,v 1.18.4.2 2009/12/21 18:38:06 steveu Exp $ + */ + +#if !defined(_SPANDSP_TELEPHONY_H_) +#define _SPANDSP_TELEPHONY_H_ + +#if defined(_M_IX86) || defined(_M_X64) +#if defined(LIBSPANDSP_EXPORTS) +#define SPAN_DECLARE(type) __declspec(dllexport) type __stdcall +#define SPAN_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl +#define SPAN_DECLARE_DATA __declspec(dllexport) +#else +#define SPAN_DECLARE(type) __declspec(dllimport) type __stdcall +#define SPAN_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl +#define SPAN_DECLARE_DATA __declspec(dllimport) +#endif +#elif defined(SPANDSP_USE_EXPORT_CAPABILITY) && (defined(__GNUC__) || defined(__SUNCC__)) +#define SPAN_DECLARE(type) __attribute__((visibility("default"))) type +#define SPAN_DECLARE_NONSTD(type) __attribute__((visibility("default"))) type +#define SPAN_DECLARE_DATA __attribute__((visibility("default"))) +#else +#define SPAN_DECLARE(type) /**/ type +#define SPAN_DECLARE_NONSTD(type) /**/ type +#define SPAN_DECLARE_DATA /**/ +#endif + +#define SAMPLE_RATE 8000 + +/* This is based on A-law, but u-law is only 0.03dB different */ +#define DBM0_MAX_POWER (3.14f + 3.02f) +#define DBM0_MAX_SINE_POWER (3.14f) +/* This is based on the ITU definition of dbOv in G.100.1 */ +#define DBOV_MAX_POWER (0.0f) +#define DBOV_MAX_SINE_POWER (-3.02f) + +/*! \brief A handler for pure receive. The buffer cannot be altered. */ +typedef int (span_rx_handler_t)(void *s, const int16_t amp[], int len); + +/*! \brief A handler for receive, where the buffer can be altered. */ +typedef int (span_mod_handler_t)(void *s, int16_t amp[], int len); + +/*! \brief A handler for missing receive data fill-in. */ +typedef int (span_rx_fillin_handler_t)(void *s, int len); + +/*! \brief A handler for transmit, where the buffer will be filled. */ +typedef int (span_tx_handler_t)(void *s, int16_t amp[], int max_len); + +#define ms_to_samples(t) ((t)*(SAMPLE_RATE/1000)) +#define us_to_samples(t) ((t)/(1000000/SAMPLE_RATE)) + +#if !defined(FALSE) +#define FALSE 0 +#endif +#if !defined(TRUE) +#define TRUE (!FALSE) +#endif + +#if defined(__cplusplus) +/* C++ doesn't seem to have sane rounding functions/macros yet */ +#if !defined(WIN32) +#define lrint(x) ((long int) (x)) +#define lrintf(x) ((long int) (x)) +#endif +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/time_scale.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/time_scale.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,118 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * time_scale.h - Time scaling for linear speech data + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: time_scale.h,v 1.20 2009/02/10 13:06:47 steveu Exp $ + */ + +#if !defined(_SPANDSP_TIME_SCALE_H_) +#define _SPANDSP_TIME_SCALE_H_ + +/*! \page time_scale_page Time scaling speech +\section time_scale_page_sec_1 What does it do? +The time scaling module allows speech files to be played back at a +different speed from the speed at which they were recorded. If this +were done by simply speeding up or slowing down replay, the pitch of +the voice would change, and sound very odd. This module keeps the pitch +of the voice at its original level. + +The speed of the voice may be altered over a wide range. However, the practical +useful rates are between about half normal speed and twice normal speed. + +\section time_scale_page_sec_2 How does it work? +The time scaling module is based on the Pointer Interval Controlled +OverLap and Add (PICOLA) method, developed by Morita Naotaka. +Mikio Ikeda has an excellent web page on this subject at +http://keizai.yokkaichi-u.ac.jp/~ikeda/research/picola.html +There is also working code there. This implementation uses +exactly the same algorithms, but the code is a complete rewrite. +Mikio's code batch processes files. This version works incrementally +on streams, and allows multiple streams to be processed concurrently. + +\section time_scale_page_sec_3 How do I used it? +The output buffer must be big enough to hold the maximum number of samples which +could result from the data in the input buffer, which is: + + input_len*playout_rate + sample_rate/TIME_SCALE_MIN_PITCH + 1 +*/ + +/*! Audio time scaling descriptor. */ +typedef struct time_scale_state_s time_scale_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Initialise a time scale context. This must be called before the first + use of the context, to initialise its contents. + \brief Initialise a time scale context. + \param s The time scale context. + \param sample_rate The sample rate of the signal. + \param playout_rate The ratio between the output speed and the input speed. + \return A pointer to the context, or NULL if there was a problem. */ +SPAN_DECLARE(time_scale_state_t *) time_scale_init(time_scale_state_t *s, int sample_rate, float playout_rate); + +/*! \brief Release a time scale context. + \param s The time scale context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) time_scale_release(time_scale_state_t *s); + +/*! \brief Free a time scale context. + \param s The time scale context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) time_scale_free(time_scale_state_t *s); + +/*! Change the time scale rate. + \brief Change the time scale rate. + \param s The time scale context. + \param playout_rate The ratio between the output speed and the input speed. + \return 0 if changed OK, else -1. */ +SPAN_DECLARE(int) time_scale_rate(time_scale_state_t *s, float playout_rate); + +/*! Find the maximum possible samples which could result from scaling the specified + number of input samples, at the current playback rate. + \brief Find the maximum possible output samples. + \param s The time scale context. + \param input_len The number of input samples. + \return The maximum possible output samples. */ +SPAN_DECLARE(int) time_scale_max_output_len(time_scale_state_t *s, int input_len); + +/*! Time scale a chunk of audio samples. + \brief Time scale a chunk of audio samples. + \param s The time scale context. + \param out The output audio sample buffer. This must be large enough to accept + the longest possible result from processing the input data. See the + algorithm documentation for how the longest possible result may be calculated. + \param in The input audio sample buffer. + \param len The number of input samples. + \return The number of output samples. +*/ +SPAN_DECLARE(int) time_scale(time_scale_state_t *s, int16_t out[], int16_t in[], int len); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/timing.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/timing.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,83 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * timing.h - Provide access to the Pentium/Athlon TSC timer register + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: timing.h,v 1.14 2009/09/04 14:38:47 steveu Exp $ + */ + +#if !defined(_SPANDSP_TIMING_H_) +#define _SPANDSP_TIMING_H_ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +#if defined(__MSVC__) +__declspec(naked) unsigned __int64 __cdecl rdtscll(void) +{ + __asm + { + rdtsc + ret ; return value at EDX:EAX + } +} +/*- End of function --------------------------------------------------------*/ +#elif defined(__GNUC__) +#if defined(__i386__) +static __inline__ uint64_t rdtscll(void) +{ + uint64_t now; + + __asm__ __volatile__(" rdtsc\n" : "=A" (now)); + return now; +} +/*- End of function --------------------------------------------------------*/ +#elif defined(__x86_64__) +static __inline__ uint64_t rdtscll(void) +{ + uint32_t a; + uint32_t d; + + /* For x86_64 we need to merge the result in 2 32 bit registers + into one clean 64 bit result. */ + __asm__ __volatile__(" rdtsc\n" : "=a" (a), "=d" (d)); + return ((uint64_t) a) | (((uint64_t) d) << 32); +} +/*- End of function --------------------------------------------------------*/ +#else +static __inline__ uint64_t rdtscll(void) +{ + /* This architecture doesn't have a suitable timer */ + return 0llu; +} +/*- End of function --------------------------------------------------------*/ +#endif +#endif + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/tone_detect.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/tone_detect.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,248 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * tone_detect.h - General telephony tone detection. + * + * Written by Steve Underwood + * + * Copyright (C) 2001, 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: tone_detect.h,v 1.45 2009/02/10 13:06:47 steveu Exp $ + */ + +#if !defined(_SPANDSP_TONE_DETECT_H_) +#define _SPANDSP_TONE_DETECT_H_ + +/*! + Goertzel filter descriptor. +*/ +struct goertzel_descriptor_s +{ +#if defined(SPANDSP_USE_FIXED_POINT) + int16_t fac; +#else + float fac; +#endif + int samples; +}; + +/*! + Goertzel filter state descriptor. +*/ +struct goertzel_state_s +{ +#if defined(SPANDSP_USE_FIXED_POINT) + int16_t v2; + int16_t v3; + int16_t fac; +#else + float v2; + float v3; + float fac; +#endif + int samples; + int current_sample; +}; + +/*! + Goertzel filter descriptor. +*/ +typedef struct goertzel_descriptor_s goertzel_descriptor_t; + +/*! + Goertzel filter state descriptor. +*/ +typedef struct goertzel_state_s goertzel_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! \brief Create a descriptor for use with either a Goertzel transform */ +SPAN_DECLARE(void) make_goertzel_descriptor(goertzel_descriptor_t *t, + float freq, + int samples); + +/*! \brief Initialise the state of a Goertzel transform. + \param s The Goertzel context. If NULL, a context is allocated with malloc. + \param t The Goertzel descriptor. + \return A pointer to the Goertzel state. */ +SPAN_DECLARE(goertzel_state_t *) goertzel_init(goertzel_state_t *s, + goertzel_descriptor_t *t); + +SPAN_DECLARE(int) goertzel_release(goertzel_state_t *s); + +SPAN_DECLARE(int) goertzel_free(goertzel_state_t *s); + +/*! \brief Reset the state of a Goertzel transform. + \param s The Goertzel context. */ +SPAN_DECLARE(void) goertzel_reset(goertzel_state_t *s); + +/*! \brief Update the state of a Goertzel transform. + \param s The Goertzel context. + \param amp The samples to be transformed. + \param samples The number of samples. + \return The number of samples unprocessed */ +SPAN_DECLARE(int) goertzel_update(goertzel_state_t *s, + const int16_t amp[], + int samples); + +/*! \brief Evaluate the final result of a Goertzel transform. + \param s The Goertzel context. + \return The result of the transform. The expected result for a pure sine wave + signal of level x dBm0, at the very centre of the bin is: + [Floating point] ((samples_per_goertzel_block*32768.0/1.4142)*10^((x - DBM0_MAX_SINE_POWER)/20.0))^2 + [Fixed point] ((samples_per_goertzel_block*256.0/1.4142)*10^((x - DBM0_MAX_SINE_POWER)/20.0))^2 */ +#if defined(SPANDSP_USE_FIXED_POINT) +SPAN_DECLARE(int32_t) goertzel_result(goertzel_state_t *s); +#else +SPAN_DECLARE(float) goertzel_result(goertzel_state_t *s); +#endif + +/*! \brief Update the state of a Goertzel transform. + \param s The Goertzel context. + \param amp The sample to be transformed. */ +static __inline__ void goertzel_sample(goertzel_state_t *s, int16_t amp) +{ +#if defined(SPANDSP_USE_FIXED_POINT) + int16_t x; + int16_t v1; +#else + float v1; +#endif + + v1 = s->v2; + s->v2 = s->v3; +#if defined(SPANDSP_USE_FIXED_POINT) + x = (((int32_t) s->fac*s->v2) >> 14); + /* Scale down the input signal to avoid overflows. 9 bits is enough to + monitor the signals of interest with adequate dynamic range and + resolution. In telephony we generally only start with 13 or 14 bits, + anyway. */ + s->v3 = x - v1 + (amp >> 7); +#else + s->v3 = s->fac*s->v2 - v1 + amp; +#endif + s->current_sample++; +} +/*- End of function --------------------------------------------------------*/ + +/* Scale down the input signal to avoid overflows. 9 bits is enough to + monitor the signals of interest with adequate dynamic range and + resolution. In telephony we generally only start with 13 or 14 bits, + anyway. This is sufficient for the longest Goertzel we currently use. */ +#if defined(SPANDSP_USE_FIXED_POINT) +#define goertzel_preadjust_amp(amp) (((int16_t) amp) >> 7) +#else +#define goertzel_preadjust_amp(amp) ((float) amp) +#endif + +/* Minimal update the state of a Goertzel transform. This is similar to + goertzel_sample, but more suited to blocks of Goertzels. It assumes + the amplitude is pre-shifted, and does not update the per-state sample + count. + \brief Update the state of a Goertzel transform. + \param s The Goertzel context. + \param amp The adjusted sample to be transformed. */ +#if defined(SPANDSP_USE_FIXED_POINT) +static __inline__ void goertzel_samplex(goertzel_state_t *s, int16_t amp) +#else +static __inline__ void goertzel_samplex(goertzel_state_t *s, float amp) +#endif +{ +#if defined(SPANDSP_USE_FIXED_POINT) + int16_t x; + int16_t v1; +#else + float v1; +#endif + + v1 = s->v2; + s->v2 = s->v3; +#if defined(SPANDSP_USE_FIXED_POINT) + x = (((int32_t) s->fac*s->v2) >> 14); + s->v3 = x - v1 + amp; +#else + s->v3 = s->fac*s->v2 - v1 + amp; +#endif +} +/*- End of function --------------------------------------------------------*/ + +/*! Generate a Hamming weighted coefficient set, to be used for a periodogram analysis. + \param coeffs The generated coefficients. + \param freq The frequency to be matched by the periodogram, in Hz. + \param sample_rate The sample rate of the signal, in samples per second. + \param window_len The length of the periodogram window. This must be an even number. + \return The number of generated coefficients. +*/ +SPAN_DECLARE(int) periodogram_generate_coeffs(complexf_t coeffs[], float freq, int sample_rate, int window_len); + +/*! Generate the phase offset to be expected between successive periodograms evaluated at the + specified interval. + \param offset A point to the generated phase offset. + \param freq The frequency being matched by the periodogram, in Hz. + \param sample_rate The sample rate of the signal, in samples per second. + \param interval The interval between periodograms, in samples. + \return The scaling factor. +*/ +SPAN_DECLARE(float) periodogram_generate_phase_offset(complexf_t *offset, float freq, int sample_rate, int interval); + +/*! Evaluate a periodogram. + \param coeffs A set of coefficients generated by periodogram_generate_coeffs(). + \param amp The complex amplitude of the signal. + \param len The length of the periodogram, in samples. This must be an even number. + \return The periodogram result. +*/ +SPAN_DECLARE(complexf_t) periodogram(const complexf_t coeffs[], const complexf_t amp[], int len); + +/*! Prepare data for evaluating a set of periodograms. + \param sum A vector of sums of pairs of signal samples. This will be half the length of len. + \param diff A vector of differences between pairs of signal samples. This will be half the length of len. + \param amp The complex amplitude of the signal. + \param len The length of the periodogram, in samples. This must be an even number. + \return The length of the vectors sum and diff. +*/ +SPAN_DECLARE(int) periodogram_prepare(complexf_t sum[], complexf_t diff[], const complexf_t amp[], int len); + +/*! Evaluate a periodogram, based on data prepared by periodogram_prepare(). This is more efficient + than using periodogram() when several periodograms are to be applied to the same signal. + \param coeffs A set of coefficients generated by periodogram_generate_coeffs(). + \param sum A vector of sums produced by periodogram_prepare(). + \param diff A vector of differences produced by periodogram_prepare(). + \param len The length of the periodogram, in samples. This must be an even number. + \return The periodogram result. +*/ +SPAN_DECLARE(complexf_t) periodogram_apply(const complexf_t coeffs[], const complexf_t sum[], const complexf_t diff[], int len); + +/*! Apply a phase offset, to find the frequency error between periodogram evaluations. + specified interval. + \param phase_offset A point to the expected phase offset. + \param scale The scaling factor to be used. + \param last_result A pointer to the previous periodogram result. + \param result A pointer to the current periodogram result. + \return The frequency error, in Hz. +*/ +SPAN_DECLARE(float) periodogram_freq_error(const complexf_t *phase_offset, float scale, const complexf_t *last_result, const complexf_t *result); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/tone_generate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/tone_generate.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,104 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * tone_generate.h - General telephony tone generation. + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: tone_generate.h,v 1.39 2009/06/02 16:03:56 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_TONE_GENERATE_H_) +#define _SPANDSP_TONE_GENERATE_H_ + +/*! \page tone_generation_page Tone generation +\section tone_generation_page_sec_1 What does it do? +The tone generation module provides for the generation of cadenced tones, +suitable for a wide range of telephony applications. + +\section tone_generation_page_sec_2 How does it work? +Oscillators are a problem. They oscillate due to instability, and yet we need +them to behave in a stable manner. A look around the web will reveal many papers +on this subject. Many describe rather complex solutions to the problem. However, +we are only concerned with telephony applications. It is possible to generate +the tones we need with a very simple efficient scheme. It is also practical to +use an exhaustive test to prove the oscillator is stable under all the +conditions in which we will use it. +*/ + +typedef struct tone_gen_tone_descriptor_s tone_gen_tone_descriptor_t; + +/*! + Cadenced multi-tone generator descriptor. +*/ +typedef struct tone_gen_descriptor_s tone_gen_descriptor_t; + +/*! + Cadenced multi-tone generator state descriptor. This defines the state of + a single working instance of a generator. +*/ +typedef struct tone_gen_state_s tone_gen_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Create a tone generator descriptor + \brief Create a tone generator descriptor + \param s The descriptor + \param f1 The first frequency, in Hz + \param l1 The level of the first frequency, in dBm0 + \param f2 0 for no second frequency, a positive number for the second frequency, + in Hz, or a negative number for an AM modulation frequency, in Hz + \param l2 The level of the second frequency, in dBm0, or the percentage modulation depth + for an AM modulated tone. + \param d1 x + \param d2 x + \param d3 x + \param d4 x + \param repeat x */ +SPAN_DECLARE(void) make_tone_gen_descriptor(tone_gen_descriptor_t *s, + int f1, + int l1, + int f2, + int l2, + int d1, + int d2, + int d3, + int d4, + int repeat); + +SPAN_DECLARE_NONSTD(int) tone_gen(tone_gen_state_t *s, int16_t amp[], int max_samples); + +SPAN_DECLARE(tone_gen_state_t *) tone_gen_init(tone_gen_state_t *s, tone_gen_descriptor_t *t); + +SPAN_DECLARE(int) tone_gen_release(tone_gen_state_t *s); + +SPAN_DECLARE(int) tone_gen_free(tone_gen_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/v17rx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/v17rx.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,334 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v17rx.h - ITU V.17 modem receive part + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v17rx.h,v 1.65 2009/07/09 13:52:09 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_V17RX_H_) +#define _SPANDSP_V17RX_H_ + +/*! \page v17rx_page The V.17 receiver +\section v17rx_page_sec_1 What does it do? +The V.17 receiver implements the receive side of a V.17 modem. This can operate +at data rates of 14400, 12000, 9600 and 7200 bits/second. The audio input is a stream +of 16 bit samples, at 8000 samples/second. The transmit and receive side of V.17 +modems operate independantly. V.17 is mostly used for FAX transmission over PSTN +lines, where it provides the standard 14400 bits/second rate. + +\section v17rx_page_sec_2 How does it work? +V.17 uses QAM modulation, at 2400 baud, and trellis coding. Constellations with +16, 32, 64, and 128 points are defined. After one bit per baud is absorbed by the +trellis coding, this gives usable bit rates of 7200, 9600, 12000, and 14400 per +second. + +V.17 specifies a training sequence at the start of transmission, which makes the +design of a V.17 receiver relatively straightforward. The first stage of the +training sequence consists of 256 +symbols, alternating between two constellation positions. The receiver monitors +the signal power, to sense the possible presence of a valid carrier. When the +alternating signal begins, the power rising above a minimum threshold (-43dBm0) +causes the main receiver computation to begin. The initial measured power is +used to quickly set the gain of the receiver. After this initial settling, the +front end gain is locked, and the adaptive equalizer tracks any subsequent +signal level variation. The signal is oversampled to 24000 samples/second (i.e. +signal, zero, zero, signal, zero, zero, ...) and fed to a complex root raised +cosine pulse shaping filter. This filter has been modified from the conventional +root raised cosine filter, by shifting it up the band, to be centred at the nominal +carrier frequency. This filter interpolates the samples, pulse shapes, and performs +a fractional sample delay at the same time. 192 sets of filter coefficients are used +to achieve a set of finely spaces fractional sample delays, between zero and +one sample. By choosing every fifth sample, and the appropriate set of filter +coefficients, the properly tuned symbol tracker can select data samples at 4800 +samples/second from points within 0.28 degrees of the centre and mid-points of +each symbol. The output of the filter is multiplied by a complex carrier, generated +by a DDS. The result is a baseband signal, requiring no further filtering, apart from +an adaptive equalizer. The baseband signal is fed to a T/2 adaptive equalizer. +A band edge component maximisation algorithm is used to tune the sampling, so the samples +fed to the equalizer are close to the mid point and edges of each symbol. Initially +the algorithm is very lightly damped, to ensure the symbol alignment pulls in +quickly. Because the sampling rate will not be precisely the same as the +transmitter's (the spec. says the symbol timing should be within 0.01%), the +receiver constantly evaluates and corrects this sampling throughout its +operation. During the symbol timing maintainence phase, the algorithm uses +a heavier damping. + +The carrier is specified as 1800Hz +- 1Hz at the transmitter, and 1800 +-7Hz at +the receiver. The receive carrier would only be this inaccurate if the link +includes FDM sections. These are being phased out, but the design must still +allow for the worst case. Using an initial 1800Hz signal for demodulation gives +a worst case rotation rate for the constellation of about one degree per symbol. +Once the symbol timing synchronisation algorithm has been given time to lock to the +symbol timing of the initial alternating pattern, the phase of the demodulated signal +is recorded on two successive symbols - once for each of the constellation positions. +The receiver then tracks the symbol alternations, until a large phase jump occurs. +This signifies the start of the next phase of the training sequence. At this +point the total phase shift between the original recorded symbol phase, and the +symbol phase just before the phase jump occurred is used to provide a coarse +estimation of the rotation rate of the constellation, and it current absolute +angle of rotation. These are used to update the current carrier phase and phase +update rate in the carrier DDS. The working data already in the pulse shaping +filter and equalizer buffers is given a similar step rotation to pull it all +into line. From this point on, a heavily damped integrate and dump approach, +based on the angular difference between each received constellation position and +its expected position, is sufficient to track the carrier, and maintain phase +alignment. A fast rough approximator for the arc-tangent function is adequate +for the estimation of the angular error. + +The next phase of the training sequence is a scrambled sequence of two +particular symbols. We train the T/2 adaptive equalizer using this sequence. The +scrambling makes the signal sufficiently diverse to ensure the equalizer +converges to the proper generalised solution. At the end of this sequence, the +equalizer should be sufficiently well adapted that is can correctly resolve the +full QAM constellation. However, the equalizer continues to adapt throughout +operation of the modem, fine tuning on the more complex data patterns of the +full QAM constellation. + +In the last phase of the training sequence, the modem enters normal data +operation, with a short defined period of all ones as data. As in most high +speed modems, data in a V.17 modem passes through a scrambler, to whiten the +spectrum of the signal. The transmitter should initialise its data scrambler, +and pass the ones through it. At the end of the ones, real data begins to pass +through the scrambler, and the transmit modem is in normal operation. The +receiver tests that ones are really received, in order to verify the modem +trained correctly. If all is well, the data following the ones is fed to the +application, and the receive modem is up and running. Unfortunately, some +transmit side of some real V.17 modems fail to initialise their scrambler before +sending the ones. This means the first 23 received bits (the length of the +scrambler register) cannot be trusted for the test. The receive modem, +therefore, only tests that bits starting at bit 24 are really ones. + +The V.17 signal is trellis coded. Two bits of each symbol are convolutionally coded +to form a 3 bit trellis code - the two original bits, plus an extra redundant bit. It +is possible to ignore the trellis coding, and just decode the non-redundant bits. +However, the noise performance of the receiver would suffer. Using a proper +trellis decoder adds several dB to the noise tolerance to the receiving modem. Trellis +coding seems quite complex at first sight, but is fairly straightforward once you +get to grips with it. + +Trellis decoding tracks the data in terms of the possible states of the convolutional +coder at the transmitter. There are 8 possible states of the V.17 coder. The first +step in trellis decoding is to find the best candidate constellation point +for each of these 8 states. One of thse will be our final answer. The constellation +has been designed so groups of 8 are spread fairly evenly across it. Locating them +is achieved is a reasonably fast manner, by looking up the answers in a set of space +map tables. The disadvantage is the tables are potentially large enough to affect +cache performance. The trellis decoder works over 16 successive symbols. The result +of decoding is not known until 16 symbols after the data enters the decoder. The +minimum total accumulated mismatch between each received point and the actual +constellation (termed the distance) is assessed for each of the 8 states. A little +analysis of the coder shows that each of the 8 current states could be arrived at +from 4 different previous states, through 4 different constellation bit patterns. +For each new state, the running total distance is arrived at by inspecting a previous +total plus a new distance for the appropriate 4 previous states. The minimum of the 4 +values becomes the new distance for the state. Clearly, a mechanism is needed to stop +this distance from growing indefinitely. A sliding window, and several other schemes +are possible. However, a simple single pole IIR is very simple, and provides adequate +results. + +For each new state we store the constellation bit pattern, or path, to that state, and +the number of the previous state. We find the minimum distance amongst the 8 new +states for each new symbol. We then trace back through the states, until we reach the +one 16 states ago which leads to the current minimum distance. The bit pattern stored +there is the error corrected bit pattern for that symbol. + +So, what does Trellis coding actually achieve? TCM is easier to understand by looking +at the V.23bis modem spec. The V.32bis spec. is very similar to V.17, except that it +is a full duplex modem and has non-TCM options, as well as the TCM ones in V.17. + +V32bis defines two options for pumping 9600 bits per second down a phone line - one +with and one without TCM. Both run at 2400 baud. The non-TCM one uses simple 16 point +QAM on the raw data. The other takes two out of every four raw bits, and convolutionally +encodes them to 3. Now we have 5 bits per symbol, and we need 32 point QAM to send the +data. + +The raw error rate from simple decoding of the 32 point QAM is horrible compared to +decoding the 16 point QAM. If a point decoded from the 32 point QAM is wrong, the likely +correct choice should be one of the adjacent ones. It is unlikely to have been one that +is far away across the constellation, unless there was a huge noise spike, interference, +or something equally nasty. Now, the 32 point symbols do not exist in isolation. There +was a kind of temporal smearing in the convolutional coding. It created a well defined +dependency between successive symbols. If we knew for sure what the last few symbols +were, they would lead us to a limited group of possible values for the current symbol, +constrained by the behaviour of the convolutional coder. If you look at how the symbols +were mapped to constellation points, you will see the mapping tries to spread those +possible symbols as far apart as possible. This will leave only one that is pretty +close to the received point, which must be the correct choice. However, this assumes +we know the last few symbols for sure. Since we don't, we have a bit more work to do +to achieve reliable decoding. + +Instead of decoding to the nearest point on the constellation, we decode to a group of +likely constellation points in the neighbourhood of the received point. We record the +mismatch for each - that is the distance across the constellation between the received +point and the group of nearby points. To avoid square roots, recording x2 + y2 can be +good enough. Symbol by symbol, we record this information. After a few symbols we can +stand back and look at the recorded information. + +For each symbol we have a set of possible symbol values and error metric pairs. The +dependency between symbols, created by the convolutional coder, means some paths from +symbol to symbol are possible and some are not. It we trace back through the possible +symbol to symbol paths, and total up the error metric through those paths, we end up +with a set of figures of merit (or more accurately figures of demerit, since +larger == worse) for the likelihood of each path being the correct one. The path with +the lowest total metric is the most likely, and gives us our final choice for what we +think the current symbol really is. + +That was hard work. It takes considerable computation to do this selection and traceback, +symbol by symbol. We need to get quite a lot from this. It needs to drive the error rate +down so far that is compensates for the much higher error rate due to the larger +constellation, and then buys us some actual benefit. Well in the example we are looking +at - V.32bis at 9600bps - it works out the error rate from the TCM option is like using +the non-TCM option with several dB more signal to noise ratio. That's nice. The non-TCM +option is pretty reasonable on most phone lines, but a better error rate is always a +good thing. However, V32bis includes a 14,400bps option. That uses 2400 baud, and 6 bit +symbols. Convolutional encoding increases that to 7 bits per symbol, by taking 2 bits and +encoding them to 3. This give a 128 point QAM constellation. Again, the difference between +using this, and using just an uncoded 64 point constellation is equivalent to maybe 5dB of +extra signal to noise ratio. However, in this case it is the difference between the modem +working only on the most optimal lines, and being widely usable across most phone lines. +TCM absolutely transformed the phone line modem business. +*/ + +/*! + V.17 modem receive side descriptor. This defines the working state for a + single instance of a V.17 modem receiver. +*/ +typedef struct v17_rx_state_s v17_rx_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Initialise a V.17 modem receive context. + \brief Initialise a V.17 modem receive context. + \param s The modem context. + \param bit_rate The bit rate of the modem. Valid values are 7200, 9600, 12000 and 14400. + \param put_bit The callback routine used to put the received data. + \param user_data An opaque pointer passed to the put_bit routine. + \return A pointer to the modem context, or NULL if there was a problem. */ +SPAN_DECLARE(v17_rx_state_t *) v17_rx_init(v17_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data); + +/*! Reinitialise an existing V.17 modem receive context. + \brief Reinitialise an existing V.17 modem receive context. + \param s The modem context. + \param bit_rate The bit rate of the modem. Valid values are 7200, 9600, 12000 and 14400. + \param short_train TRUE if a short training sequence is expected. + \return 0 for OK, -1 for bad parameter */ +SPAN_DECLARE(int) v17_rx_restart(v17_rx_state_t *s, int bit_rate, int short_train); + +/*! Release a V.17 modem receive context. + \brief Release a V.17 modem receive context. + \param s The modem context. + \return 0 for OK */ +SPAN_DECLARE(int) v17_rx_release(v17_rx_state_t *s); + +/*! Free a V.17 modem receive context. + \brief Free a V.17 modem receive context. + \param s The modem context. + \return 0 for OK */ +SPAN_DECLARE(int) v17_rx_free(v17_rx_state_t *s); + +/*! Get the logging context associated with a V.17 modem receive context. + \brief Get the logging context associated with a V.17 modem receive context. + \param s The modem context. + \return A pointer to the logging context */ +SPAN_DECLARE(logging_state_t *) v17_rx_get_logging_state(v17_rx_state_t *s); + +/*! Change the put_bit function associated with a V.17 modem receive context. + \brief Change the put_bit function associated with a V.17 modem receive context. + \param s The modem context. + \param put_bit The callback routine used to handle received bits. + \param user_data An opaque pointer. */ +SPAN_DECLARE(void) v17_rx_set_put_bit(v17_rx_state_t *s, put_bit_func_t put_bit, void *user_data); + +/*! Change the modem status report function associated with a V.17 modem receive context. + \brief Change the modem status report function associated with a V.17 modem receive context. + \param s The modem context. + \param handler The callback routine used to report modem status changes. + \param user_data An opaque pointer. */ +SPAN_DECLARE(void) v17_rx_set_modem_status_handler(v17_rx_state_t *s, modem_rx_status_func_t handler, void *user_data); + +/*! Process a block of received V.17 modem audio samples. + \brief Process a block of received V.17 modem audio samples. + \param s The modem context. + \param amp The audio sample buffer. + \param len The number of samples in the buffer. + \return The number of samples unprocessed. +*/ +SPAN_DECLARE_NONSTD(int) v17_rx(v17_rx_state_t *s, const int16_t amp[], int len); + +/*! Fake processing of a missing block of received V.17 modem audio samples. + (e.g due to packet loss). + \brief Fake processing of a missing block of received V.17 modem audio samples. + \param s The modem context. + \param len The number of samples to fake. + \return The number of samples unprocessed. +*/ +SPAN_DECLARE(int) v17_rx_fillin(v17_rx_state_t *s, int len); + +/*! Get a snapshot of the current equalizer coefficients. + \brief Get a snapshot of the current equalizer coefficients. + \param s The modem context. + \param coeffs The vector of complex coefficients. + \return The number of coefficients in the vector. */ +#if defined(SPANDSP_USE_FIXED_POINTx) +SPAN_DECLARE(int) v17_rx_equalizer_state(v17_rx_state_t *s, complexi_t **coeffs); +#else +SPAN_DECLARE(int) v17_rx_equalizer_state(v17_rx_state_t *s, complexf_t **coeffs); +#endif + +/*! Get the current received carrier frequency. + \param s The modem context. + \return The frequency, in Hertz. */ +SPAN_DECLARE(float) v17_rx_carrier_frequency(v17_rx_state_t *s); + +/*! Get the current symbol timing correction since startup. + \param s The modem context. + \return The correction. */ +SPAN_DECLARE(float) v17_rx_symbol_timing_correction(v17_rx_state_t *s); + +/*! Get a current received signal power. + \param s The modem context. + \return The signal power, in dBm0. */ +SPAN_DECLARE(float) v17_rx_signal_power(v17_rx_state_t *s); + +/*! Set the power level at which the carrier detection will cut in + \param s The modem context. + \param cutoff The signal cutoff power, in dBm0. */ +SPAN_DECLARE(void) v17_rx_signal_cutoff(v17_rx_state_t *s, float cutoff); + +/*! Set a handler routine to process QAM status reports + \param s The modem context. + \param handler The handler routine. + \param user_data An opaque pointer passed to the handler routine. */ +SPAN_DECLARE(void) v17_rx_set_qam_report_handler(v17_rx_state_t *s, qam_report_handler_t handler, void *user_data); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/v17tx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/v17tx.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,167 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v17tx.h - ITU V.17 modem transmit part + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v17tx.h,v 1.43.4.1 2009/12/24 16:52:30 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_V17TX_H_) +#define _SPANDSP_V17TX_H_ + +/*! \page v17tx_page The V.17 transmitter +\section v17tx_page_sec_1 What does it do? +The V.17 transmitter implements the transmit side of a V.17 modem. This can +operate at data rates of 14400, 12000, 9600 and 7200 bits/second. The audio +output is a stream of 16 bit samples, at 8000 samples/second. The transmit and +receive side of V.17 modems operate independantly. V.17 is mostly used for FAX +transmission, where it provides the standard 14400 bits/second rate. + +\section v17tx_page_sec_2 How does it work? +V.17 uses QAM modulation and trellis coding. The data to be transmitted is +scrambled, to whiten it. The least significant 2 bits of each symbol are then +differentially encoded, using a simple lookup approach. The resulting 2 bits are +convolutionally encoded, producing 3 bits. The extra bit is the redundant bit +of the trellis code. The other bits of the symbol pass by the differential +and convolutional coding unchanged. The resulting bits define the constellation +point to be transmitted for the symbol. The redundant bit doubles the size of the +constellation, and so increases the error rate for detecting individual symbols +at the receiver. However, when a number of successive symbols are processed at +the receiver, the redundancy actually provides several dB of improved error +performance. + +The standard method of producing a QAM modulated signal is to use a sampling +rate which is a multiple of the baud rate. The raw signal is then a series of +complex pulses, each an integer number of samples long. These can be shaped, +using a suitable complex filter, and multiplied by a complex carrier signal +to produce the final QAM signal for transmission. + +The pulse shaping filter is only vaguely defined by the V.17 spec. Some of the +other ITU modem specs. fully define the filter, typically specifying a root +raised cosine filter, with 50% excess bandwidth. This is a pity, since it +increases the variability of the received signal. However, the receiver's +adaptive equalizer will compensate for these differences. The current +design uses a root raised cosine filter with 25% excess bandwidth. Greater +excess bandwidth will not allow the tranmitted signal to meet the spectral +requirements. + +The sampling rate for our transmitter is defined by the channel - 8000 per +second. This is not a multiple of the baud rate (i.e. 2400 baud). The baud +interval is actually 10/3 sample periods. Instead of using a symmetric +FIR to pulse shape the signal, a polyphase filter is used. This consists of +10 sets of coefficients, offering zero to 9/10ths of a baud phase shift as well +as root raised cosine filtering. The appropriate coefficient set is chosen for +each signal sample generated. + +The carrier is generated using the DDS method. Using two second order resonators, +started in quadrature, might be more efficient, as it would have less impact on +the processor cache than a table lookup approach. However, the DDS approach +suits the receiver better, so the same signal generator is also used for the +transmitter. +*/ + +/*! + V.17 modem transmit side descriptor. This defines the working state for a + single instance of a V.17 modem transmitter. +*/ +typedef struct v17_tx_state_s v17_tx_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Adjust a V.17 modem transmit context's power output. + \brief Adjust a V.17 modem transmit context's output power. + \param s The modem context. + \param power The power level, in dBm0 */ +SPAN_DECLARE(void) v17_tx_power(v17_tx_state_t *s, float power); + +/*! Initialise a V.17 modem transmit context. This must be called before the first + use of the context, to initialise its contents. + \brief Initialise a V.17 modem transmit context. + \param s The modem context. + \param bit_rate The bit rate of the modem. Valid values are 7200, 9600, 12000 and 14400. + \param tep TRUE is the optional TEP tone is to be transmitted. + \param get_bit The callback routine used to get the data to be transmitted. + \param user_data An opaque pointer. + \return A pointer to the modem context, or NULL if there was a problem. */ +SPAN_DECLARE(v17_tx_state_t *) v17_tx_init(v17_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data); + +/*! Reinitialise an existing V.17 modem transmit context, so it may be reused. + \brief Reinitialise an existing V.17 modem transmit context. + \param s The modem context. + \param bit_rate The bit rate of the modem. Valid values are 7200, 9600, 12000 and 14400. + \param tep TRUE is the optional TEP tone is to be transmitted. + \param short_train TRUE if the short training sequence should be used. + \return 0 for OK, -1 for parameter error. */ +SPAN_DECLARE(int) v17_tx_restart(v17_tx_state_t *s, int bit_rate, int tep, int short_train); + +/*! Release a V.17 modem transmit context. + \brief Release a V.17 modem transmit context. + \param s The modem context. + \return 0 for OK */ +SPAN_DECLARE(int) v17_tx_release(v17_tx_state_t *s); + +/*! Free a V.17 modem transmit context. + \brief Free a V.17 modem transmit context. + \param s The modem context. + \return 0 for OK */ +SPAN_DECLARE(int) v17_tx_free(v17_tx_state_t *s); + +/*! Get the logging context associated with a V.17 modem transmit context. + \brief Get the logging context associated with a V.17 modem transmit context. + \param s The modem context. + \return A pointer to the logging context */ +SPAN_DECLARE(logging_state_t *) v17_tx_get_logging_state(v17_tx_state_t *s); + +/*! Change the get_bit function associated with a V.17 modem transmit context. + \brief Change the get_bit function associated with a V.17 modem transmit context. + \param s The modem context. + \param get_bit The callback routine used to get the data to be transmitted. + \param user_data An opaque pointer. */ +SPAN_DECLARE(void) v17_tx_set_get_bit(v17_tx_state_t *s, get_bit_func_t get_bit, void *user_data); + +/*! Change the modem status report function associated with a V.17 modem transmit context. + \brief Change the modem status report function associated with a V.17 modem transmit context. + \param s The modem context. + \param handler The callback routine used to report modem status changes. + \param user_data An opaque pointer. */ +SPAN_DECLARE(void) v17_tx_set_modem_status_handler(v17_tx_state_t *s, modem_tx_status_func_t handler, void *user_data); + +/*! Generate a block of V.17 modem audio samples. + \brief Generate a block of V.17 modem audio samples. + \param s The modem context. + \param amp The audio sample buffer. + \param len The number of samples to be generated. + \return The number of samples actually generated. +*/ +SPAN_DECLARE_NONSTD(int) v17_tx(v17_tx_state_t *s, int16_t amp[], int len); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/v18.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/v18.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,156 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v18.h - V.18 text telephony for the deaf. + * + * Written by Steve Underwood + * + * Copyright (C) 2004-2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v18.h,v 1.6 2009/11/04 15:52:06 steveu Exp $ + */ + +/*! \file */ + +/*! \page v18_page The V.18 text telephony protocols +\section v18_page_sec_1 What does it do? + +\section v18_page_sec_2 How does it work? +*/ + +#if !defined(_SPANDSP_V18_H_) +#define _SPANDSP_V18_H_ + +typedef struct v18_state_s v18_state_t; + +enum +{ + V18_MODE_NONE = 0, + /* V.18 Annex A - Weitbrecht TDD at 45.45bps, half-duplex, 5 bit baudot. */ + V18_MODE_5BIT_45 = 1, + /* V.18 Annex A - Weitbrecht TDD at 50bps, half-duplex, 5 bit baudot. */ + V18_MODE_5BIT_50 = 2, + /* V.18 Annex B - DTMF encoding of ASCII. */ + V18_MODE_DTMF = 3, + /* V.18 Annex C - EDT 110bps, V.21, half-duplex, ASCII. */ + V18_MODE_EDT = 4, + /* V.18 Annex D - 300bps, Bell 103, duplex, ASCII. */ + V18_MODE_BELL103 = 5, + /* V.18 Annex E - 1200bps Videotex terminals, ASCII. */ + V18_MODE_V23VIDEOTEX = 6, + /* V.18 Annex F - V.21 text telephone, V.21, duplex, ASCII. */ + V18_MODE_V21TEXTPHONE = 7, + /* V.18 Annex G - V.18 text telephone mode. */ + V18_MODE_V18TEXTPHONE = 8 +}; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +SPAN_DECLARE(logging_state_t *) v18_get_logging_state(v18_state_t *s); + +/*! Initialise a V.18 context. + \brief Initialise a V.18 context. + \param s The V.18 context. + \param calling_party TRUE if caller mode, else answerer mode. + \param mode Mode of operation. + \param put_msg A callback routine called to deliver the received text + to the application. + \param user_data An opaque pointer for the callback routine. + \return A pointer to the V.18 context, or NULL if there was a problem. */ +SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s, + int calling_party, + int mode, + put_msg_func_t put_msg, + void *user_data); + +/*! Release a V.18 context. + \brief Release a V.18 context. + \param s The V.18 context. + \return 0 for OK. */ +SPAN_DECLARE(int) v18_release(v18_state_t *s); + +/*! Free a V.18 context. + \brief Release a V.18 context. + \param s The V.18 context. + \return 0 for OK. */ +SPAN_DECLARE(int) v18_free(v18_state_t *s); + +/*! Generate a block of V.18 audio samples. + \brief Generate a block of V.18 audio samples. + \param s The V.18 context. + \param amp The audio sample buffer. + \param max_len The number of samples to be generated. + \return The number of samples actually generated. +*/ +SPAN_DECLARE_NONSTD(int) v18_tx(v18_state_t *s, int16_t amp[], int max_len); + +/*! Process a block of received V.18 audio samples. + \brief Process a block of received V.18 audio samples. + \param s The V.18 context. + \param amp The audio sample buffer. + \param len The number of samples in the buffer. +*/ +SPAN_DECLARE_NONSTD(int) v18_rx(v18_state_t *s, const int16_t amp[], int len); + +/*! \brief Put a string to a V.18 context's input buffer. + \param s The V.18 context. + \param msg The string to be added. + \param len The length of the string. If negative, the string is + assumed to be a NULL terminated string. + \return The number of characters actually added. This may be less than the + length of the digit string, if the buffer fills up. If the string is + invalid, this function will return -1. */ +SPAN_DECLARE(int) v18_put(v18_state_t *s, const char msg[], int len); + +/*! Convert a text string to a V.18 DTMF string. + \brief Convert a text string to a V.18 DTMF string. + \param s The V.18 context. + \param dtmf The resulting DTMF string. + \param msg The text string to be converted. + \return The length of the DTMF string. +*/ +SPAN_DECLARE(int) v18_encode_dtmf(v18_state_t *s, char dtmf[], const char msg[]); + +/*! Convert a V.18 DTMF string to a text string. + \brief Convert a V.18 DTMF string to a text string. + \param s The V.18 context. + \param msg The resulting test string. + \param dtmf The DTMF string to be converted. + \return The length of the text string. +*/ +SPAN_DECLARE(int) v18_decode_dtmf(v18_state_t *s, char msg[], const char dtmf[]); + +SPAN_DECLARE(uint16_t) v18_encode_baudot(v18_state_t *s, uint8_t ch); + +SPAN_DECLARE(uint8_t) v18_decode_baudot(v18_state_t *s, uint8_t ch); + +/*! \brief Return a short name for an V.18 mode + \param mode The code for the V.18 mode. + \return A pointer to the name. +*/ +SPAN_DECLARE(const char *) v18_mode_to_str(int mode); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/v22bis.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/v22bis.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,225 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v22bis.h - ITU V.22bis modem + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v22bis.h,v 1.46 2009/11/04 15:52:06 steveu Exp $ + */ + +/*! \file */ + +/*! \page v22bis_page The V.22bis modem +\section v22bis_page_sec_1 What does it do? +The V.22bis modem is a duplex modem for general data use on the PSTN, at rates +of 1200 and 2400 bits/second. It is a compatible extension of the V.22 modem, +which is a 1200 bits/second only design. It is a band-split design, using carriers +of 1200Hz and 2400Hz. It is the fastest PSTN modem in general use which does not +use echo-cancellation. + +\section v22bis__page_sec_2 How does it work? +V.22bis uses 4PSK modulation at 1200 bits/second or 16QAM modulation at 2400 +bits/second. At 1200bps the symbols are so long that a fixed compromise equaliser +is sufficient to recover the 4PSK signal reliably. At 2400bps an adaptive +equaliser is necessary. + +The V.22bis training sequence includes sections which allow the modems to determine +if the far modem can support (or is willing to support) 2400bps operation. The +modems will automatically use 2400bps if both ends are willing to use that speed, +or 1200bps if one or both ends to not acknowledge that 2400bps is OK. +*/ + +#if !defined(_SPANDSP_V22BIS_H_) +#define _SPANDSP_V22BIS_H_ + +enum +{ + V22BIS_GUARD_TONE_NONE, + V22BIS_GUARD_TONE_550HZ, + V22BIS_GUARD_TONE_1800HZ +}; + +/*! + V.22bis modem descriptor. This defines the working state for a single instance + of a V.22bis modem. +*/ +typedef struct v22bis_state_s v22bis_state_t; + +extern const complexf_t v22bis_constellation[16]; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Process a block of received V.22bis modem audio samples. + \brief Process a block of received V.22bis modem audio samples. + \param s The modem context. + \param amp The audio sample buffer. + \param len The number of samples in the buffer. + \return The number of samples unprocessed. */ +SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int len); + +/*! Fake processing of a missing block of received V.22bis modem audio samples. + (e.g due to packet loss). + \brief Fake processing of a missing block of received V.22bis modem audio samples. + \param s The modem context. + \param len The number of samples to fake. + \return The number of samples unprocessed. */ +SPAN_DECLARE(int) v22bis_rx_fillin(v22bis_state_t *s, int len); + +/*! Get a snapshot of the current equalizer coefficients. + \brief Get a snapshot of the current equalizer coefficients. + \param coeffs The vector of complex coefficients. + \return The number of coefficients in the vector. */ +SPAN_DECLARE(int) v22bis_rx_equalizer_state(v22bis_state_t *s, complexf_t **coeffs); + +/*! Get the current received carrier frequency. + \param s The modem context. + \return The frequency, in Hertz. */ +SPAN_DECLARE(float) v22bis_rx_carrier_frequency(v22bis_state_t *s); + +/*! Get the current symbol timing correction since startup. + \param s The modem context. + \return The correction. */ +SPAN_DECLARE(float) v22bis_rx_symbol_timing_correction(v22bis_state_t *s); + +/*! Get a current received signal power. + \param s The modem context. + \return The signal power, in dBm0. */ +SPAN_DECLARE(float) v22bis_rx_signal_power(v22bis_state_t *s); + +/*! Set the power level at which the carrier detection will cut in + \param s The modem context. + \param cutoff The signal cutoff power, in dBm0. */ +SPAN_DECLARE(void) v22bis_rx_signal_cutoff(v22bis_state_t *s, float cutoff); + +/*! Set a handler routine to process QAM status reports + \param s The modem context. + \param handler The handler routine. + \param user_data An opaque pointer passed to the handler routine. */ +SPAN_DECLARE(void) v22bis_rx_set_qam_report_handler(v22bis_state_t *s, qam_report_handler_t handler, void *user_data); + +/*! Generate a block of V.22bis modem audio samples. + \brief Generate a block of V.22bis modem audio samples. + \param s The modem context. + \param amp The audio sample buffer. + \param len The number of samples to be generated. + \return The number of samples actually generated. */ +SPAN_DECLARE_NONSTD(int) v22bis_tx(v22bis_state_t *s, int16_t amp[], int len); + +/*! Adjust a V.22bis modem transmit context's power output. + \brief Adjust a V.22bis modem transmit context's output power. + \param s The modem context. + \param power The power level, in dBm0 */ +SPAN_DECLARE(void) v22bis_tx_power(v22bis_state_t *s, float power); + +/*! Reinitialise an existing V.22bis modem context, so it may be reused. + \brief Reinitialise an existing V.22bis modem context. + \param s The modem context. + \param bit_rate The bit rate of the modem. Valid values are 1200 and 2400. + \return 0 for OK, -1 for bad parameter. */ +SPAN_DECLARE(int) v22bis_restart(v22bis_state_t *s, int bit_rate); + +/*! Request a retrain for a V.22bis modem context. A rate change may also be requested. + \brief Request a retrain for a V.22bis modem context. + \param s The modem context. + \param bit_rate The bit rate of the modem. Valid values are 1200 and 2400. + \return 0 for OK, -1 for request rejected. */ +SPAN_DECLARE(int) v22bis_request_retrain(v22bis_state_t *s, int bit_rate); + +/*! Request a loopback 2 for a V.22bis modem context. + \brief Request a loopback 2 for a V.22bis modem context. + \param s The modem context. + \param enable TRUE to enable loopback, or FALSE to disable it. + \return 0 for OK, -1 for request reject. */ +SPAN_DECLARE(int) v22bis_remote_loopback(v22bis_state_t *s, int enable); + +/*! Report the current operating bit rate of a V.22bis modem context. + \brief Report the current operating bit rate of a V.22bis modem context + \param s The modem context. */ +SPAN_DECLARE(int) v22bis_current_bit_rate(v22bis_state_t *s); + +/*! Initialise a V.22bis modem context. This must be called before the first + use of the context, to initialise its contents. + \brief Initialise a V.22bis modem context. + \param s The modem context. + \param bit_rate The bit rate of the modem. Valid values are 1200 and 2400. + \param guard The guard tone option. 0 = none, 1 = 550Hz, 2 = 1800Hz. + \param calling_party TRUE if this is the calling modem. + \param get_bit The callback routine used to get the data to be transmitted. + \param put_bit The callback routine used to get the data to be transmitted. + \param user_data An opaque pointer, passed in calls to the get and put routines. + \return A pointer to the modem context, or NULL if there was a problem. */ +SPAN_DECLARE(v22bis_state_t *) v22bis_init(v22bis_state_t *s, + int bit_rate, + int guard, + int calling_party, + get_bit_func_t get_bit, + void *get_bit_user_data, + put_bit_func_t put_bit, + void *put_bit_user_data); + +/*! Release a V.22bis modem receive context. + \brief Release a V.22bis modem receive context. + \param s The modem context. + \return 0 for OK */ +SPAN_DECLARE(int) v22bis_release(v22bis_state_t *s); + +/*! Free a V.22bis modem receive context. + \brief Free a V.22bis modem receive context. + \param s The modem context. + \return 0 for OK */ +SPAN_DECLARE(int) v22bis_free(v22bis_state_t *s); + +/*! Get the logging context associated with a V.22bis modem context. + \brief Get the logging context associated with a V.22bis modem context. + \param s The modem context. + \return A pointer to the logging context */ +SPAN_DECLARE(logging_state_t *) v22bis_get_logging_state(v22bis_state_t *s); + +/*! Change the get_bit function associated with a V.22bis modem context. + \brief Change the get_bit function associated with a V.22bis modem context. + \param s The modem context. + \param get_bit The callback routine used to get the data to be transmitted. + \param user_data An opaque pointer. */ +SPAN_DECLARE(void) v22bis_set_get_bit(v22bis_state_t *s, get_bit_func_t get_bit, void *user_data); + +/*! Change the get_bit function associated with a V.22bis modem context. + \brief Change the put_bit function associated with a V.22bis modem context. + \param s The modem context. + \param put_bit The callback routine used to process the data received. + \param user_data An opaque pointer. */ +SPAN_DECLARE(void) v22bis_set_put_bit(v22bis_state_t *s, put_bit_func_t put_bit, void *user_data); + +/*! Change the modem status report function associated with a V.22bis modem receive context. + \brief Change the modem status report function associated with a V.22bis modem receive context. + \param s The modem context. + \param handler The callback routine used to report modem status changes. + \param user_data An opaque pointer. */ +SPAN_DECLARE(void) v22bis_set_modem_status_handler(v22bis_state_t *s, modem_rx_status_func_t handler, void *user_data); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/v27ter_rx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/v27ter_rx.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,164 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v27ter_rx.h - ITU V.27ter modem receive part + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v27ter_rx.h,v 1.61 2009/07/09 13:52:09 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_V27TER_RX_H_) +#define _SPANDSP_V27TER_RX_H_ + +/*! \page v27ter_rx_page The V.27ter receiver + +\section v27ter_rx_page_sec_1 What does it do? +The V.27ter receiver implements the receive side of a V.27ter modem. This can operate +at data rates of 4800 and 2400 bits/s. The audio input is a stream of 16 bit samples, +at 8000 samples/second. The transmit and receive side of V.27ter modems operate +independantly. V.27ter is mostly used for FAX transmission, where it provides the +standard 4800 bits/s rate (the 2400 bits/s mode is not used for FAX). + +\section v27ter_rx_page_sec_2 How does it work? +V.27ter defines two modes of operation. One uses 8-PSK at 1600 baud, giving 4800bps. +The other uses 4-PSK at 1200 baud, giving 2400bps. A training sequence is specified +at the start of transmission, which makes the design of a V.27ter receiver relatively +straightforward. +*/ + +/*! + V.27ter modem receive side descriptor. This defines the working state for a + single instance of a V.27ter modem receiver. +*/ +typedef struct v27ter_rx_state_s v27ter_rx_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Initialise a V.27ter modem receive context. + \brief Initialise a V.27ter modem receive context. + \param s The modem context. + \param bit_rate The bit rate of the modem. Valid values are 2400 and 4800. + \param put_bit The callback routine used to put the received data. + \param user_data An opaque pointer passed to the put_bit routine. + \return A pointer to the modem context, or NULL if there was a problem. */ +SPAN_DECLARE(v27ter_rx_state_t *) v27ter_rx_init(v27ter_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data); + +/*! Reinitialise an existing V.27ter modem receive context. + \brief Reinitialise an existing V.27ter modem receive context. + \param s The modem context. + \param bit_rate The bit rate of the modem. Valid values are 2400 and 4800. + \param old_train TRUE if a previous trained values are to be reused. + \return 0 for OK, -1 for bad parameter */ +SPAN_DECLARE(int) v27ter_rx_restart(v27ter_rx_state_t *s, int bit_rate, int old_train); + +/*! Release a V.27ter modem receive context. + \brief Release a V.27ter modem receive context. + \param s The modem context. + \return 0 for OK */ +SPAN_DECLARE(int) v27ter_rx_release(v27ter_rx_state_t *s); + +/*! Free a V.27ter modem receive context. + \brief Free a V.27ter modem receive context. + \param s The modem context. + \return 0 for OK */ +SPAN_DECLARE(int) v27ter_rx_free(v27ter_rx_state_t *s); + +/*! Get the logging context associated with a V.27ter modem receive context. + \brief Get the logging context associated with a V.27ter modem receive context. + \param s The modem context. + \return A pointer to the logging context */ +SPAN_DECLARE(logging_state_t *) v27ter_rx_get_logging_state(v27ter_rx_state_t *s); + +/*! Change the put_bit function associated with a V.27ter modem receive context. + \brief Change the put_bit function associated with a V.27ter modem receive context. + \param s The modem context. + \param put_bit The callback routine used to handle received bits. + \param user_data An opaque pointer. */ +SPAN_DECLARE(void) v27ter_rx_set_put_bit(v27ter_rx_state_t *s, put_bit_func_t put_bit, void *user_data); + +/*! Change the modem status report function associated with a V.27ter modem receive context. + \brief Change the modem status report function associated with a V.27ter modem receive context. + \param s The modem context. + \param handler The callback routine used to report modem status changes. + \param user_data An opaque pointer. */ +SPAN_DECLARE(void) v27ter_rx_set_modem_status_handler(v27ter_rx_state_t *s, modem_rx_status_func_t handler, void *user_data); + +/*! Process a block of received V.27ter modem audio samples. + \brief Process a block of received V.27ter modem audio samples. + \param s The modem context. + \param amp The audio sample buffer. + \param len The number of samples in the buffer. + \return The number of samples unprocessed. +*/ +SPAN_DECLARE_NONSTD(int) v27ter_rx(v27ter_rx_state_t *s, const int16_t amp[], int len); + +/*! Fake processing of a missing block of received V.27ter modem audio samples. + (e.g due to packet loss). + \brief Fake processing of a missing block of received V.27ter modem audio samples. + \param s The modem context. + \param len The number of samples to fake. + \return The number of samples unprocessed. +*/ +SPAN_DECLARE(int) v27ter_rx_fillin(v27ter_rx_state_t *s, int len); + +/*! Get a snapshot of the current equalizer coefficients. + \brief Get a snapshot of the current equalizer coefficients. + \param coeffs The vector of complex coefficients. + \return The number of coefficients in the vector. */ +SPAN_DECLARE(int) v27ter_rx_equalizer_state(v27ter_rx_state_t *s, complexf_t **coeffs); + +/*! Get the current received carrier frequency. + \param s The modem context. + \return The frequency, in Hertz. */ +SPAN_DECLARE(float) v27ter_rx_carrier_frequency(v27ter_rx_state_t *s); + +/*! Get the current symbol timing correction since startup. + \param s The modem context. + \return The correction. */ +SPAN_DECLARE(float) v27ter_rx_symbol_timing_correction(v27ter_rx_state_t *s); + +/*! Get a current received signal power. + \param s The modem context. + \return The signal power, in dBm0. */ +SPAN_DECLARE(float) v27ter_rx_signal_power(v27ter_rx_state_t *s); + +/*! Set the power level at which the carrier detection will cut in + \param s The modem context. + \param cutoff The signal cutoff power, in dBm0. */ +SPAN_DECLARE(void) v27ter_rx_signal_cutoff(v27ter_rx_state_t *s, float cutoff); + +/*! Set a handler routine to process QAM status reports + \param s The modem context. + \param handler The handler routine. + \param user_data An opaque pointer passed to the handler routine. */ +SPAN_DECLARE(void) v27ter_rx_set_qam_report_handler(v27ter_rx_state_t *s, qam_report_handler_t handler, void *user_data); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/v27ter_tx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/v27ter_tx.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,148 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v27ter_tx.h - ITU V.27ter modem transmit part + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v27ter_tx.h,v 1.43 2009/07/09 13:52:09 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_V27TER_TX_H_) +#define _SPANDSP_V27TER_TX_H_ + +/*! \page v27ter_tx_page The V.27ter transmitter +\section v27ter_tx_page_sec_1 What does it do? +The V.27ter transmitter implements the transmit side of a V.27ter modem. This +can operate at data rates of 4800 and 2400 bits/s. The audio output is a stream +of 16 bit samples, at 8000 samples/second. The transmit and receive side of +V.27ter modems operate independantly. V.27ter is used for FAX transmission, +where it provides the standard 4800 and 2400 bits/s rates. + +\section v27ter_tx_page_sec_2 How does it work? +V.27ter uses DPSK modulation. A common method of producing a DPSK modulated +signal is to use a sampling rate which is a multiple of the baud rate. The raw +signal is then a series of complex pulses, each an integer number of samples +long. These can be shaped, using a suitable complex filter, and multiplied by a +complex carrier signal to produce the final DPSK signal for transmission. + +The pulse shaping filter for V.27ter is defined in the spec. It is a root raised +cosine filter with 50% excess bandwidth. + +The sampling rate for our transmitter is defined by the channel - 8000 samples/s. +This is a multiple of the baud rate at 4800 bits/s (8-PSK at 1600 baud, 5 samples per +symbol), but not at 2400 bits/s (4-PSK at 1200 baud, 20/3 samples per symbol). The baud +interval is actually 20/3 sample periods at 2400bis/s. A symmetric FIR is used to +apply root raised cosine filtering in the 4800bits/s mode. In the 2400bits/s mode +a polyphase FIR filter is used. This consists of 20 sets of coefficients, offering +zero to 19/20ths of a baud phase shift as well as root raised cosine filtering. +The appropriate coefficient set is chosen for each signal sample generated. + +The carrier is generated using the DDS method. Using 2 second order resonators, +started in quadrature, might be more efficient, as it would have less impact on +the processor cache than a table lookup approach. However, the DDS approach +suits the receiver better, so then same signal generator is also used for the +transmitter. +*/ + +/*! + V.27ter modem transmit side descriptor. This defines the working state for a + single instance of a V.27ter modem transmitter. +*/ +typedef struct v27ter_tx_state_s v27ter_tx_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Adjust a V.27ter modem transmit context's power output. + \brief Adjust a V.27ter modem transmit context's output power. + \param s The modem context. + \param power The power level, in dBm0 */ +SPAN_DECLARE(void) v27ter_tx_power(v27ter_tx_state_t *s, float power); + +/*! Initialise a V.27ter modem transmit context. + \brief Initialise a V.27ter modem transmit context. + \param s The modem context. + \param bit_rate The bit rate of the modem. Valid values are 2400 and 4800. + \param tep TRUE is the optional TEP tone is to be transmitted. + \param get_bit The callback routine used to get the data to be transmitted. + \param user_data An opaque pointer. + \return A pointer to the modem context, or NULL if there was a problem. */ +SPAN_DECLARE(v27ter_tx_state_t *) v27ter_tx_init(v27ter_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data); + +/*! Reinitialise an existing V.27ter modem transmit context, so it may be reused. + \brief Reinitialise an existing V.27ter modem transmit context. + \param s The modem context. + \param bit_rate The bit rate of the modem. Valid values are 2400 and 4800. + \param tep TRUE is the optional TEP tone is to be transmitted. + \return 0 for OK, -1 for bad parameter */ +SPAN_DECLARE(int) v27ter_tx_restart(v27ter_tx_state_t *s, int bit_rate, int tep); + +/*! Release a V.27ter modem transmit context. + \brief Release a V.27ter modem transmit context. + \param s The modem context. + \return 0 for OK */ +SPAN_DECLARE(int) v27ter_tx_release(v27ter_tx_state_t *s); + +/*! Free a V.27ter modem transmit context. + \brief Free a V.27ter modem transmit context. + \param s The modem context. + \return 0 for OK */ +SPAN_DECLARE(int) v27ter_tx_free(v27ter_tx_state_t *s); + +/*! Get the logging context associated with a V.27ter modem transmit context. + \brief Get the logging context associated with a V.27ter modem transmit context. + \param s The modem context. + \return A pointer to the logging context */ +SPAN_DECLARE(logging_state_t *) v27ter_tx_get_logging_state(v27ter_tx_state_t *s); + +/*! Change the get_bit function associated with a V.27ter modem transmit context. + \brief Change the get_bit function associated with a V.27ter modem transmit context. + \param s The modem context. + \param get_bit The callback routine used to get the data to be transmitted. + \param user_data An opaque pointer. */ +SPAN_DECLARE(void) v27ter_tx_set_get_bit(v27ter_tx_state_t *s, get_bit_func_t get_bit, void *user_data); + +/*! Change the modem status report function associated with a V.27ter modem transmit context. + \brief Change the modem status report function associated with a V.27ter modem transmit context. + \param s The modem context. + \param handler The callback routine used to report modem status changes. + \param user_data An opaque pointer. */ +SPAN_DECLARE(void) v27ter_tx_set_modem_status_handler(v27ter_tx_state_t *s, modem_tx_status_func_t handler, void *user_data); + +/*! Generate a block of V.27ter modem audio samples. + \brief Generate a block of V.27ter modem audio samples. + \param s The modem context. + \param amp The audio sample buffer. + \param len The number of samples to be generated. + \return The number of samples actually generated. +*/ +SPAN_DECLARE_NONSTD(int) v27ter_tx(v27ter_tx_state_t *s, int16_t amp[], int len); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/v29rx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/v29rx.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,243 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v29rx.h - ITU V.29 modem receive part + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v29rx.h,v 1.72 2009/07/09 13:52:09 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_V29RX_H_) +#define _SPANDSP_V29RX_H_ + +/*! \page v29rx_page The V.29 receiver +\section v29rx_page_sec_1 What does it do? +The V.29 receiver implements the receive side of a V.29 modem. This can operate +at data rates of 9600, 7200 and 4800 bits/s. The audio input is a stream of 16 +bit samples, at 8000 samples/second. The transmit and receive side of V.29 +modems operate independantly. V.29 is mostly used for FAX transmission, where it +provides the standard 9600 and 7200 bits/s rates (the 4800 bits/s mode is not +used for FAX). + +\section v29rx_page_sec_2 How does it work? +V.29 operates at 2400 baud for all three bit rates. It uses 16-QAM modulation for +9600bps, 8-QAM for 7200bps, and 4-PSK for 4800bps. A training sequence is specified +at the start of transmission, which makes the design of a V.29 receiver relatively +straightforward. + +The first stage of the training sequence consists of 128 +symbols, alternating between two constellation positions. The receiver monitors +the signal power, to sense the possible presence of a valid carrier. When the +alternating signal begins, the power rising above a minimum threshold (-26dBm0) +causes the main receiver computation to begin. The initial measured power is +used to quickly set the gain of the receiver. After this initial settling, the +front end gain is locked, and the adaptive equalizer tracks any subsequent +signal level variation. The signal is oversampled to 24000 samples/second (i.e. +signal, zero, zero, signal, zero, zero, ...) and fed to a complex root raised +cosine pulse shaping filter. This filter has been modified from the conventional +root raised cosine filter, by shifting it up the band, to be centred at the nominal +carrier frequency. This filter interpolates the samples, pulse shapes, and performs +a fractional sample delay at the same time. 48 sets of filter coefficients are used to +achieve a set of finely spaces fractional sample delays, between zero and +one sample. By choosing every fifth sample, and the appropriate set of filter +coefficients, the properly tuned symbol tracker can select data samples at 4800 +samples/second from points within 1.125 degrees of the centre and mid-points of +each symbol. The output of the filter is multiplied by a complex carrier, generated +by a DDS. The result is a baseband signal, requiring no further filtering, apart from +an adaptive equalizer. The baseband signal is fed to a T/2 adaptive equalizer. +A band edge component maximisation algorithm is used to tune the sampling, so the samples +fed to the equalizer are close to the mid point and edges of each symbol. Initially +the algorithm is very lightly damped, to ensure the symbol alignment pulls in +quickly. Because the sampling rate will not be precisely the same as the +transmitter's (the spec. says the symbol timing should be within 0.01%), the +receiver constantly evaluates and corrects this sampling throughout its +operation. During the symbol timing maintainence phase, the algorithm uses +a heavier damping. + +The carrier is specified as 1700Hz +-1Hz at the transmitter, and 1700 +-7Hz at +the receiver. The receive carrier would only be this inaccurate if the link +includes FDM sections. These are being phased out, but the design must still +allow for the worst case. Using an initial 1700Hz signal for demodulation gives +a worst case rotation rate for the constellation of about one degree per symbol. +Once the symbol timing synchronisation algorithm has been given time to lock to +the symbol timing of the initial alternating pattern, the phase of the demodulated +signal is recorded on two successive symbols - once for each of the constellation +positions. The receiver then tracks the symbol alternations, until a large phase jump +occurs. This signifies the start of the next phase of the training sequence. At this +point the total phase shift between the original recorded symbol phase, and the +symbol phase just before the phase jump occurred is used to provide a coarse +estimation of the rotation rate of the constellation, and it current absolute +angle of rotation. These are used to update the current carrier phase and phase +update rate in the carrier DDS. The working data already in the pulse shaping +filter and equalizer buffers is given a similar step rotation to pull it all +into line. From this point on, a heavily damped integrate and dump approach, +based on the angular difference between each received constellation position and +its expected position, is sufficient to track the carrier, and maintain phase +alignment. A fast rough approximator for the arc-tangent function is adequate +for the estimation of the angular error. + +The next phase of the training sequence is a scrambled sequence of two +particular symbols. We train the T/2 adaptive equalizer using this sequence. The +scrambling makes the signal sufficiently diverse to ensure the equalizer +converges to the proper generalised solution. At the end of this sequence, the +equalizer should be sufficiently well adapted that is can correctly resolve the +full QAM constellation. However, the equalizer continues to adapt throughout +operation of the modem, fine tuning on the more complex data patterns of the +full QAM constellation. + +In the last phase of the training sequence, the modem enters normal data +operation, with a short defined period of all ones as data. As in most high +speed modems, data in a V.29 modem passes through a scrambler, to whiten the +spectrum of the signal. The transmitter should initialise its data scrambler, +and pass the ones through it. At the end of the ones, real data begins to pass +through the scrambler, and the transmit modem is in normal operation. The +receiver tests that ones are really received, in order to verify the modem +trained correctly. If all is well, the data following the ones is fed to the +application, and the receive modem is up and running. Unfortunately, some +transmit side of some real V.29 modems fail to initialise their scrambler before +sending the ones. This means the first 23 received bits (the length of the +scrambler register) cannot be trusted for the test. The receive modem, +therefore, only tests that bits starting at bit 24 are really ones. +*/ + +typedef void (*qam_report_handler_t)(void *user_data, const complexf_t *constel, const complexf_t *target, int symbol); + +/*! + V.29 modem receive side descriptor. This defines the working state for a + single instance of a V.29 modem receiver. +*/ +typedef struct v29_rx_state_s v29_rx_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Initialise a V.29 modem receive context. + \brief Initialise a V.29 modem receive context. + \param s The modem context. + \param bit_rate The bit rate of the modem. Valid values are 4800, 7200 and 9600. + \param put_bit The callback routine used to put the received data. + \param user_data An opaque pointer passed to the put_bit routine. + \return A pointer to the modem context, or NULL if there was a problem. */ +SPAN_DECLARE(v29_rx_state_t *) v29_rx_init(v29_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data); + +/*! Reinitialise an existing V.29 modem receive context. + \brief Reinitialise an existing V.29 modem receive context. + \param s The modem context. + \param bit_rate The bit rate of the modem. Valid values are 4800, 7200 and 9600. + \param old_train TRUE if a previous trained values are to be reused. + \return 0 for OK, -1 for bad parameter */ +SPAN_DECLARE(int) v29_rx_restart(v29_rx_state_t *s, int bit_rate, int old_train); + +/*! Release a V.29 modem receive context. + \brief Release a V.29 modem receive context. + \param s The modem context. + \return 0 for OK */ +SPAN_DECLARE(int) v29_rx_release(v29_rx_state_t *s); + +/*! Free a V.29 modem receive context. + \brief Free a V.29 modem receive context. + \param s The modem context. + \return 0 for OK */ +SPAN_DECLARE(int) v29_rx_free(v29_rx_state_t *s); + +/*! Get the logging context associated with a V.29 modem receive context. + \brief Get the logging context associated with a V.29 modem receive context. + \param s The modem context. + \return A pointer to the logging context */ +SPAN_DECLARE(logging_state_t *) v29_rx_get_logging_state(v29_rx_state_t *s); + +/*! Change the put_bit function associated with a V.29 modem receive context. + \brief Change the put_bit function associated with a V.29 modem receive context. + \param s The modem context. + \param put_bit The callback routine used to handle received bits. + \param user_data An opaque pointer. */ +SPAN_DECLARE(void) v29_rx_set_put_bit(v29_rx_state_t *s, put_bit_func_t put_bit, void *user_data); + +/*! Change the modem status report function associated with a V.29 modem receive context. + \brief Change the modem status report function associated with a V.29 modem receive context. + \param s The modem context. + \param handler The callback routine used to report modem status changes. + \param user_data An opaque pointer. */ +SPAN_DECLARE(void) v29_rx_set_modem_status_handler(v29_rx_state_t *s, modem_rx_status_func_t handler, void *user_data); + +/*! Process a block of received V.29 modem audio samples. + \brief Process a block of received V.29 modem audio samples. + \param s The modem context. + \param amp The audio sample buffer. + \param len The number of samples in the buffer. + \return The number of samples unprocessed. */ +SPAN_DECLARE_NONSTD(int) v29_rx(v29_rx_state_t *s, const int16_t amp[], int len); + +/*! Fake processing of a missing block of received V.29 modem audio samples. + (e.g due to packet loss). + \brief Fake processing of a missing block of received V.29 modem audio samples. + \param s The modem context. + \param len The number of samples to fake. + \return The number of samples unprocessed. */ +SPAN_DECLARE(int) v29_rx_fillin(v29_rx_state_t *s, int len); + +/*! Get a snapshot of the current equalizer coefficients. + \brief Get a snapshot of the current equalizer coefficients. + \param s The modem context. + \param coeffs The vector of complex coefficients. + \return The number of coefficients in the vector. */ +#if defined(SPANDSP_USE_FIXED_POINT) +SPAN_DECLARE(int) v29_rx_equalizer_state(v29_rx_state_t *s, complexi16_t **coeffs); +#else +SPAN_DECLARE(int) v29_rx_equalizer_state(v29_rx_state_t *s, complexf_t **coeffs); +#endif + +/*! Get the current received carrier frequency. + \param s The modem context. + \return The frequency, in Hertz. */ +SPAN_DECLARE(float) v29_rx_carrier_frequency(v29_rx_state_t *s); + +/*! Get the current symbol timing correction since startup. + \param s The modem context. + \return The correction. */ +SPAN_DECLARE(float) v29_rx_symbol_timing_correction(v29_rx_state_t *s); + +/*! Get the current received signal power. + \param s The modem context. + \return The signal power, in dBm0. */ +SPAN_DECLARE(float) v29_rx_signal_power(v29_rx_state_t *s); + +/*! Set the power level at which the carrier detection will cut in + \param s The modem context. + \param cutoff The signal cutoff power, in dBm0. */ +SPAN_DECLARE(void) v29_rx_signal_cutoff(v29_rx_state_t *s, float cutoff); + +/*! Set a handler routine to process QAM status reports + \param s The modem context. + \param handler The handler routine. + \param user_data An opaque pointer passed to the handler routine. */ +SPAN_DECLARE(void) v29_rx_set_qam_report_handler(v29_rx_state_t *s, qam_report_handler_t handler, void *user_data); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/v29tx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/v29tx.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,179 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v29tx.h - ITU V.29 modem transmit part + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v29tx.h,v 1.41 2009/07/09 13:52:09 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_V29TX_H_) +#define _SPANDSP_V29TX_H_ + +/*! \page v29tx_page The V.29 transmitter +\section v29tx_page_sec_1 What does it do? +The V.29 transmitter implements the transmit side of a V.29 modem. This can +operate at data rates of 9600, 7200 and 4800 bits/s. The audio output is a +stream of 16 bit samples, at 8000 samples/second. The transmit and receive side +of V.29 modems operate independantly. V.29 is mostly used for FAX transmission, +where it provides the standard 9600 and 7200 bits/s rates (the 4800 bits/s mode +is not used for FAX). + +\section v29tx_page_sec_2 How does it work? +V.29 uses QAM modulation. The standard method of producing a QAM modulated +signal is to use a sampling rate which is a multiple of the baud rate. The raw +signal is then a series of complex pulses, each an integer number of samples +long. These can be shaped, using a suitable complex filter, and multiplied by a +complex carrier signal to produce the final QAM signal for transmission. + +The pulse shaping filter is only vaguely defined by the V.29 spec. Some of the +other ITU modem specs. fully define the filter, typically specifying a root +raised cosine filter, with 50% excess bandwidth. This is a pity, since it +increases the variability of the received signal. However, the receiver's +adaptive equalizer will compensate for these differences. The current +design uses a root raised cosine filter with 25% excess bandwidth. Greater +excess bandwidth will not allow the tranmitted signal to meet the spectral +requirements. + +The sampling rate for our transmitter is defined by the channel - 8000 per +second. This is not a multiple of the baud rate (i.e. 2400 baud). The baud +interval is actually 10/3 sample periods. Instead of using a symmetric +FIR to pulse shape the signal, a polyphase filter is used. This consists of +10 sets of coefficients, offering zero to 9/10ths of a baud phase shift as well +as root raised cosine filtering. The appropriate coefficient set is chosen for +each signal sample generated. + +The carrier is generated using the DDS method. Using two second order resonators, +started in quadrature, might be more efficient, as it would have less impact on +the processor cache than a table lookup approach. However, the DDS approach +suits the receiver better, so the same signal generator is also used for the +transmitter. + +The equation defining QAM modulation is: + + s(n) = A*cos(2*pi*f*n + phi(n)) + +where phi(n) is the phase of the information, and A is the amplitude of the information + +using the identity + + cos(x + y) = cos(x)*cos(y) - sin(x)*sin(y) + +we get + + s(n) = A {cos(2*pi*f*n)*cos(phi(n)) - sin(2*pi*f*n)*sin(phi(n))} + +substituting with the constellation positions + + I(n) = A*cos(phi(n)) + Q(n) = A*sin(phi(n)) + +gives + + s(n) = I(n)*cos(2*pi*f*n) - Q(n)*sin(2*pi*f*n) + +*/ + +/*! + V.29 modem transmit side descriptor. This defines the working state for a + single instance of a V.29 modem transmitter. +*/ +typedef struct v29_tx_state_s v29_tx_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Adjust a V.29 modem transmit context's power output. + \brief Adjust a V.29 modem transmit context's output power. + \param s The modem context. + \param power The power level, in dBm0 */ +SPAN_DECLARE(void) v29_tx_power(v29_tx_state_t *s, float power); + +/*! Initialise a V.29 modem transmit context. This must be called before the first + use of the context, to initialise its contents. + \brief Initialise a V.29 modem transmit context. + \param s The modem context. + \param bit_rate The bit rate of the modem. Valid values are 4800, 7200 and 9600. + \param tep TRUE is the optional TEP tone is to be transmitted. + \param get_bit The callback routine used to get the data to be transmitted. + \param user_data An opaque pointer. + \return A pointer to the modem context, or NULL if there was a problem. */ +SPAN_DECLARE(v29_tx_state_t *) v29_tx_init(v29_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data); + +/*! Reinitialise an existing V.29 modem transmit context, so it may be reused. + \brief Reinitialise an existing V.29 modem transmit context. + \param s The modem context. + \param bit_rate The bit rate of the modem. Valid values are 4800, 7200 and 9600. + \param tep TRUE is the optional TEP tone is to be transmitted. + \return 0 for OK, -1 for bad parameter */ +SPAN_DECLARE(int) v29_tx_restart(v29_tx_state_t *s, int bit_rate, int tep); + +/*! Release a V.29 modem transmit context. + \brief Release a V.29 modem transmit context. + \param s The modem context. + \return 0 for OK */ +SPAN_DECLARE(int) v29_tx_release(v29_tx_state_t *s); + +/*! Free a V.29 modem transmit context. + \brief Free a V.29 modem transmit context. + \param s The modem context. + \return 0 for OK */ +SPAN_DECLARE(int) v29_tx_free(v29_tx_state_t *s); + +/*! Get the logging context associated with a V.29 modem transmit context. + \brief Get the logging context associated with a V.29 modem transmit context. + \param s The modem context. + \return A pointer to the logging context */ +SPAN_DECLARE(logging_state_t *) v29_tx_get_logging_state(v29_tx_state_t *s); + +/*! Change the get_bit function associated with a V.29 modem transmit context. + \brief Change the get_bit function associated with a V.29 modem transmit context. + \param s The modem context. + \param get_bit The callback routine used to get the data to be transmitted. + \param user_data An opaque pointer. */ +SPAN_DECLARE(void) v29_tx_set_get_bit(v29_tx_state_t *s, get_bit_func_t get_bit, void *user_data); + +/*! Change the modem status report function associated with a V.29 modem transmit context. + \brief Change the modem status report function associated with a V.29 modem transmit context. + \param s The modem context. + \param handler The callback routine used to report modem status changes. + \param user_data An opaque pointer. */ +SPAN_DECLARE(void) v29_tx_set_modem_status_handler(v29_tx_state_t *s, modem_tx_status_func_t handler, void *user_data); + +/*! Generate a block of V.29 modem audio samples. + \brief Generate a block of V.29 modem audio samples. + \param s The modem context. + \param amp The audio sample buffer. + \param len The number of samples to be generated. + \return The number of samples actually generated. +*/ +SPAN_DECLARE_NONSTD(int) v29_tx(v29_tx_state_t *s, int16_t amp[], int len); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/v42.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/v42.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,160 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v42.h + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v42.h,v 1.31 2009/11/04 15:52:06 steveu Exp $ + */ + +/*! \page v42_page V.42 modem error correction +\section v42_page_sec_1 What does it do? +The V.42 specification defines an error correcting protocol for PSTN modems, based on +HDLC and LAP. This makes it similar to an X.25 link. A special variant of LAP, known +as LAP-M, is defined in the V.42 specification. A means for modems to determine if the +far modem supports V.42 is also defined. + +\section v42_page_sec_2 How does it work? +*/ + +#if !defined(_SPANDSP_V42_H_) +#define _SPANDSP_V42_H_ + +enum +{ + LAPM_DETECT = 0, + LAPM_ESTABLISH = 1, + LAPM_DATA = 2, + LAPM_RELEASE = 3, + LAPM_SIGNAL = 4, + LAPM_SETPARM = 5, + LAPM_TEST = 6, + LAPM_UNSUPPORTED = 7 +}; + +typedef void (*v42_status_func_t)(void *user_data, int status); +typedef void (*v42_frame_handler_t)(void *user_data, const uint8_t *pkt, int len); + +typedef struct lapm_frame_queue_s +{ + struct lapm_frame_queue_s *next; + int len; + uint8_t frame[]; +} lapm_frame_queue_t; + +/*! + LAP-M descriptor. This defines the working state for a single instance of LAP-M. +*/ +typedef struct lapm_state_s lapm_state_t; + +/*! + V.42 descriptor. This defines the working state for a single instance of V.42. +*/ +typedef struct v42_state_s v42_state_t; + +/*! Log the raw HDLC frames */ +#define LAPM_DEBUG_LAPM_RAW (1 << 0) +/*! Log the interpreted frames */ +#define LAPM_DEBUG_LAPM_DUMP (1 << 1) +/*! Log state machine changes */ +#define LAPM_DEBUG_LAPM_STATE (1 << 2) + +#if defined(__cplusplus) +extern "C" +{ +#endif + +SPAN_DECLARE(const char *) lapm_status_to_str(int status); + +/*! Dump LAP.M frames in a raw and/or decoded forms + \param frame The frame itself + \param len The length of the frame, in octets + \param showraw TRUE if the raw octets should be dumped + \param txrx TRUE if tx, FALSE if rx. Used to highlight the packet's direction. +*/ +SPAN_DECLARE(void) lapm_dump(lapm_state_t *s, const uint8_t *frame, int len, int showraw, int txrx); + +/*! Accept an HDLC packet +*/ +SPAN_DECLARE_NONSTD(void) lapm_receive(void *user_data, const uint8_t *buf, int len, int ok); + +/*! Transmit a LAP.M frame +*/ +SPAN_DECLARE(int) lapm_tx(lapm_state_t *s, const void *buf, int len); + +/*! Transmit a LAP.M information frame +*/ +SPAN_DECLARE(int) lapm_tx_iframe(lapm_state_t *s, const void *buf, int len, int cr); + +/*! Send a break over a LAP.M connection +*/ +SPAN_DECLARE(int) lapm_break(lapm_state_t *s, int enable); + +/*! Initiate an orderly release of a LAP.M connection +*/ +SPAN_DECLARE(int) lapm_release(lapm_state_t *s); + +/*! Enable or disable loopback of a LAP.M connection +*/ +SPAN_DECLARE(int) lapm_loopback(lapm_state_t *s, int enable); + +/*! Assign or remove a callback routine used to deal with V.42 status changes. +*/ +SPAN_DECLARE(void) v42_set_status_callback(v42_state_t *s, v42_status_func_t callback, void *user_data); + +/*! Process a newly received bit for a V.42 context. +*/ +SPAN_DECLARE(void) v42_rx_bit(void *user_data, int bit); + +/*! Get the next transmit bit for a V.42 context. +*/ +SPAN_DECLARE(int) v42_tx_bit(void *user_data); + +/*! Initialise a V.42 context. + \param s The V.42 context. + \param calling_party TRUE if caller mode, else answerer mode. + \param frame_handler A callback function to handle received frames of data. + \param user_data An opaque pointer passed to the frame handler routine. + \return ??? +*/ +SPAN_DECLARE(v42_state_t *) v42_init(v42_state_t *s, int calling_party, int detect, v42_frame_handler_t frame_handler, void *user_data); + +/*! Restart a V.42 context. + \param s The V.42 context. +*/ +SPAN_DECLARE(void) v42_restart(v42_state_t *s); + +/*! Release a V.42 context. + \param s The V.42 context. + \return 0 if OK */ +SPAN_DECLARE(int) v42_release(v42_state_t *s); + +/*! Free a V.42 context. + \param s The V.42 context. + \return 0 if OK */ +SPAN_DECLARE(int) v42_free(v42_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/v42bis.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/v42bis.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,143 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v42bis.h + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v42bis.h,v 1.27 2009/04/11 18:11:19 steveu Exp $ + */ + +/*! \page v42bis_page V.42bis modem data compression +\section v42bis_page_sec_1 What does it do? +The v.42bis specification defines a data compression scheme, to work in +conjunction with the error correction scheme defined in V.42. + +\section v42bis_page_sec_2 How does it work? +*/ + +#if !defined(_SPANDSP_V42BIS_H_) +#define _SPANDSP_V42BIS_H_ + +#define V42BIS_MAX_BITS 12 +#define V42BIS_MAX_CODEWORDS 4096 /* 2^V42BIS_MAX_BITS */ +#define V42BIS_TABLE_SIZE 5021 /* This should be a prime >(2^V42BIS_MAX_BITS) */ +#define V42BIS_MAX_STRING_SIZE 250 + +enum +{ + V42BIS_P0_NEITHER_DIRECTION = 0, + V42BIS_P0_INITIATOR_RESPONDER, + V42BIS_P0_RESPONDER_INITIATOR, + V42BIS_P0_BOTH_DIRECTIONS +}; + +enum +{ + V42BIS_COMPRESSION_MODE_DYNAMIC = 0, + V42BIS_COMPRESSION_MODE_ALWAYS, + V42BIS_COMPRESSION_MODE_NEVER +}; + +typedef void (*v42bis_frame_handler_t)(void *user_data, const uint8_t *pkt, int len); +typedef void (*v42bis_data_handler_t)(void *user_data, const uint8_t *buf, int len); + +/*! + V.42bis compression/decompression descriptor. This defines the working state for a + single instance of V.42bis compress/decompression. +*/ +typedef struct v42bis_state_s v42bis_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Compress a block of octets. + \param s The V.42bis context. + \param buf The data to be compressed. + \param len The length of the data buffer. + \return 0 */ +SPAN_DECLARE(int) v42bis_compress(v42bis_state_t *s, const uint8_t *buf, int len); + +/*! Flush out any data remaining in a compression buffer. + \param s The V.42bis context. + \return 0 */ +SPAN_DECLARE(int) v42bis_compress_flush(v42bis_state_t *s); + +/*! Decompress a block of octets. + \param s The V.42bis context. + \param buf The data to be decompressed. + \param len The length of the data buffer. + \return 0 */ +SPAN_DECLARE(int) v42bis_decompress(v42bis_state_t *s, const uint8_t *buf, int len); + +/*! Flush out any data remaining in the decompression buffer. + \param s The V.42bis context. + \return 0 */ +SPAN_DECLARE(int) v42bis_decompress_flush(v42bis_state_t *s); + +/*! Set the compression mode. + \param s The V.42bis context. + \param mode One of the V.42bis compression modes - + V42BIS_COMPRESSION_MODE_DYNAMIC, + V42BIS_COMPRESSION_MODE_ALWAYS, + V42BIS_COMPRESSION_MODE_NEVER */ +SPAN_DECLARE(void) v42bis_compression_control(v42bis_state_t *s, int mode); + +/*! Initialise a V.42bis context. + \param s The V.42bis context. + \param negotiated_p0 The negotiated P0 parameter, from the V.42bis spec. + \param negotiated_p1 The negotiated P1 parameter, from the V.42bis spec. + \param negotiated_p2 The negotiated P2 parameter, from the V.42bis spec. + \param frame_handler Frame callback handler. + \param frame_user_data An opaque pointer passed to the frame callback handler. + \param max_frame_len The maximum length that should be passed to the frame handler. + \param data_handler data callback handler. + \param data_user_data An opaque pointer passed to the data callback handler. + \param max_data_len The maximum length that should be passed to the data handler. + \return The V.42bis context. */ +SPAN_DECLARE(v42bis_state_t *) v42bis_init(v42bis_state_t *s, + int negotiated_p0, + int negotiated_p1, + int negotiated_p2, + v42bis_frame_handler_t frame_handler, + void *frame_user_data, + int max_frame_len, + v42bis_data_handler_t data_handler, + void *data_user_data, + int max_data_len); + +/*! Release a V.42bis context. + \param s The V.42bis context. + \return 0 if OK */ +SPAN_DECLARE(int) v42bis_release(v42bis_state_t *s); + +/*! Free a V.42bis context. + \param s The V.42bis context. + \return 0 if OK */ +SPAN_DECLARE(int) v42bis_free(v42bis_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/v8.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/v8.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,190 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v8.h - V.8 modem negotiation processing. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v8.h,v 1.31.4.1 2009/12/28 12:20:47 steveu Exp $ + */ + +/*! \file */ + +/*! \page v8_page The V.8 modem negotiation protocol +\section v8_page_sec_1 What does it do? +The V.8 specification defines a procedure to be used as PSTN modem answer phone calls, +which allows the modems to negotiate the optimum modem standard, which both ends can +support. + +\section v8_page_sec_2 How does it work? +At startup the modems communicate using the V.21 standard at 300 bits/second. They +exchange simple messages about their capabilities, and choose the modem standard they +will use for data communication. The V.8 protocol then terminates, and the modems +being negotiating and training with their chosen modem standard. +*/ + +#if !defined(_SPANDSP_V8_H_) +#define _SPANDSP_V8_H_ + +typedef struct v8_parms_s v8_parms_t; + +typedef void (v8_result_handler_t)(void *user_data, v8_parms_t *result); + +enum v8_call_function_e +{ + V8_CALL_TBS = 0, + V8_CALL_H324 = 1, + V8_CALL_V18 = 2, + V8_CALL_T101 = 3, + V8_CALL_T30_TX = 4, + V8_CALL_T30_RX = 5, + V8_CALL_V_SERIES = 6, + V8_CALL_FUNCTION_EXTENSION = 7 +}; + +enum v8_modulation_e +{ + V8_MOD_V17 = (1 << 0), /* V.17 half-duplex */ + V8_MOD_V21 = (1 << 1), /* V.21 duplex */ + V8_MOD_V22 = (1 << 2), /* V.22/V22.bis duplex */ + V8_MOD_V23HALF = (1 << 3), /* V.23 half-duplex */ + V8_MOD_V23 = (1 << 4), /* V.23 duplex */ + V8_MOD_V26BIS = (1 << 5), /* V.23 duplex */ + V8_MOD_V26TER = (1 << 6), /* V.23 duplex */ + V8_MOD_V27TER = (1 << 7), /* V.23 duplex */ + V8_MOD_V29 = (1 << 8), /* V.29 half-duplex */ + V8_MOD_V32 = (1 << 9), /* V.32/V32.bis duplex */ + V8_MOD_V34HALF = (1 << 10), /* V.34 half-duplex */ + V8_MOD_V34 = (1 << 11), /* V.34 duplex */ + V8_MOD_V90 = (1 << 12), /* V.90 duplex */ + V8_MOD_V92 = (1 << 13), /* V.92 duplex */ + + V8_MOD_FAILED = (1 << 15) /* Indicates failure to negotiate */ +}; + +enum v8_protocol_e +{ + V8_PROTOCOL_NONE = 0, + V8_PROTOCOL_LAPM_V42 = 1, + V8_PROTOCOL_EXTENSION = 7 +}; + +enum v8_pstn_access_e +{ + V8_PSTN_ACCESS_CALL_DCE_CELLULAR = 0x01, + V8_PSTN_ACCESS_ANSWER_DCE_CELLULAR = 0x02, + V8_PSTN_ACCESS_DCE_ON_DIGITAL = 0x04 +}; + +enum v8_pcm_modem_availability_e +{ + V8_PSTN_PCM_MODEM_V90_V92_ANALOGUE = 0x01, + V8_PSTN_PCM_MODEM_V90_V92_DIGITAL = 0x02, + V8_PSTN_PCM_MODEM_V91 = 0x04 +}; + +typedef struct v8_state_s v8_state_t; + +struct v8_parms_s +{ + int modem_connect_tone; + int call_function; + unsigned int modulations; + int protocol; + int pstn_access; + int pcm_modem_availability; + int nsf; + int t66; +}; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +SPAN_DECLARE(int) v8_restart(v8_state_t *s, + int calling_party, + v8_parms_t *parms); + +/*! Initialise a V.8 context. + \brief Initialise a V.8 context. + \param s The V.8 context. + \param calling_party TRUE if caller mode, else answerer mode. + \param parms The allowed parameters for the call. + \param result_handler The callback routine used to handle the results of negotiation. + \param user_data An opaque pointer passed to the result_handler routine. + \return A pointer to the V.8 context, or NULL if there was a problem. */ +SPAN_DECLARE(v8_state_t *) v8_init(v8_state_t *s, + int calling_party, + v8_parms_t *parms, + v8_result_handler_t *result_handler, + void *user_data); + +/*! Release a V.8 context. + \brief Release a V.8 context. + \param s The V.8 context. + \return 0 for OK. */ +SPAN_DECLARE(int) v8_release(v8_state_t *s); + +/*! Free a V.8 context. + \brief Release a V.8 context. + \param s The V.8 context. + \return 0 for OK. */ +SPAN_DECLARE(int) v8_free(v8_state_t *s); + +SPAN_DECLARE(logging_state_t *) v8_get_logging_state(v8_state_t *s); + +/*! Generate a block of V.8 audio samples. + \brief Generate a block of V.8 audio samples. + \param s The V.8 context. + \param amp The audio sample buffer. + \param max_len The number of samples to be generated. + \return The number of samples actually generated. +*/ +SPAN_DECLARE_NONSTD(int) v8_tx(v8_state_t *s, int16_t *amp, int max_len); + +/*! Process a block of received V.8 audio samples. + \brief Process a block of received V.8 audio samples. + \param s The V.8 context. + \param amp The audio sample buffer. + \param len The number of samples in the buffer. +*/ +SPAN_DECLARE_NONSTD(int) v8_rx(v8_state_t *s, const int16_t *amp, int len); + +/*! Log the list of supported modulations. + \brief Log the list of supported modulations. + \param s The V.8 context. + \param modulation_schemes The list of supported modulations. */ +SPAN_DECLARE(void) v8_log_supported_modulations(v8_state_t *s, int modulation_schemes); + +SPAN_DECLARE(const char *) v8_call_function_to_str(int call_function); +SPAN_DECLARE(const char *) v8_modulation_to_str(int modulation_scheme); +SPAN_DECLARE(const char *) v8_protocol_to_str(int protocol); +SPAN_DECLARE(const char *) v8_pstn_access_to_str(int pstn_access); +SPAN_DECLARE(const char *) v8_nsf_to_str(int nsf); +SPAN_DECLARE(const char *) v8_pcm_modem_availability_to_str(int pcm_modem_availability); +SPAN_DECLARE(const char *) v8_t66_to_str(int t66); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/vector_float.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/vector_float.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,197 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * vector_float.h + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: vector_float.h,v 1.15 2009/01/31 08:48:11 steveu Exp $ + */ + +#if !defined(_SPANDSP_VECTOR_FLOAT_H_) +#define _SPANDSP_VECTOR_FLOAT_H_ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +SPAN_DECLARE(void) vec_copyf(float z[], const float x[], int n); + +SPAN_DECLARE(void) vec_copy(double z[], const double x[], int n); + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_copyl(long double z[], const long double x[], int n); +#endif + +SPAN_DECLARE(void) vec_negatef(float z[], const float x[], int n); + +SPAN_DECLARE(void) vec_negate(double z[], const double x[], int n); + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_negatel(long double z[], const long double x[], int n); +#endif + +SPAN_DECLARE(void) vec_zerof(float z[], int n); + +SPAN_DECLARE(void) vec_zero(double z[], int n); + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_zerol(long double z[], int n); +#endif + +SPAN_DECLARE(void) vec_setf(float z[], float x, int n); + +SPAN_DECLARE(void) vec_set(double z[], double x, int n); + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_setl(long double z[], long double x, int n); +#endif + +SPAN_DECLARE(void) vec_addf(float z[], const float x[], const float y[], int n); + +SPAN_DECLARE(void) vec_add(double z[], const double x[], const double y[], int n); + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_addl(long double z[], const long double x[], const long double y[], int n); +#endif + +SPAN_DECLARE(void) vec_scaledxy_addf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n); + +SPAN_DECLARE(void) vec_scaledxy_add(double z[], const double x[], double x_scale, const double y[], double y_scale, int n); + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_scaledxy_addl(long double z[], const long double x[], long double x_scale, const long double y[], long double y_scale, int n); +#endif + +SPAN_DECLARE(void) vec_scaledy_addf(float z[], const float x[], const float y[], float y_scale, int n); + +SPAN_DECLARE(void) vec_scaledy_add(double z[], const double x[], const double y[], double y_scale, int n); + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_scaledy_addl(long double z[], const long double x[], const long double y[], long double y_scale, int n); +#endif + +SPAN_DECLARE(void) vec_subf(float z[], const float x[], const float y[], int n); + +SPAN_DECLARE(void) vec_sub(double z[], const double x[], const double y[], int n); + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_subl(long double z[], const long double x[], const long double y[], int n); +#endif + +SPAN_DECLARE(void) vec_scaledxy_subf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n); + +SPAN_DECLARE(void) vec_scaledxy_sub(double z[], const double x[], double x_scale, const double y[], double y_scale, int n); + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_scaledxy_subl(long double z[], const long double x[], long double x_scale, const long double y[], long double y_scale, int n); +#endif + +SPAN_DECLARE(void) vec_scaledx_subf(float z[], const float x[], float x_scale, const float y[], int n); + +SPAN_DECLARE(void) vec_scaledx_sub(double z[], const double x[], double x_scale, const double y[], int n); + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_scaledx_subl(long double z[], const long double x[], long double x_scale, const long double y[], int n); +#endif + +SPAN_DECLARE(void) vec_scaledy_subf(float z[], const float x[], const float y[], float y_scale, int n); + +SPAN_DECLARE(void) vec_scaledy_sub(double z[], const double x[], const double y[], double y_scale, int n); + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_scaledy_subl(long double z[], const long double x[], const long double y[], long double y_scale, int n); +#endif + +SPAN_DECLARE(void) vec_scalar_mulf(float z[], const float x[], float y, int n); + +SPAN_DECLARE(void) vec_scalar_mul(double z[], const double x[], double y, int n); + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_scalar_mull(long double z[], const long double x[], long double y, int n); +#endif + +SPAN_DECLARE(void) vec_scalar_addf(float z[], const float x[], float y, int n); + +SPAN_DECLARE(void) vec_scalar_add(double z[], const double x[], double y, int n); + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_scalar_addl(long double z[], const long double x[], long double y, int n); +#endif + +SPAN_DECLARE(void) vec_scalar_subf(float z[], const float x[], float y, int n); + +SPAN_DECLARE(void) vec_scalar_sub(double z[], const double x[], double y, int n); + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_scalar_subl(long double z[], const long double x[], long double y, int n); +#endif + +SPAN_DECLARE(void) vec_mulf(float z[], const float x[], const float y[], int n); + +SPAN_DECLARE(void) vec_mul(double z[], const double x[], const double y[], int n); + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_mull(long double z[], const long double x[], const long double y[], int n); +#endif + +/*! \brief Find the dot product of two float vectors. + \param x The first vector. + \param y The first vector. + \param n The number of elements in the vectors. + \return The dot product of the two vectors. */ +SPAN_DECLARE(float) vec_dot_prodf(const float x[], const float y[], int n); + +/*! \brief Find the dot product of two double vectors. + \param x The first vector. + \param y The first vector. + \param n The number of elements in the vectors. + \return The dot product of the two vectors. */ +SPAN_DECLARE(double) vec_dot_prod(const double x[], const double y[], int n); + +#if defined(HAVE_LONG_DOUBLE) +/*! \brief Find the dot product of two long double vectors. + \param x The first vector. + \param y The first vector. + \param n The number of elements in the vectors. + \return The dot product of the two vectors. */ +SPAN_DECLARE(long double) vec_dot_prodl(const long double x[], const long double y[], int n); +#endif + +/*! \brief Find the dot product of two float vectors, where the first is a circular buffer + with an offset for the starting position. + \param x The first vector. + \param y The first vector. + \param n The number of elements in the vectors. + \param pos The starting position in the x vector. + \return The dot product of the two vectors. */ +SPAN_DECLARE(float) vec_circular_dot_prodf(const float x[], const float y[], int n, int pos); + +SPAN_DECLARE(void) vec_lmsf(const float x[], float y[], int n, float error); + +SPAN_DECLARE(void) vec_circular_lmsf(const float x[], float y[], int n, int pos, float error); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/vector_int.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/vector_int.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,180 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * vector_int.h + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: vector_int.h,v 1.14 2009/01/31 08:48:11 steveu Exp $ + */ + +#if !defined(_SPANDSP_VECTOR_INT_H_) +#define _SPANDSP_VECTOR_INT_H_ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +static __inline__ void vec_copyi(int z[], const int x[], int n) +{ + memcpy(z, x, n*sizeof(z[0])); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void vec_copyi16(int16_t z[], const int16_t x[], int n) +{ + memcpy(z, x, n*sizeof(z[0])); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void vec_copyi32(int32_t z[], const int32_t x[], int n) +{ + memcpy(z, x, n*sizeof(z[0])); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void vec_zeroi(int z[], int n) +{ + memset(z, 0, n*sizeof(z[0])); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void vec_zeroi16(int16_t z[], int n) +{ + memset(z, 0, n*sizeof(z[0])); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void vec_zeroi32(int32_t z[], int n) +{ + memset(z, 0, n*sizeof(z[0])); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void vec_seti(int z[], int x, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void vec_seti16(int16_t z[], int16_t x, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void vec_seti32(int32_t z[], int32_t x, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x; +} +/*- End of function --------------------------------------------------------*/ + +/*! \brief Find the dot product of two int16_t vectors. + \param x The first vector. + \param y The first vector. + \param n The number of elements in the vectors. + \return The dot product of the two vectors. */ +SPAN_DECLARE(int32_t) vec_dot_prodi16(const int16_t x[], const int16_t y[], int n); + +/*! \brief Find the dot product of two int16_t vectors, where the first is a circular buffer + with an offset for the starting position. + \param x The first vector. + \param y The first vector. + \param n The number of elements in the vectors. + \param pos The starting position in the x vector. + \return The dot product of the two vectors. */ +SPAN_DECLARE(int32_t) vec_circular_dot_prodi16(const int16_t x[], const int16_t y[], int n, int pos); + +SPAN_DECLARE(void) vec_lmsi16(const int16_t x[], int16_t y[], int n, int16_t error); + +SPAN_DECLARE(void) vec_circular_lmsi16(const int16_t x[], int16_t y[], int n, int pos, int16_t error); + +/*! \brief Find the minimum and maximum values in an int16_t vector. + \param x The vector to be searched. + \param n The number of elements in the vector. + \param out A two element vector. The first will receive the + maximum. The second will receive the minimum. This parameter + may be set to NULL. + \return The absolute maximum value. Since the range of negative numbers + exceeds the range of positive one, the returned integer is longer + than the ones being searched. */ +SPAN_DECLARE(int32_t) vec_min_maxi16(const int16_t x[], int n, int16_t out[]); + +static __inline__ int vec_norm2i16(const int16_t *vec, int len) +{ + int i; + int sum; + + sum = 0; + for (i = 0; i < len; i++) + sum += vec[i]*vec[i]; + return sum; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void vec_sari16(int16_t *vec, int len, int shift) +{ + int i; + + for (i = 0; i < len; i++) + vec[i] >>= shift; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int vec_max_bitsi16(const int16_t *vec, int len) +{ + int i; + int max; + int v; + int b; + + max = 0; + for (i = 0; i < len; i++) + { + v = abs(vec[i]); + if (v > max) + max = v; + } + b = 0; + while (max != 0) + { + b++; + max >>= 1; + } + return b; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/version.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/version.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,38 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * version.h - A tag file, so the exact installed revision can be assertained. + * + * Written by Steve Underwood + * + * Copyright (C) 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: version.h.in,v 1.3.4.1 2009/12/19 09:47:56 steveu Exp $ + */ + +#if !defined(_SPANDSP_VERSION_H_) +#define _SPANDSP_VERSION_H_ + +/* The date and time of the version are in UTC form. */ + +#define SPANDSP_RELEASE_DATE 20091228 +#define SPANDSP_RELEASE_TIME 123351 +#define SPANDSP_RELEASE_DATETIME_STRING "20091228 123351" + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/spandsp/version.h.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/spandsp/version.h.in Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,38 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * version.h - A tag file, so the exact installed revision can be assertained. + * + * Written by Steve Underwood + * + * Copyright (C) 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: version.h.in,v 1.3.4.1 2009/12/19 09:47:56 steveu Exp $ + */ + +#if !defined(_SPANDSP_VERSION_H_) +#define _SPANDSP_VERSION_H_ + +/* The date and time of the version are in UTC form. */ + +#define SPANDSP_RELEASE_DATE $SPANDSP_RELEASE_DATE +#define SPANDSP_RELEASE_TIME $SPANDSP_RELEASE_TIME +#define SPANDSP_RELEASE_DATETIME_STRING "$SPANDSP_RELEASE_DATE $SPANDSP_RELEASE_TIME" + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/super_tone_rx.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/super_tone_rx.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,470 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * super_tone_rx.c - Flexible telephony supervisory tone detection. + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: super_tone_rx.c,v 1.33.4.1 2009/12/19 09:47:56 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/complex.h" +#include "spandsp/vector_float.h" +#include "spandsp/complex_vector_float.h" +#include "spandsp/tone_detect.h" +#include "spandsp/tone_generate.h" +#include "spandsp/super_tone_rx.h" + +#include "spandsp/private/super_tone_rx.h" + +#if defined(SPANDSP_USE_FIXED_POINT) +#define DETECTION_THRESHOLD 16439 /* -42dBm0 */ +#define TONE_TWIST 4 /* 6dB */ +#define TONE_TO_TOTAL_ENERGY 64 /* -3dB */ +#else +#define DETECTION_THRESHOLD 269338317.0f /* -42dBm0 [((128.0*32768.0/1.4142)*10^((-42 - DBM0_MAX_SINE_POWER)/20.0))^2 => 269338317.0] */ +#define TONE_TWIST 3.981f /* 6dB */ +#define TONE_TO_TOTAL_ENERGY 1.995f /* 3dB */ +#define DTMF_TO_TOTAL_ENERGY 64.152f /* -3dB [BINS*10^(-3/10.0)] */ +#endif + +static int add_super_tone_freq(super_tone_rx_descriptor_t *desc, int freq) +{ + int i; + + if (freq == 0) + return -1; + /* Look for an existing frequency */ + for (i = 0; i < desc->used_frequencies; i++) + { + if (desc->pitches[i][0] == freq) + return desc->pitches[i][1]; + } + /* Look for an existing tone which is very close. We may need to merge + the detectors. */ + for (i = 0; i < desc->used_frequencies; i++) + { + if ((desc->pitches[i][0] - 10) <= freq && freq <= (desc->pitches[i][0] + 10)) + { + /* Merge these two */ + desc->pitches[desc->used_frequencies][0] = freq; + desc->pitches[desc->used_frequencies][1] = i; + make_goertzel_descriptor(&desc->desc[desc->pitches[i][1]], (float) (freq + desc->pitches[i][0])/2, BINS); + desc->used_frequencies++; + return desc->pitches[i][1]; + } + } + desc->pitches[i][0] = freq; + desc->pitches[i][1] = desc->monitored_frequencies; + if (desc->monitored_frequencies%5 == 0) + { + desc->desc = (goertzel_descriptor_t *) realloc(desc->desc, (desc->monitored_frequencies + 5)*sizeof(goertzel_descriptor_t)); + } + make_goertzel_descriptor(&desc->desc[desc->monitored_frequencies++], (float) freq, BINS); + desc->used_frequencies++; + return desc->pitches[i][1]; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) super_tone_rx_add_tone(super_tone_rx_descriptor_t *desc) +{ + if (desc->tones%5 == 0) + { + desc->tone_list = (super_tone_rx_segment_t **) realloc(desc->tone_list, (desc->tones + 5)*sizeof(super_tone_rx_segment_t *)); + desc->tone_segs = (int *) realloc(desc->tone_segs, (desc->tones + 5)*sizeof(int)); + } + desc->tone_list[desc->tones] = NULL; + desc->tone_segs[desc->tones] = 0; + desc->tones++; + return desc->tones - 1; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) super_tone_rx_add_element(super_tone_rx_descriptor_t *desc, + int tone, + int f1, + int f2, + int min, + int max) +{ + int step; + + step = desc->tone_segs[tone]; + if (step%5 == 0) + { + desc->tone_list[tone] = (super_tone_rx_segment_t *) realloc(desc->tone_list[tone], (step + 5)*sizeof(super_tone_rx_segment_t)); + } + desc->tone_list[tone][step].f1 = add_super_tone_freq(desc, f1); + desc->tone_list[tone][step].f2 = add_super_tone_freq(desc, f2); + desc->tone_list[tone][step].min_duration = min*8; + desc->tone_list[tone][step].max_duration = (max == 0) ? 0x7FFFFFFF : max*8; + desc->tone_segs[tone]++; + return step; +} +/*- End of function --------------------------------------------------------*/ + +static int test_cadence(super_tone_rx_segment_t *pattern, + int steps, + super_tone_rx_segment_t *test, + int rotation) +{ + int i; + int j; + + if (rotation >= 0) + { + /* Check only for the sustaining of a tone in progress. This means + we only need to check each block if the latest step is compatible + with the tone template. */ + if (steps < 0) + { + /* A -ve value for steps indicates we just changed step, and need to + check the last one ended within spec. If we don't do this + extra test a low duration segment might be accepted as OK. */ + steps = -steps; + j = (rotation + steps - 2)%steps; + if (pattern[j].f1 != test[8].f1 || pattern[j].f2 != test[8].f2) + return 0; + if (pattern[j].min_duration > test[8].min_duration*BINS + || + pattern[j].max_duration < test[8].min_duration*BINS) + { + return 0; + } + } + j = (rotation + steps - 1)%steps; + if (pattern[j].f1 != test[9].f1 || pattern[j].f2 != test[9].f2) + return 0; + if (pattern[j].max_duration < test[9].min_duration*BINS) + return 0; + } + else + { + /* Look for a complete template match. */ + for (i = 0; i < steps; i++) + { + j = i + 10 - steps; + if (pattern[i].f1 != test[j].f1 || pattern[i].f2 != test[j].f2) + return 0; + if (pattern[i].min_duration > test[j].min_duration*BINS + || + pattern[i].max_duration < test[j].min_duration*BINS) + { + return 0; + } + } + } + return 1; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(super_tone_rx_descriptor_t *) super_tone_rx_make_descriptor(super_tone_rx_descriptor_t *desc) +{ + if (desc == NULL) + { + if ((desc = (super_tone_rx_descriptor_t *) malloc(sizeof(*desc))) == NULL) + return NULL; + } + desc->tone_list = NULL; + desc->tone_segs = NULL; + + desc->used_frequencies = 0; + desc->monitored_frequencies = 0; + desc->desc = NULL; + desc->tones = 0; + return desc; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) super_tone_rx_free_descriptor(super_tone_rx_descriptor_t *desc) +{ + int i; + + if (desc) + { + for (i = 0; i < desc->tones; i++) + { + if (desc->tone_list[i]) + free(desc->tone_list[i]); + } + if (desc->tone_list) + free(desc->tone_list); + if (desc->tone_segs) + free(desc->tone_segs); + if (desc->desc) + free(desc->desc); + free(desc); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) super_tone_rx_segment_callback(super_tone_rx_state_t *s, + void (*callback)(void *data, int f1, int f2, int duration)) +{ + s->segment_callback = callback; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(super_tone_rx_state_t *) super_tone_rx_init(super_tone_rx_state_t *s, + super_tone_rx_descriptor_t *desc, + tone_report_func_t callback, + void *user_data) +{ + int i; + + if (desc == NULL) + return NULL; + if (callback == NULL) + return NULL; + if (s == NULL) + { + if ((s = (super_tone_rx_state_t *) malloc(sizeof(*s) + desc->monitored_frequencies*sizeof(goertzel_state_t))) == NULL) + return NULL; + } + + for (i = 0; i < 11; i++) + { + s->segments[i].f1 = -1; + s->segments[i].f2 = -1; + s->segments[i].min_duration = 0; + } + s->segment_callback = NULL; + s->tone_callback = callback; + s->callback_data = user_data; + if (desc) + s->desc = desc; + s->detected_tone = -1; + s->energy = 0.0f; + for (i = 0; i < desc->monitored_frequencies; i++) + goertzel_init(&s->state[i], &s->desc->desc[i]); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) super_tone_rx_release(super_tone_rx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) super_tone_rx_free(super_tone_rx_state_t *s) +{ + if (s) + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void super_tone_chunk(super_tone_rx_state_t *s) +{ + int i; + int j; + int k1; + int k2; +#if defined(SPANDSP_USE_FIXED_POINT) + int32_t res[BINS/2]; +#else + float res[BINS/2]; +#endif + + for (i = 0; i < s->desc->monitored_frequencies; i++) + res[i] = goertzel_result(&s->state[i]); + /* Find our two best monitored frequencies, which also have adequate energy. */ + if (s->energy < DETECTION_THRESHOLD) + { + k1 = -1; + k2 = -1; + } + else + { + if (res[0] > res[1]) + { + k1 = 0; + k2 = 1; + } + else + { + k1 = 1; + k2 = 0; + } + for (j = 2; j < s->desc->monitored_frequencies; j++) + { + if (res[j] >= res[k1]) + { + k2 = k1; + k1 = j; + } + else if (res[j] >= res[k2]) + { + k2 = j; + } + } + if ((res[k1] + res[k2]) < TONE_TO_TOTAL_ENERGY*s->energy) + { + k1 = -1; + k2 = -1; + } + else if (res[k1] > TONE_TWIST*res[k2]) + { + k2 = -1; + } + else if (k2 < k1) + { + j = k1; + k1 = k2; + k2 = j; + } + } + /* See if this differs from last time. */ + if (k1 != s->segments[10].f1 || k2 != s->segments[10].f2) + { + /* It is different, but this might just be a transitional quirk, or + a one shot hiccup (eg due to noise). Only if this same thing is + seen a second time should we change state. */ + s->segments[10].f1 = k1; + s->segments[10].f2 = k2; + /* While things are hopping around, consider this a continuance of the + previous state. */ + s->segments[9].min_duration++; + } + else + { + if (k1 != s->segments[9].f1 || k2 != s->segments[9].f2) + { + if (s->detected_tone >= 0) + { + /* Test for the continuance of the existing tone pattern, based on our new knowledge of an + entire segment length. */ + if (!test_cadence(s->desc->tone_list[s->detected_tone], -s->desc->tone_segs[s->detected_tone], s->segments, s->rotation++)) + { + s->detected_tone = -1; + s->tone_callback(s->callback_data, s->detected_tone, -10, 0); + } + } + if (s->segment_callback) + { + s->segment_callback(s->callback_data, + s->segments[9].f1, + s->segments[9].f2, + s->segments[9].min_duration*BINS/8); + } + memcpy (&s->segments[0], &s->segments[1], 9*sizeof(s->segments[0])); + s->segments[9].f1 = k1; + s->segments[9].f2 = k2; + s->segments[9].min_duration = 1; + } + else + { + /* This is a continuance of the previous state */ + if (s->detected_tone >= 0) + { + /* Test for the continuance of the existing tone pattern. We must do this here, so we can sense the + discontinuance of the tone on an excessively long segment. */ + if (!test_cadence(s->desc->tone_list[s->detected_tone], s->desc->tone_segs[s->detected_tone], s->segments, s->rotation)) + { + s->detected_tone = -1; + s->tone_callback(s->callback_data, s->detected_tone, -10, 0); + } + } + s->segments[9].min_duration++; + } + } + if (s->detected_tone < 0) + { + /* Test for the start of any of the monitored tone patterns */ + for (j = 0; j < s->desc->tones; j++) + { + if (test_cadence(s->desc->tone_list[j], s->desc->tone_segs[j], s->segments, -1)) + { + s->detected_tone = j; + s->rotation = 0; + s->tone_callback(s->callback_data, s->detected_tone, -10, 0); + break; + } + } + } +#if defined(SPANDSP_USE_FIXED_POINT) + s->energy = 0; +#else + s->energy = 0.0f; +#endif +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) super_tone_rx(super_tone_rx_state_t *s, const int16_t amp[], int samples) +{ + int i; + int x; + int sample; +#if defined(SPANDSP_USE_FIXED_POINT) + int16_t xamp; +#else + float xamp; +#endif + + x = 0; + for (sample = 0; sample < samples; sample += x) + { + for (i = 0; i < s->desc->monitored_frequencies; i++) + x = goertzel_update(&s->state[i], amp + sample, samples - sample); + for (i = 0; i < x; i++) + { + xamp = goertzel_preadjust_amp(amp[sample + i]); +#if defined(SPANDSP_USE_FIXED_POINT) + s->energy += ((int32_t) xamp*xamp); +#else + s->energy += xamp*xamp; +#endif + } + if (s->state[0].current_sample >= BINS) + { + /* We have finished a Goertzel block. */ + super_tone_chunk(s); + s->energy = 0; + } + } + return samples; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/super_tone_tx.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/super_tone_tx.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,288 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * super_tone_tx.c - Flexible telephony supervisory tone generation. + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: super_tone_tx.c,v 1.30 2009/02/10 17:44:18 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/complex.h" +#include "spandsp/dds.h" +#include "spandsp/tone_generate.h" +#include "spandsp/super_tone_tx.h" + +#include "spandsp/private/tone_generate.h" +#include "spandsp/private/super_tone_tx.h" + +/* + The tone played to wake folk up when they have left the phone off hook is an + oddity amongst supervisory tones. It is designed to sound loud and nasty. Most + tones are one or two pure sine pitches, or one AM moduluated pitch. This alert + tone varies between countries, but AT&T are a typical example. + + AT&T Receiver Off-Hook Tone is 1400 Hz, 2060 Hz, 2450 Hz and 2600 Hz at 0dBm0/frequency + on and off every .1 second. On some older space division switching systems + Receiver Off-Hook was 1400 Hz, 2060 Hz, 2450 Hz and 2600 Hz at +5 VU on and + off every .1 second. On a No. 5 ESS this continues for 30 seconds. On a No. + 2/2B ESS this continues for 40 seconds. On some other AT&T switches there are + two iterations of 50 seconds each. +*/ + +SPAN_DECLARE(super_tone_tx_step_t *) super_tone_tx_make_step(super_tone_tx_step_t *s, + float f1, + float l1, + float f2, + float l2, + int length, + int cycles) +{ + if (s == NULL) + { + if ((s = (super_tone_tx_step_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + if (f1 >= 1.0f) + { + s->tone[0].phase_rate = dds_phase_ratef(f1); + s->tone[0].gain = dds_scaling_dbm0f(l1); + } + else + { + s->tone[0].phase_rate = 0; + s->tone[0].gain = 0.0f; + } + if (f2 >= 1.0f) + { + s->tone[1].phase_rate = dds_phase_ratef(f2); + s->tone[1].gain = dds_scaling_dbm0f(l2); + } + else + { + s->tone[1].phase_rate = 0; + s->tone[1].gain = 0.0f; + } + s->tone_on = (f1 > 0.0f); + s->length = length*SAMPLE_RATE/1000; + s->cycles = cycles; + s->next = NULL; + s->nest = NULL; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) super_tone_tx_free_tone(super_tone_tx_step_t *s) +{ + super_tone_tx_step_t *t; + + while (s) + { + /* Follow nesting... */ + if (s->nest) + super_tone_tx_free_tone(s->nest); + t = s; + s = s->next; + free(t); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(super_tone_tx_state_t *) super_tone_tx_init(super_tone_tx_state_t *s, super_tone_tx_step_t *tree) +{ + if (tree == NULL) + return NULL; + if (s == NULL) + { + if ((s = (super_tone_tx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + s->level = 0; + s->levels[0] = tree; + s->cycles[0] = tree->cycles; + + s->current_position = 0; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) super_tone_tx_release(super_tone_tx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) super_tone_tx_free(super_tone_tx_state_t *s) +{ + if (s) + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) super_tone_tx(super_tone_tx_state_t *s, int16_t amp[], int max_samples) +{ + int samples; + int limit; + int len; + int i; + float xamp; + super_tone_tx_step_t *tree; + + if (s->level < 0 || s->level > 3) + return 0; + samples = 0; + tree = s->levels[s->level]; + while (tree && samples < max_samples) + { + if (tree->tone_on) + { + /* A period of tone. A length of zero means infinite length. */ + if (s->current_position == 0) + { + /* New step - prepare the tone generator */ + for (i = 0; i < 4; i++) + s->tone[i] = tree->tone[i]; + } + len = tree->length - s->current_position; + if (tree->length == 0) + { + len = max_samples - samples; + /* We just need to make current position non-zero */ + s->current_position = 1; + } + else if (len > max_samples - samples) + { + len = max_samples - samples; + s->current_position += len; + } + else + { + s->current_position = 0; + } + if (s->tone[0].phase_rate < 0) + { + for (limit = len + samples; samples < limit; samples++) + { + /* There must be two, and only two tones */ + xamp = dds_modf(&s->phase[0], -s->tone[0].phase_rate, s->tone[0].gain, 0) + *(1.0f + dds_modf(&s->phase[1], s->tone[1].phase_rate, s->tone[1].gain, 0)); + amp[samples] = (int16_t) lfastrintf(xamp); + } + } + else + { + for (limit = len + samples; samples < limit; samples++) + { + xamp = 0.0f; + for (i = 0; i < 4; i++) + { + if (s->tone[i].phase_rate == 0) + break; + xamp += dds_modf(&s->phase[i], s->tone[i].phase_rate, s->tone[i].gain, 0); + } + amp[samples] = (int16_t) lfastrintf(xamp); + } + } + if (s->current_position) + return samples; + } + else if (tree->length) + { + /* A period of silence. The length must always + be explicitly stated. A length of zero does + not give infinite silence. */ + len = tree->length - s->current_position; + if (len > max_samples - samples) + { + len = max_samples - samples; + s->current_position += len; + } + else + { + s->current_position = 0; + } + memset(amp + samples, 0, sizeof(uint16_t)*len); + samples += len; + if (s->current_position) + return samples; + } + /* Nesting has priority... */ + if (tree->nest) + { + tree = tree->nest; + s->levels[++s->level] = tree; + s->cycles[s->level] = tree->cycles; + } + else + { + /* ...Next comes repeating, and finally moving forward a step. */ + /* When repeating, note that zero cycles really means endless cycles. */ + while (tree->cycles && --s->cycles[s->level] <= 0) + { + tree = tree->next; + if (tree) + { + /* A fresh new step. */ + s->levels[s->level] = tree; + s->cycles[s->level] = tree->cycles; + break; + } + /* If we are nested we need to pop, otherwise this is the end. */ + if (s->level <= 0) + { + /* Mark the tone as completed */ + s->levels[0] = NULL; + break; + } + tree = s->levels[--s->level]; + } + } + + } + return samples; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/swept_tone.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/swept_tone.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,128 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * swept_tone.c - Swept tone generation + * + * Written by Steve Underwood + * + * Copyright (C) 2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: swept_tone.c,v 1.2 2009/09/23 16:02:59 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/complex.h" +#include "spandsp/vector_float.h" +#include "spandsp/complex_vector_float.h" +#include "spandsp/vector_int.h" +#include "spandsp/complex_vector_int.h" +#include "spandsp/dds.h" + +#include "spandsp/swept_tone.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/swept_tone.h" + +SPAN_DECLARE(swept_tone_state_t *) swept_tone_init(swept_tone_state_t *s, float start, float end, float level, int duration, int repeating) +{ + if (s == NULL) + { + if ((s = (swept_tone_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + s->current_phase_inc = + s->starting_phase_inc = dds_phase_rate(start); + s->phase_inc_step = dds_phase_rate((end - start)/(float) duration); + s->scale = dds_scaling_dbm0(level); + s->duration = duration; + s->repeating = repeating; + s->pos = 0; + s->phase = 0; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) swept_tone(swept_tone_state_t *s, int16_t amp[], int max_len) +{ + int i; + int len; + int chunk_len; + + for (len = 0; len < max_len; ) + { + chunk_len = max_len - len; + if (chunk_len > s->duration - s->pos) + chunk_len = s->duration - s->pos; + for (i = len; i < len + chunk_len; i++) + { + amp[i] = (dds(&s->phase, s->current_phase_inc)*s->scale) >> 15; + s->current_phase_inc += s->phase_inc_step; + } + len += chunk_len; + s->pos += chunk_len; + if (s->pos >= s->duration) + { + if (!s->repeating) + break; + s->pos = 0; + s->current_phase_inc = s->starting_phase_inc; + } + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) swept_tone_current_frequency(swept_tone_state_t *s) +{ + return dds_frequency(s->current_phase_inc); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) swept_tone_release(swept_tone_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) swept_tone_free(swept_tone_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/t30.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/t30.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,6278 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t30.c - ITU T.30 FAX transfer processing + * + * Written by Steve Underwood + * + * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t30.c,v 1.305.4.4 2009/12/23 14:23:49 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/bit_operations.h" +#include "spandsp/queue.h" +#include "spandsp/power_meter.h" +#include "spandsp/complex.h" +#include "spandsp/tone_generate.h" +#include "spandsp/async.h" +#include "spandsp/hdlc.h" +#include "spandsp/fsk.h" +#include "spandsp/v29rx.h" +#include "spandsp/v29tx.h" +#include "spandsp/v27ter_rx.h" +#include "spandsp/v27ter_tx.h" +#include "spandsp/t4_rx.h" +#include "spandsp/t4_tx.h" +#include "spandsp/t30_fcf.h" +#include "spandsp/t35.h" +#include "spandsp/t30.h" +#include "spandsp/t30_api.h" +#include "spandsp/t30_logging.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/t4_rx.h" +#include "spandsp/private/t4_tx.h" +#include "spandsp/private/t30.h" +#include "spandsp/private/t30_dis_dtc_dcs_bits.h" + +#include "t30_local.h" + +/*! The maximum permitted number of retries of a single command allowed. */ +#define MAX_COMMAND_TRIES 3 + +/*! The maximum permitted number of retries of a single response request allowed. This + is not specified in T.30. However, if you don't apply some limit a messed up FAX + terminal could keep you retrying all day. Its a backstop protection. */ +#define MAX_RESPONSE_TRIES 6 + +/* T.30 defines the following call phases: + Phase A: Call set-up. + Exchange of CNG, CED and the called terminal identification. + Phase B: Pre-message procedure for identifying and selecting the required facilities. + Capabilities negotiation, and training, up the the confirmation to receive. + Phase C: Message transmission (includes phasing and synchronization where appropriate). + Transfer of the message at high speed. + Phase D: Post-message procedure, including end-of-message and confirmation and multi-document procedures. + End of message and acknowledgement. + Phase E: Call release + Final call disconnect. */ +enum +{ + T30_PHASE_IDLE = 0, /* Freshly initialised */ + T30_PHASE_A_CED, /* Doing the CED (answer) sequence */ + T30_PHASE_A_CNG, /* Doing the CNG (caller) sequence */ + T30_PHASE_B_RX, /* Receiving pre-message control messages */ + T30_PHASE_B_TX, /* Transmitting pre-message control messages */ + T30_PHASE_C_NON_ECM_RX, /* Receiving a document message in non-ECM mode */ + T30_PHASE_C_NON_ECM_TX, /* Transmitting a document message in non-ECM mode */ + T30_PHASE_C_ECM_RX, /* Receiving a document message in ECM (HDLC) mode */ + T30_PHASE_C_ECM_TX, /* Transmitting a document message in ECM (HDLC) mode */ + T30_PHASE_D_RX, /* Receiving post-message control messages */ + T30_PHASE_D_TX, /* Transmitting post-message control messages */ + T30_PHASE_E, /* In phase E */ + T30_PHASE_CALL_FINISHED /* Call completely finished */ +}; + +static const char *phase_names[] = +{ + "T30_PHASE_IDLE", + "T30_PHASE_A_CED", + "T30_PHASE_A_CNG", + "T30_PHASE_B_RX", + "T30_PHASE_B_TX", + "T30_PHASE_C_NON_ECM_RX", + "T30_PHASE_C_NON_ECM_TX", + "T30_PHASE_C_ECM_RX", + "T30_PHASE_C_ECM_TX", + "T30_PHASE_D_RX", + "T30_PHASE_D_TX", + "T30_PHASE_E", + "T30_PHASE_CALL_FINISHED" +}; + +/* These state names are modelled after places in the T.30 flow charts. */ +enum +{ + T30_STATE_ANSWERING = 1, + T30_STATE_B, + T30_STATE_C, + T30_STATE_D, + T30_STATE_D_TCF, + T30_STATE_D_POST_TCF, + T30_STATE_F_TCF, + T30_STATE_F_CFR, + T30_STATE_F_FTT, + T30_STATE_F_DOC_NON_ECM, + T30_STATE_F_POST_DOC_NON_ECM, + T30_STATE_F_DOC_ECM, + T30_STATE_F_POST_DOC_ECM, + T30_STATE_F_POST_RCP_MCF, + T30_STATE_F_POST_RCP_PPR, + T30_STATE_F_POST_RCP_RNR, + T30_STATE_R, + T30_STATE_T, + T30_STATE_I, + T30_STATE_II, + T30_STATE_II_Q, + T30_STATE_III_Q_MCF, + T30_STATE_III_Q_RTP, + T30_STATE_III_Q_RTN, + T30_STATE_IV, + T30_STATE_IV_PPS_NULL, + T30_STATE_IV_PPS_Q, + T30_STATE_IV_PPS_RNR, + T30_STATE_IV_CTC, + T30_STATE_IV_EOR, + T30_STATE_IV_EOR_RNR, + T30_STATE_CALL_FINISHED +}; + +enum +{ + T30_MIN_SCAN_20MS = 0, + T30_MIN_SCAN_5MS = 1, + T30_MIN_SCAN_10MS = 2, + T30_MIN_SCAN_40MS = 4, + T30_MIN_SCAN_0MS = 7, +}; + +enum +{ + T30_MODE_SEND_DOC = 1, + T30_MODE_RECEIVE_DOC +}; + +/*! These are internal assessments of received image quality, used to determine whether we + continue, retrain, or abandon the call. */ +enum +{ + T30_COPY_QUALITY_PERFECT = 0, + T30_COPY_QUALITY_GOOD, + T30_COPY_QUALITY_POOR, + T30_COPY_QUALITY_BAD +}; + +enum +{ + DISBIT1 = 0x01, + DISBIT2 = 0x02, + DISBIT3 = 0x04, + DISBIT4 = 0x08, + DISBIT5 = 0x10, + DISBIT6 = 0x20, + DISBIT7 = 0x40, + DISBIT8 = 0x80 +}; + +/*! There are high level indications of what is happening at any instant, to guide the cleanup + process if the call is abandoned. */ +enum +{ + OPERATION_IN_PROGRESS_NONE = 0, + OPERATION_IN_PROGRESS_T4_RX, + OPERATION_IN_PROGRESS_T4_TX +}; + +/* All timers specified in milliseconds */ + +/*! Time-out T0 defines the amount of time an automatic calling terminal waits for the called terminal + to answer the call. + T0 begins after the dialling of the number is completed and is reset: + a) when T0 times out; or + b) when timer T1 is started; or + c) if the terminal is capable of detecting any condition which indicates that the call will not be + successful, when such a condition is detected. + The recommended value of T0 is 60+-5s. However, when it is anticipated that a long call set-up + time may be encountered, an alternative value of up to 120s may be used. + NOTE - National regulations may require the use of other values for T0. */ +#define DEFAULT_TIMER_T0 60000 + +/*! Time-out T1 defines the amount of time two terminals will continue to attempt to identify each + other. T1 is 35+-5s, begins upon entering phase B, and is reset upon detecting a valid signal or + when T1 times out. + For operating methods 3 and 4 (see 3.1), the calling terminal starts time-out T1 upon reception of + the V.21 modulation scheme. + For operating method 4 bis a (see 3.1), the calling terminal starts time-out T1 upon starting + transmission using the V.21 modulation scheme. + Annex A says T1 is also the timeout to be used for the receipt of the first HDLC frame after the + start of high speed flags in ECM mode. This seems a strange reuse of the T1 name, so we distinguish + it here by calling it T1A. */ +#define DEFAULT_TIMER_T1 35000 +#define DEFAULT_TIMER_T1A 35000 + +/*! Time-out T2 makes use of the tight control between commands and responses to detect the loss of + command/response synchronization. T2 is 6+-1s, and begins when initiating a command search + (e.g., the first entrance into the "command received" subroutine, reference flow diagram in section 5.2). + T2 is reset when an HDLC flag is received or when T2 times out. */ +#define DEFAULT_TIMER_T2 7000 + +/*! Once HDLC flags begin, T2 is reset, and a 3s timer begins. This timer is unnamed in T.30. Here we + term it T2A. No tolerance is specified for this timer. T2A specifies the maximum time to wait for the + end of a frame, after the initial flag has been seen. */ +#define DEFAULT_TIMER_T2A 3000 + +/*! If the HDLC carrier falls during reception, we need to apply a minimum time before continuing. If we + don't, there are circumstances where we could continue and reply before the incoming signals have + really finished. E.g. if a bad DCS is received in a DCS-TCF sequence, we need wait for the TCF + carrier to pass, before continuing. This timer is specified as 200ms, but no tolerance is specified. + It is unnamed in T.30. Here we term it T2B */ +#define DEFAULT_TIMER_T2B 200 + +/*! Time-out T3 defines the amount of time a terminal will attempt to alert the local operator in + response to a procedural interrupt. Failing to achieve operator intervention, the terminal will + discontinue this attempt and shall issue other commands or responses. T3 is 10+-5s, begins on the + first detection of a procedural interrupt command/response signal (i.e., PIN/PIP or PRI-Q) and is + reset when T3 times out or when the operator initiates a line request. */ +#define DEFAULT_TIMER_T3 15000 + +/*! Time-out T4 defines the amount of time a terminal will wait for flags to begin, when waiting for a + response from a remote terminal. T2 is 3s +-15%, and begins when initiating a response search + (e.g., the first entrance into the "response received" subroutine, reference flow diagram in section 5.2). + T4 is reset when an HDLC flag is received or when T4 times out. + NOTE - For manual FAX units, the value of timer T4 may be either 3.0s +-15% or 4.5s +-15%. + If the value of 4.5s is used, then after detection of a valid response to the first DIS, it may + be reduced to 3.0s +-15%. T4 = 3.0s +-15% for automatic units. */ +#define DEFAULT_TIMER_T4 3450 + +/*! Once HDLC flags begin, T4 is reset, and a 3s timer begins. This timer is unnamed in T.30. Here we + term it T4A. No tolerance is specified for this timer. T4A specifies the maximum time to wait for the + end of a frame, after the initial flag has been seen. Note that a different timer is used for the fast + HDLC in ECM mode, to provide time for physical paper handling. */ +#define DEFAULT_TIMER_T4A 3000 + +/*! If the HDLC carrier falls during reception, we need to apply a minimum time before continuing. if we + don't, there are circumstances where we could continue and reply before the incoming signals have + really finished. E.g. if a bad DCS is received in a DCS-TCF sequence, we need wait for the TCF + carrier to pass, before continuing. This timer is specified as 200ms, but no tolerance is specified. + It is unnamed in T.30. Here we term it T4B */ +#define DEFAULT_TIMER_T4B 200 + +/*! Time-out T5 is defined for the optional T.4 error correction mode. Time-out T5 defines the amount + of time waiting for clearance of the busy condition of the receiving terminal. T5 is 60+-5s and + begins on the first detection of the RNR response. T5 is reset when T5 times out or the MCF or PIP + response is received or when the ERR or PIN response is received in the flow control process after + transmitting the EOR command. If the timer T5 has expired, the DCN command is transmitted for + call release. */ +#define DEFAULT_TIMER_T5 65000 + +/*! (Annex C - ISDN) Time-out T6 defines the amount of time two terminals will continue to attempt to + identify each other. T6 is 5+-0.5s. The timeout begins upon entering Phase B, and is reset upon + detecting a valid signal, or when T6 times out. */ +#define DEFAULT_TIMER_T6 5000 + +/*! (Annex C - ISDN) Time-out T7 is used to detect loss of command/response synchronization. T7 is 6+-1s. + The timeout begins when initiating a command search (e.g., the first entrance into the "command received" + subroutine - see flow diagram in C.5) and is reset upon detecting a valid signal or when T7 times out. */ +#define DEFAULT_TIMER_T7 7000 + +/*! (Annex C - ISDN) Time-out T8 defines the amount of time waiting for clearance of the busy condition + of the receiving terminal. T8 is 10+-1s. The timeout begins on the first detection of the combination + of no outstanding corrections and the RNR response. T8 is reset when T8 times out or MCF response is + received. If the timer T8 expires, a DCN command is transmitted for call release. */ +#define DEFAULT_TIMER_T8 10000 + +/*! Final time we allow for things to flush through the system, before we disconnect, in milliseconds. + 200ms should be fine for a PSTN call. For a T.38 call something longer is desirable. */ +#define FINAL_FLUSH_TIME 1000 + +/*! The number of PPRs received before CTC or EOR is sent in ECM mode. T.30 defines this as 4, + but it could be varied, and the Japanese spec, for example, does make this value a + variable. */ +#define PPR_LIMIT_BEFORE_CTC_OR_EOR 4 + +/* HDLC message header byte values */ +#define ADDRESS_FIELD 0xFF +#define CONTROL_FIELD_NON_FINAL_FRAME 0x03 +#define CONTROL_FIELD_FINAL_FRAME 0x13 + +enum +{ + TIMER_IS_IDLE = 0, + TIMER_IS_T2, + TIMER_IS_T1A, + TIMER_IS_T2A, + TIMER_IS_T2B, + TIMER_IS_T2C, + TIMER_IS_T4, + TIMER_IS_T4A, + TIMER_IS_T4B, + TIMER_IS_T4C +}; + +/* Start points in the fallback table for different capabilities */ +/*! The starting point in the modem fallback sequence if V.17 is allowed */ +#define T30_V17_FALLBACK_START 0 +/*! The starting point in the modem fallback sequence if V.17 is not allowed */ +#define T30_V29_FALLBACK_START 3 +/*! The starting point in the modem fallback sequence if V.29 is not allowed */ +#define T30_V27TER_FALLBACK_START 6 + +static const struct +{ + int bit_rate; + int modem_type; + int which; + uint8_t dcs_code; +} fallback_sequence[] = +{ + {14400, T30_MODEM_V17, T30_SUPPORT_V17, DISBIT6}, + {12000, T30_MODEM_V17, T30_SUPPORT_V17, (DISBIT6 | DISBIT4)}, + { 9600, T30_MODEM_V17, T30_SUPPORT_V17, (DISBIT6 | DISBIT3)}, + { 9600, T30_MODEM_V29, T30_SUPPORT_V29, DISBIT3}, + { 7200, T30_MODEM_V17, T30_SUPPORT_V17, (DISBIT6 | DISBIT4 | DISBIT3)}, + { 7200, T30_MODEM_V29, T30_SUPPORT_V29, (DISBIT4 | DISBIT3)}, + { 4800, T30_MODEM_V27TER, T30_SUPPORT_V27TER, DISBIT4}, + { 2400, T30_MODEM_V27TER, T30_SUPPORT_V27TER, 0}, + { 0, 0, 0, 0} +}; + +static void queue_phase(t30_state_t *s, int phase); +static void set_phase(t30_state_t *s, int phase); +static void set_state(t30_state_t *s, int state); +static void send_simple_frame(t30_state_t *s, int type); +static void send_frame(t30_state_t *s, const uint8_t *fr, int frlen); +static void send_dcn(t30_state_t *s); +static void repeat_last_command(t30_state_t *s); +static void disconnect(t30_state_t *s); +static void decode_20digit_msg(t30_state_t *s, char *msg, const uint8_t *pkt, int len); +static void decode_url_msg(t30_state_t *s, char *msg, const uint8_t *pkt, int len); +static int set_min_scan_time_code(t30_state_t *s); +static int send_cfr_sequence(t30_state_t *s, int start); +static void timer_t2_start(t30_state_t *s); +static void timer_t2a_start(t30_state_t *s); +static void timer_t2b_start(t30_state_t *s); +static void timer_t4_start(t30_state_t *s); +static void timer_t4a_start(t30_state_t *s); +static void timer_t4b_start(t30_state_t *s); +static void timer_t2_t4_stop(t30_state_t *s); + +/*! Test a specified bit within a DIS, DTC or DCS frame */ +#define test_ctrl_bit(s,bit) ((s)[3 + ((bit - 1)/8)] & (1 << ((bit - 1)%8))) +/*! Set a specified bit within a DIS, DTC or DCS frame */ +#define set_ctrl_bit(s,bit) (s)[3 + ((bit - 1)/8)] |= (1 << ((bit - 1)%8)) +/*! Set a specified block of bits within a DIS, DTC or DCS frame */ +#define set_ctrl_bits(s,val,bit) (s)[3 + ((bit - 1)/8)] |= ((val) << ((bit - 1)%8)) +/*! Clear a specified bit within a DIS, DTC or DCS frame */ +#define clr_ctrl_bit(s,bit) (s)[3 + ((bit - 1)/8)] &= ~(1 << ((bit - 1)%8)) + +static int terminate_operation_in_progress(t30_state_t *s) +{ + /* Make sure any FAX in progress is tidied up. If the tidying up has + already happened, repeating it here is harmless. */ + switch (s->operation_in_progress) + { + case OPERATION_IN_PROGRESS_T4_TX: + t4_tx_release(&s->t4); + break; + case OPERATION_IN_PROGRESS_T4_RX: + t4_rx_release(&s->t4); + break; + } + s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int tx_start_page(t30_state_t *s) +{ + if (t4_tx_start_page(&s->t4)) + { + terminate_operation_in_progress(s); + return -1; + } + s->ecm_block = 0; + s->error_correcting_mode_retries = 0; + span_log(&s->logging, SPAN_LOG_FLOW, "Starting page %d of transfer\n", s->tx_page_number + 1); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int tx_end_page(t30_state_t *s) +{ + s->retries = 0; + if (t4_tx_end_page(&s->t4) == 0) + { + s->tx_page_number++; + s->ecm_block = 0; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int rx_start_page(t30_state_t *s) +{ + int i; + + t4_rx_set_image_width(&s->t4, s->image_width); + t4_rx_set_sub_address(&s->t4, s->rx_info.sub_address); + t4_rx_set_dcs(&s->t4, s->rx_dcs_string); + t4_rx_set_far_ident(&s->t4, s->rx_info.ident); + t4_rx_set_vendor(&s->t4, s->vendor); + t4_rx_set_model(&s->t4, s->model); + + t4_rx_set_rx_encoding(&s->t4, s->line_encoding); + t4_rx_set_x_resolution(&s->t4, s->x_resolution); + t4_rx_set_y_resolution(&s->t4, s->y_resolution); + + if (t4_rx_start_page(&s->t4)) + return -1; + /* Clear the buffer */ + for (i = 0; i < 256; i++) + s->ecm_len[i] = -1; + s->ecm_block = 0; + s->ecm_frames = -1; + s->ecm_frames_this_tx_burst = 0; + s->error_correcting_mode_retries = 0; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int rx_end_page(t30_state_t *s) +{ + if (t4_rx_end_page(&s->t4) == 0) + { + s->rx_page_number++; + s->ecm_block = 0; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int copy_quality(t30_state_t *s) +{ + t4_stats_t stats; + int quality; + + t4_get_transfer_statistics(&s->t4, &stats); + /* There is no specification for judging copy quality. However, we need to classify + it at three levels, to control what we do next: OK; tolerable, but retrain; + intolerable. */ + /* Based on the thresholds used in the TSB85 tests, we consider: + <5% bad rows is OK + <15% bad rows to be tolerable, but retrain + >15% bad rows to be intolerable + */ + span_log(&s->logging, SPAN_LOG_FLOW, "Page no = %d\n", stats.pages_transferred + 1); + span_log(&s->logging, SPAN_LOG_FLOW, "Image size = %d x %d pixels\n", stats.width, stats.length); + span_log(&s->logging, SPAN_LOG_FLOW, "Image resolution = %d/m x %d/m\n", stats.x_resolution, stats.y_resolution); + span_log(&s->logging, SPAN_LOG_FLOW, "Bad rows = %d\n", stats.bad_rows); + span_log(&s->logging, SPAN_LOG_FLOW, "Longest bad row run = %d\n", stats.longest_bad_row_run); + /* Don't treat a page as perfect because it has zero bad rows out of zero total rows. A zero row + page has got to be some kind of total page failure. */ + if (stats.bad_rows == 0 && stats.length != 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Page quality is perfect\n"); + quality = T30_COPY_QUALITY_PERFECT; + } + else if (stats.bad_rows*20 < stats.length) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Page quality is good\n"); + quality = T30_COPY_QUALITY_GOOD; + } + else if (stats.bad_rows*20 < stats.length*3) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Page quality is poor\n"); + quality = T30_COPY_QUALITY_POOR; + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Page quality is bad\n"); + quality = T30_COPY_QUALITY_BAD; + } + return quality; +} +/*- End of function --------------------------------------------------------*/ + +static void release_resources(t30_state_t *s) +{ + if (s->tx_info.nsf) + { + free(s->tx_info.nsf); + s->tx_info.nsf = NULL; + } + s->tx_info.nsf_len = 0; + if (s->tx_info.nsc) + { + free(s->tx_info.nsc); + s->tx_info.nsc = NULL; + } + s->tx_info.nsc_len = 0; + if (s->tx_info.nss) + { + free(s->tx_info.nss); + s->tx_info.nss = NULL; + } + s->tx_info.nss_len = 0; + if (s->tx_info.tsa) + { + free(s->tx_info.tsa); + s->tx_info.tsa = NULL; + } + if (s->tx_info.ira) + { + free(s->tx_info.ira); + s->tx_info.ira = NULL; + } + if (s->tx_info.cia) + { + free(s->tx_info.cia); + s->tx_info.cia = NULL; + } + if (s->tx_info.isp) + { + free(s->tx_info.isp); + s->tx_info.isp = NULL; + } + if (s->tx_info.csa) + { + free(s->tx_info.csa); + s->tx_info.csa = NULL; + } + + if (s->rx_info.nsf) + { + free(s->rx_info.nsf); + s->rx_info.nsf = NULL; + } + s->rx_info.nsf_len = 0; + if (s->rx_info.nsc) + { + free(s->rx_info.nsc); + s->rx_info.nsc = NULL; + } + s->rx_info.nsc_len = 0; + if (s->rx_info.nss) + { + free(s->rx_info.nss); + s->rx_info.nss = NULL; + } + s->rx_info.nss_len = 0; + if (s->rx_info.tsa) + { + free(s->rx_info.tsa); + s->rx_info.tsa = NULL; + } + if (s->rx_info.ira) + { + free(s->rx_info.ira); + s->rx_info.ira = NULL; + } + if (s->rx_info.cia) + { + free(s->rx_info.cia); + s->rx_info.cia = NULL; + } + if (s->rx_info.isp) + { + free(s->rx_info.isp); + s->rx_info.isp = NULL; + } + if (s->rx_info.csa) + { + free(s->rx_info.csa); + s->rx_info.csa = NULL; + } +} +/*- End of function --------------------------------------------------------*/ + +static uint8_t check_next_tx_step(t30_state_t *s) +{ + int res; + int more; + + res = t4_tx_next_page_has_different_format(&s->t4); + if (res == 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "More pages to come with the same format\n"); + return (s->local_interrupt_pending) ? T30_PRI_MPS : T30_MPS; + } + if (res > 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "More pages to come with a different format\n"); + s->tx_start_page = t4_tx_get_current_page_in_file(&s->t4) + 1; + return (s->local_interrupt_pending) ? T30_PRI_EOM : T30_EOM; + } + /* Call a user handler, if one is set, to check if another document is to be sent. + If so, we send an EOM, rather than an EOP. Then we will renegotiate, and the new + document will begin. */ + if (s->document_handler) + more = s->document_handler(s, s->document_user_data, 0); + else + more = FALSE; + if (more) + { + //if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_MULTIPLE_SELECTIVE_POLLING_CAPABLE)) + // return T30_EOS; + return (s->local_interrupt_pending) ? T30_PRI_EOM : T30_EOM; + } + return (s->local_interrupt_pending) ? T30_PRI_EOP : T30_EOP; +} +/*- End of function --------------------------------------------------------*/ + +static int get_partial_ecm_page(t30_state_t *s) +{ + int i; + int len; + + s->ppr_count = 0; + s->ecm_progress = 0; + /* Fill our partial page buffer with a partial page. Use the negotiated preferred frame size + as the basis for the size of the frames produced. */ + /* We fill the buffer with complete HDLC frames, ready to send out. */ + /* The frames are all marked as not being final frames. When sent, the are followed by a partial + page signal, which is marked as the final frame. */ + for (i = 3; i < 32 + 3; i++) + s->ecm_frame_map[i] = 0xFF; + for (i = 0; i < 256; i++) + { + s->ecm_len[i] = -1; + s->ecm_data[i][0] = ADDRESS_FIELD; + s->ecm_data[i][1] = CONTROL_FIELD_NON_FINAL_FRAME; + s->ecm_data[i][2] = T4_FCD; + /* These frames contain a frame sequence number within the partial page (one octet) followed + by some image data. */ + s->ecm_data[i][3] = (uint8_t) i; + if ((len = t4_tx_get_chunk(&s->t4, &s->ecm_data[i][4], s->octets_per_ecm_frame)) < s->octets_per_ecm_frame) + { + /* The image is not big enough to fill the entire buffer */ + /* We need to pad to a full frame, as most receivers expect that. */ + if (len > 0) + { + memset(&s->ecm_data[i][4 + len], 0, s->octets_per_ecm_frame - len); + s->ecm_len[i++] = (int16_t) (s->octets_per_ecm_frame + 4); + } + s->ecm_frames = i; + span_log(&s->logging, SPAN_LOG_FLOW, "Partial page buffer contains %d frames (%d per frame)\n", i, s->octets_per_ecm_frame); + s->ecm_at_page_end = TRUE; + return i; + } + s->ecm_len[i] = (int16_t) (4 + len); + } + /* We filled the entire buffer */ + s->ecm_frames = 256; + span_log(&s->logging, SPAN_LOG_FLOW, "Partial page buffer full (%d per frame)\n", s->octets_per_ecm_frame); + s->ecm_at_page_end = ((t4_tx_check_bit(&s->t4) & 2) != 0); + return 256; +} +/*- End of function --------------------------------------------------------*/ + +static int t30_ecm_commit_partial_page(t30_state_t *s) +{ + int i; + int image_ended; + + span_log(&s->logging, SPAN_LOG_FLOW, "Commiting partial page - block %d, %d frames\n", s->ecm_block, s->ecm_frames); + image_ended = FALSE; + for (i = 0; i < s->ecm_frames; i++) + { + if (t4_rx_put_chunk(&s->t4, s->ecm_data[i], s->ecm_len[i])) + { + /* This is the end of the document */ + /* Clear the buffer */ + for (i = 0; i < 256; i++) + s->ecm_len[i] = -1; + s->ecm_frames = -1; + image_ended = TRUE; + break; + } + } + /* Clear the buffer */ + for (i = 0; i < 256; i++) + s->ecm_len[i] = -1; + s->ecm_block++; + s->ecm_frames = -1; + return (image_ended) ? -1 : 0; +} +/*- End of function --------------------------------------------------------*/ + +static int send_next_ecm_frame(t30_state_t *s) +{ + int i; + uint8_t frame[3]; + + if (s->ecm_current_tx_frame < s->ecm_frames) + { + /* Search for the next frame, within the current partial page, which has + not been tagged as transferred OK. */ + for (i = s->ecm_current_tx_frame; i < s->ecm_frames; i++) + { + if (s->ecm_len[i] >= 0) + { + send_frame(s, s->ecm_data[i], s->ecm_len[i]); + s->ecm_current_tx_frame = i + 1; + s->ecm_frames_this_tx_burst++; + return 0; + } + } + s->ecm_current_tx_frame = s->ecm_frames; + } + if (s->ecm_current_tx_frame <= s->ecm_frames + 3) + { + /* We have sent all the FCD frames. Send some RCP frames. Three seems to be + a popular number, to minimise the risk of a bit error stopping the receiving + end from recognising the RCP. */ + s->ecm_current_tx_frame++; + /* The RCP frame is an odd man out, as its a simple 1 byte control + frame, but is specified to not have the final bit set. It doesn't + seem to have the DIS received bit set, either. */ + frame[0] = ADDRESS_FIELD; + frame[1] = CONTROL_FIELD_NON_FINAL_FRAME; + frame[2] = T4_RCP; + send_frame(s, frame, 3); + /* In case we are just after a CTC/CTR exchange, which kicked us back to long training */ + s->short_train = TRUE; + return 0; + } + return -1; +} +/*- End of function --------------------------------------------------------*/ + +static void send_rr(t30_state_t *s) +{ + if (s->current_status != T30_ERR_TX_T5EXP) + send_simple_frame(s, T30_RR); + else + send_dcn(s); +} +/*- End of function --------------------------------------------------------*/ + +static int send_first_ecm_frame(t30_state_t *s) +{ + s->ecm_current_tx_frame = 0; + s->ecm_frames_this_tx_burst = 0; + return send_next_ecm_frame(s); +} +/*- End of function --------------------------------------------------------*/ + +static void print_frame(t30_state_t *s, const char *io, const uint8_t *msg, int len) +{ + span_log(&s->logging, + SPAN_LOG_FLOW, + "%s %s with%s final frame tag\n", + io, + t30_frametype(msg[2]), + (msg[1] & 0x10) ? "" : "out"); + span_log_buf(&s->logging, SPAN_LOG_FLOW, io, msg, len); +} +/*- End of function --------------------------------------------------------*/ + +static void send_frame(t30_state_t *s, const uint8_t *msg, int len) +{ + print_frame(s, "Tx: ", msg, len); + + if (s->real_time_frame_handler) + s->real_time_frame_handler(s, s->real_time_frame_user_data, FALSE, msg, len); + if (s->send_hdlc_handler) + s->send_hdlc_handler(s->send_hdlc_user_data, msg, len); +} +/*- End of function --------------------------------------------------------*/ + +static void send_simple_frame(t30_state_t *s, int type) +{ + uint8_t frame[3]; + + /* The simple command/response frames are always final frames */ + frame[0] = ADDRESS_FIELD; + frame[1] = CONTROL_FIELD_FINAL_FRAME; + frame[2] = (uint8_t) (type | s->dis_received); + send_frame(s, frame, 3); +} +/*- End of function --------------------------------------------------------*/ + +static void send_20digit_msg_frame(t30_state_t *s, int cmd, char *msg) +{ + size_t len; + int p; + uint8_t frame[23]; + + len = strlen(msg); + p = 0; + frame[p++] = ADDRESS_FIELD; + frame[p++] = CONTROL_FIELD_NON_FINAL_FRAME; + frame[p++] = (uint8_t) (cmd | s->dis_received); + while (len > 0) + frame[p++] = msg[--len]; + while (p < 23) + frame[p++] = ' '; + send_frame(s, frame, 23); +} +/*- End of function --------------------------------------------------------*/ + +static int send_nsf_frame(t30_state_t *s) +{ + /* Only send if there is an NSF message to send. */ + if (s->tx_info.nsf && s->tx_info.nsf_len) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Sending user supplied NSF - %d octets\n", s->tx_info.nsf_len); + s->tx_info.nsf[0] = ADDRESS_FIELD; + s->tx_info.nsf[1] = CONTROL_FIELD_NON_FINAL_FRAME; + s->tx_info.nsf[2] = (uint8_t) (T30_NSF | s->dis_received); + send_frame(s, s->tx_info.nsf, s->tx_info.nsf_len + 3); + return TRUE; + } + return FALSE; +} +/*- End of function --------------------------------------------------------*/ + +static int send_nss_frame(t30_state_t *s) +{ + /* Only send if there is an NSF message to send. */ + if (s->tx_info.nss && s->tx_info.nss_len) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Sending user supplied NSS - %d octets\n", s->tx_info.nss_len); + s->tx_info.nss[0] = ADDRESS_FIELD; + s->tx_info.nss[1] = CONTROL_FIELD_NON_FINAL_FRAME; + s->tx_info.nss[2] = (uint8_t) (T30_NSS | s->dis_received); + send_frame(s, s->tx_info.nss, s->tx_info.nss_len + 3); + return TRUE; + } + return FALSE; +} +/*- End of function --------------------------------------------------------*/ + +static int send_nsc_frame(t30_state_t *s) +{ + /* Only send if there is an NSF message to send. */ + if (s->tx_info.nsc && s->tx_info.nsc_len) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Sending user supplied NSC - %d octets\n", s->tx_info.nsc_len); + s->tx_info.nsc[0] = ADDRESS_FIELD; + s->tx_info.nsc[1] = CONTROL_FIELD_NON_FINAL_FRAME; + s->tx_info.nsc[2] = (uint8_t) (T30_NSC | s->dis_received); + send_frame(s, s->tx_info.nsc, s->tx_info.nsc_len + 3); + return TRUE; + } + return FALSE; +} +/*- End of function --------------------------------------------------------*/ + +static int send_ident_frame(t30_state_t *s, uint8_t cmd) +{ + if (s->tx_info.ident[0]) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Sending ident '%s'\n", s->tx_info.ident); + /* 'cmd' should be T30_TSI, T30_CIG or T30_CSI */ + send_20digit_msg_frame(s, cmd, s->tx_info.ident); + return TRUE; + } + return FALSE; +} +/*- End of function --------------------------------------------------------*/ + +static int send_psa_frame(t30_state_t *s) +{ + if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_POLLED_SUBADDRESSING_CAPABLE) && s->tx_info.polled_sub_address[0]) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Sending polled sub-address '%s'\n", s->tx_info.polled_sub_address); + send_20digit_msg_frame(s, T30_PSA, s->tx_info.polled_sub_address); + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_POLLED_SUBADDRESSING_CAPABLE); + return TRUE; + } + clr_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_POLLED_SUBADDRESSING_CAPABLE); + return FALSE; +} +/*- End of function --------------------------------------------------------*/ + +static int send_sep_frame(t30_state_t *s) +{ + if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_SELECTIVE_POLLING_CAPABLE) && s->tx_info.selective_polling_address[0]) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Sending selective polling address '%s'\n", s->tx_info.selective_polling_address); + send_20digit_msg_frame(s, T30_SEP, s->tx_info.selective_polling_address); + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SELECTIVE_POLLING_CAPABLE); + return TRUE; + } + clr_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SELECTIVE_POLLING_CAPABLE); + return FALSE; +} +/*- End of function --------------------------------------------------------*/ + +static int send_sid_frame(t30_state_t *s) +{ + /* Only send if there is an ID to send. */ + if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_PASSWORD) && s->tx_info.sender_ident[0]) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Sending sender identification '%s'\n", s->tx_info.sender_ident); + send_20digit_msg_frame(s, T30_SID, s->tx_info.sender_ident); + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_SENDER_ID_TRANSMISSION); + return TRUE; + } + clr_ctrl_bit(s->dcs_frame, T30_DCS_BIT_SENDER_ID_TRANSMISSION); + return FALSE; +} +/*- End of function --------------------------------------------------------*/ + +static int send_pwd_frame(t30_state_t *s) +{ + /* Only send if there is a password to send. */ + if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_PASSWORD) && s->tx_info.password[0]) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Sending password '%s'\n", s->tx_info.password); + send_20digit_msg_frame(s, T30_PWD, s->tx_info.password); + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_PASSWORD); + return TRUE; + } + clr_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_PASSWORD); + return FALSE; +} +/*- End of function --------------------------------------------------------*/ + +static int send_sub_frame(t30_state_t *s) +{ + /* Only send if there is a sub-address to send. */ + if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_SUBADDRESSING_CAPABLE) && s->tx_info.sub_address[0]) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Sending sub-address '%s'\n", s->tx_info.sub_address); + send_20digit_msg_frame(s, T30_SUB, s->tx_info.sub_address); + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_SUBADDRESS_TRANSMISSION); + return TRUE; + } + clr_ctrl_bit(s->dcs_frame, T30_DCS_BIT_SUBADDRESS_TRANSMISSION); + return FALSE; +} +/*- End of function --------------------------------------------------------*/ + +static int send_tsa_frame(t30_state_t *s) +{ + if ((test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T37) || test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T38)) && 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Sending transmitting subscriber internet address '%s'\n", ""); + return TRUE; + } + return FALSE; +} +/*- End of function --------------------------------------------------------*/ + +static int send_ira_frame(t30_state_t *s) +{ + if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INTERNET_ROUTING_ADDRESS) && 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Sending internet routing address '%s'\n", ""); + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INTERNET_ROUTING_ADDRESS_TRANSMISSION); + return TRUE; + } + clr_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INTERNET_ROUTING_ADDRESS_TRANSMISSION); + return FALSE; +} +/*- End of function --------------------------------------------------------*/ + +static int send_cia_frame(t30_state_t *s) +{ + if ((test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T37) || test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T38)) && 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Sending calling subscriber internet address '%s'\n", ""); + return TRUE; + } + return FALSE; +} +/*- End of function --------------------------------------------------------*/ + +static int send_isp_frame(t30_state_t *s) +{ + if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INTERNET_SELECTIVE_POLLING_ADDRESS) && 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Sending internet selective polling address '%s'\n", ""); + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INTERNET_SELECTIVE_POLLING_ADDRESS); + return TRUE; + } + clr_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INTERNET_SELECTIVE_POLLING_ADDRESS); + return FALSE; +} +/*- End of function --------------------------------------------------------*/ + +#if 0 +static int send_csa_frame(t30_state_t *s) +{ +#if 0 + if (("in T.37 mode" || "in T.38 mode") && 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Sending called subscriber internet address '%s'\n", ""); + return TRUE; + } +#endif + return FALSE; +} +/*- End of function --------------------------------------------------------*/ +#endif + +static int send_pps_frame(t30_state_t *s) +{ + uint8_t frame[7]; + + frame[0] = ADDRESS_FIELD; + frame[1] = CONTROL_FIELD_FINAL_FRAME; + frame[2] = (uint8_t) (T30_PPS | s->dis_received); + frame[3] = (s->ecm_at_page_end) ? ((uint8_t) (s->next_tx_step | s->dis_received)) : T30_NULL; + frame[4] = (uint8_t) (s->tx_page_number & 0xFF); + frame[5] = (uint8_t) (s->ecm_block & 0xFF); + frame[6] = (uint8_t) ((s->ecm_frames_this_tx_burst == 0) ? 0 : (s->ecm_frames_this_tx_burst - 1)); + span_log(&s->logging, SPAN_LOG_FLOW, "Sending PPS + %s\n", t30_frametype(frame[3])); + send_frame(s, frame, 7); + return frame[3] & 0xFE; +} +/*- End of function --------------------------------------------------------*/ + +static int set_dis_or_dtc(t30_state_t *s) +{ + /* Whether we use a DIS or a DTC is determined by whether we have received a DIS. + We just need to edit the prebuilt message. */ + s->local_dis_dtc_frame[2] = (uint8_t) (T30_DIS | s->dis_received); + /* If we have a file name to receive into, then we are receive capable */ + if (s->rx_file[0]) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_READY_TO_RECEIVE_FAX_DOCUMENT); + else + clr_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_READY_TO_RECEIVE_FAX_DOCUMENT); + /* If we have a file name to transmit, then we are ready to transmit (polling) */ + if (s->tx_file[0]) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_READY_TO_TRANSMIT_FAX_DOCUMENT); + else + clr_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_READY_TO_TRANSMIT_FAX_DOCUMENT); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int t30_build_dis_or_dtc(t30_state_t *s) +{ + int i; + + /* Build a skeleton for the DIS and DTC messages. This will be edited for + the dynamically changing capabilities (e.g. can receive) just before + it is sent. It might also be edited if the application changes our + capabilities (e.g. disabling fine mode). Right now we set up all the + unchanging stuff about what we are capable of doing. */ + s->local_dis_dtc_frame[0] = ADDRESS_FIELD; + s->local_dis_dtc_frame[1] = CONTROL_FIELD_FINAL_FRAME; + s->local_dis_dtc_frame[2] = (uint8_t) (T30_DIS | s->dis_received); + for (i = 3; i < 19; i++) + s->local_dis_dtc_frame[i] = 0x00; + + /* Always say 256 octets per ECM frame preferred, as 64 is never used in the + real world. */ + if ((s->iaf & T30_IAF_MODE_T37)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T37); + if ((s->iaf & T30_IAF_MODE_T38)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T38); + /* No 3G mobile */ + /* No V.8 */ + /* 256 octets preferred - don't bother making this optional, as everything uses 256 */ + /* Ready to transmit a fax (polling) will be determined separately, and this message edited. */ + /* Ready to receive a fax will be determined separately, and this message edited. */ + /* With no modems set we are actually selecting V.27ter fallback at 2400bps */ + if ((s->supported_modems & T30_SUPPORT_V27TER)) + set_ctrl_bit(s->local_dis_dtc_frame, 12); + if ((s->supported_modems & T30_SUPPORT_V29)) + set_ctrl_bit(s->local_dis_dtc_frame, 11); + /* V.17 is only valid when combined with V.29 and V.27ter, so if we enable V.17 we force the others too. */ + if ((s->supported_modems & T30_SUPPORT_V17)) + s->local_dis_dtc_frame[4] |= (DISBIT6 | DISBIT4 | DISBIT3); + if ((s->supported_resolutions & T30_SUPPORT_FINE_RESOLUTION)) + set_ctrl_bit(s->local_dis_dtc_frame, 15); + if ((s->supported_compressions & T30_SUPPORT_T4_2D_COMPRESSION)) + set_ctrl_bit(s->local_dis_dtc_frame, 16); + /* 215mm wide is always supported */ + if ((s->supported_image_sizes & T30_SUPPORT_303MM_WIDTH)) + set_ctrl_bit(s->local_dis_dtc_frame, 18); + else if ((s->supported_image_sizes & T30_SUPPORT_255MM_WIDTH)) + set_ctrl_bit(s->local_dis_dtc_frame, 17); + /* A4 is always supported. */ + if ((s->supported_image_sizes & T30_SUPPORT_UNLIMITED_LENGTH)) + set_ctrl_bit(s->local_dis_dtc_frame, 20); + else if ((s->supported_image_sizes & T30_SUPPORT_B4_LENGTH)) + set_ctrl_bit(s->local_dis_dtc_frame, 19); + /* No scan-line padding required, but some may be specified by the application. */ + set_ctrl_bits(s->local_dis_dtc_frame, s->local_min_scan_time_code, 21); + if ((s->supported_compressions & T30_SUPPORT_NO_COMPRESSION)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_UNCOMPRESSED_CAPABLE); + if (s->ecm_allowed) + { + /* ECM allowed */ + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_ECM_CAPABLE); + /* Only offer the option of fancy compression schemes, if we are + also offering the ECM option needed to support them. */ + if ((s->supported_compressions & T30_SUPPORT_T6_COMPRESSION)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE); + if ((s->supported_compressions & T30_SUPPORT_T43_COMPRESSION)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T43_CAPABLE); +#if 0 + if ((s->supported_compressions & T30_SUPPORT_T45_COMPRESSION)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T45_CAPABLE); + if ((s->supported_compressions & T30_SUPPORT_T81_COMPRESSION)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE); + if ((s->supported_compressions & T30_SUPPORT_SYCC_T81_COMPRESSION)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SYCC_T81_CAPABLE); + if ((s->supported_compressions & T30_SUPPORT_T85_COMPRESSION)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE); + /* No T.85 optional L0. */ + //if ((s->supported_compressions & T30_SUPPORT_T85_L0_COMPRESSION)) + // set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T85_L0_CAPABLE); + //if ((s->supported_compressions & T30_SUPPORT_T89_COMPRESSION)) + // set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T89_CAPABLE); +#endif + } + if ((s->supported_t30_features & T30_SUPPORT_FIELD_NOT_VALID)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_FNV_CAPABLE); + if ((s->supported_t30_features & T30_SUPPORT_MULTIPLE_SELECTIVE_POLLING)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_MULTIPLE_SELECTIVE_POLLING_CAPABLE); + if ((s->supported_t30_features & T30_SUPPORT_POLLED_SUB_ADDRESSING)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_POLLED_SUBADDRESSING_CAPABLE); + /* No plane interleave */ + /* No G.726 */ + /* No extended voice coding */ + if ((s->supported_resolutions & T30_SUPPORT_SUPERFINE_RESOLUTION)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_200_400_CAPABLE); + if ((s->supported_resolutions & T30_SUPPORT_300_300_RESOLUTION)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_300_300_CAPABLE); + if ((s->supported_resolutions & (T30_SUPPORT_400_400_RESOLUTION | T30_SUPPORT_R16_RESOLUTION))) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_400_400_CAPABLE); + /* Metric */ + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_METRIC_RESOLUTION_PREFERRED); + /* Superfine minimum scan line time pattern follows fine */ + if ((s->supported_t30_features & T30_SUPPORT_SELECTIVE_POLLING)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SELECTIVE_POLLING_CAPABLE); + if ((s->supported_t30_features & T30_SUPPORT_SUB_ADDRESSING)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SUBADDRESSING_CAPABLE); + if ((s->supported_t30_features & T30_SUPPORT_IDENTIFICATION)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_PASSWORD); + /* Ready to transmit a data file (polling) */ + if (s->tx_file[0]) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_READY_TO_TRANSMIT_DATA_FILE); + /* No Binary file transfer (BFT) */ + /* No Document transfer mode (DTM) */ + /* No Electronic data interchange (EDI) */ + /* No Basic transfer mode (BTM) */ + /* No mixed mode (polling) */ + /* No character mode */ + /* No mixed mode (T.4/Annex E) */ + /* No mode 26 (T.505) */ + /* No digital network capability */ + /* No duplex operation */ + /* No JPEG */ + /* No full colour */ + /* No 12bits/pel */ + /* No sub-sampling (1:1:1) */ + /* No custom illuminant */ + /* No custom gamut range */ + if ((s->supported_image_sizes & T30_SUPPORT_US_LETTER_LENGTH)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_NORTH_AMERICAN_LETTER_CAPABLE); + if ((s->supported_image_sizes & T30_SUPPORT_US_LEGAL_LENGTH)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_NORTH_AMERICAN_LEGAL_CAPABLE); + /* No HKM key management */ + /* No RSA key management */ + /* No override */ + /* No HFX40 cipher */ + /* No alternative cipher number 2 */ + /* No alternative cipher number 3 */ + /* No HFX40-I hashing */ + /* No alternative hashing system number 2 */ + /* No alternative hashing system number 3 */ + /* No T.44 (mixed raster content) */ + /* No page length maximum strip size for T.44 (mixed raster content) */ + /* No colour/grey scale 300x300 or 400x400 */ + /* No colour/grey scale 100x100 */ + /* No simple phase C BFT negotiations */ + /* No extended BFT negotiations */ + if ((s->supported_t30_features & T30_SUPPORT_INTERNET_SELECTIVE_POLLING_ADDRESS)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INTERNET_SELECTIVE_POLLING_ADDRESS); + if ((s->supported_t30_features & T30_SUPPORT_INTERNET_ROUTING_ADDRESS)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INTERNET_ROUTING_ADDRESS); + if ((s->supported_resolutions & T30_SUPPORT_600_600_RESOLUTION)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_600_600_CAPABLE); + if ((s->supported_resolutions & T30_SUPPORT_1200_1200_RESOLUTION)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_1200_1200_CAPABLE); + if ((s->supported_resolutions & T30_SUPPORT_300_600_RESOLUTION)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_300_600_CAPABLE); + if ((s->supported_resolutions & T30_SUPPORT_400_800_RESOLUTION)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_400_800_CAPABLE); + if ((s->supported_resolutions & T30_SUPPORT_600_1200_RESOLUTION)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_600_1200_CAPABLE); + /* No colour/grey scale 600x600 */ + /* No colour/grey scale 1200x1200 */ + /* No double sided printing (alternate mode) */ + /* No double sided printing (continuous mode) */ + /* No black and white mixed raster content profile */ + /* No shared data memory */ + /* No T.44 colour space */ + if ((s->iaf & T30_IAF_MODE_FLOW_CONTROL)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T38_FLOW_CONTROL_CAPABLE); + /* No k > 4 */ + if ((s->iaf & T30_IAF_MODE_CONTINUOUS_FLOW)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T38_FAX_CAPABLE); + /* No T.89 profile */ + s->local_dis_dtc_len = 19; + //t30_decode_dis_dtc_dcs(s, s->local_dis_dtc_frame, s->local_dis_dtc_len); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int prune_dis_dtc(t30_state_t *s) +{ + int i; + + /* Find the last octet that is really needed, set the extension bits, and trim the message length */ + for (i = 18; i >= 6; i--) + { + /* Strip the top bit */ + s->local_dis_dtc_frame[i] &= (DISBIT1 | DISBIT2 | DISBIT3 | DISBIT4 | DISBIT5 | DISBIT6 | DISBIT7); + /* Check if there is some real message content here */ + if (s->local_dis_dtc_frame[i]) + break; + } + s->local_dis_dtc_len = i + 1; + /* Fill in any required extension bits */ + s->local_dis_dtc_frame[i] &= ~DISBIT8; + for (i--; i > 4; i--) + s->local_dis_dtc_frame[i] |= DISBIT8; + t30_decode_dis_dtc_dcs(s, s->local_dis_dtc_frame, s->local_dis_dtc_len); + return s->local_dis_dtc_len; +} +/*- End of function --------------------------------------------------------*/ + +static int build_dcs(t30_state_t *s) +{ + int i; + int bad; + + /* Make a DCS frame based on local issues and the latest received DIS/DTC frame. Negotiate + the result based on what both parties can do. */ + s->dcs_frame[0] = ADDRESS_FIELD; + s->dcs_frame[1] = CONTROL_FIELD_FINAL_FRAME; + s->dcs_frame[2] = (uint8_t) (T30_DCS | s->dis_received); + for (i = 3; i < 19; i++) + s->dcs_frame[i] = 0x00; + +#if 0 + /* Check for T.37 simple mode. */ + if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T37)) + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T37); + /* Check for T.38 mode. */ + if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T38)) + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T38); +#endif + + /* Set to required modem rate */ + s->dcs_frame[4] |= fallback_sequence[s->current_fallback].dcs_code; + + /* Select the compression to use. */ + switch (s->line_encoding) + { +#if 0 + case T4_COMPRESSION_ITU_T85: + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T85_MODE); + //set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T85_L0_MODE); + set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21); + break; +#endif + case T4_COMPRESSION_ITU_T6: + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T6_MODE); + set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21); + break; + case T4_COMPRESSION_ITU_T4_2D: + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_2D_CODING); + set_ctrl_bits(s->dcs_frame, s->min_scan_time_code, 21); + break; + case T4_COMPRESSION_ITU_T4_1D: + set_ctrl_bits(s->dcs_frame, s->min_scan_time_code, 21); + break; + default: + set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21); + break; + } + /* We have a file to send, so tell the far end to go into receive mode. */ + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_RECEIVE_FAX_DOCUMENT); + /* Set the Y resolution bits */ + bad = T30_ERR_OK; + switch (s->y_resolution) + { + case T4_Y_RESOLUTION_1200: + switch (s->x_resolution) + { + case T4_X_RESOLUTION_600: + if (!(s->supported_resolutions & T30_SUPPORT_600_1200_RESOLUTION)) + bad = T30_ERR_NORESSUPPORT; + else + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_600_1200); + break; + case T4_X_RESOLUTION_1200: + if (!(s->supported_resolutions & T30_SUPPORT_1200_1200_RESOLUTION)) + bad = T30_ERR_NORESSUPPORT; + else + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_1200_1200); + break; + default: + bad = T30_ERR_NORESSUPPORT; + break; + } + break; + case T4_Y_RESOLUTION_800: + switch (s->x_resolution) + { + case T4_X_RESOLUTION_R16: + if (!(s->supported_resolutions & T30_SUPPORT_400_800_RESOLUTION)) + bad = T30_ERR_NORESSUPPORT; + else + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_400_800); + break; + default: + bad = T30_ERR_NORESSUPPORT; + break; + } + break; + case T4_Y_RESOLUTION_600: + switch (s->x_resolution) + { + case T4_X_RESOLUTION_300: + if (!(s->supported_resolutions & T30_SUPPORT_300_600_RESOLUTION)) + bad = T30_ERR_NORESSUPPORT; + else + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_300_600); + break; + case T4_X_RESOLUTION_600: + if (!(s->supported_resolutions & T30_SUPPORT_600_600_RESOLUTION)) + bad = T30_ERR_NORESSUPPORT; + else + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_600_600); + break; + default: + bad = T30_ERR_NORESSUPPORT; + break; + } + break; + case T4_Y_RESOLUTION_SUPERFINE: + if (!(s->supported_resolutions & T30_SUPPORT_SUPERFINE_RESOLUTION)) + { + bad = T30_ERR_NORESSUPPORT; + } + else + { + switch (s->x_resolution) + { + case T4_X_RESOLUTION_R8: + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_200_400); + break; + case T4_X_RESOLUTION_R16: + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_400_400); + break; + default: + bad = T30_ERR_NORESSUPPORT; + break; + } + } + break; + case T4_Y_RESOLUTION_300: + switch (s->x_resolution) + { + case T4_X_RESOLUTION_300: + if (!(s->supported_resolutions & T30_SUPPORT_300_300_RESOLUTION)) + bad = T30_ERR_NORESSUPPORT; + else + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_300_300); + break; + default: + bad = T30_ERR_NORESSUPPORT; + break; + } + break; + case T4_Y_RESOLUTION_FINE: + if (!(s->supported_resolutions & T30_SUPPORT_FINE_RESOLUTION)) + { + bad = T30_ERR_NORESSUPPORT; + } + else + { + switch (s->x_resolution) + { + case T4_X_RESOLUTION_R8: + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_200_200); + break; + default: + bad = T30_ERR_NORESSUPPORT; + break; + } + } + break; + default: + case T4_Y_RESOLUTION_STANDARD: + switch (s->x_resolution) + { + case T4_X_RESOLUTION_R8: + /* No bits to set for this */ + break; + default: + bad = T30_ERR_NORESSUPPORT; + break; + } + break; + } + if (bad != T30_ERR_OK) + { + s->current_status = bad; + span_log(&s->logging, SPAN_LOG_FLOW, "Image resolution (%d x %d) not acceptable\n", s->x_resolution, s->y_resolution); + return -1; + } + /* Deal with the image width. The X resolution will fall in line with any valid width. */ + /* Low (R4) res widths are not supported in recent versions of T.30 */ + bad = T30_ERR_OK; + /* The following treats a width field of 11 like 10, which does what note 6 of Table 2/T.30 + says we should do with the invalid value 11. */ + switch (s->image_width) + { + case T4_WIDTH_R8_A4: + case T4_WIDTH_300_A4: + case T4_WIDTH_R16_A4: + case T4_WIDTH_600_A4: + case T4_WIDTH_1200_A4: + /* No width related bits need to be set. */ + break; + case T4_WIDTH_R8_B4: + case T4_WIDTH_300_B4: + case T4_WIDTH_R16_B4: + case T4_WIDTH_600_B4: + case T4_WIDTH_1200_B4: + if ((s->far_dis_dtc_frame[5] & (DISBIT2 | DISBIT1)) < 1) + bad = T30_ERR_NOSIZESUPPORT; + else if (!(s->supported_image_sizes & T30_SUPPORT_255MM_WIDTH)) + bad = T30_ERR_NOSIZESUPPORT; + else + set_ctrl_bit(s->dcs_frame, 17); + break; + case T4_WIDTH_R8_A3: + case T4_WIDTH_300_A3: + case T4_WIDTH_R16_A3: + case T4_WIDTH_600_A3: + case T4_WIDTH_1200_A3: + if ((s->far_dis_dtc_frame[5] & (DISBIT2 | DISBIT1)) < 2) + bad = T30_ERR_NOSIZESUPPORT; + else if (!(s->supported_image_sizes & T30_SUPPORT_303MM_WIDTH)) + bad = T30_ERR_NOSIZESUPPORT; + else + set_ctrl_bit(s->dcs_frame, 18); + break; + default: + /* T.30 does not support this width */ + bad = T30_ERR_NOSIZESUPPORT; + break; + } + if (bad != T30_ERR_OK) + { + s->current_status = bad; + span_log(&s->logging, SPAN_LOG_FLOW, "Image width (%d pixels) not an acceptable FAX image width\n", s->image_width); + return -1; + } + switch (s->image_width) + { + case T4_WIDTH_R8_A4: + case T4_WIDTH_R8_B4: + case T4_WIDTH_R8_A3: + /* These are always OK */ + break; + case T4_WIDTH_300_A4: + case T4_WIDTH_300_B4: + case T4_WIDTH_300_A3: + if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_300_300_CAPABLE) && !test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_300_600_CAPABLE)) + bad = T30_ERR_NOSIZESUPPORT; + break; + case T4_WIDTH_R16_A4: + case T4_WIDTH_R16_B4: + case T4_WIDTH_R16_A3: + if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_400_400_CAPABLE)) + bad = T30_ERR_NOSIZESUPPORT; + break; + case T4_WIDTH_600_A4: + case T4_WIDTH_600_B4: + case T4_WIDTH_600_A3: + if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_600_600_CAPABLE) && !test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_600_1200_CAPABLE)) + bad = T30_ERR_NOSIZESUPPORT; + break; + case T4_WIDTH_1200_A4: + case T4_WIDTH_1200_B4: + case T4_WIDTH_1200_A3: + if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_1200_1200_CAPABLE)) + bad = T30_ERR_NOSIZESUPPORT; + break; + default: + /* T.30 does not support this width */ + bad = T30_ERR_NOSIZESUPPORT; + break; + } + if (bad != T30_ERR_OK) + { + s->current_status = bad; + span_log(&s->logging, SPAN_LOG_FLOW, "Image width (%d pixels) not an acceptable FAX image width\n", s->image_width); + return -1; + } + /* Deal with the image length */ + /* If the other end supports unlimited length, then use that. Otherwise, if the other end supports + B4 use that, as its longer than the default A4 length. */ + if (test_ctrl_bit(s->far_dis_dtc_frame, 20)) + set_ctrl_bit(s->dcs_frame, 20); + else if (test_ctrl_bit(s->far_dis_dtc_frame, 19)) + set_ctrl_bit(s->dcs_frame, 19); + + if (s->error_correcting_mode) + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_ECM); + + if ((s->iaf & T30_IAF_MODE_FLOW_CONTROL) && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T38_FLOW_CONTROL_CAPABLE)) + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T38_FLOW_CONTROL_CAPABLE); + if ((s->iaf & T30_IAF_MODE_CONTINUOUS_FLOW) && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T38_FAX_CAPABLE)) + { + /* Clear the modem type bits, in accordance with note 77 of Table 2/T.30 */ + clr_ctrl_bit(s->local_dis_dtc_frame, 11); + clr_ctrl_bit(s->local_dis_dtc_frame, 12); + clr_ctrl_bit(s->local_dis_dtc_frame, 13); + clr_ctrl_bit(s->local_dis_dtc_frame, 14); + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T38_FAX_MODE); + } + s->dcs_len = 19; + //t30_decode_dis_dtc_dcs(s, s->dcs_frame, s->dcs_len); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int prune_dcs(t30_state_t *s) +{ + int i; + + /* Find the last octet that is really needed, set the extension bits, and trim the message length */ + for (i = 18; i >= 6; i--) + { + /* Strip the top bit */ + s->dcs_frame[i] &= (DISBIT1 | DISBIT2 | DISBIT3 | DISBIT4 | DISBIT5 | DISBIT6 | DISBIT7); + /* Check if there is some real message content here */ + if (s->dcs_frame[i]) + break; + } + s->dcs_len = i + 1; + /* Fill in any required extension bits */ + s->local_dis_dtc_frame[i] &= ~DISBIT8; + for (i-- ; i > 4; i--) + s->dcs_frame[i] |= DISBIT8; + t30_decode_dis_dtc_dcs(s, s->dcs_frame, s->dcs_len); + return s->dcs_len; +} +/*- End of function --------------------------------------------------------*/ + +static int step_fallback_entry(t30_state_t *s) +{ + int min_row_bits; + + while (fallback_sequence[++s->current_fallback].which) + { + if ((fallback_sequence[s->current_fallback].which & s->current_permitted_modems)) + break; + } + if (fallback_sequence[s->current_fallback].which == 0) + return -1; + /* TODO: This only sets the minimum row time for future pages. It doesn't fix up the + current page, though it is benign - fallback will only result in an excessive + minimum. */ + min_row_bits = set_min_scan_time_code(s); + t4_tx_set_min_row_bits(&s->t4, min_row_bits); + /* We need to rebuild the DCS message we will send. */ + build_dcs(s); + return s->current_fallback; +} +/*- End of function --------------------------------------------------------*/ + +static int find_fallback_entry(int dcs_code) +{ + int i; + + /* The table is short, and not searched often, so a brain-dead linear scan seems OK */ + for (i = 0; fallback_sequence[i].bit_rate; i++) + { + if (fallback_sequence[i].dcs_code == dcs_code) + break; + } + if (fallback_sequence[i].bit_rate == 0) + return -1; + return i; +} +/*- End of function --------------------------------------------------------*/ + +static void send_dcn(t30_state_t *s) +{ + queue_phase(s, T30_PHASE_D_TX); + set_state(s, T30_STATE_C); + send_simple_frame(s, T30_DCN); +} +/*- End of function --------------------------------------------------------*/ + +static void return_to_phase_b(t30_state_t *s, int with_fallback) +{ + /* This is what we do after things like T30_EOM is exchanged. */ +#if 0 + if (step_fallback_entry(s) < 0) + { + /* We have fallen back as far as we can go. Give up. */ + s->current_fallback = 0; + s->current_status = T30_ERR_CANNOT_TRAIN; + send_dcn(s); + } + else + { + if (s->calling_party) + set_state(s, T30_STATE_T); + else + set_state(s, T30_STATE_R); + } +#else + if (s->calling_party) + set_state(s, T30_STATE_T); + else + set_state(s, T30_STATE_R); +#endif +} +/*- End of function --------------------------------------------------------*/ + +static int send_dis_or_dtc_sequence(t30_state_t *s, int start) +{ + /* (NSF) (CSI) DIS */ + /* (NSC) (CIG) (PWD) (SEP) (PSA) (CIA) (ISP) DTC */ + if (start) + { + set_dis_or_dtc(s); + set_state(s, T30_STATE_R); + s->step = 0; + } + if (!s->dis_received) + { + /* DIS sequence */ + switch (s->step) + { + case 0: + s->step++; + if (send_nsf_frame(s)) + break; + /* Fall through */ + case 1: + s->step++; + if (send_ident_frame(s, T30_CSI)) + break; + /* Fall through */ + case 2: + s->step++; + prune_dis_dtc(s); + send_frame(s, s->local_dis_dtc_frame, s->local_dis_dtc_len); + break; + case 3: + s->step++; + /* Shut down HDLC transmission. */ + if (s->send_hdlc_handler) + s->send_hdlc_handler(s->send_hdlc_user_data, NULL, 0); + break; + default: + return -1; + } + } + else + { + /* DTC sequence */ + switch (s->step) + { + case 0: + s->step++; + if (send_nsc_frame(s)) + break; + /* Fall through */ + case 1: + s->step++; + if (send_ident_frame(s, T30_CIG)) + break; + /* Fall through */ + case 2: + s->step++; + if (send_pwd_frame(s)) + break; + /* Fall through */ + case 3: + s->step++; + if (send_sep_frame(s)) + break; + /* Fall through */ + case 4: + s->step++; + if (send_psa_frame(s)) + break; + /* Fall through */ + case 5: + s->step++; + if (send_cia_frame(s)) + break; + /* Fall through */ + case 6: + s->step++; + if (send_isp_frame(s)) + break; + /* Fall through */ + case 7: + s->step++; + prune_dis_dtc(s); + send_frame(s, s->local_dis_dtc_frame, s->local_dis_dtc_len); + break; + case 8: + s->step++; + /* Shut down HDLC transmission. */ + if (s->send_hdlc_handler) + s->send_hdlc_handler(s->send_hdlc_user_data, NULL, 0); + break; + default: + return -1; + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int send_dcs_sequence(t30_state_t *s, int start) +{ + /* (NSS) (TSI) (SUB) (SID) (TSA) (IRA) DCS */ + /* Schedule training after the messages */ + if (start) + { + prune_dcs(s); + set_state(s, T30_STATE_D); + s->step = 0; + } + switch (s->step) + { + case 0: + s->step++; + if (send_nss_frame(s)) + break; + /* Fall through */ + case 1: + s->step++; + if (send_ident_frame(s, T30_TSI)) + break; + /* Fall through */ + case 2: + s->step++; + if (send_sub_frame(s)) + break; + /* Fall through */ + case 3: + s->step++; + if (send_sid_frame(s)) + break; + /* Fall through */ + case 4: + s->step++; + if (send_tsa_frame(s)) + break; + /* Fall through */ + case 5: + s->step++; + if (send_ira_frame(s)) + break; + /* Fall through */ + case 6: + s->step++; + prune_dcs(s); + send_frame(s, s->dcs_frame, s->dcs_len); + break; + case 7: + s->step++; + /* Shut down HDLC transmission. */ + if (s->send_hdlc_handler) + s->send_hdlc_handler(s->send_hdlc_user_data, NULL, 0); + break; + default: + return -1; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int send_cfr_sequence(t30_state_t *s, int start) +{ + /* (CSA) CFR */ + /* CFR is usually a simple frame, but can become a sequence with Internet + FAXing. */ + send_simple_frame(s, T30_CFR); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void disconnect(t30_state_t *s) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "Disconnecting\n"); + /* Make sure any FAX in progress is tidied up. If the tidying up has + already happened, repeating it here is harmless. */ + switch (s->operation_in_progress) + { + case OPERATION_IN_PROGRESS_T4_TX: + t4_tx_release(&s->t4); + break; + case OPERATION_IN_PROGRESS_T4_RX: + t4_rx_release(&s->t4); + break; + } + s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + s->timer_t0_t1 = 0; + s->timer_t2_t4 = 0; + s->timer_t3 = 0; + s->timer_t5 = 0; + set_phase(s, T30_PHASE_E); + set_state(s, T30_STATE_B); +} +/*- End of function --------------------------------------------------------*/ + +static int set_min_scan_time_code(t30_state_t *s) +{ + /* Translation between the codes for the minimum scan times the other end needs, + and the codes for what we say will be used. We need 0 minimum. */ + static const uint8_t translate_min_scan_time[3][8] = + { + {T30_MIN_SCAN_20MS, T30_MIN_SCAN_5MS, T30_MIN_SCAN_10MS, T30_MIN_SCAN_20MS, T30_MIN_SCAN_40MS, T30_MIN_SCAN_40MS, T30_MIN_SCAN_10MS, T30_MIN_SCAN_0MS}, /* normal */ + {T30_MIN_SCAN_20MS, T30_MIN_SCAN_5MS, T30_MIN_SCAN_10MS, T30_MIN_SCAN_10MS, T30_MIN_SCAN_40MS, T30_MIN_SCAN_20MS, T30_MIN_SCAN_5MS, T30_MIN_SCAN_0MS}, /* fine */ + {T30_MIN_SCAN_10MS, T30_MIN_SCAN_5MS, T30_MIN_SCAN_5MS, T30_MIN_SCAN_5MS, T30_MIN_SCAN_20MS, T30_MIN_SCAN_10MS, T30_MIN_SCAN_5MS, T30_MIN_SCAN_0MS} /* superfine, when half fine time is selected */ + }; + /* Translation between the codes for the minimum scan time we will use, and milliseconds. */ + static const int min_scan_times[8] = + { + 20, 5, 10, 0, 40, 0, 0, 0 + }; + int min_bits_field; + + /* Set the minimum scan time bits */ + if (s->error_correcting_mode) + min_bits_field = T30_MIN_SCAN_0MS; + else + min_bits_field = (s->far_dis_dtc_frame[5] >> 4) & 7; + switch (s->y_resolution) + { + case T4_Y_RESOLUTION_SUPERFINE: + if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_400_CAPABLE)) + { + s->current_status = T30_ERR_NORESSUPPORT; + span_log(&s->logging, SPAN_LOG_FLOW, "Remote FAX does not support super-fine resolution.\n"); + return -1; + } + s->min_scan_time_code = translate_min_scan_time[(test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_MIN_SCAN_TIME_HALVES)) ? 2 : 1][min_bits_field]; + break; + case T4_Y_RESOLUTION_FINE: + if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE)) + { + s->current_status = T30_ERR_NORESSUPPORT; + span_log(&s->logging, SPAN_LOG_FLOW, "Remote FAX does not support fine resolution.\n"); + return -1; + } + s->min_scan_time_code = translate_min_scan_time[1][min_bits_field]; + break; + default: + case T4_Y_RESOLUTION_STANDARD: + s->min_scan_time_code = translate_min_scan_time[0][min_bits_field]; + break; + } + if (!s->error_correcting_mode && (s->iaf & T30_IAF_MODE_NO_FILL_BITS)) + return 0; + return fallback_sequence[s->current_fallback].bit_rate*min_scan_times[s->min_scan_time_code]/1000; +} +/*- End of function --------------------------------------------------------*/ + +static int start_sending_document(t30_state_t *s) +{ + int min_row_bits; + + if (s->tx_file[0] == '\0') + { + /* There is nothing to send */ + span_log(&s->logging, SPAN_LOG_FLOW, "No document to send\n"); + return -1; + } + span_log(&s->logging, SPAN_LOG_FLOW, "Start sending document\n"); + if (t4_tx_init(&s->t4, s->tx_file, s->tx_start_page, s->tx_stop_page) == NULL) + { + span_log(&s->logging, SPAN_LOG_WARNING, "Cannot open source TIFF file '%s'\n", s->tx_file); + s->current_status = T30_ERR_FILEERROR; + return -1; + } + s->operation_in_progress = OPERATION_IN_PROGRESS_T4_TX; + t4_tx_get_pages_in_file(&s->t4); + t4_tx_set_tx_encoding(&s->t4, s->line_encoding); + t4_tx_set_local_ident(&s->t4, s->tx_info.ident); + t4_tx_set_header_info(&s->t4, s->header_info); + + s->x_resolution = t4_tx_get_x_resolution(&s->t4); + s->y_resolution = t4_tx_get_y_resolution(&s->t4); + /* The minimum scan time to be used can't be evaluated until we know the Y resolution, and + must be evaluated before the minimum scan row bits can be evaluated. */ + if ((min_row_bits = set_min_scan_time_code(s)) < 0) + { + t4_tx_release(&s->t4); + s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + return -1; + } + span_log(&s->logging, SPAN_LOG_FLOW, "Minimum bits per row will be %d\n", min_row_bits); + t4_tx_set_min_row_bits(&s->t4, min_row_bits); + + if (tx_start_page(s)) + return -1; + s->image_width = t4_tx_get_image_width(&s->t4); + if (s->error_correcting_mode) + { + if (get_partial_ecm_page(s) == 0) + span_log(&s->logging, SPAN_LOG_WARNING, "No image data to send\n"); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int restart_sending_document(t30_state_t *s) +{ + t4_tx_restart_page(&s->t4); + s->retries = 0; + s->ecm_block = 0; + send_dcs_sequence(s, TRUE); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int start_receiving_document(t30_state_t *s) +{ + if (s->rx_file[0] == '\0') + { + /* There is nothing to receive to */ + span_log(&s->logging, SPAN_LOG_FLOW, "No document to receive\n"); + return -1; + } + span_log(&s->logging, SPAN_LOG_FLOW, "Start receiving document\n"); + queue_phase(s, T30_PHASE_B_TX); + s->ecm_block = 0; + send_dis_or_dtc_sequence(s, TRUE); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void unexpected_non_final_frame(t30_state_t *s, const uint8_t *msg, int len) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "Unexpected %s frame in state %d\n", t30_frametype(msg[2]), s->state); + if (s->current_status == T30_ERR_OK) + s->current_status = T30_ERR_UNEXPECTED; +} +/*- End of function --------------------------------------------------------*/ + +static void unexpected_final_frame(t30_state_t *s, const uint8_t *msg, int len) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "Unexpected %s frame in state %d\n", t30_frametype(msg[2]), s->state); + if (s->current_status == T30_ERR_OK) + s->current_status = T30_ERR_UNEXPECTED; + send_dcn(s); +} +/*- End of function --------------------------------------------------------*/ + +static void unexpected_frame_length(t30_state_t *s, const uint8_t *msg, int len) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "Unexpected %s frame length - %d\n", t30_frametype(msg[0]), len); + if (s->current_status == T30_ERR_OK) + s->current_status = T30_ERR_UNEXPECTED; + send_dcn(s); +} +/*- End of function --------------------------------------------------------*/ + +static int process_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len) +{ + int new_status; + + t30_decode_dis_dtc_dcs(s, msg, len); + if (len < 6) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Short DIS/DTC frame\n"); + return -1; + } + + if (msg[2] == T30_DIS) + s->dis_received = TRUE; + /* Make a local copy of the message, padded to the maximum possible length with zeros. This allows + us to simply pick out the bits, without worrying about whether they were set from the remote side. */ + s->far_dis_dtc_len = (len > T30_MAX_DIS_DTC_DCS_LEN) ? T30_MAX_DIS_DTC_DCS_LEN : len; + memcpy(s->far_dis_dtc_frame, msg, s->far_dis_dtc_len); + if (s->far_dis_dtc_len < T30_MAX_DIS_DTC_DCS_LEN) + memset(s->far_dis_dtc_frame + s->far_dis_dtc_len, 0, T30_MAX_DIS_DTC_DCS_LEN - s->far_dis_dtc_len); + s->error_correcting_mode = (s->ecm_allowed && (s->far_dis_dtc_frame[6] & DISBIT3) != 0); + /* 256 octets per ECM frame */ + s->octets_per_ecm_frame = 256; + /* Select the compression to use. */ +#if 0 + if (s->error_correcting_mode && (s->supported_compressions & T30_SUPPORT_T85_COMPRESSION) && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE)) + { + s->line_encoding = T4_COMPRESSION_ITU_T85; + } + else if (s->error_correcting_mode && (s->supported_compressions & T30_SUPPORT_T6_COMPRESSION) && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE)) +#else + if (s->error_correcting_mode && (s->supported_compressions & T30_SUPPORT_T6_COMPRESSION) && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE)) +#endif + { + s->line_encoding = T4_COMPRESSION_ITU_T6; + } + else if ((s->supported_compressions & T30_SUPPORT_T4_2D_COMPRESSION) && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE)) + { + s->line_encoding = T4_COMPRESSION_ITU_T4_2D; + } + else + { + s->line_encoding = T4_COMPRESSION_ITU_T4_1D; + } + span_log(&s->logging, SPAN_LOG_FLOW, "Selected compression %s (%d)\n", t4_encoding_to_str(s->line_encoding), s->line_encoding); + switch (s->far_dis_dtc_frame[4] & (DISBIT6 | DISBIT5 | DISBIT4 | DISBIT3)) + { + case (DISBIT6 | DISBIT4 | DISBIT3): + if ((s->supported_modems & T30_SUPPORT_V17)) + { + s->current_permitted_modems = T30_SUPPORT_V17 | T30_SUPPORT_V29 | T30_SUPPORT_V27TER; + s->current_fallback = T30_V17_FALLBACK_START; + break; + } + /* Fall through */ + case (DISBIT4 | DISBIT3): + if ((s->supported_modems & T30_SUPPORT_V29)) + { + s->current_permitted_modems = T30_SUPPORT_V29 | T30_SUPPORT_V27TER; + s->current_fallback = T30_V29_FALLBACK_START; + break; + } + /* Fall through */ + case DISBIT4: + s->current_permitted_modems = T30_SUPPORT_V27TER; + s->current_fallback = T30_V27TER_FALLBACK_START; + break; + case 0: + s->current_permitted_modems = T30_SUPPORT_V27TER; + s->current_fallback = T30_V27TER_FALLBACK_START + 1; + break; + case DISBIT3: + if ((s->supported_modems & T30_SUPPORT_V29)) + { + /* TODO: this doesn't allow for skipping the V.27ter modes */ + s->current_permitted_modems = T30_SUPPORT_V29; + s->current_fallback = T30_V29_FALLBACK_START; + break; + } + /* Fall through */ + default: + span_log(&s->logging, SPAN_LOG_FLOW, "Remote does not support a compatible modem\n"); + /* We cannot talk to this machine! */ + s->current_status = T30_ERR_INCOMPATIBLE; + return -1; + } + if (s->phase_b_handler) + { + new_status = s->phase_b_handler(s, s->phase_b_user_data, msg[2]); + if (new_status != T30_ERR_OK) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Application rejected DIS/DTC - '%s'\n", t30_completion_code_to_str(new_status)); + s->current_status = new_status; + /* TODO: If FNV is allowed, process it here */ + send_dcn(s); + return -1; + } + } + queue_phase(s, T30_PHASE_B_TX); + /* Try to send something */ + if (s->tx_file[0]) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Trying to send file '%s'\n", s->tx_file); + if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_READY_TO_RECEIVE_FAX_DOCUMENT)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "%s far end cannot receive\n", t30_frametype(msg[2])); + s->current_status = T30_ERR_RX_INCAPABLE; + send_dcn(s); + } + if (start_sending_document(s)) + { + send_dcn(s); + return -1; + } + if (build_dcs(s)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "The far end is incompatible\n", s->tx_file); + send_dcn(s); + return -1; + } + s->retries = 0; + send_dcs_sequence(s, TRUE); + return 0; + } + span_log(&s->logging, SPAN_LOG_FLOW, "%s nothing to send\n", t30_frametype(msg[2])); + /* ... then try to receive something */ + if (s->rx_file[0]) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Trying to receive file '%s'\n", s->rx_file); + if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_READY_TO_TRANSMIT_FAX_DOCUMENT)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "%s far end cannot transmit\n", t30_frametype(msg[2])); + s->current_status = T30_ERR_TX_INCAPABLE; + send_dcn(s); + return -1; + } + if (start_receiving_document(s)) + { + send_dcn(s); + return -1; + } + if (set_dis_or_dtc(s)) + { + s->current_status = T30_ERR_INCOMPATIBLE; + send_dcn(s); + return -1; + } + s->retries = 0; + send_dis_or_dtc_sequence(s, TRUE); + return 0; + } + span_log(&s->logging, SPAN_LOG_FLOW, "%s nothing to receive\n", t30_frametype(msg[2])); + /* There is nothing to do, or nothing we are able to do. */ + send_dcn(s); + return -1; +} +/*- End of function --------------------------------------------------------*/ + +static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) +{ + static const int widths[6][4] = + { + { T4_WIDTH_R4_A4, T4_WIDTH_R4_B4, T4_WIDTH_R4_A3, -1}, /* R4 resolution - no longer used in recent versions of T.30 */ + { T4_WIDTH_R8_A4, T4_WIDTH_R8_B4, T4_WIDTH_R8_A3, -1}, /* R8 resolution */ + { T4_WIDTH_300_A4, T4_WIDTH_300_B4, T4_WIDTH_300_A3, -1}, /* 300/inch resolution */ + { T4_WIDTH_R16_A4, T4_WIDTH_R16_B4, T4_WIDTH_R16_A3, -1}, /* R16 resolution */ + { T4_WIDTH_600_A4, T4_WIDTH_600_B4, T4_WIDTH_600_A3, -1}, /* 600/inch resolution */ + {T4_WIDTH_1200_A4, T4_WIDTH_1200_B4, T4_WIDTH_1200_A3, -1} /* 1200/inch resolution */ + }; + uint8_t dcs_frame[T30_MAX_DIS_DTC_DCS_LEN]; + int i; + int new_status; + + t30_decode_dis_dtc_dcs(s, msg, len); + + /* Check DCS frame from remote */ + if (len < 6) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Short DCS frame\n"); + return -1; + } + + /* Make an ASCII string format copy of the message, for logging in the + received file. This string does not include the frame header octets. */ + sprintf(s->rx_dcs_string, "%02X", bit_reverse8(msg[3])); + for (i = 4; i < len; i++) + sprintf(s->rx_dcs_string + 3*i - 10, " %02X", bit_reverse8(msg[i])); + /* Make a local copy of the message, padded to the maximum possible length with zeros. This allows + us to simply pick out the bits, without worrying about whether they were set from the remote side. */ + if (len > T30_MAX_DIS_DTC_DCS_LEN) + { + memcpy(dcs_frame, msg, T30_MAX_DIS_DTC_DCS_LEN); + } + else + { + memcpy(dcs_frame, msg, len); + if (len < T30_MAX_DIS_DTC_DCS_LEN) + memset(dcs_frame + len, 0, T30_MAX_DIS_DTC_DCS_LEN - len); + } + + s->octets_per_ecm_frame = test_ctrl_bit(dcs_frame, T30_DCS_BIT_64_OCTET_ECM_FRAMES) ? 256 : 64; + + if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_1200_1200)) + s->x_resolution = T4_X_RESOLUTION_1200; + else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_600_600) || test_ctrl_bit(dcs_frame, T30_DCS_BIT_600_1200)) + s->x_resolution = T4_X_RESOLUTION_600; + else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_400_400) || test_ctrl_bit(dcs_frame, T30_DCS_BIT_400_800)) + s->x_resolution = T4_X_RESOLUTION_R16; + else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_300) || test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_600)) + s->x_resolution = T4_X_RESOLUTION_300; + else + s->x_resolution = T4_X_RESOLUTION_R8; + + if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_1200_1200) || test_ctrl_bit(dcs_frame, T30_DCS_BIT_600_1200)) + s->y_resolution = T4_Y_RESOLUTION_1200; + else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_400_800)) + s->y_resolution = T4_Y_RESOLUTION_800; + else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_600_600) || test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_600)) + s->y_resolution = T4_Y_RESOLUTION_600; + else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_200_400) || test_ctrl_bit(dcs_frame, T30_DCS_BIT_400_400)) + s->y_resolution = T4_Y_RESOLUTION_SUPERFINE; + else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_300)) + s->y_resolution = T4_Y_RESOLUTION_300; + else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_200_200)) + s->y_resolution = T4_Y_RESOLUTION_FINE; + else + s->y_resolution = T4_Y_RESOLUTION_STANDARD; + + if (s->x_resolution == T4_X_RESOLUTION_1200) + i = 5; + else if (s->x_resolution == T4_X_RESOLUTION_600) + i = 4; + else if (s->x_resolution == T4_X_RESOLUTION_R16) + i = 3; + else if (s->x_resolution == T4_X_RESOLUTION_300) + i = 2; + else if (s->x_resolution == T4_X_RESOLUTION_R4) + i = 0; + else + i = 1; + + s->image_width = widths[i][dcs_frame[5] & (DISBIT2 | DISBIT1)]; + + /* Check which compression we will use. */ +#if 0 + if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T85_MODE)) + s->line_encoding = T4_COMPRESSION_ITU_T85; + else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T6_MODE)) +#else + if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T6_MODE)) +#endif + s->line_encoding = T4_COMPRESSION_ITU_T6; + else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_2D_CODING)) + s->line_encoding = T4_COMPRESSION_ITU_T4_2D; + else + s->line_encoding = T4_COMPRESSION_ITU_T4_1D; + span_log(&s->logging, SPAN_LOG_FLOW, "Selected compression %d\n", s->line_encoding); + if (!test_ctrl_bit(dcs_frame, T30_DCS_BIT_RECEIVE_FAX_DOCUMENT)) + span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Remote is not requesting receive in DCS\n"); + + if ((s->current_fallback = find_fallback_entry(dcs_frame[4] & (DISBIT6 | DISBIT5 | DISBIT4 | DISBIT3))) < 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Remote asked for a modem standard we do not support\n"); + return -1; + } + s->error_correcting_mode = (test_ctrl_bit(dcs_frame, T30_DCS_BIT_ECM) != 0); + + if (s->phase_b_handler) + { + new_status = s->phase_b_handler(s, s->phase_b_user_data, msg[2]); + if (new_status != T30_ERR_OK) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Application rejected DCS - '%s'\n", t30_completion_code_to_str(new_status)); + s->current_status = new_status; + /* TODO: If FNV is allowed, process it here */ + send_dcn(s); + return -1; + } + } + /* Start document reception */ + span_log(&s->logging, + SPAN_LOG_FLOW, + "Get document at %dbps, modem %d\n", + fallback_sequence[s->current_fallback].bit_rate, + fallback_sequence[s->current_fallback].modem_type); + if (s->rx_file[0] == '\0') + { + span_log(&s->logging, SPAN_LOG_FLOW, "No document to receive\n"); + s->current_status = T30_ERR_FILEERROR; + send_dcn(s); + return -1; + } + if (!s->in_message) + { + if (t4_rx_init(&s->t4, s->rx_file, s->output_encoding) == NULL) + { + span_log(&s->logging, SPAN_LOG_WARNING, "Cannot open target TIFF file '%s'\n", s->rx_file); + s->current_status = T30_ERR_FILEERROR; + send_dcn(s); + return -1; + } + s->operation_in_progress = OPERATION_IN_PROGRESS_T4_RX; + } + if (!(s->iaf & T30_IAF_MODE_NO_TCF)) + { + /* TCF is always sent with long training */ + s->short_train = FALSE; + set_state(s, T30_STATE_F_TCF); + queue_phase(s, T30_PHASE_C_NON_ECM_RX); + timer_t2_start(s); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int send_deferred_pps_response(t30_state_t *s) +{ + queue_phase(s, T30_PHASE_D_TX); + if (s->ecm_first_bad_frame >= s->ecm_frames) + { + /* Everything was OK. We can accept the data and move on. */ + t30_ecm_commit_partial_page(s); + switch (s->last_pps_fcf2) + { + case T30_NULL: + /* We can confirm this partial page. */ + break; + default: + /* We can confirm the whole page. */ + s->next_rx_step = s->last_pps_fcf2; + rx_end_page(s); + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, s->last_pps_fcf2); + rx_start_page(s); + break; + } + set_state(s, T30_STATE_F_POST_RCP_MCF); + send_simple_frame(s, T30_MCF); + } + else + { + /* We need to send the PPR frame we have created, to try to fill in the missing/bad data. */ + set_state(s, T30_STATE_F_POST_RCP_PPR); + s->ecm_frame_map[0] = ADDRESS_FIELD; + s->ecm_frame_map[1] = CONTROL_FIELD_FINAL_FRAME; + s->ecm_frame_map[2] = (uint8_t) (T30_PPR | s->dis_received); + send_frame(s, s->ecm_frame_map, 3 + 32); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len) +{ + int page; + int block; + int frames; + int i; + int j; + int frame_no; + + if (len < 7) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Bad PPS message length %d.\n", len); + return -1; + } + s->last_pps_fcf2 = msg[3] & 0xFE; + page = msg[4]; + block = msg[5]; + + /* The frames count is not well specified in T.30. In practice it seems it might be the + number of frames in the current block, or it might be the number of frames in the + current burst of transmission. For a burst of resent frames this would make it smaller + than the actual size of the block. If we only accept the number when it exceeds + previous values, we should get the real number of frames in the block. */ + frames = msg[6] + 1; + if (s->ecm_frames < 0) + { + /* First time. Take the number and believe in it. */ + s->ecm_frames = frames; + } + else + { + /* If things have gone wrong, the far end might try to send us zero FCD + frames. It can't represent zero in the block count field, so it might + put zero there, or it might simplistically insert (blocks - 1), and put + 0xFF there. Beware of this. */ + if (frames == 0xFF) + { + /* This is probably zero, erroneously rolled over to the maximum count */ + frames = 0; + } + } + span_log(&s->logging, SPAN_LOG_FLOW, "Received PPS + %s - page %d, block %d, %d frames\n", t30_frametype(msg[3]), page, block, frames); + if (page != s->rx_page_number) + { + span_log(&s->logging, SPAN_LOG_FLOW, "ECM rx page mismatch - expected %d, but received %d.\n", s->rx_page_number, page); + } + if (block != s->ecm_block) + { + span_log(&s->logging, SPAN_LOG_FLOW, "ECM rx block mismatch - expected %d, but received %d.\n", s->ecm_block, block); + } + /* Build a bit map of which frames we now have stored OK */ + s->ecm_first_bad_frame = 256; + for (i = 0; i < 32; i++) + { + s->ecm_frame_map[i + 3] = 0; + for (j = 0; j < 8; j++) + { + frame_no = (i << 3) + j; + if (s->ecm_len[frame_no] < 0) + { + s->ecm_frame_map[i + 3] |= (1 << j); + if (frame_no < s->ecm_first_bad_frame) + s->ecm_first_bad_frame = frame_no; + if (frame_no < s->ecm_frames) + s->error_correcting_mode_retries++; + } + } + } + /* Are there any bad frames, or does our scan represent things being OK? */ + switch (s->last_pps_fcf2) + { + case T30_NULL: + case T30_EOP: + case T30_PRI_EOP: + case T30_EOM: + case T30_PRI_EOM: + case T30_EOS: + case T30_MPS: + case T30_PRI_MPS: + if (s->receiver_not_ready_count > 0) + { + s->receiver_not_ready_count--; + queue_phase(s, T30_PHASE_D_TX); + set_state(s, T30_STATE_F_POST_RCP_RNR); + send_simple_frame(s, T30_RNR); + } + else + { + send_deferred_pps_response(s); + } + break; + default: + unexpected_final_frame(s, msg, len); + break; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void process_rx_ppr(t30_state_t *s, const uint8_t *msg, int len) +{ + int i; + int j; + int frame_no; + uint8_t frame[4]; + + if (len != 3 + 32) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for PPR bits - %d\n", len); + /* TODO: probably should send DCN */ + return; + } + /* Check which frames are OK, and mark them as OK. */ + for (i = 0; i < 32; i++) + { + for (j = 0; j < 8; j++) + { + frame_no = (i << 3) + j; + /* Tick off the frames they are not complaining about as OK */ + if ((msg[i + 3] & (1 << j)) == 0) + { + if (s->ecm_len[frame_no] >= 0) + s->ecm_progress++; + s->ecm_len[frame_no] = -1; + } + else + { + if (frame_no < s->ecm_frames) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Frame %d to be resent\n", frame_no); + s->error_correcting_mode_retries++; + } +#if 0 + /* Diagnostic: See if the other end is complaining about something we didn't even send this time. */ + if (s->ecm_len[frame_no] < 0) + span_log(&s->logging, SPAN_LOG_FLOW, "PPR contains complaint about frame %d, which was not sent\n", frame_no); +#endif + } + } + } + if (++s->ppr_count >= PPR_LIMIT_BEFORE_CTC_OR_EOR) + { + /* Continue to correct? */ + /* Continue only if we have been making progress */ + s->ppr_count = 0; + if (s->ecm_progress) + { + s->ecm_progress = 0; + queue_phase(s, T30_PHASE_D_TX); + set_state(s, T30_STATE_IV_CTC); + send_simple_frame(s, T30_CTC); + } + else + { + set_state(s, T30_STATE_IV_EOR); + queue_phase(s, T30_PHASE_D_TX); + frame[0] = ADDRESS_FIELD; + frame[1] = CONTROL_FIELD_FINAL_FRAME; + frame[2] = (uint8_t) (T30_EOR | s->dis_received); + frame[3] = (s->ecm_at_page_end) ? ((uint8_t) (s->next_tx_step | s->dis_received)) : T30_NULL; + span_log(&s->logging, SPAN_LOG_FLOW, "Sending EOR + %s\n", t30_frametype(frame[3])); + send_frame(s, frame, 4); + } + } + else + { + /* Initiate resending of the remainder of the frames. */ + set_state(s, T30_STATE_IV); + queue_phase(s, T30_PHASE_C_ECM_TX); + send_first_ecm_frame(s); + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_rx_fcd(t30_state_t *s, const uint8_t *msg, int len) +{ + int frame_no; + + /* Facsimile coded data */ + switch (s->state) + { + case T30_STATE_F_DOC_ECM: + if (len <= 4 + 256) + { + frame_no = msg[3]; + /* Just store the actual image data, and record its length */ + span_log(&s->logging, SPAN_LOG_FLOW, "Storing ECM frame %d, length %d\n", frame_no, len - 4); + memcpy(&s->ecm_data[frame_no][0], &msg[4], len - 4); + s->ecm_len[frame_no] = (int16_t) (len - 4); + /* In case we are just after a CTC/CTR exchange, which kicked us back to long training */ + s->short_train = TRUE; + } + else + { + unexpected_frame_length(s, msg, len); + } + /* We have received something, so any missing carrier status is out of date */ + if (s->current_status == T30_ERR_RX_NOCARRIER) + s->current_status = T30_ERR_OK; + break; + default: + unexpected_non_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_rx_rcp(t30_state_t *s, const uint8_t *msg, int len) +{ + /* Return to control for partial page. These might come through with or without the final frame tag. + Here we deal with the "no final frame tag" case. */ + switch (s->state) + { + case T30_STATE_F_DOC_ECM: + set_state(s, T30_STATE_F_POST_DOC_ECM); + queue_phase(s, T30_PHASE_D_RX); + timer_t2_start(s); + /* We have received something, so any missing carrier status is out of date */ + if (s->current_status == T30_ERR_RX_NOCARRIER) + s->current_status = T30_ERR_OK; + break; + case T30_STATE_F_POST_DOC_ECM: + /* Just ignore this. It must be an extra RCP. Several are usually sent, to maximise the chance + of receiving a correct one. */ + break; + default: + unexpected_non_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_rx_fnv(t30_state_t *s, const uint8_t *msg, int len) +{ + logging_state_t *log; + const char *x; + + /* Field not valid */ + /* TODO: analyse the message, as per 5.3.6.2.13 */ + if (!span_log_test(&s->logging, SPAN_LOG_FLOW)) + return; + log = &s->logging; + + if ((msg[3] & 0x01)) + span_log(log, SPAN_LOG_FLOW, " Incorrect password (PWD).\n"); + if ((msg[3] & 0x02)) + span_log(log, SPAN_LOG_FLOW, " Selective polling reference (SEP) not known.\n"); + if ((msg[3] & 0x04)) + span_log(log, SPAN_LOG_FLOW, " Sub-address (SUB) not known.\n"); + if ((msg[3] & 0x08)) + span_log(log, SPAN_LOG_FLOW, " Sender identity (SID) not known.\n"); + if ((msg[3] & 0x10)) + span_log(log, SPAN_LOG_FLOW, " Secure fax error.\n"); + if ((msg[3] & 0x20)) + span_log(log, SPAN_LOG_FLOW, " Transmitting subscriber identity (TSI) not accepted.\n"); + if ((msg[3] & 0x40)) + span_log(log, SPAN_LOG_FLOW, " Polled sub-address (PSA) not known.\n"); + if (len > 4 && (msg[3] & DISBIT8)) + { + if ((msg[4] & 0x01)) + span_log(log, SPAN_LOG_FLOW, " BFT negotiations request not accepted.\n"); + if ((msg[4] & 0x02)) + span_log(log, SPAN_LOG_FLOW, " Internet routing address (IRA) not known.\n"); + if ((msg[4] & 0x04)) + span_log(log, SPAN_LOG_FLOW, " Internet selective polling address (ISP) not known.\n"); + } + if (len > 5) + { + span_log(log, SPAN_LOG_FLOW, " FNV sequence number %d.\n", msg[5]); + } + if (len > 6) + { + switch (msg[6]) + { + case T30_PWD: + x = "Incorrect password (PWD)"; + break; + case T30_SEP: + x = "Selective polling reference (SEP) not known"; + break; + case T30_SUB: + case T30_SUB | 0x01: + x = "Sub-address (SUB) not known"; + break; + case T30_SID: + case T30_SID | 0x01: + x = "Sender identity (SID) not known"; + break; + case T30_SPI: + x = "Secure fax error"; + break; + case T30_TSI: + case T30_TSI | 0x01: + x = "Transmitting subscriber identity (TSI) not accepted"; + break; + case T30_PSA: + x = "Polled sub-address (PSA) not known"; + break; + default: + x = "???"; + break; + } + span_log(log, SPAN_LOG_FLOW, " FNV diagnostic info type %s.\n", x); + } + if (len > 7) + { + span_log(log, SPAN_LOG_FLOW, " FNV length %d.\n", msg[7]); + } + /* We've decoded it, but we don't yet know how to deal with it, so treat it as unexpected */ + unexpected_final_frame(s, msg, len); +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_answering(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + /* We should be sending the TCF data right now */ + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_DIS: + /* TODO: This is a fudge to allow for starting up in T.38, where the other end has + seen DIS by analogue modem means, and has immediately sent DIS/DTC. We might have + missed useful info, like TSI, but just accept things and carry on form now. */ + span_log(&s->logging, SPAN_LOG_FLOW, "DIS/DTC before DIS\n"); + process_rx_dis_dtc(s, msg, len); + break; + case T30_DCS: + /* TODO: This is a fudge to allow for starting up in T.38, where the other end has + seen DIS by analogue modem means, and has immediately sent DCS. We might have + missed useful info, like TSI, but just accept things and carry on form now. */ + span_log(&s->logging, SPAN_LOG_FLOW, "DCS before DIS\n"); + process_rx_dcs(s, msg, len); + break; + case T30_DCN: + s->current_status = T30_ERR_TX_GOTDCN; + disconnect(s); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_b(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_DCN: + /* Just ignore any DCN's which appear at this stage. */ + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_c(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_DCN: + /* Just ignore any DCN's which appear at this stage. */ + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_d(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + /* We should be sending the DCS sequence right now */ + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_DCN: + s->current_status = T30_ERR_TX_BADDCS; + disconnect(s); + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_d_tcf(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + /* We should be sending the TCF data right now */ + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_DCN: + s->current_status = T30_ERR_TX_BADDCS; + disconnect(s); + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_d_post_tcf(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_CFR: + /* Trainability test succeeded. Send the document. */ + span_log(&s->logging, SPAN_LOG_FLOW, "Trainability test succeeded\n"); + s->retries = 0; + s->short_train = TRUE; + if (s->error_correcting_mode) + { + set_state(s, T30_STATE_IV); + queue_phase(s, T30_PHASE_C_ECM_TX); + send_first_ecm_frame(s); + } + else + { + set_state(s, T30_STATE_I); + queue_phase(s, T30_PHASE_C_NON_ECM_TX); + } + break; + case T30_FTT: + /* Trainability test failed. Try again. */ + span_log(&s->logging, SPAN_LOG_FLOW, "Trainability test failed\n"); + s->retries = 0; + s->short_train = FALSE; + if (step_fallback_entry(s) < 0) + { + /* We have fallen back as far as we can go. Give up. */ + s->current_fallback = 0; + s->current_status = T30_ERR_CANNOT_TRAIN; + send_dcn(s); + break; + } + queue_phase(s, T30_PHASE_B_TX); + send_dcs_sequence(s, TRUE); + break; + case T30_DIS: + /* It appears they didn't see what we sent - retry the TCF */ + if (++s->retries >= MAX_COMMAND_TRIES) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Too many retries. Giving up.\n"); + s->current_status = T30_ERR_RETRYDCN; + send_dcn(s); + break; + } + span_log(&s->logging, SPAN_LOG_FLOW, "Retry number %d\n", s->retries); + queue_phase(s, T30_PHASE_B_TX); + /* TODO: should we reassess the new DIS message, and possibly adjust the DCS we use? */ + send_dcs_sequence(s, TRUE); + break; + case T30_DCN: + s->current_status = T30_ERR_TX_BADDCS; + disconnect(s); + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_f_tcf(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + /* We should be receiving TCF right now, not HDLC messages */ + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_f_cfr(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + /* We're waiting for a response to the CFR we sent */ + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_DCS: + /* If we received another DCS, they must have missed our CFR */ + process_rx_dcs(s, msg, len); + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_f_ftt(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + /* We're waiting for a response to the FTT we sent */ + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_DCS: + process_rx_dcs(s, msg, len); + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_f_doc_non_ecm(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + /* If we are getting HDLC messages, and we have not moved to the _POST_DOC_NON_ECM + state, it looks like either: + - we didn't see the image data carrier properly, or + - they didn't see our T30_CFR, and are repeating the DCS/TCF sequence. + - they didn't see out T30_MCF, and are repeating the end of page message. */ + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_DIS: + process_rx_dis_dtc(s, msg, len); + break; + case T30_DCS: + process_rx_dcs(s, msg, len); + break; + case T30_MPS: + /* Treat this as a bad quality page. */ + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->next_rx_step = msg[2] & 0xFE; + queue_phase(s, T30_PHASE_D_TX); + set_state(s, T30_STATE_III_Q_RTN); + send_simple_frame(s, T30_RTN); + break; + case T30_PRI_MPS: + /* Treat this as a bad quality page. */ + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + s->next_rx_step = msg[2] & 0xFE; + set_state(s, T30_STATE_III_Q_RTN); + break; + case T30_EOM: + case T30_EOS: + /* Treat this as a bad quality page. */ + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->next_rx_step = msg[2] & 0xFE; + /* Return to phase B */ + queue_phase(s, T30_PHASE_B_TX); + set_state(s, T30_STATE_III_Q_RTN); + send_simple_frame(s, T30_RTN); + break; + case T30_PRI_EOM: + /* Treat this as a bad quality page. */ + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + s->next_rx_step = T30_PRI_EOM; + set_state(s, T30_STATE_III_Q_RTN); + break; + case T30_EOP: + /* Treat this as a bad quality page. */ + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->next_rx_step = msg[2] & 0xFE; + queue_phase(s, T30_PHASE_D_TX); + set_state(s, T30_STATE_III_Q_RTN); + send_simple_frame(s, T30_RTN); + break; + case T30_PRI_EOP: + /* Treat this as a bad quality page. */ + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + s->next_rx_step = msg[2] & 0xFE; + set_state(s, T30_STATE_III_Q_RTN); + break; + case T30_DCN: + s->current_status = T30_ERR_RX_DCNDATA; + disconnect(s); + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + s->current_status = T30_ERR_RX_INVALCMD; + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_f_post_doc_non_ecm(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_MPS: + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->next_rx_step = fcf; + queue_phase(s, T30_PHASE_D_TX); + switch (copy_quality(s)) + { + case T30_COPY_QUALITY_PERFECT: + case T30_COPY_QUALITY_GOOD: + rx_end_page(s); + rx_start_page(s); + set_state(s, T30_STATE_III_Q_MCF); + send_simple_frame(s, T30_MCF); + break; + case T30_COPY_QUALITY_POOR: + rx_end_page(s); + rx_start_page(s); + set_state(s, T30_STATE_III_Q_RTP); + send_simple_frame(s, T30_RTP); + break; + case T30_COPY_QUALITY_BAD: + rx_start_page(s); + set_state(s, T30_STATE_III_Q_RTN); + send_simple_frame(s, T30_RTN); + break; + } + break; + case T30_PRI_MPS: + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + s->next_rx_step = fcf; + switch (copy_quality(s)) + { + case T30_COPY_QUALITY_PERFECT: + case T30_COPY_QUALITY_GOOD: + rx_end_page(s); + t4_rx_release(&s->t4); + s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + s->in_message = FALSE; + set_state(s, T30_STATE_III_Q_MCF); + break; + case T30_COPY_QUALITY_POOR: + rx_end_page(s); + t4_rx_release(&s->t4); + s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + s->in_message = FALSE; + set_state(s, T30_STATE_III_Q_RTP); + break; + case T30_COPY_QUALITY_BAD: + set_state(s, T30_STATE_III_Q_RTN); + break; + } + break; + case T30_EOM: + case T30_EOS: + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->next_rx_step = fcf; + /* Return to phase B */ + queue_phase(s, T30_PHASE_B_TX); + switch (copy_quality(s)) + { + case T30_COPY_QUALITY_PERFECT: + case T30_COPY_QUALITY_GOOD: + rx_end_page(s); + rx_start_page(s); + set_state(s, T30_STATE_III_Q_MCF); + send_simple_frame(s, T30_MCF); + break; + case T30_COPY_QUALITY_POOR: + rx_end_page(s); + rx_start_page(s); + set_state(s, T30_STATE_III_Q_RTP); + send_simple_frame(s, T30_RTP); + break; + case T30_COPY_QUALITY_BAD: + rx_start_page(s); + set_state(s, T30_STATE_III_Q_RTN); + send_simple_frame(s, T30_RTN); + break; + } + break; + case T30_PRI_EOM: + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + s->next_rx_step = fcf; + switch (copy_quality(s)) + { + case T30_COPY_QUALITY_PERFECT: + case T30_COPY_QUALITY_GOOD: + rx_end_page(s); + t4_rx_release(&s->t4); + s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + s->in_message = FALSE; + set_state(s, T30_STATE_III_Q_MCF); + break; + case T30_COPY_QUALITY_POOR: + rx_end_page(s); + t4_rx_release(&s->t4); + s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + s->in_message = FALSE; + set_state(s, T30_STATE_III_Q_RTP); + break; + case T30_COPY_QUALITY_BAD: + set_state(s, T30_STATE_III_Q_RTN); + break; + } + break; + case T30_EOP: + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->next_rx_step = fcf; + queue_phase(s, T30_PHASE_D_TX); + switch (copy_quality(s)) + { + case T30_COPY_QUALITY_PERFECT: + case T30_COPY_QUALITY_GOOD: + rx_end_page(s); + t4_rx_release(&s->t4); + s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + s->in_message = FALSE; + set_state(s, T30_STATE_III_Q_MCF); + send_simple_frame(s, T30_MCF); + break; + case T30_COPY_QUALITY_POOR: + rx_end_page(s); + t4_rx_release(&s->t4); + s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + s->in_message = FALSE; + set_state(s, T30_STATE_III_Q_RTP); + send_simple_frame(s, T30_RTP); + break; + case T30_COPY_QUALITY_BAD: + set_state(s, T30_STATE_III_Q_RTN); + send_simple_frame(s, T30_RTN); + break; + } + break; + case T30_PRI_EOP: + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + s->next_rx_step = fcf; + switch (copy_quality(s)) + { + case T30_COPY_QUALITY_PERFECT: + case T30_COPY_QUALITY_GOOD: + rx_end_page(s); + t4_rx_release(&s->t4); + s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + s->in_message = FALSE; + set_state(s, T30_STATE_III_Q_MCF); + break; + case T30_COPY_QUALITY_POOR: + rx_end_page(s); + t4_rx_release(&s->t4); + s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + s->in_message = FALSE; + set_state(s, T30_STATE_III_Q_RTP); + break; + case T30_COPY_QUALITY_BAD: + set_state(s, T30_STATE_III_Q_RTN); + break; + } + break; + case T30_DCN: + s->current_status = T30_ERR_RX_DCNFAX; + disconnect(s); + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + s->current_status = T30_ERR_RX_INVALCMD; + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_f_doc_and_post_doc_ecm(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + uint8_t fcf2; + + /* This actually handles 2 states - _DOC_ECM and _POST_DOC_ECM - as they are very similar */ + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_DIS: + process_rx_dis_dtc(s, msg, len); + break; + case T30_DCS: + process_rx_dcs(s, msg, len); + break; + case T4_RCP: + /* Return to control for partial page. These might come through with or without the final frame tag. + Here we deal with the "final frame tag" case. */ + if (s->state == T30_STATE_F_DOC_ECM) + { + /* Return to control for partial page */ + set_state(s, T30_STATE_F_POST_DOC_ECM); + queue_phase(s, T30_PHASE_D_RX); + timer_t2_start(s); + /* We have received something, so any missing carrier status is out of date */ + if (s->current_status == T30_ERR_RX_NOCARRIER) + s->current_status = T30_ERR_OK; + } + else + { + /* Just ignore this. It must be an extra RCP. Several are usually sent, to maximise the chance + of receiving a correct one. */ + } + break; + case T30_EOR: + if (len != 4) + { + unexpected_frame_length(s, msg, len); + break; + } + fcf2 = msg[3] & 0xFE; + span_log(&s->logging, SPAN_LOG_FLOW, "Received EOR + %s\n", t30_frametype(msg[3])); + switch (fcf2) + { + case T30_PRI_EOP: + case T30_PRI_EOM: + case T30_PRI_MPS: + /* TODO: Alert operator */ + /* Fall through */ + case T30_NULL: + case T30_EOP: + case T30_EOM: + case T30_EOS: + case T30_MPS: + s->next_rx_step = fcf2; + queue_phase(s, T30_PHASE_D_TX); + set_state(s, T30_STATE_F_DOC_ECM); + send_simple_frame(s, T30_ERR); + break; + default: + unexpected_final_frame(s, msg, len); + break; + } + break; + case T30_PPS: + process_rx_pps(s, msg, len); + break; + case T30_CTC: + /* T.30 says we change back to long training here */ + s->short_train = FALSE; + queue_phase(s, T30_PHASE_D_TX); + set_state(s, T30_STATE_F_DOC_ECM); + send_simple_frame(s, T30_CTR); + break; + case T30_RR: + break; + case T30_DCN: + s->current_status = T30_ERR_RX_DCNDATA; + disconnect(s); + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + s->current_status = T30_ERR_RX_INVALCMD; + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_f_post_rcp_mcf(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + case T30_DCN: + disconnect(s); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_f_post_rcp_ppr(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_f_post_rcp_rnr(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_RR: + if (s->receiver_not_ready_count > 0) + { + s->receiver_not_ready_count--; + queue_phase(s, T30_PHASE_D_TX); + set_state(s, T30_STATE_F_POST_RCP_RNR); + send_simple_frame(s, T30_RNR); + } + else + { + send_deferred_pps_response(s); + } + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_r(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_DIS: + process_rx_dis_dtc(s, msg, len); + break; + case T30_DCS: + process_rx_dcs(s, msg, len); + break; + case T30_DCN: + /* Received a DCN while waiting for a DIS */ + s->current_status = T30_ERR_TX_GOTDCN; + disconnect(s); + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_t(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_DIS: + process_rx_dis_dtc(s, msg, len); + break; + case T30_DCN: + s->current_status = T30_ERR_RX_DCNWHY; + disconnect(s); + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + s->current_status = T30_ERR_TX_NODIS; + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_i(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_ii(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len) +{ + t4_stats_t stats; + uint8_t fcf; + + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_MCF: + switch (s->next_tx_step) + { + case T30_MPS: + case T30_PRI_MPS: + tx_end_page(s); + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + /* Transmit the next page */ + if (tx_start_page(s)) + { + /* TODO: recover */ + break; + } + set_state(s, T30_STATE_I); + queue_phase(s, T30_PHASE_C_NON_ECM_TX); + break; + case T30_EOM: + case T30_PRI_EOM: + case T30_EOS: + tx_end_page(s); + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + t4_tx_release(&s->t4); + s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + if (span_log_test(&s->logging, SPAN_LOG_FLOW)) + { + t4_get_transfer_statistics(&s->t4, &stats); + span_log(&s->logging, SPAN_LOG_FLOW, "Success - delivered %d pages\n", stats.pages_transferred); + } + return_to_phase_b(s, FALSE); + break; + case T30_EOP: + case T30_PRI_EOP: + tx_end_page(s); + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + t4_tx_release(&s->t4); + s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + send_dcn(s); + if (span_log_test(&s->logging, SPAN_LOG_FLOW)) + { + t4_get_transfer_statistics(&s->t4, &stats); + span_log(&s->logging, SPAN_LOG_FLOW, "Success - delivered %d pages\n", stats.pages_transferred); + } + break; + } + break; + case T30_RTP: +#if 0 + s->rtp_events++; +#endif + switch (s->next_tx_step) + { + case T30_MPS: + case T30_PRI_MPS: + tx_end_page(s); + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + if (tx_start_page(s)) + { + /* TODO: recover */ + break; + } + /* Send fresh training, and then the next page */ + if (step_fallback_entry(s) < 0) + { + /* We have fallen back as far as we can go. Give up. */ + s->current_fallback = 0; + s->current_status = T30_ERR_CANNOT_TRAIN; + send_dcn(s); + break; + } + queue_phase(s, T30_PHASE_B_TX); + restart_sending_document(s); + break; + case T30_EOM: + case T30_PRI_EOM: + case T30_EOS: + tx_end_page(s); + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + t4_tx_release(&s->t4); + /* TODO: should go back to T, and resend */ + return_to_phase_b(s, TRUE); + break; + case T30_EOP: + case T30_PRI_EOP: + tx_end_page(s); + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + t4_tx_release(&s->t4); + send_dcn(s); + break; + } + break; + case T30_RTN: +#if 0 + s->rtn_events++; +#endif + switch (s->next_tx_step) + { + case T30_MPS: + case T30_PRI_MPS: + s->retries = 0; + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); +#if 0 + if (!s->retransmit_capable) +#endif + { + /* Send the next page, regardless of the problem with the current one. */ + if (tx_start_page(s)) + { + /* TODO: recover */ + break; + } + } + /* Send fresh training */ + if (step_fallback_entry(s) < 0) + { + /* We have fallen back as far as we can go. Give up. */ + s->current_fallback = 0; + s->current_status = T30_ERR_CANNOT_TRAIN; + send_dcn(s); + break; + } + queue_phase(s, T30_PHASE_B_TX); + restart_sending_document(s); + break; + case T30_EOM: + case T30_PRI_EOM: + case T30_EOS: + s->retries = 0; + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); +#if 0 + if (s->retransmit_capable) + { + /* Wait for DIS */ + } + else +#endif + { + return_to_phase_b(s, TRUE); + } + break; + case T30_EOP: + case T30_PRI_EOP: + s->retries = 0; + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); +#if 0 + if (s->retransmit_capable) + { + /* Send fresh training, and then repeat the last page */ + if (step_fallback_entry(s) < 0) + { + /* We have fallen back as far as we can go. Give up. */ + s->current_fallback = 0; + s->current_status = T30_ERR_CANNOT_TRAIN; + send_dcn(s); + break; + } + queue_phase(s, T30_PHASE_B_TX); + restart_sending_document(s); + } + else +#endif + { + send_dcn(s); + } + break; + } + break; + case T30_PIP: + s->retries = 0; + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + break; + case T30_PIN: + s->retries = 0; + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + break; + case T30_DCN: + switch (s->next_tx_step) + { + case T30_MPS: + case T30_PRI_MPS: + case T30_EOM: + case T30_PRI_EOM: + case T30_EOS: + /* Unexpected DCN after EOM, EOS or MPS sequence */ + s->current_status = T30_ERR_RX_DCNPHD; + break; + default: + s->current_status = T30_ERR_TX_BADPG; + break; + } + disconnect(s); + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + s->current_status = T30_ERR_TX_INVALRSP; + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_iii_q_mcf(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_EOP: + case T30_EOM: + case T30_EOS: + case T30_MPS: + /* Looks like they didn't see our signal. Repeat it */ + queue_phase(s, T30_PHASE_D_TX); + set_state(s, T30_STATE_III_Q_MCF); + send_simple_frame(s, T30_MCF); + break; + case T30_DIS: + if (msg[2] == T30_DTC) + process_rx_dis_dtc(s, msg, len); + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + case T30_DCN: + disconnect(s); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_iii_q_rtp(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_EOP: + case T30_EOM: + case T30_EOS: + case T30_MPS: + /* Looks like they didn't see our signal. Repeat it */ + queue_phase(s, T30_PHASE_D_TX); + set_state(s, T30_STATE_III_Q_RTP); + send_simple_frame(s, T30_RTP); + break; + case T30_DIS: + if (msg[2] == T30_DTC) + process_rx_dis_dtc(s, msg, len); + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_iii_q_rtn(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_EOP: + case T30_EOM: + case T30_EOS: + case T30_MPS: + /* Looks like they didn't see our signal. Repeat it */ + queue_phase(s, T30_PHASE_D_TX); + set_state(s, T30_STATE_III_Q_RTN); + send_simple_frame(s, T30_RTN); + break; + case T30_DIS: + if (msg[2] == T30_DTC) + process_rx_dis_dtc(s, msg, len); + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + case T30_DCN: + s->current_status = T30_ERR_RX_DCNNORTN; + disconnect(s); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_iv(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_iv_pps_null(t30_state_t *s, const uint8_t *msg, int len) +{ + t4_stats_t stats; + uint8_t fcf; + + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_MCF: + s->retries = 0; + s->timer_t5 = 0; + /* Is there more of the current page to get, or do we move on? */ + span_log(&s->logging, SPAN_LOG_FLOW, "Is there more to send? - %d %d\n", s->ecm_frames, s->ecm_len[255]); + if (!s->ecm_at_page_end && get_partial_ecm_page(s) > 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Additional image data to send\n"); + s->ecm_block++; + set_state(s, T30_STATE_IV); + queue_phase(s, T30_PHASE_C_ECM_TX); + send_first_ecm_frame(s); + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Moving on to the next page\n"); + switch (s->next_tx_step) + { + case T30_MPS: + case T30_PRI_MPS: + tx_end_page(s); + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + if (tx_start_page(s)) + { + /* TODO: recover */ + break; + } + if (get_partial_ecm_page(s) > 0) + { + set_state(s, T30_STATE_IV); + queue_phase(s, T30_PHASE_C_ECM_TX); + send_first_ecm_frame(s); + } + break; + case T30_EOM: + case T30_PRI_EOM: + case T30_EOS: + tx_end_page(s); + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + t4_tx_release(&s->t4); + s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + if (span_log_test(&s->logging, SPAN_LOG_FLOW)) + { + t4_get_transfer_statistics(&s->t4, &stats); + span_log(&s->logging, SPAN_LOG_FLOW, "Success - delivered %d pages\n", stats.pages_transferred); + } + return_to_phase_b(s, FALSE); + break; + case T30_EOP: + case T30_PRI_EOP: + tx_end_page(s); + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + t4_tx_release(&s->t4); + s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + send_dcn(s); + if (span_log_test(&s->logging, SPAN_LOG_FLOW)) + { + t4_get_transfer_statistics(&s->t4, &stats); + span_log(&s->logging, SPAN_LOG_FLOW, "Success - delivered %d pages\n", stats.pages_transferred); + } + break; + } + } + break; + case T30_PPR: + process_rx_ppr(s, msg, len); + break; + case T30_RNR: + if (s->timer_t5 == 0) + s->timer_t5 = ms_to_samples(DEFAULT_TIMER_T5); + queue_phase(s, T30_PHASE_D_TX); + set_state(s, T30_STATE_IV_PPS_RNR); + send_rr(s); + break; + case T30_DCN: + s->current_status = T30_ERR_TX_BADPG; + disconnect(s); + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + s->current_status = T30_ERR_TX_ECMPHD; + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len) +{ + t4_stats_t stats; + uint8_t fcf; + + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_MCF: + s->retries = 0; + s->timer_t5 = 0; + /* Is there more of the current page to get, or do we move on? */ + span_log(&s->logging, SPAN_LOG_FLOW, "Is there more to send? - %d %d\n", s->ecm_frames, s->ecm_len[255]); + if (!s->ecm_at_page_end && get_partial_ecm_page(s) > 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Additional image data to send\n"); + s->ecm_block++; + set_state(s, T30_STATE_IV); + queue_phase(s, T30_PHASE_C_ECM_TX); + send_first_ecm_frame(s); + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Moving on to the next page\n"); + switch (s->next_tx_step) + { + case T30_MPS: + case T30_PRI_MPS: + tx_end_page(s); + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + if (tx_start_page(s)) + { + /* TODO: recover */ + break; + } + if (get_partial_ecm_page(s) > 0) + { + set_state(s, T30_STATE_IV); + queue_phase(s, T30_PHASE_C_ECM_TX); + send_first_ecm_frame(s); + } + break; + case T30_EOM: + case T30_PRI_EOM: + case T30_EOS: + tx_end_page(s); + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + t4_tx_release(&s->t4); + s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + if (span_log_test(&s->logging, SPAN_LOG_FLOW)) + { + t4_get_transfer_statistics(&s->t4, &stats); + span_log(&s->logging, SPAN_LOG_FLOW, "Success - delivered %d pages\n", stats.pages_transferred); + } + return_to_phase_b(s, FALSE); + break; + case T30_EOP: + case T30_PRI_EOP: + tx_end_page(s); + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + t4_tx_release(&s->t4); + s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + send_dcn(s); + if (span_log_test(&s->logging, SPAN_LOG_FLOW)) + { + t4_get_transfer_statistics(&s->t4, &stats); + span_log(&s->logging, SPAN_LOG_FLOW, "Success - delivered %d pages\n", stats.pages_transferred); + } + break; + } + } + break; + case T30_RNR: + if (s->timer_t5 == 0) + s->timer_t5 = ms_to_samples(DEFAULT_TIMER_T5); + queue_phase(s, T30_PHASE_D_TX); + set_state(s, T30_STATE_IV_PPS_RNR); + send_rr(s); + break; + case T30_PIP: + s->retries = 0; + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + break; + case T30_PIN: + s->retries = 0; + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + break; + case T30_PPR: + process_rx_ppr(s, msg, len); + break; + case T30_DCN: + s->current_status = T30_ERR_TX_BADPG; + disconnect(s); + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + s->current_status = T30_ERR_TX_ECMPHD; + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_iv_pps_rnr(t30_state_t *s, const uint8_t *msg, int len) +{ + t4_stats_t stats; + uint8_t fcf; + + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_MCF: + s->retries = 0; + s->timer_t5 = 0; + /* Is there more of the current page to get, or do we move on? */ + span_log(&s->logging, SPAN_LOG_FLOW, "Is there more to send? - %d %d\n", s->ecm_frames, s->ecm_len[255]); + if (!s->ecm_at_page_end && get_partial_ecm_page(s) > 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Additional image data to send\n"); + s->ecm_block++; + set_state(s, T30_STATE_IV); + queue_phase(s, T30_PHASE_C_ECM_TX); + send_first_ecm_frame(s); + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Moving on to the next page\n"); + switch (s->next_tx_step) + { + case T30_MPS: + case T30_PRI_MPS: + tx_end_page(s); + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + if (tx_start_page(s)) + { + /* TODO: recover */ + break; + } + if (get_partial_ecm_page(s) > 0) + { + set_state(s, T30_STATE_IV); + queue_phase(s, T30_PHASE_C_ECM_TX); + send_first_ecm_frame(s); + } + break; + case T30_EOM: + case T30_PRI_EOM: + case T30_EOS: + tx_end_page(s); + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + t4_tx_release(&s->t4); + s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + if (span_log_test(&s->logging, SPAN_LOG_FLOW)) + { + t4_get_transfer_statistics(&s->t4, &stats); + span_log(&s->logging, SPAN_LOG_FLOW, "Success - delivered %d pages\n", stats.pages_transferred); + } + return_to_phase_b(s, FALSE); + break; + case T30_EOP: + case T30_PRI_EOP: + tx_end_page(s); + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + t4_tx_release(&s->t4); + s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + send_dcn(s); + if (span_log_test(&s->logging, SPAN_LOG_FLOW)) + { + t4_get_transfer_statistics(&s->t4, &stats); + span_log(&s->logging, SPAN_LOG_FLOW, "Success - delivered %d pages\n", stats.pages_transferred); + } + break; + } + } + break; + case T30_RNR: + if (s->timer_t5 == 0) + s->timer_t5 = ms_to_samples(DEFAULT_TIMER_T5); + queue_phase(s, T30_PHASE_D_TX); + set_state(s, T30_STATE_IV_PPS_RNR); + send_rr(s); + break; + case T30_PIP: + s->retries = 0; + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + break; + case T30_PIN: + s->retries = 0; + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + break; + case T30_DCN: + s->current_status = T30_ERR_RX_DCNRRD; + disconnect(s); + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_iv_ctc(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_CTR: + /* Valid response to a CTC received */ + /* T.30 says we change back to long training here */ + s->short_train = FALSE; + /* Initiate resending of the remainder of the frames. */ + set_state(s, T30_STATE_IV); + queue_phase(s, T30_PHASE_C_ECM_TX); + send_first_ecm_frame(s); + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_iv_eor(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_RNR: + if (s->timer_t5 == 0) + s->timer_t5 = ms_to_samples(DEFAULT_TIMER_T5); + queue_phase(s, T30_PHASE_D_TX); + set_state(s, T30_STATE_IV_EOR_RNR); + send_rr(s); + break; + case T30_PIN: + s->retries = 0; + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + break; + case T30_ERR: + /* TODO: Continue with the next message if MPS or EOM? */ + s->timer_t5 = 0; + send_dcn(s); + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_iv_eor_rnr(t30_state_t *s, const uint8_t *msg, int len) +{ + uint8_t fcf; + + fcf = msg[2] & 0xFE; + switch (fcf) + { + case T30_RNR: + if (s->timer_t5 == 0) + s->timer_t5 = ms_to_samples(DEFAULT_TIMER_T5); + queue_phase(s, T30_PHASE_D_TX); + set_state(s, T30_STATE_IV_EOR_RNR); + send_rr(s); + break; + case T30_PIN: + s->retries = 0; + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + break; + case T30_ERR: + /* TODO: Continue with the next message if MPS or EOM? */ + s->timer_t5 = 0; + send_dcn(s); + break; + case T30_DCN: + s->current_status = T30_ERR_RX_DCNRRD; + disconnect(s); + break; + case T30_CRP: + repeat_last_command(s); + break; + case T30_FNV: + process_rx_fnv(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_state_call_finished(t30_state_t *s, const uint8_t *msg, int len) +{ + /* Simply ignore anything which comes in when we have declared the call + to have finished. */ +} +/*- End of function --------------------------------------------------------*/ + +static void process_rx_control_msg(t30_state_t *s, const uint8_t *msg, int len) +{ + /* We should only get good frames here. */ + print_frame(s, "Rx: ", msg, len); + if (s->real_time_frame_handler) + s->real_time_frame_handler(s, s->real_time_frame_user_data, TRUE, msg, len); + + if ((msg[1] & 0x10) == 0) + { + /* This is not a final frame */ + /* It seems we should not restart the command or response timer when exchanging HDLC image + data. If the modem looses sync in the middle of the image, we should just wait until + the carrier goes away before proceeding. */ + if (s->phase != T30_PHASE_C_ECM_RX) + { + /* Restart the command or response timer, T2 or T4 */ + switch (s->timer_t2_t4_is) + { + case TIMER_IS_T1A: + case TIMER_IS_T2: + case TIMER_IS_T2A: + case TIMER_IS_T2B: + timer_t2a_start(s); + break; + case TIMER_IS_T4: + case TIMER_IS_T4A: + case TIMER_IS_T4B: + timer_t4a_start(s); + break; + } + } + /* The following handles all the message types we expect to get without + a final frame tag. If we get one that T.30 says we should not expect + in a particular context, its pretty harmless, so don't worry. */ + switch (msg[2] & 0xFE) + { + case (T30_CSI & 0xFE): + /* Called subscriber identification or Calling subscriber identification (T30_CIG) */ + /* OK in (NSF) (CSI) DIS */ + /* OK in (NSC) (CIG) DTC */ + /* OK in (PWD) (SEP) (CIG) DTC */ + decode_20digit_msg(s, s->rx_info.ident, &msg[2], len - 2); + break; + case (T30_NSF & 0xFE): + if (msg[2] == T30_NSF) + { + /* Non-standard facilities */ + /* OK in (NSF) (CSI) DIS */ + t35_decode(&msg[3], len - 3, &s->country, &s->vendor, &s->model); + if (s->country) + span_log(&s->logging, SPAN_LOG_FLOW, "The remote was made in '%s'\n", s->country); + if (s->vendor) + span_log(&s->logging, SPAN_LOG_FLOW, "The remote was made by '%s'\n", s->vendor); + if (s->model) + span_log(&s->logging, SPAN_LOG_FLOW, "The remote is a '%s'\n", s->model); + } + else + { + /* NSC - Non-standard facilities command */ + /* OK in (NSC) (CIG) DTC */ + } + break; + case (T30_PWD & 0xFE): + if (msg[2] == T30_PWD) + { + /* Password */ + /* OK in (SUB) (SID) (SEP) (PWD) (TSI) DCS */ + /* OK in (SUB) (SID) (SEP) (PWD) (CIG) DTC */ + decode_20digit_msg(s, s->rx_info.password, &msg[2], len - 2); + } + else + { + unexpected_non_final_frame(s, msg, len); + } + break; + case (T30_SEP & 0xFE): + if (msg[2] == T30_SEP) + { + /* Selective polling address */ + /* OK in (PWD) (SEP) (CIG) DTC */ + decode_20digit_msg(s, s->rx_info.selective_polling_address, &msg[2], len - 2); + } + else + { + unexpected_non_final_frame(s, msg, len); + } + break; + case (T30_PSA & 0xFE): + if (msg[2] == T30_PSA) + { + /* Polled sub-address */ + decode_20digit_msg(s, s->rx_info.polled_sub_address, &msg[2], len - 2); + } + else + { + unexpected_non_final_frame(s, msg, len); + } + break; + case (T30_CIA & 0xFE): + if (msg[2] == T30_CIA) + { + /* Calling subscriber internet address */ + decode_url_msg(s, NULL, &msg[2], len - 2); + } + else + { + unexpected_non_final_frame(s, msg, len); + } + break; + case (T30_ISP & 0xFE): + if (msg[2] == T30_ISP) + { + /* Internet selective polling address */ + decode_url_msg(s, NULL, &msg[2], len - 2); + } + else + { + unexpected_non_final_frame(s, msg, len); + } + break; + case (T30_TSI & 0xFE): + /* Transmitting subscriber identity */ + /* OK in (PWD) (SUB) (TSI) DCS */ + decode_20digit_msg(s, s->rx_info.ident, &msg[2], len - 2); + break; + case (T30_NSS & 0xFE): + /* Non-standard facilities set-up */ + break; + case (T30_SUB & 0xFE): + /* Sub-address */ + /* OK in (PWD) (SUB) (TSI) DCS */ + decode_20digit_msg(s, s->rx_info.sub_address, &msg[2], len - 2); + break; + case (T30_SID & 0xFE): + /* Sender Identification */ + /* OK in (SUB) (SID) (SEP) (PWD) (TSI) DCS */ + /* OK in (SUB) (SID) (SEP) (PWD) (CIG) DTC */ + decode_20digit_msg(s, s->rx_info.sender_ident, &msg[2], len - 2); + break; + case (T30_CSA & 0xFE): + /* Calling subscriber internet address */ + decode_url_msg(s, NULL, &msg[2], len - 2); + break; + case (T30_TSA & 0xFE): + /* Transmitting subscriber internet address */ + decode_url_msg(s, NULL, &msg[2], len - 2); + break; + case (T30_IRA & 0xFE): + /* Internet routing address */ + decode_url_msg(s, NULL, &msg[2], len - 2); + break; + case T4_FCD: + process_rx_fcd(s, msg, len); + break; + case T4_RCP: + process_rx_rcp(s, msg, len); + break; + default: + unexpected_non_final_frame(s, msg, len); + break; + } + } + else + { + /* This is a final frame */ + /* Once we have any successful message from the far end, we + cancel timer T1 */ + s->timer_t0_t1 = 0; + + /* The following handles context sensitive message types, which should + occur at the end of message sequences. They should, therefore have + the final frame flag set. */ + span_log(&s->logging, SPAN_LOG_FLOW, "In state %d\n", s->state); + + switch (s->state) + { + case T30_STATE_ANSWERING: + process_state_answering(s, msg, len); + break; + case T30_STATE_B: + process_state_b(s, msg, len); + break; + case T30_STATE_C: + process_state_c(s, msg, len); + break; + case T30_STATE_D: + process_state_d(s, msg, len); + break; + case T30_STATE_D_TCF: + process_state_d_tcf(s, msg, len); + break; + case T30_STATE_D_POST_TCF: + process_state_d_post_tcf(s, msg, len); + break; + case T30_STATE_F_TCF: + process_state_f_tcf(s, msg, len); + break; + case T30_STATE_F_CFR: + process_state_f_cfr(s, msg, len); + break; + case T30_STATE_F_FTT: + process_state_f_ftt(s, msg, len); + break; + case T30_STATE_F_DOC_NON_ECM: + process_state_f_doc_non_ecm(s, msg, len); + break; + case T30_STATE_F_POST_DOC_NON_ECM: + process_state_f_post_doc_non_ecm(s, msg, len); + break; + case T30_STATE_F_DOC_ECM: + case T30_STATE_F_POST_DOC_ECM: + process_state_f_doc_and_post_doc_ecm(s, msg, len); + break; + case T30_STATE_F_POST_RCP_MCF: + process_state_f_post_rcp_mcf(s, msg, len); + break; + case T30_STATE_F_POST_RCP_PPR: + process_state_f_post_rcp_ppr(s, msg, len); + break; + case T30_STATE_F_POST_RCP_RNR: + process_state_f_post_rcp_rnr(s, msg, len); + break; + case T30_STATE_R: + process_state_r(s, msg, len); + break; + case T30_STATE_T: + process_state_t(s, msg, len); + break; + case T30_STATE_I: + process_state_i(s, msg, len); + break; + case T30_STATE_II: + process_state_ii(s, msg, len); + break; + case T30_STATE_II_Q: + process_state_ii_q(s, msg, len); + break; + case T30_STATE_III_Q_MCF: + process_state_iii_q_mcf(s, msg, len); + break; + case T30_STATE_III_Q_RTP: + process_state_iii_q_rtp(s, msg, len); + break; + case T30_STATE_III_Q_RTN: + process_state_iii_q_rtn(s, msg, len); + break; + case T30_STATE_IV: + process_state_iv(s, msg, len); + break; + case T30_STATE_IV_PPS_NULL: + process_state_iv_pps_null(s, msg, len); + break; + case T30_STATE_IV_PPS_Q: + process_state_iv_pps_q(s, msg, len); + break; + case T30_STATE_IV_PPS_RNR: + process_state_iv_pps_rnr(s, msg, len); + break; + case T30_STATE_IV_CTC: + process_state_iv_ctc(s, msg, len); + break; + case T30_STATE_IV_EOR: + process_state_iv_eor(s, msg, len); + break; + case T30_STATE_IV_EOR_RNR: + process_state_iv_eor_rnr(s, msg, len); + break; + case T30_STATE_CALL_FINISHED: + process_state_call_finished(s, msg, len); + break; + default: + /* We don't know what to do with this. */ + unexpected_final_frame(s, msg, len); + break; + } + } +} +/*- End of function --------------------------------------------------------*/ + +static void queue_phase(t30_state_t *s, int phase) +{ + if (s->rx_signal_present) + { + /* We need to wait for that signal to go away */ + s->next_phase = phase; + } + else + { + set_phase(s, phase); + s->next_phase = T30_PHASE_IDLE; + } +} +/*- End of function --------------------------------------------------------*/ + +static void set_phase(t30_state_t *s, int phase) +{ + //if (phase = s->phase) + // return; + span_log(&s->logging, SPAN_LOG_FLOW, "Changing from phase %s to %s\n", phase_names[s->phase], phase_names[phase]); + /* We may be killing a receiver before it has declared the end of the + signal. Force the signal present indicator to off, because the + receiver will never be able to. */ + if (s->phase != T30_PHASE_A_CED && s->phase != T30_PHASE_A_CNG) + s->rx_signal_present = FALSE; + s->rx_trained = FALSE; + s->rx_frame_received = FALSE; + s->phase = phase; + switch (phase) + { + case T30_PHASE_A_CED: + if (s->set_rx_type_handler) + s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_V21, 300, FALSE, TRUE); + if (s->set_tx_type_handler) + s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_CED, 0, FALSE, FALSE); + break; + case T30_PHASE_A_CNG: + if (s->set_rx_type_handler) + s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_V21, 300, FALSE, TRUE); + if (s->set_tx_type_handler) + s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_CNG, 0, FALSE, FALSE); + break; + case T30_PHASE_B_RX: + case T30_PHASE_D_RX: + if (s->set_rx_type_handler) + s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_V21, 300, FALSE, TRUE); + if (s->set_tx_type_handler) + s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE); + break; + case T30_PHASE_B_TX: + case T30_PHASE_D_TX: + if (!s->far_end_detected && s->timer_t0_t1 > 0) + { + s->timer_t0_t1 = ms_to_samples(DEFAULT_TIMER_T1); + s->far_end_detected = TRUE; + } + if (s->set_rx_type_handler) + s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE); + if (s->set_tx_type_handler) + s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_V21, 300, FALSE, TRUE); + break; + case T30_PHASE_C_NON_ECM_RX: + if (s->set_rx_type_handler) + { + /* Momentarily stop the receive modem, so the next change is forced to happen. If we don't do this + an HDLC message on the slow modem, which has disabled the fast modem, will prevent the same + fast modem from restarting. */ + s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE); + s->set_rx_type_handler(s->set_rx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, FALSE); + } + if (s->set_tx_type_handler) + s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE); + break; + case T30_PHASE_C_NON_ECM_TX: + /* Pause before switching from anything to phase C */ + /* Always prime the training count for 1.5s of data at the current rate. Its harmless if + we prime it and are not doing TCF. */ + s->tcf_test_bits = (3*fallback_sequence[s->current_fallback].bit_rate)/2; + if (s->set_rx_type_handler) + { + /* Momentarily stop the receive modem, so the next change is forced to happen. If we don't do this + an HDLC message on the slow modem, which has disabled the fast modem, will prevent the same + fast modem from restarting. */ + s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE); + s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE); + } + if (s->set_tx_type_handler) + s->set_tx_type_handler(s->set_tx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, FALSE); + break; + case T30_PHASE_C_ECM_RX: + if (s->set_rx_type_handler) + s->set_rx_type_handler(s->set_rx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, TRUE); + if (s->set_tx_type_handler) + s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE); + break; + case T30_PHASE_C_ECM_TX: + /* Pause before switching from anything to phase C */ + if (s->set_rx_type_handler) + s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE); + if (s->set_tx_type_handler) + s->set_tx_type_handler(s->set_tx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, TRUE); + break; + case T30_PHASE_E: + /* Send a little silence before ending things, to ensure the + buffers are all flushed through, and the far end has seen + the last message we sent. */ + s->tcf_test_bits = 0; + s->tcf_current_zeros = 0; + s->tcf_most_zeros = 0; + if (s->set_rx_type_handler) + s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE); + if (s->set_tx_type_handler) + s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_PAUSE, 0, FINAL_FLUSH_TIME, FALSE); + break; + case T30_PHASE_CALL_FINISHED: + if (s->set_rx_type_handler) + s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_DONE, 0, FALSE, FALSE); + if (s->set_tx_type_handler) + s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_DONE, 0, FALSE, FALSE); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void set_state(t30_state_t *s, int state) +{ + if (s->state != state) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Changing from state %d to %d\n", s->state, state); + s->state = state; + } + s->step = 0; +} +/*- End of function --------------------------------------------------------*/ + +static void repeat_last_command(t30_state_t *s) +{ + s->step = 0; + if (++s->retries >= MAX_COMMAND_TRIES) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Too many retries. Giving up.\n"); + switch (s->state) + { + case T30_STATE_D_POST_TCF: + /* Received no response to DCS or TCF */ + s->current_status = T30_ERR_TX_PHBDEAD; + break; + case T30_STATE_II_Q: + case T30_STATE_IV_PPS_NULL: + case T30_STATE_IV_PPS_Q: + /* No response after sending a page */ + s->current_status = T30_ERR_TX_PHDDEAD; + break; + default: + /* Disconnected after permitted retries */ + s->current_status = T30_ERR_RETRYDCN; + break; + } + send_dcn(s); + return; + } + span_log(&s->logging, SPAN_LOG_FLOW, "Retry number %d\n", s->retries); + switch (s->state) + { + case T30_STATE_R: + s->dis_received = FALSE; + queue_phase(s, T30_PHASE_B_TX); + send_dis_or_dtc_sequence(s, TRUE); + break; + case T30_STATE_III_Q_MCF: + queue_phase(s, T30_PHASE_D_TX); + send_simple_frame(s, T30_MCF); + break; + case T30_STATE_III_Q_RTP: + queue_phase(s, T30_PHASE_D_TX); + send_simple_frame(s, T30_RTP); + break; + case T30_STATE_III_Q_RTN: + queue_phase(s, T30_PHASE_D_TX); + send_simple_frame(s, T30_RTN); + break; + case T30_STATE_II_Q: + queue_phase(s, T30_PHASE_D_TX); + send_simple_frame(s, s->next_tx_step); + break; + case T30_STATE_IV_PPS_NULL: + case T30_STATE_IV_PPS_Q: + queue_phase(s, T30_PHASE_D_TX); + send_pps_frame(s); + break; + case T30_STATE_IV_PPS_RNR: + case T30_STATE_IV_EOR_RNR: + queue_phase(s, T30_PHASE_D_TX); + send_rr(s); + break; + case T30_STATE_D: + queue_phase(s, T30_PHASE_B_TX); + send_dcs_sequence(s, TRUE); + break; + case T30_STATE_F_FTT: + queue_phase(s, T30_PHASE_B_TX); + send_simple_frame(s, T30_FTT); + break; + case T30_STATE_F_CFR: + queue_phase(s, T30_PHASE_B_TX); + send_cfr_sequence(s, TRUE); + break; + case T30_STATE_D_POST_TCF: + /* Need to send the whole training thing again */ + s->short_train = FALSE; + queue_phase(s, T30_PHASE_B_TX); + send_dcs_sequence(s, TRUE); + break; + case T30_STATE_F_POST_RCP_RNR: + /* Just ignore */ + break; + default: + span_log(&s->logging, + SPAN_LOG_FLOW, + "Repeat command called with nothing to repeat - phase %s, state %d\n", + phase_names[s->phase], + s->state); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void timer_t2_start(t30_state_t *s) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "Start T2\n"); + s->timer_t2_t4 = ms_to_samples(DEFAULT_TIMER_T2); + s->timer_t2_t4_is = TIMER_IS_T2; +} +/*- End of function --------------------------------------------------------*/ + +static void timer_t2a_start(t30_state_t *s) +{ + /* T.30 Annex A says timeout T1 should be used in ECM phase C to time out the + first frame after the flags start. This seems a strange reuse of the name T1 + for a different purpose, but there it is. We distinguish it by calling it T1A. */ + if (s->phase == T30_PHASE_C_ECM_RX) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Start T1A\n"); + s->timer_t2_t4 = ms_to_samples(DEFAULT_TIMER_T1A); + s->timer_t2_t4_is = TIMER_IS_T1A; + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Start T2A\n"); + s->timer_t2_t4 = ms_to_samples(DEFAULT_TIMER_T2A); + s->timer_t2_t4_is = TIMER_IS_T2A; + } +} +/*- End of function --------------------------------------------------------*/ + +static void timer_t2b_start(t30_state_t *s) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "Start T2B\n"); + s->timer_t2_t4 = ms_to_samples(DEFAULT_TIMER_T2B); + s->timer_t2_t4_is = TIMER_IS_T2B; +} +/*- End of function --------------------------------------------------------*/ + +static void timer_t4_start(t30_state_t *s) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "Start T4\n"); + s->timer_t2_t4 = ms_to_samples(DEFAULT_TIMER_T4); + s->timer_t2_t4_is = TIMER_IS_T4; +} +/*- End of function --------------------------------------------------------*/ + +static void timer_t4a_start(t30_state_t *s) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "Start T4A\n"); + s->timer_t2_t4 = ms_to_samples(DEFAULT_TIMER_T4A); + s->timer_t2_t4_is = TIMER_IS_T4A; +} +/*- End of function --------------------------------------------------------*/ + +static void timer_t4b_start(t30_state_t *s) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "Start T4B\n"); + s->timer_t2_t4 = ms_to_samples(DEFAULT_TIMER_T4B); + s->timer_t2_t4_is = TIMER_IS_T4B; +} +/*- End of function --------------------------------------------------------*/ + +static void timer_t2_t4_stop(t30_state_t *s) +{ + const char *tag; + + switch (s->timer_t2_t4_is) + { + case TIMER_IS_IDLE: + tag = "none"; + break; + case TIMER_IS_T1A: + tag = "T1A"; + break; + case TIMER_IS_T2: + tag = "T2"; + break; + case TIMER_IS_T2A: + tag = "T2A"; + break; + case TIMER_IS_T2B: + tag = "T2B"; + break; + case TIMER_IS_T2C: + tag = "T2C"; + break; + case TIMER_IS_T4: + tag = "T4"; + break; + case TIMER_IS_T4A: + tag = "T4A"; + break; + case TIMER_IS_T4B: + tag = "T4B"; + break; + case TIMER_IS_T4C: + tag = "T4C"; + break; + default: + tag = "T2/T4"; + break; + } + span_log(&s->logging, SPAN_LOG_FLOW, "Stop %s (%d remaining)\n", tag, s->timer_t2_t4); + s->timer_t2_t4 = 0; + s->timer_t2_t4_is = TIMER_IS_IDLE; +} +/*- End of function --------------------------------------------------------*/ + +static void timer_t0_expired(t30_state_t *s) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "T0 expired in state %d\n", s->state); + s->current_status = T30_ERR_T0_EXPIRED; + /* Just end the call */ + disconnect(s); +} +/*- End of function --------------------------------------------------------*/ + +static void timer_t1_expired(t30_state_t *s) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "T1 expired in state %d\n", s->state); + /* The initial connection establishment has timeout out. In other words, we + have been unable to communicate successfully with a remote machine. + It is time to abandon the call. */ + s->current_status = T30_ERR_T1_EXPIRED; + switch (s->state) + { + case T30_STATE_T: + /* Just end the call */ + disconnect(s); + break; + case T30_STATE_R: + /* Send disconnect, and then end the call. Since we have not + successfully contacted the far end, it is unclear why we should + send a disconnect message at this point. However, it is what T.30 + says we should do. */ + send_dcn(s); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void timer_t2_expired(t30_state_t *s) +{ + if (s->timer_t2_t4_is != TIMER_IS_T2B) + span_log(&s->logging, SPAN_LOG_FLOW, "T2 expired in phase %s, state %d\n", phase_names[s->phase], s->state); + switch (s->state) + { + case T30_STATE_III_Q_MCF: + case T30_STATE_III_Q_RTP: + case T30_STATE_III_Q_RTN: + case T30_STATE_F_POST_RCP_PPR: + case T30_STATE_F_POST_RCP_MCF: + switch (s->next_rx_step) + { + case T30_EOM: + case T30_PRI_EOM: + case T30_EOS: + /* We didn't receive a response to our T30_MCF after T30_EOM, so we must be OK + to proceed to phase B, and pretty act like its the beginning of a call. */ + span_log(&s->logging, SPAN_LOG_FLOW, "Returning to phase B after %s\n", t30_frametype(s->next_rx_step)); + set_phase(s, T30_PHASE_B_TX); + timer_t2_start(s); + s->dis_received = FALSE; + send_dis_or_dtc_sequence(s, TRUE); + return; + } + break; + case T30_STATE_F_TCF: + span_log(&s->logging, SPAN_LOG_FLOW, "No TCF data received\n"); + set_phase(s, T30_PHASE_B_TX); + set_state(s, T30_STATE_F_FTT); + send_simple_frame(s, T30_FTT); + return; + case T30_STATE_F_DOC_ECM: + case T30_STATE_F_DOC_NON_ECM: + /* While waiting for FAX page */ + s->current_status = T30_ERR_RX_T2EXPFAX; + break; + case T30_STATE_F_POST_DOC_ECM: + case T30_STATE_F_POST_DOC_NON_ECM: + /* While waiting for next FAX page */ + s->current_status = T30_ERR_RX_T2EXPMPS; + break; +#if 0 + case ??????: + /* While waiting for DCN */ + s->current_status = T30_ERR_RX_T2EXPDCN; + break; + case ??????: + /* While waiting for phase D */ + s->current_status = T30_ERR_RX_T2EXPD; + break; +#endif + case T30_STATE_IV_PPS_RNR: + case T30_STATE_IV_EOR_RNR: + /* While waiting for RR command */ + s->current_status = T30_ERR_RX_T2EXPRR; + break; + case T30_STATE_R: + /* While waiting for NSS, DCS or MCF */ + s->current_status = T30_ERR_RX_T2EXP; + break; + case T30_STATE_F_FTT: + break; + } + queue_phase(s, T30_PHASE_B_TX); + start_receiving_document(s); +} +/*- End of function --------------------------------------------------------*/ + +static void timer_t1a_expired(t30_state_t *s) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "T1A expired in phase %s, state %d. An HDLC frame lasted too long.\n", phase_names[s->phase], s->state); + s->current_status = T30_ERR_HDLC_CARRIER; + disconnect(s); +} +/*- End of function --------------------------------------------------------*/ + +static void timer_t2a_expired(t30_state_t *s) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "T2A expired in phase %s, state %d. An HDLC frame lasted too long.\n", phase_names[s->phase], s->state); + s->current_status = T30_ERR_HDLC_CARRIER; + disconnect(s); +} +/*- End of function --------------------------------------------------------*/ + +static void timer_t2b_expired(t30_state_t *s) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "T2B expired in phase %s, state %d. The line is now quiet.\n", phase_names[s->phase], s->state); + timer_t2_expired(s); +} +/*- End of function --------------------------------------------------------*/ + +static void timer_t3_expired(t30_state_t *s) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "T3 expired in phase %s, state %d\n", phase_names[s->phase], s->state); + s->current_status = T30_ERR_T3_EXPIRED; + disconnect(s); +} +/*- End of function --------------------------------------------------------*/ + +static void timer_t4_expired(t30_state_t *s) +{ + /* There was no response (or only a corrupt response) to a command, + within the T4 timeout period. */ + span_log(&s->logging, SPAN_LOG_FLOW, "T4 expired in phase %s, state %d\n", phase_names[s->phase], s->state); + /* Of course, things might just be a little late, especially if there are T.38 + links in the path. There is no point in simply timing out, and resending, + if we are currently receiving something from the far end - its a half-duplex + path, so the two transmissions will conflict. Our best strategy is to wait + until there is nothing being received, or give up after a long backstop timeout. + In the meantime, if we get a meaningful, if somewhat delayed, response, we + should accept it and carry on. */ + repeat_last_command(s); +} +/*- End of function --------------------------------------------------------*/ + +static void timer_t4a_expired(t30_state_t *s) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "T4A expired in phase %s, state %d. An HDLC frame lasted too long.\n", phase_names[s->phase], s->state); + s->current_status = T30_ERR_HDLC_CARRIER; + disconnect(s); +} +/*- End of function --------------------------------------------------------*/ + +static void timer_t4b_expired(t30_state_t *s) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "T4B expired in phase %s, state %d. The line is now quiet.\n", phase_names[s->phase], s->state); + timer_t4_expired(s); +} +/*- End of function --------------------------------------------------------*/ + +static void timer_t5_expired(t30_state_t *s) +{ + /* Give up waiting for the receiver to become ready in error correction mode */ + span_log(&s->logging, SPAN_LOG_FLOW, "T5 expired in phase %s, state %d\n", phase_names[s->phase], s->state); + s->current_status = T30_ERR_TX_T5EXP; +} +/*- End of function --------------------------------------------------------*/ + +static void decode_20digit_msg(t30_state_t *s, char *msg, const uint8_t *pkt, int len) +{ + int p; + int k; + char text[T30_MAX_IDENT_LEN + 1]; + + if (msg == NULL) + msg = text; + if (len > T30_MAX_IDENT_LEN + 1) + { + unexpected_frame_length(s, pkt, len); + msg[0] = '\0'; + return; + } + p = len; + /* Strip trailing spaces */ + while (p > 1 && pkt[p - 1] == ' ') + p--; + /* The string is actually backwards in the message */ + k = 0; + while (p > 1) + msg[k++] = pkt[--p]; + msg[k] = '\0'; + span_log(&s->logging, SPAN_LOG_FLOW, "Remote gave %s as: \"%s\"\n", t30_frametype(pkt[0]), msg); +} +/*- End of function --------------------------------------------------------*/ + +static void decode_url_msg(t30_state_t *s, char *msg, const uint8_t *pkt, int len) +{ + char text[77 + 1]; + + /* TODO: decode properly, as per T.30 5.3.6.2.12 */ + if (msg == NULL) + msg = text; + if (len < 3 || len > 77 + 3 || len != pkt[2] + 3) + { + unexpected_frame_length(s, pkt, len); + msg[0] = '\0'; + return; + } + /* First octet is the sequence number of the packet. + Bit 7 = 1 for more follows, 0 for last packet in the sequence. + Bits 6-0 = The sequence number, 0 to 0x7F + Second octet is the type of internet address. + Bits 7-4 = reserved + Bits 3-0 = type: + 0 = reserved + 1 = e-mail address + 2 = URL + 3 = TCP/IP V4 + 4 = TCP/IP V6 + 5 = international phone number, in the usual +... format + 6-15 = reserved + Third octet is the length of the internet address + Bit 7 = 1 for more follows, 0 for last packet in the sequence. + Bits 6-0 = length + */ + memcpy(msg, &pkt[3], len - 3); + msg[len - 3] = '\0'; + span_log(&s->logging, SPAN_LOG_FLOW, "Remote fax gave %s as: %d, %d, \"%s\"\n", t30_frametype(pkt[0]), pkt[0], pkt[1], msg); +} +/*- End of function --------------------------------------------------------*/ + +static void t30_non_ecm_rx_status(void *user_data, int status) +{ + t30_state_t *s; + int was_trained; + + s = (t30_state_t *) user_data; + span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM signal status is %s (%d) in state %d\n", signal_status_to_str(status), status, s->state); + switch (status) + { + case SIG_STATUS_TRAINING_IN_PROGRESS: + break; + case SIG_STATUS_TRAINING_FAILED: + s->rx_trained = FALSE; + break; + case SIG_STATUS_TRAINING_SUCCEEDED: + /* The modem is now trained */ + /* In case we are in trainability test mode... */ + s->tcf_test_bits = 0; + s->tcf_current_zeros = 0; + s->tcf_most_zeros = 0; + s->rx_signal_present = TRUE; + s->rx_trained = TRUE; + timer_t2_t4_stop(s); + break; + case SIG_STATUS_CARRIER_UP: + break; + case SIG_STATUS_CARRIER_DOWN: + was_trained = s->rx_trained; + s->rx_signal_present = FALSE; + s->rx_trained = FALSE; + switch (s->state) + { + case T30_STATE_F_TCF: + /* Only respond if we managed to actually sync up with the source. We don't + want to respond just because we saw a click. These often occur just + before the real signal, with many modems. Presumably this is due to switching + within the far end modem. We also want to avoid the possibility of responding + to the tail end of any slow modem signal. If there was a genuine data signal + which we failed to train on it should not matter. If things are that bad, we + do not stand much chance of good quality communications. */ + if (was_trained) + { + /* Although T.30 says the training test should be 1.5s of all 0's, some FAX + machines send a burst of all 1's before the all 0's. Tolerate this. */ + if (s->tcf_current_zeros > s->tcf_most_zeros) + s->tcf_most_zeros = s->tcf_current_zeros; + span_log(&s->logging, SPAN_LOG_FLOW, "Trainability (TCF) test result - %d total bits. longest run of zeros was %d\n", s->tcf_test_bits, s->tcf_most_zeros); + if (s->tcf_most_zeros < fallback_sequence[s->current_fallback].bit_rate) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Trainability (TCF) test failed - longest run of zeros was %d\n", s->tcf_most_zeros); + set_phase(s, T30_PHASE_B_TX); + set_state(s, T30_STATE_F_FTT); + send_simple_frame(s, T30_FTT); + } + else + { + /* The training went OK */ + s->short_train = TRUE; + s->in_message = TRUE; + rx_start_page(s); + set_phase(s, T30_PHASE_B_TX); + set_state(s, T30_STATE_F_CFR); + send_cfr_sequence(s, TRUE); + } + } + break; + case T30_STATE_F_POST_DOC_NON_ECM: + /* Page ended cleanly */ + if (s->current_status == T30_ERR_RX_NOCARRIER) + s->current_status = T30_ERR_OK; + break; + default: + /* We should be receiving a document right now, but it did not end cleanly. */ + if (was_trained) + { + span_log(&s->logging, SPAN_LOG_WARNING, "Page did not end cleanly\n"); + /* We trained OK, so we should have some kind of received page, even though + it did not end cleanly. */ + set_state(s, T30_STATE_F_POST_DOC_NON_ECM); + set_phase(s, T30_PHASE_D_RX); + timer_t2_start(s); + if (s->current_status == T30_ERR_RX_NOCARRIER) + s->current_status = T30_ERR_OK; + } + else + { + span_log(&s->logging, SPAN_LOG_WARNING, "Non-ECM carrier not found\n"); + s->current_status = T30_ERR_RX_NOCARRIER; + } + break; + } + if (s->next_phase != T30_PHASE_IDLE) + { + set_phase(s, s->next_phase); + s->next_phase = T30_PHASE_IDLE; + } + break; + default: + span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected non-ECM rx status - %d!\n", status); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(void) t30_non_ecm_put_bit(void *user_data, int bit) +{ + t30_state_t *s; + + if (bit < 0) + { + t30_non_ecm_rx_status(user_data, bit); + return; + } + s = (t30_state_t *) user_data; + switch (s->state) + { + case T30_STATE_F_TCF: + /* Trainability test */ + s->tcf_test_bits++; + if (bit) + { + if (s->tcf_current_zeros > s->tcf_most_zeros) + s->tcf_most_zeros = s->tcf_current_zeros; + s->tcf_current_zeros = 0; + } + else + { + s->tcf_current_zeros++; + } + break; + case T30_STATE_F_DOC_NON_ECM: + /* Document transfer */ + if (t4_rx_put_bit(&s->t4, bit)) + { + /* That is the end of the document */ + set_state(s, T30_STATE_F_POST_DOC_NON_ECM); + queue_phase(s, T30_PHASE_D_RX); + timer_t2_start(s); + } + break; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t30_non_ecm_put_byte(void *user_data, int byte) +{ + t30_state_t *s; + + s = (t30_state_t *) user_data; + switch (s->state) + { + case T30_STATE_F_TCF: + /* Trainability test */ + /* This makes counting zeros fast, but approximate. That really doesn't matter */ + s->tcf_test_bits += 8; + if (byte) + { + if (s->tcf_current_zeros > s->tcf_most_zeros) + s->tcf_most_zeros = s->tcf_current_zeros; + s->tcf_current_zeros = 0; + } + else + { + s->tcf_current_zeros += 8; + } + break; + case T30_STATE_F_DOC_NON_ECM: + /* Document transfer */ + if (t4_rx_put_byte(&s->t4, (uint8_t) byte)) + { + /* That is the end of the document */ + set_state(s, T30_STATE_F_POST_DOC_NON_ECM); + queue_phase(s, T30_PHASE_D_RX); + timer_t2_start(s); + } + break; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t30_non_ecm_put_chunk(void *user_data, const uint8_t buf[], int len) +{ + t30_state_t *s; + int i; + + s = (t30_state_t *) user_data; + switch (s->state) + { + case T30_STATE_F_TCF: + /* Trainability test */ + /* This makes counting zeros fast, but approximate. That really doesn't matter */ + s->tcf_test_bits += 8*len; + for (i = 0; i < len; i++) + { + if (buf[i]) + { + if (s->tcf_current_zeros > s->tcf_most_zeros) + s->tcf_most_zeros = s->tcf_current_zeros; + s->tcf_current_zeros = 0; + } + else + { + s->tcf_current_zeros += 8; + } + } + break; + case T30_STATE_F_DOC_NON_ECM: + /* Document transfer */ + if (t4_rx_put_chunk(&s->t4, buf, len)) + { + /* That is the end of the document */ + set_state(s, T30_STATE_F_POST_DOC_NON_ECM); + queue_phase(s, T30_PHASE_D_RX); + timer_t2_start(s); + } + break; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) t30_non_ecm_get_bit(void *user_data) +{ + int bit; + t30_state_t *s; + + s = (t30_state_t *) user_data; + switch (s->state) + { + case T30_STATE_D_TCF: + /* Trainability test. */ + bit = 0; + if (s->tcf_test_bits-- < 0) + { + /* Finished sending training test. */ + bit = SIG_STATUS_END_OF_DATA; + } + break; + case T30_STATE_I: + /* Transferring real data. */ + bit = t4_tx_get_bit(&s->t4); + break; + case T30_STATE_D_POST_TCF: + case T30_STATE_II_Q: + /* We should be padding out a block of samples if we are here */ + bit = 0; + break; + default: + span_log(&s->logging, SPAN_LOG_WARNING, "t30_non_ecm_get_bit in bad state %d\n", s->state); + bit = SIG_STATUS_END_OF_DATA; + break; + } + return bit; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_non_ecm_get_byte(void *user_data) +{ + int byte; + t30_state_t *s; + + s = (t30_state_t *) user_data; + switch (s->state) + { + case T30_STATE_D_TCF: + /* Trainability test. */ + byte = 0; + if ((s->tcf_test_bits -= 8) < 0) + { + /* Finished sending training test. */ + byte = 0x100; + } + break; + case T30_STATE_I: + /* Transferring real data. */ + byte = t4_tx_get_byte(&s->t4); + break; + case T30_STATE_D_POST_TCF: + case T30_STATE_II_Q: + /* We should be padding out a block of samples if we are here */ + byte = 0; + break; + default: + span_log(&s->logging, SPAN_LOG_WARNING, "t30_non_ecm_get_byte in bad state %d\n", s->state); + byte = 0x100; + break; + } + return byte; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_non_ecm_get_chunk(void *user_data, uint8_t buf[], int max_len) +{ + int len; + t30_state_t *s; + + s = (t30_state_t *) user_data; + switch (s->state) + { + case T30_STATE_D_TCF: + /* Trainability test. */ + for (len = 0; len < max_len; len++) + { + buf[len] = 0; + if ((s->tcf_test_bits -= 8) < 0) + break; + } + break; + case T30_STATE_I: + /* Transferring real data. */ + len = t4_tx_get_chunk(&s->t4, buf, max_len); + break; + case T30_STATE_D_POST_TCF: + case T30_STATE_II_Q: + /* We should be padding out a block of samples if we are here */ + len = 0; + break; + default: + span_log(&s->logging, SPAN_LOG_WARNING, "t30_non_ecm_get_chunk in bad state %d\n", s->state); + len = 0; + break; + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +static void t30_hdlc_rx_status(void *user_data, int status) +{ + t30_state_t *s; + int was_trained; + + s = (t30_state_t *) user_data; + span_log(&s->logging, SPAN_LOG_FLOW, "HDLC signal status is %s (%d) in state %d\n", signal_status_to_str(status), status, s->state); + switch (status) + { + case SIG_STATUS_TRAINING_IN_PROGRESS: + break; + case SIG_STATUS_TRAINING_FAILED: + s->rx_trained = FALSE; + break; + case SIG_STATUS_TRAINING_SUCCEEDED: + /* The modem is now trained */ + s->rx_signal_present = TRUE; + s->rx_trained = TRUE; + break; + case SIG_STATUS_CARRIER_UP: + s->rx_signal_present = TRUE; + switch (s->timer_t2_t4_is) + { + case TIMER_IS_T2B: + timer_t2_t4_stop(s); + s->timer_t2_t4_is = TIMER_IS_T2C; + break; + case TIMER_IS_T4B: + timer_t2_t4_stop(s); + s->timer_t2_t4_is = TIMER_IS_T4C; + break; + } + break; + case SIG_STATUS_CARRIER_DOWN: + was_trained = s->rx_trained; + s->rx_signal_present = FALSE; + s->rx_trained = FALSE; + /* If a phase change has been queued to occur after the receive signal drops, + its time to change. */ + if (s->state == T30_STATE_F_DOC_ECM) + { + /* We should be receiving a document right now, but we haven't seen an RCP at the end of + transmission. */ + if (was_trained) + { + /* We trained OK, so we should have some kind of received page, possibly with + zero good HDLC frames. It just did'nt end cleanly with an RCP. */ + span_log(&s->logging, SPAN_LOG_WARNING, "ECM signal did not end cleanly\n"); + /* Fake the existance of an RCP, and proceed */ + set_state(s, T30_STATE_F_POST_DOC_ECM); + queue_phase(s, T30_PHASE_D_RX); + timer_t2_start(s); + /* We at least trained, so any missing carrier status is out of date */ + if (s->current_status == T30_ERR_RX_NOCARRIER) + s->current_status = T30_ERR_OK; + } + else + { + /* Either there was no image carrier, or we failed to train to it. */ + span_log(&s->logging, SPAN_LOG_WARNING, "ECM carrier not found\n"); + s->current_status = T30_ERR_RX_NOCARRIER; + } + } + if (s->next_phase != T30_PHASE_IDLE) + { + /* The appropriate timer for the next phase should already be in progress */ + set_phase(s, s->next_phase); + s->next_phase = T30_PHASE_IDLE; + } + else + { + switch (s->timer_t2_t4_is) + { + case TIMER_IS_T1A: + case TIMER_IS_T2A: + case TIMER_IS_T2C: + timer_t2b_start(s); + break; + case TIMER_IS_T4A: + case TIMER_IS_T4C: + timer_t4b_start(s); + break; + } + } + break; + case SIG_STATUS_FRAMING_OK: + if (!s->far_end_detected && s->timer_t0_t1 > 0) + { + s->timer_t0_t1 = ms_to_samples(DEFAULT_TIMER_T1); + s->far_end_detected = TRUE; + if (s->phase == T30_PHASE_A_CED || s->phase == T30_PHASE_A_CNG) + set_phase(s, T30_PHASE_B_RX); + } + /* 5.4.3.1 Timer T2 is reset if flag is received. Timer T2A must be started. */ + /* Unstated, but implied, is that timer T4 and T4A are handled the same way. */ + if (s->timer_t2_t4 > 0) + { + switch(s->timer_t2_t4_is) + { + case TIMER_IS_T1A: + case TIMER_IS_T2: + case TIMER_IS_T2A: + timer_t2a_start(s); + break; + case TIMER_IS_T4: + case TIMER_IS_T4A: + timer_t4a_start(s); + break; + } + } + break; + case SIG_STATUS_ABORT: + /* Just ignore these */ + break; + default: + span_log(&s->logging, SPAN_LOG_FLOW, "Unexpected HDLC special length - %d!\n", status); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(void) t30_hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok) +{ + t30_state_t *s; + + if (len < 0) + { + t30_hdlc_rx_status(user_data, len); + return; + } + + s = (t30_state_t *) user_data; + /* The spec. says a command or response is not valid if: + - any of the frames, optional or mandatory, have an FCS error. + - any single frame exceeds 3s +- 15% (i.e. no frame should exceed 2.55s) + - the final frame is not tagged as a final frame + - the final frame is not a recognised one. + The first point seems benign. If we accept an optional frame, and a later + frame is bad, having accepted the optional frame should be harmless. + The 2.55s maximum seems to limit signalling frames to no more than 95 octets, + including FCS, and flag octets (assuming the use of V.21). + */ + if (!ok) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Bad HDLC CRC received\n"); + if (s->phase != T30_PHASE_C_ECM_RX) + { + /* We either force a resend, or we wait until a resend occurs through a timeout. */ + if ((s->supported_t30_features & T30_SUPPORT_COMMAND_REPEAT)) + { + s->step = 0; + if (s->phase == T30_PHASE_B_RX) + queue_phase(s, T30_PHASE_B_TX); + else + queue_phase(s, T30_PHASE_D_TX); + send_simple_frame(s, T30_CRP); + } + else + { + /* Cancel the command or response timer (if one is running) */ + span_log(&s->logging, SPAN_LOG_FLOW, "Bad CRC and timer is %d\n", s->timer_t2_t4_is); + if (s->timer_t2_t4_is == TIMER_IS_T2A) + timer_t2_t4_stop(s); + } + } + return; + } + + if (len < 3) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Bad HDLC frame length - %d\n", len); + /* Cancel the command or response timer (if one is running) */ + timer_t2_t4_stop(s); + return; + } + if (msg[0] != ADDRESS_FIELD + || + !(msg[1] == CONTROL_FIELD_NON_FINAL_FRAME || msg[1] == CONTROL_FIELD_FINAL_FRAME)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Bad HDLC frame header - %02x %02x\n", msg[0], msg[1]); + /* Cancel the command or response timer (if one is running) */ + timer_t2_t4_stop(s); + return; + } + s->rx_frame_received = TRUE; + /* Cancel the command or response timer (if one is running) */ + timer_t2_t4_stop(s); + process_rx_control_msg(s, msg, len); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status) +{ + t30_state_t *s; + + s = (t30_state_t *) user_data; + + switch (status) + { + case T30_FRONT_END_SEND_STEP_COMPLETE: + span_log(&s->logging, SPAN_LOG_FLOW, "Send complete in phase %s, state %d\n", phase_names[s->phase], s->state); + /* We have finished sending our messages, so move on to the next operation. */ + switch (s->state) + { + case T30_STATE_ANSWERING: + span_log(&s->logging, SPAN_LOG_FLOW, "Starting answer mode\n"); + set_phase(s, T30_PHASE_B_TX); + timer_t2_start(s); + s->dis_received = FALSE; + send_dis_or_dtc_sequence(s, TRUE); + break; + case T30_STATE_R: + if (send_dis_or_dtc_sequence(s, FALSE)) + { + /* Wait for an acknowledgement. */ + set_phase(s, T30_PHASE_B_RX); + timer_t4_start(s); + } + break; + case T30_STATE_F_CFR: + if (s->step == 0) + { + /* Shut down HDLC transmission. */ + if (s->send_hdlc_handler) + s->send_hdlc_handler(s->send_hdlc_user_data, NULL, 0); + s->step++; + } + else + { + if (s->error_correcting_mode) + { + set_state(s, T30_STATE_F_DOC_ECM); + queue_phase(s, T30_PHASE_C_ECM_RX); + } + else + { + set_state(s, T30_STATE_F_DOC_NON_ECM); + queue_phase(s, T30_PHASE_C_NON_ECM_RX); + } + timer_t2_start(s); + s->next_rx_step = T30_MPS; + } + break; + case T30_STATE_F_FTT: + if (s->step == 0) + { + /* Shut down HDLC transmission. */ + if (s->send_hdlc_handler) + s->send_hdlc_handler(s->send_hdlc_user_data, NULL, 0); + s->step++; + } + else + { + set_phase(s, T30_PHASE_B_RX); + timer_t2_start(s); + } + break; + case T30_STATE_III_Q_MCF: + case T30_STATE_III_Q_RTP: + case T30_STATE_III_Q_RTN: + case T30_STATE_F_POST_RCP_PPR: + case T30_STATE_F_POST_RCP_MCF: + if (s->step == 0) + { + /* Shut down HDLC transmission. */ + if (s->send_hdlc_handler) + s->send_hdlc_handler(s->send_hdlc_user_data, NULL, 0); + s->step++; + } + else + { + switch (s->next_rx_step) + { + case T30_MPS: + case T30_PRI_MPS: + /* We should now start to get another page */ + if (s->error_correcting_mode) + { + set_state(s, T30_STATE_F_DOC_ECM); + queue_phase(s, T30_PHASE_C_ECM_RX); + } + else + { + set_state(s, T30_STATE_F_DOC_NON_ECM); + queue_phase(s, T30_PHASE_C_NON_ECM_RX); + } + timer_t2_start(s); + break; + case T30_EOM: + case T30_PRI_EOM: + case T30_EOS: + /* See if we get something back, before moving to phase B. */ + timer_t2_start(s); + set_phase(s, T30_PHASE_D_RX); + break; + case T30_EOP: + case T30_PRI_EOP: + /* Wait for a DCN. */ + set_phase(s, T30_PHASE_D_RX); + timer_t4_start(s); + break; + default: + span_log(&s->logging, SPAN_LOG_FLOW, "Unknown next rx step - %d\n", s->next_rx_step); + disconnect(s); + break; + } + } + break; + case T30_STATE_II_Q: + case T30_STATE_IV_PPS_NULL: + case T30_STATE_IV_PPS_Q: + case T30_STATE_IV_PPS_RNR: + case T30_STATE_IV_EOR_RNR: + case T30_STATE_F_POST_RCP_RNR: + case T30_STATE_IV_EOR: + case T30_STATE_IV_CTC: + if (s->step == 0) + { + /* Shut down HDLC transmission. */ + if (s->send_hdlc_handler) + s->send_hdlc_handler(s->send_hdlc_user_data, NULL, 0); + s->step++; + } + else + { + /* We have finished sending the post image message. Wait for an + acknowledgement. */ + set_phase(s, T30_PHASE_D_RX); + timer_t4_start(s); + } + break; + case T30_STATE_B: + /* We have now allowed time for the last message to flush through + the system, so it is safe to report the end of the call. */ + if (s->phase_e_handler) + s->phase_e_handler(s, s->phase_e_user_data, s->current_status); + set_state(s, T30_STATE_CALL_FINISHED); + set_phase(s, T30_PHASE_CALL_FINISHED); + release_resources(s); + break; + case T30_STATE_C: + if (s->step == 0) + { + /* Shut down HDLC transmission. */ + if (s->send_hdlc_handler) + s->send_hdlc_handler(s->send_hdlc_user_data, NULL, 0); + s->step++; + } + else + { + /* We just sent the disconnect message. Now it is time to disconnect. */ + disconnect(s); + } + break; + case T30_STATE_D: + if (send_dcs_sequence(s, FALSE)) + { + if ((s->iaf & T30_IAF_MODE_NO_TCF)) + { + /* Skip the trainability test */ + s->retries = 0; + s->short_train = TRUE; + if (s->error_correcting_mode) + { + set_state(s, T30_STATE_IV); + queue_phase(s, T30_PHASE_C_ECM_TX); + } + else + { + set_state(s, T30_STATE_I); + queue_phase(s, T30_PHASE_C_NON_ECM_TX); + } + } + else + { + /* Do the trainability test */ + /* TCF is always sent with long training */ + s->short_train = FALSE; + set_state(s, T30_STATE_D_TCF); + set_phase(s, T30_PHASE_C_NON_ECM_TX); + } + } + break; + case T30_STATE_D_TCF: + /* Finished sending training test. Listen for the response. */ + set_phase(s, T30_PHASE_B_RX); + timer_t4_start(s); + set_state(s, T30_STATE_D_POST_TCF); + break; + case T30_STATE_I: + /* Send the end of page message */ + set_phase(s, T30_PHASE_D_TX); + set_state(s, T30_STATE_II_Q); + /* We might need to resend the page we are on, but we need to check if there + are any more pages to send, so we can send the correct signal right now. */ + send_simple_frame(s, s->next_tx_step = check_next_tx_step(s)); + break; + case T30_STATE_IV: + /* We have finished sending an FCD frame */ + if (s->step == 0) + { + if (send_next_ecm_frame(s)) + { + /* Shut down HDLC transmission. */ + if (s->send_hdlc_handler) + s->send_hdlc_handler(s->send_hdlc_user_data, NULL, 0); + s->step++; + } + } + else + { + /* Send the end of page or partial page message */ + set_phase(s, T30_PHASE_D_TX); + s->next_tx_step = check_next_tx_step(s); + if (send_pps_frame(s) == T30_NULL) + set_state(s, T30_STATE_IV_PPS_NULL); + else + set_state(s, T30_STATE_IV_PPS_Q); + } + break; + case T30_STATE_F_DOC_ECM: + /* This should be the end of a CTR being sent. */ + if (s->step == 0) + { + /* Shut down HDLC transmission. */ + if (s->send_hdlc_handler) + s->send_hdlc_handler(s->send_hdlc_user_data, NULL, 0); + s->step++; + } + else + { + /* We have finished sending the CTR. Wait for image data again. */ + queue_phase(s, T30_PHASE_C_ECM_RX); + timer_t2_start(s); + } + break; + case T30_STATE_CALL_FINISHED: + /* Just ignore anything that happens now. We might get here if a premature + disconnect from the far end overlaps something. */ + break; + default: + span_log(&s->logging, SPAN_LOG_FLOW, "Bad state for send complete in t30_front_end_status - %d\n", s->state); + break; + } + break; + case T30_FRONT_END_RECEIVE_COMPLETE: + span_log(&s->logging, SPAN_LOG_FLOW, "Receive complete in phase %s, state %d\n", phase_names[s->phase], s->state); + /* Usually receive complete is notified by a carrier down signal. However, + in cases like a T.38 packet stream dying in the middle of reception + there needs to be a means to stop things. */ + switch (s->phase) + { + case T30_PHASE_C_NON_ECM_RX: + t30_non_ecm_rx_status(s, SIG_STATUS_CARRIER_DOWN); + break; + default: + t30_hdlc_rx_status(s, SIG_STATUS_CARRIER_DOWN); + break; + } + break; + case T30_FRONT_END_SIGNAL_PRESENT: + span_log(&s->logging, SPAN_LOG_FLOW, "A signal is present\n"); + /* The front end is explicitly telling us the signal we expect is present. This might + be a premature indication from a T.38 implementation, but we have to believe it. + if we don't we can time out improperly. For example, we might get an image modem + carrier signal, but the first HDLC frame might only occur several seconds later. + Many ECM senders idle on HDLC flags while waiting for the paper or filing system + to become ready. T.38 offers no specific indication of correct carrier training, so + if we don't kill the timer on the initial carrier starting signal, we will surely + time out quite often before the next thing we receive. */ + switch (s->phase) + { + case T30_PHASE_A_CED: + case T30_PHASE_A_CNG: + case T30_PHASE_B_RX: + case T30_PHASE_D_RX: + /* We are running a V.21 receive modem, where an explicit training indication + will not occur. */ + t30_hdlc_rx_status(s, SIG_STATUS_CARRIER_UP); + t30_hdlc_rx_status(s, SIG_STATUS_FRAMING_OK); + break; + default: + /* Cancel any receive timeout, and declare that a receive signal is present, + since the front end is explicitly telling us we have seen something. */ + s->rx_signal_present = TRUE; + timer_t2_t4_stop(s); + break; + } + break; + case T30_FRONT_END_SIGNAL_ABSENT: + span_log(&s->logging, SPAN_LOG_FLOW, "No signal is present\n"); + /* TODO: Should we do anything here? */ + break; + case T30_FRONT_END_CED_PRESENT: + span_log(&s->logging, SPAN_LOG_FLOW, "CED tone is present\n"); + /* TODO: Should we do anything here? */ + break; + case T30_FRONT_END_CNG_PRESENT: + span_log(&s->logging, SPAN_LOG_FLOW, "CNG tone is present\n"); + /* TODO: Should we do anything here? */ + break; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t30_timer_update(t30_state_t *s, int samples) +{ + int previous; + + if (s->timer_t0_t1 > 0) + { + if ((s->timer_t0_t1 -= samples) <= 0) + { + s->timer_t0_t1 = 0; + if (s->far_end_detected) + timer_t1_expired(s); + else + timer_t0_expired(s); + } + } + if (s->timer_t3 > 0) + { + if ((s->timer_t3 -= samples) <= 0) + { + s->timer_t3 = 0; + timer_t3_expired(s); + } + } + if (s->timer_t2_t4 > 0) + { + if ((s->timer_t2_t4 -= samples) <= 0) + { + previous = s->timer_t2_t4_is; + /* Don't allow the count to be left at a small negative number. + It looks cosmetically bad in the logs. */ + s->timer_t2_t4 = 0; + s->timer_t2_t4_is = TIMER_IS_IDLE; + switch (previous) + { + case TIMER_IS_T1A: + timer_t1a_expired(s); + break; + case TIMER_IS_T2: + timer_t2_expired(s); + break; + case TIMER_IS_T2A: + timer_t2a_expired(s); + break; + case TIMER_IS_T2B: + timer_t2b_expired(s); + break; + case TIMER_IS_T4: + timer_t4_expired(s); + break; + case TIMER_IS_T4A: + timer_t4a_expired(s); + break; + case TIMER_IS_T4B: + timer_t4b_expired(s); + break; + } + } + } + if (s->timer_t5 > 0) + { + if ((s->timer_t5 -= samples) <= 0) + { + s->timer_t5 = 0; + timer_t5_expired(s); + } + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t30_terminate(t30_state_t *s) +{ + if (s->phase != T30_PHASE_CALL_FINISHED) + { + /* The far end disconnected early, but was it just a tiny bit too early, + as we were just tidying up, or seriously early as in a failure? */ + switch (s->state) + { + case T30_STATE_C: + /* We were sending the final disconnect, so just hussle things along. */ + disconnect(s); + break; + case T30_STATE_B: + /* We were in the final wait for everything to flush through, so just + hussle things along. */ + break; + default: + /* The call terminated prematurely. */ + s->current_status = T30_ERR_CALLDROPPED; + break; + } + if (s->phase_e_handler) + s->phase_e_handler(s, s->phase_e_user_data, s->current_status); + set_state(s, T30_STATE_CALL_FINISHED); + set_phase(s, T30_PHASE_CALL_FINISHED); + release_resources(s); + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t30_get_transfer_statistics(t30_state_t *s, t30_stats_t *t) +{ + t4_stats_t stats; + + t->bit_rate = fallback_sequence[s->current_fallback].bit_rate; + t->error_correcting_mode = s->error_correcting_mode; + t->error_correcting_mode_retries = s->error_correcting_mode_retries; + t4_get_transfer_statistics(&s->t4, &stats); + t->pages_tx = s->tx_page_number; + t->pages_rx = s->rx_page_number; + t->pages_in_file = stats.pages_in_file; + t->width = stats.width; + t->length = stats.length; + t->bad_rows = stats.bad_rows; + t->longest_bad_row_run = stats.longest_bad_row_run; + t->x_resolution = stats.x_resolution; + t->y_resolution = stats.y_resolution; + t->encoding = stats.encoding; + t->image_size = stats.line_image_size; + t->current_status = s->current_status; +#if 0 + t->rtn_events = s->rtn_events; + t->rtp_events = s->rtp_events; +#endif +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t30_local_interrupt_request(t30_state_t *s, int state) +{ + if (s->timer_t3 > 0) + { + /* Accept the far end's outstanding request for interrupt. */ + /* TODO: */ + send_simple_frame(s, (state) ? T30_PIP : T30_PIN); + } + s->local_interrupt_pending = state; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_restart(t30_state_t *s) +{ + s->phase = T30_PHASE_IDLE; + s->next_phase = T30_PHASE_IDLE; + s->current_fallback = 0; + s->rx_signal_present = FALSE; + s->rx_trained = FALSE; + s->rx_frame_received = FALSE; + s->current_status = T30_ERR_OK; + s->ppr_count = 0; + s->ecm_progress = 0; + s->receiver_not_ready_count = 0; + s->far_dis_dtc_len = 0; + memset(&s->far_dis_dtc_frame, 0, sizeof(s->far_dis_dtc_frame)); + t30_build_dis_or_dtc(s); + memset(&s->rx_info, 0, sizeof(s->rx_info)); + release_resources(s); + /* The page number is only reset at call establishment */ + s->rx_page_number = 0; + s->tx_page_number = 0; +#if 0 + s->rtn_events = 0; + s->rtp_events = 0; +#endif + s->far_end_detected = FALSE; + s->timer_t0_t1 = ms_to_samples(DEFAULT_TIMER_T0); + if (s->calling_party) + { + set_state(s, T30_STATE_T); + set_phase(s, T30_PHASE_A_CNG); + } + else + { + set_state(s, T30_STATE_ANSWERING); + set_phase(s, T30_PHASE_A_CED); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(t30_state_t *) t30_init(t30_state_t *s, + int calling_party, + t30_set_handler_t *set_rx_type_handler, + void *set_rx_type_user_data, + t30_set_handler_t *set_tx_type_handler, + void *set_tx_type_user_data, + t30_send_hdlc_handler_t *send_hdlc_handler, + void *send_hdlc_user_data) +{ + if (s == NULL) + { + if ((s = (t30_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + s->calling_party = calling_party; + s->set_rx_type_handler = set_rx_type_handler; + s->set_rx_type_user_data = set_rx_type_user_data; + s->set_tx_type_handler = set_tx_type_handler; + s->set_tx_type_user_data = set_tx_type_user_data; + s->send_hdlc_handler = send_hdlc_handler; + s->send_hdlc_user_data = send_hdlc_user_data; + + /* Default to the basic modems. */ + s->supported_modems = T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17; + s->supported_compressions = T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION; + s->supported_resolutions = T30_SUPPORT_STANDARD_RESOLUTION | T30_SUPPORT_FINE_RESOLUTION | T30_SUPPORT_SUPERFINE_RESOLUTION + | T30_SUPPORT_R8_RESOLUTION; + s->supported_image_sizes = T30_SUPPORT_US_LETTER_LENGTH | T30_SUPPORT_US_LEGAL_LENGTH | T30_SUPPORT_UNLIMITED_LENGTH + | T30_SUPPORT_215MM_WIDTH; + /* Set the output encoding to something safe. Most things get 1D and 2D + encoding right. Quite a lot get other things wrong. */ + s->output_encoding = T4_COMPRESSION_ITU_T4_2D; + s->local_min_scan_time_code = T30_MIN_SCAN_0MS; + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "T.30"); + t30_restart(s); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_release(t30_state_t *s) +{ + /* Make sure any FAX in progress is tidied up. If the tidying up has + already happened, repeating it here is harmless. */ + switch (s->operation_in_progress) + { + case OPERATION_IN_PROGRESS_T4_TX: + t4_tx_release(&s->t4); + break; + case OPERATION_IN_PROGRESS_T4_RX: + t4_rx_release(&s->t4); + break; + } + s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_free(t30_state_t *s) +{ + t30_release(s); + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_call_active(t30_state_t *s) +{ + return (s->phase != T30_PHASE_CALL_FINISHED); +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/t30_api.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/t30_api.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,739 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t30_api.c - ITU T.30 FAX transfer processing + * + * Written by Steve Underwood + * + * Copyright (C) 2003, 2004, 2005, 2006, 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t30_api.c,v 1.13.4.2 2009/12/19 14:18:13 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/bit_operations.h" +#include "spandsp/queue.h" +#include "spandsp/power_meter.h" +#include "spandsp/complex.h" +#include "spandsp/tone_generate.h" +#include "spandsp/async.h" +#include "spandsp/hdlc.h" +#include "spandsp/fsk.h" +#include "spandsp/v29rx.h" +#include "spandsp/v29tx.h" +#include "spandsp/v27ter_rx.h" +#include "spandsp/v27ter_tx.h" +#include "spandsp/t4_rx.h" +#include "spandsp/t4_tx.h" +#include "spandsp/t30_fcf.h" +#include "spandsp/t35.h" +#include "spandsp/t30.h" +#include "spandsp/t30_api.h" +#include "spandsp/t30_logging.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/t4_rx.h" +#include "spandsp/private/t4_tx.h" +#include "spandsp/private/t30.h" + +#include "t30_local.h" + +SPAN_DECLARE(int) t30_set_tx_ident(t30_state_t *s, const char *id) +{ + if (id == NULL) + { + s->tx_info.ident[0] = '\0'; + return 0; + } + if (strlen(id) > T30_MAX_IDENT_LEN) + return -1; + strcpy(s->tx_info.ident, id); + t4_tx_set_local_ident(&s->t4, s->tx_info.ident); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) t30_get_tx_ident(t30_state_t *s) +{ + if (s->tx_info.ident[0] == '\0') + return NULL; + return s->tx_info.ident; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) t30_get_rx_ident(t30_state_t *s) +{ + if (s->rx_info.ident[0] == '\0') + return NULL; + return s->rx_info.ident; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_tx_sub_address(t30_state_t *s, const char *sub_address) +{ + if (sub_address == NULL) + { + s->tx_info.sub_address[0] = '\0'; + return 0; + } + if (strlen(sub_address) > T30_MAX_IDENT_LEN) + return -1; + strcpy(s->tx_info.sub_address, sub_address); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) t30_get_tx_sub_address(t30_state_t *s) +{ + if (s->tx_info.sub_address[0] == '\0') + return NULL; + return s->tx_info.sub_address; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) t30_get_rx_sub_address(t30_state_t *s) +{ + if (s->rx_info.sub_address[0] == '\0') + return NULL; + return s->rx_info.sub_address; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_tx_selective_polling_address(t30_state_t *s, const char *selective_polling_address) +{ + if (selective_polling_address == NULL) + { + s->tx_info.selective_polling_address[0] = '\0'; + return 0; + } + if (strlen(selective_polling_address) > T30_MAX_IDENT_LEN) + return -1; + strcpy(s->tx_info.selective_polling_address, selective_polling_address); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) t30_get_tx_selective_polling_address(t30_state_t *s) +{ + if (s->tx_info.selective_polling_address[0] == '\0') + return NULL; + return s->tx_info.selective_polling_address; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) t30_get_rx_selective_polling_address(t30_state_t *s) +{ + if (s->rx_info.selective_polling_address[0] == '\0') + return NULL; + return s->rx_info.selective_polling_address; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_tx_polled_sub_address(t30_state_t *s, const char *polled_sub_address) +{ + if (polled_sub_address == NULL) + { + s->tx_info.polled_sub_address[0] = '\0'; + return 0; + } + if (strlen(polled_sub_address) > T30_MAX_IDENT_LEN) + return -1; + strcpy(s->tx_info.polled_sub_address, polled_sub_address); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) t30_get_tx_polled_sub_address(t30_state_t *s) +{ + if (s->tx_info.polled_sub_address[0] == '\0') + return NULL; + return s->tx_info.polled_sub_address; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) t30_get_rx_polled_sub_address(t30_state_t *s) +{ + if (s->rx_info.polled_sub_address[0] == '\0') + return NULL; + return s->rx_info.polled_sub_address; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_tx_sender_ident(t30_state_t *s, const char *sender_ident) +{ + if (sender_ident == NULL) + { + s->tx_info.sender_ident[0] = '\0'; + return 0; + } + if (strlen(sender_ident) > T30_MAX_IDENT_LEN) + return -1; + strcpy(s->tx_info.sender_ident, sender_ident); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) t30_get_tx_sender_ident(t30_state_t *s) +{ + if (s->tx_info.sender_ident[0] == '\0') + return NULL; + return s->tx_info.sender_ident; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) t30_get_rx_sender_ident(t30_state_t *s) +{ + if (s->rx_info.sender_ident[0] == '\0') + return NULL; + return s->rx_info.sender_ident; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_tx_password(t30_state_t *s, const char *password) +{ + if (password == NULL) + { + s->tx_info.password[0] = '\0'; + return 0; + } + if (strlen(password) > T30_MAX_IDENT_LEN) + return -1; + strcpy(s->tx_info.password, password); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) t30_get_tx_password(t30_state_t *s) +{ + if (s->tx_info.password[0] == '\0') + return NULL; + return s->tx_info.password; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) t30_get_rx_password(t30_state_t *s) +{ + if (s->rx_info.password[0] == '\0') + return NULL; + return s->rx_info.password; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_tx_nsf(t30_state_t *s, const uint8_t *nsf, int len) +{ + if (s->tx_info.nsf) + free(s->tx_info.nsf); + if (nsf && len > 0 && (s->tx_info.nsf = malloc(len + 3))) + { + memcpy(s->tx_info.nsf + 3, nsf, len); + s->tx_info.nsf_len = len; + } + else + { + s->tx_info.nsf = NULL; + s->tx_info.nsf_len = 0; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(size_t) t30_get_tx_nsf(t30_state_t *s, const uint8_t *nsf[]) +{ + if (nsf) + *nsf = s->tx_info.nsf; + return s->tx_info.nsf_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(size_t) t30_get_rx_nsf(t30_state_t *s, const uint8_t *nsf[]) +{ + if (nsf) + *nsf = s->rx_info.nsf; + return s->rx_info.nsf_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_tx_nsc(t30_state_t *s, const uint8_t *nsc, int len) +{ + if (s->tx_info.nsc) + free(s->tx_info.nsc); + if (nsc && len > 0 && (s->tx_info.nsc = malloc(len + 3))) + { + memcpy(s->tx_info.nsc + 3, nsc, len); + s->tx_info.nsc_len = len; + } + else + { + s->tx_info.nsc = NULL; + s->tx_info.nsc_len = 0; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(size_t) t30_get_tx_nsc(t30_state_t *s, const uint8_t *nsc[]) +{ + if (nsc) + *nsc = s->tx_info.nsc; + return s->tx_info.nsc_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(size_t) t30_get_rx_nsc(t30_state_t *s, const uint8_t *nsc[]) +{ + if (nsc) + *nsc = s->rx_info.nsc; + return s->rx_info.nsc_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_tx_nss(t30_state_t *s, const uint8_t *nss, int len) +{ + if (s->tx_info.nss) + free(s->tx_info.nss); + if (nss && len > 0 && (s->tx_info.nss = malloc(len + 3))) + { + memcpy(s->tx_info.nss + 3, nss, len); + s->tx_info.nss_len = len; + } + else + { + s->tx_info.nss = NULL; + s->tx_info.nss_len = 0; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(size_t) t30_get_tx_nss(t30_state_t *s, const uint8_t *nss[]) +{ + if (nss) + *nss = s->tx_info.nss; + return s->tx_info.nss_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(size_t) t30_get_rx_nss(t30_state_t *s, const uint8_t *nss[]) +{ + if (nss) + *nss = s->rx_info.nss; + return s->rx_info.nss_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_tx_tsa(t30_state_t *s, int type, const char *address, int len) +{ + if (s->tx_info.tsa) + free(s->tx_info.tsa); + if (address == NULL || len == 0) + { + s->tx_info.tsa = NULL; + s->tx_info.tsa_len = 0; + return 0; + } + s->tx_info.tsa_type = type; + if (len < 0) + len = strlen(address); + if ((s->tx_info.tsa = malloc(len))) + { + memcpy(s->tx_info.tsa, address, len); + s->tx_info.tsa_len = len; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(size_t) t30_get_tx_tsa(t30_state_t *s, int *type, const char *address[]) +{ + if (type) + *type = s->tx_info.tsa_type; + if (address) + *address = s->tx_info.tsa; + return s->tx_info.tsa_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(size_t) t30_get_rx_tsa(t30_state_t *s, int *type, const char *address[]) +{ + if (type) + *type = s->rx_info.tsa_type; + if (address) + *address = s->rx_info.tsa; + return s->rx_info.tsa_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_tx_ira(t30_state_t *s, int type, const char *address, int len) +{ + if (s->tx_info.ira) + free(s->tx_info.ira); + if (address == NULL) + { + s->tx_info.ira = NULL; + return 0; + } + s->tx_info.ira = strdup(address); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(size_t) t30_get_tx_ira(t30_state_t *s, int *type, const char *address[]) +{ + if (type) + *type = s->tx_info.ira_type; + if (address) + *address = s->tx_info.ira; + return s->tx_info.ira_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(size_t) t30_get_rx_ira(t30_state_t *s, int *type, const char *address[]) +{ + if (type) + *type = s->rx_info.ira_type; + if (address) + *address = s->rx_info.ira; + return s->rx_info.ira_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_tx_cia(t30_state_t *s, int type, const char *address, int len) +{ + if (s->tx_info.cia) + free(s->tx_info.cia); + if (address == NULL) + { + s->tx_info.cia = NULL; + return 0; + } + s->tx_info.cia = strdup(address); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(size_t) t30_get_tx_cia(t30_state_t *s, int *type, const char *address[]) +{ + if (type) + *type = s->tx_info.cia_type; + if (address) + *address = s->tx_info.cia; + return s->tx_info.cia_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(size_t) t30_get_rx_cia(t30_state_t *s, int *type, const char *address[]) +{ + if (type) + *type = s->rx_info.cia_type; + if (address) + *address = s->rx_info.cia; + return s->rx_info.cia_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_tx_isp(t30_state_t *s, int type, const char *address, int len) +{ + if (s->tx_info.isp) + free(s->tx_info.isp); + if (address == NULL) + { + s->tx_info.isp = NULL; + return 0; + } + s->tx_info.isp = strdup(address); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(size_t) t30_get_tx_isp(t30_state_t *s, int *type, const char *address[]) +{ + if (type) + *type = s->tx_info.isp_type; + if (address) + *address = s->tx_info.isp; + return s->tx_info.isp_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(size_t) t30_get_rx_isp(t30_state_t *s, int *type, const char *address[]) +{ + if (type) + *type = s->rx_info.isp_type; + if (address) + *address = s->rx_info.isp; + return s->rx_info.isp_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_tx_csa(t30_state_t *s, int type, const char *address, int len) +{ + if (s->tx_info.csa) + free(s->tx_info.csa); + if (address == NULL) + { + s->tx_info.csa = NULL; + return 0; + } + s->tx_info.csa = strdup(address); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(size_t) t30_get_tx_csa(t30_state_t *s, int *type, const char *address[]) +{ + if (type) + *type = s->tx_info.csa_type; + if (address) + *address = s->tx_info.csa; + return s->tx_info.csa_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(size_t) t30_get_rx_csa(t30_state_t *s, int *type, const char *address[]) +{ + if (type) + *type = s->rx_info.csa_type; + if (address) + *address = s->rx_info.csa; + return s->rx_info.csa_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_tx_page_header_info(t30_state_t *s, const char *info) +{ + if (info == NULL) + { + s->header_info[0] = '\0'; + return 0; + } + if (strlen(info) > T30_MAX_PAGE_HEADER_INFO) + return -1; + strcpy(s->header_info, info); + t4_tx_set_header_info(&s->t4, s->header_info); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(size_t) t30_get_tx_page_header_info(t30_state_t *s, char *info) +{ + if (info) + strcpy(info, s->header_info); + return strlen(s->header_info); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) t30_get_rx_country(t30_state_t *s) +{ + return s->country; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) t30_get_rx_vendor(t30_state_t *s) +{ + return s->vendor; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) t30_get_rx_model(t30_state_t *s) +{ + return s->model; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t30_set_rx_file(t30_state_t *s, const char *file, int stop_page) +{ + strncpy(s->rx_file, file, sizeof(s->rx_file)); + s->rx_file[sizeof(s->rx_file) - 1] = '\0'; + s->rx_stop_page = stop_page; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t30_set_tx_file(t30_state_t *s, const char *file, int start_page, int stop_page) +{ + strncpy(s->tx_file, file, sizeof(s->tx_file)); + s->tx_file[sizeof(s->tx_file) - 1] = '\0'; + s->tx_start_page = start_page; + s->tx_stop_page = stop_page; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t30_set_iaf_mode(t30_state_t *s, int iaf) +{ + s->iaf = iaf; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_ecm_capability(t30_state_t *s, int enabled) +{ + s->ecm_allowed = enabled; + t30_build_dis_or_dtc(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_rx_encoding(t30_state_t *s, int encoding) +{ + switch (encoding) + { + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + s->output_encoding = encoding; + return 0; + } + return -1; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_minimum_scan_line_time(t30_state_t *s, int min_time) +{ + /* There are only certain possible times supported, so we need to select + the code which best matches the request. */ + if (min_time == 0) + s->local_min_scan_time_code = 7; + else if (min_time <= 5) + s->local_min_scan_time_code = 1; + else if (min_time <= 10) + s->local_min_scan_time_code = 2; + else if (min_time <= 20) + s->local_min_scan_time_code = 0; + else if (min_time <= 40) + s->local_min_scan_time_code = 4; + else + return -1; + t30_build_dis_or_dtc(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_supported_modems(t30_state_t *s, int supported_modems) +{ + s->supported_modems = supported_modems; + t30_build_dis_or_dtc(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_supported_compressions(t30_state_t *s, int supported_compressions) +{ + s->supported_compressions = supported_compressions; + t30_build_dis_or_dtc(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_supported_resolutions(t30_state_t *s, int supported_resolutions) +{ + s->supported_resolutions = supported_resolutions; + t30_build_dis_or_dtc(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_supported_image_sizes(t30_state_t *s, int supported_image_sizes) +{ + s->supported_image_sizes = supported_image_sizes; + t30_build_dis_or_dtc(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_supported_t30_features(t30_state_t *s, int supported_t30_features) +{ + s->supported_t30_features = supported_t30_features; + t30_build_dis_or_dtc(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t30_set_status(t30_state_t *s, int status) +{ + s->current_status = status; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_receiver_not_ready(t30_state_t *s, int count) +{ + s->receiver_not_ready_count = count; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t30_set_phase_b_handler(t30_state_t *s, t30_phase_b_handler_t *handler, void *user_data) +{ + s->phase_b_handler = handler; + s->phase_b_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t30_set_phase_d_handler(t30_state_t *s, t30_phase_d_handler_t *handler, void *user_data) +{ + s->phase_d_handler = handler; + s->phase_d_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t30_set_phase_e_handler(t30_state_t *s, t30_phase_e_handler_t *handler, void *user_data) +{ + s->phase_e_handler = handler; + s->phase_e_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t30_set_document_handler(t30_state_t *s, t30_document_handler_t *handler, void *user_data) +{ + s->document_handler = handler; + s->document_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t30_set_real_time_frame_handler(t30_state_t *s, t30_real_time_frame_handler_t *handler, void *user_data) +{ + s->real_time_frame_handler = handler; + s->real_time_frame_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(logging_state_t *) t30_get_logging_state(t30_state_t *s) +{ + return &s->logging; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/t30_local.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/t30_local.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,45 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t30_local.h - definitions for T.30 fax processing + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t30_local.h,v 1.2 2008/04/17 14:26:57 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_T30_LOCAL_H_) +#define _T30_LOCAL_H_ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +int t30_build_dis_or_dtc(t30_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/t30_logging.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/t30_logging.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,945 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t30_logging.c - ITU T.30 FAX transfer processing + * + * Written by Steve Underwood + * + * Copyright (C) 2003, 2004, 2005, 2006, 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t30_logging.c,v 1.12.4.2 2009/12/19 10:44:10 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/bit_operations.h" +#include "spandsp/queue.h" +#include "spandsp/power_meter.h" +#include "spandsp/complex.h" +#include "spandsp/tone_generate.h" +#include "spandsp/async.h" +#include "spandsp/hdlc.h" +#include "spandsp/fsk.h" +#include "spandsp/v29rx.h" +#include "spandsp/v29tx.h" +#include "spandsp/v27ter_rx.h" +#include "spandsp/v27ter_tx.h" +#include "spandsp/t4_rx.h" +#include "spandsp/t4_tx.h" +#include "spandsp/t30_fcf.h" +#include "spandsp/t35.h" +#include "spandsp/t30.h" +#include "spandsp/t30_logging.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/t4_rx.h" +#include "spandsp/private/t4_tx.h" +#include "spandsp/private/t30.h" + +#include "t30_local.h" + +/*! Value string pair structure */ +typedef struct +{ + int val; + const char *str; +} value_string_t; + +enum +{ + DISBIT1 = 0x01, + DISBIT2 = 0x02, + DISBIT3 = 0x04, + DISBIT4 = 0x08, + DISBIT5 = 0x10, + DISBIT6 = 0x20, + DISBIT7 = 0x40, + DISBIT8 = 0x80 +}; + +SPAN_DECLARE(const char *) t30_completion_code_to_str(int result) +{ + switch (result) + { + case T30_ERR_OK: + return "OK"; + case T30_ERR_CEDTONE: + return "The CED tone exceeded 5s"; + case T30_ERR_T0_EXPIRED: + return "Timed out waiting for initial communication"; + case T30_ERR_T1_EXPIRED: + return "Timed out waiting for the first message"; + case T30_ERR_T3_EXPIRED: + return "Timed out waiting for procedural interrupt"; + case T30_ERR_HDLC_CARRIER: + return "The HDLC carrier did not stop in a timely manner"; + case T30_ERR_CANNOT_TRAIN: + return "Failed to train with any of the compatible modems"; + case T30_ERR_OPER_INT_FAIL: + return "Operator intervention failed"; + case T30_ERR_INCOMPATIBLE: + return "Far end is not compatible"; + case T30_ERR_RX_INCAPABLE: + return "Far end is not able to receive"; + case T30_ERR_TX_INCAPABLE: + return "Far end is not able to transmit"; + case T30_ERR_NORESSUPPORT: + return "Far end cannot receive at the resolution of the image"; + case T30_ERR_NOSIZESUPPORT: + return "Far end cannot receive at the size of image"; + case T30_ERR_UNEXPECTED: + return "Unexpected message received"; + case T30_ERR_TX_BADDCS: + return "Received bad response to DCS or training"; + case T30_ERR_TX_BADPG: + return "Received a DCN from remote after sending a page"; + case T30_ERR_TX_ECMPHD: + return "Invalid ECM response received from receiver"; + case T30_ERR_TX_GOTDCN: + return "Received a DCN while waiting for a DIS"; + case T30_ERR_TX_INVALRSP: + return "Invalid response after sending a page"; + case T30_ERR_TX_NODIS: + return "Received other than DIS while waiting for DIS"; + case T30_ERR_TX_PHBDEAD: + return "Received no response to DCS or TCF"; + case T30_ERR_TX_PHDDEAD: + return "No response after sending a page"; + case T30_ERR_TX_T5EXP: + return "Timed out waiting for receiver ready (ECM mode)"; + case T30_ERR_RX_ECMPHD: + return "Invalid ECM response received from transmitter"; + case T30_ERR_RX_GOTDCS: + return "DCS received while waiting for DTC"; + case T30_ERR_RX_INVALCMD: + return "Unexpected command after page received"; + case T30_ERR_RX_NOCARRIER: + return "Carrier lost during fax receive"; + case T30_ERR_RX_NOEOL: + return "Timed out while waiting for EOL (end Of line)"; + case T30_ERR_RX_NOFAX: + return "Timed out while waiting for first line"; + case T30_ERR_RX_T2EXPDCN: + return "Timer T2 expired while waiting for DCN"; + case T30_ERR_RX_T2EXPD: + return "Timer T2 expired while waiting for phase D"; + case T30_ERR_RX_T2EXPFAX: + return "Timer T2 expired while waiting for fax page"; + case T30_ERR_RX_T2EXPMPS: + return "Timer T2 expired while waiting for next fax page"; + case T30_ERR_RX_T2EXPRR: + return "Timer T2 expired while waiting for RR command"; + case T30_ERR_RX_T2EXP: + return "Timer T2 expired while waiting for NSS, DCS or MCF"; + case T30_ERR_RX_DCNWHY: + return "Unexpected DCN while waiting for DCS or DIS"; + case T30_ERR_RX_DCNDATA: + return "Unexpected DCN while waiting for image data"; + case T30_ERR_RX_DCNFAX: + return "Unexpected DCN while waiting for EOM, EOP or MPS"; + case T30_ERR_RX_DCNPHD: + return "Unexpected DCN after EOM or MPS sequence"; + case T30_ERR_RX_DCNRRD: + return "Unexpected DCN after RR/RNR sequence"; + case T30_ERR_RX_DCNNORTN: + return "Unexpected DCN after requested retransmission"; + case T30_ERR_FILEERROR: + return "TIFF/F file cannot be opened"; + case T30_ERR_NOPAGE: + return "TIFF/F page not found"; + case T30_ERR_BADTIFF: + return "TIFF/F format is not compatible"; + case T30_ERR_BADPAGE: + return "TIFF/F page number tag missing"; + case T30_ERR_BADTAG: + return "Incorrect values for TIFF/F tags"; + case T30_ERR_BADTIFFHDR: + return "Bad TIFF/F header - incorrect values in fields"; + case T30_ERR_NOMEM: + return "Cannot allocate memory for more pages"; + case T30_ERR_RETRYDCN: + return "Disconnected after permitted retries"; + case T30_ERR_CALLDROPPED: + return "The call dropped prematurely"; + case T30_ERR_NOPOLL: + return "Poll not accepted"; + case T30_ERR_IDENT_UNACCEPTABLE: + return "Ident not accepted"; + case T30_ERR_PSA_UNACCEPTABLE: + return "Polled sub-address not accepted"; + case T30_ERR_SEP_UNACCEPTABLE: + return "Selective polling address not accepted"; + case T30_ERR_SID_UNACCEPTABLE: + return "Sender identification not accepted"; + case T30_ERR_PWD_UNACCEPTABLE: + return "Password not accepted"; + case T30_ERR_SUB_UNACCEPTABLE: + return "Sub-address not accepted"; + case T30_ERR_TSA_UNACCEPTABLE: + return "Transmitting subscriber internet address not accepted"; + case T30_ERR_IRA_UNACCEPTABLE: + return "Internet routing address not accepted"; + case T30_ERR_CIA_UNACCEPTABLE: + return "Calling subscriber internet address not accepted"; + case T30_ERR_ISP_UNACCEPTABLE: + return "Internet selective polling address not accepted"; + case T30_ERR_CSA_UNACCEPTABLE: + return "Called subscriber internet address not accepted"; + } + return "???"; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) t30_frametype(uint8_t x) +{ + switch (x) + { + case T30_DIS: + return "DIS"; + case T30_CSI: + return "CSI"; + case T30_NSF: + return "NSF"; + case T30_DTC: + return "DTC"; + case T30_CIG: + return "CIG"; + case T30_NSC: + return "NSC"; + case T30_PWD: + return "PWD"; + case T30_SEP: + return "SEP"; + case T30_PSA: + return "PSA"; + case T30_CIA: + return "CIA"; + case T30_ISP: + return "ISP"; + case T30_DCS: + case T30_DCS | 0x01: + return "DCS"; + case T30_TSI: + case T30_TSI | 0x01: + return "TSI"; + case T30_NSS: + case T30_NSS | 0x01: + return "NSS"; + case T30_SUB: + case T30_SUB | 0x01: + return "SUB"; + case T30_SID: + case T30_SID | 0x01: + return "SID"; + case T30_CTC: + case T30_CTC | 0x01: + return "CTC"; + case T30_TSA: + case T30_TSA | 0x01: + return "TSA"; + case T30_IRA: + case T30_IRA | 0x01: + return "IRA"; + case T30_CFR: + case T30_CFR | 0x01: + return "CFR"; + case T30_FTT: + case T30_FTT | 0x01: + return "FTT"; + case T30_CTR: + case T30_CTR | 0x01: + return "CTR"; + case T30_CSA: + case T30_CSA | 0x01: + return "CSA"; + case T30_EOM: + case T30_EOM | 0x01: + return "EOM"; + case T30_MPS: + case T30_MPS | 0x01: + return "MPS"; + case T30_EOP: + case T30_EOP | 0x01: + return "EOP"; + case T30_PRI_EOM: + case T30_PRI_EOM | 0x01: + return "PRI-EOM"; + case T30_PRI_MPS: + case T30_PRI_MPS | 0x01: + return "PRI-MPS"; + case T30_PRI_EOP: + case T30_PRI_EOP | 0x01: + return "PRI-EOP"; + case T30_EOS: + case T30_EOS | 0x01: + return "EOS"; + case T30_PPS: + case T30_PPS | 0x01: + return "PPS"; + case T30_EOR: + case T30_EOR | 0x01: + return "EOR"; + case T30_RR: + case T30_RR | 0x01: + return "RR"; + case T30_MCF: + case T30_MCF | 0x01: + return "MCF"; + case T30_RTP: + case T30_RTP | 0x01: + return "RTP"; + case T30_RTN: + case T30_RTN | 0x01: + return "RTN"; + case T30_PIP: + case T30_PIP | 0x01: + return "PIP"; + case T30_PIN: + case T30_PIN | 0x01: + return "PIN"; + case T30_PPR: + case T30_PPR | 0x01: + return "PPR"; + case T30_RNR: + case T30_RNR | 0x01: + return "RNR"; + case T30_ERR: + case T30_ERR | 0x01: + return "ERR"; + case T30_FDM: + case T30_FDM | 0x01: + return "FDM"; + case T30_DCN: + case T30_DCN | 0x01: + return "DCN"; + case T30_CRP: + case T30_CRP | 0x01: + return "CRP"; + case T30_FNV: + case T30_FNV | 0x01: + return "FNV"; + case T30_TNR: + case T30_TNR | 0x01: + return "TNR"; + case T30_TR: + case T30_TR | 0x01: + return "TR"; + case T30_TK: + return "TK"; + case T30_RK: + return "RK"; +#if 0 + case T30_PSS: + return "PSS"; +#endif + case T30_DES: + return "DES"; + case T30_DEC: + return "DEC"; + case T30_DER: + return "DER"; +#if 0 + case T30_DTR: + return "DTR"; +#endif + case T30_DNK: + case T30_DNK | 0x01: + return "DNK"; + case T30_PID: + case T30_PID | 0x01: + return "PID"; + case T30_NULL: + return "NULL"; + case T4_FCD: + return "FCD"; + case T4_RCP: + return "RCP"; + } + return "???"; +} +/*- End of function --------------------------------------------------------*/ + +static void octet_reserved_bit(logging_state_t *log, + const uint8_t *msg, + int bit_no, + int expected) +{ + char s[10] = ".... ...."; + int bit; + uint8_t octet; + + /* Break out the octet and the bit number within it. */ + octet = msg[((bit_no - 1) >> 3) + 3]; + bit_no = (bit_no - 1) & 7; + /* Now get the actual bit. */ + bit = (octet >> bit_no) & 1; + /* Is it what it should be. */ + if (bit ^ expected) + { + /* Only log unexpected values. */ + s[7 - bit_no + ((bit_no < 4) ? 1 : 0)] = (uint8_t) (bit + '0'); + span_log(log, SPAN_LOG_FLOW, " %s= Unexpected state for reserved bit: %d\n", s, bit); + } +} +/*- End of function --------------------------------------------------------*/ + +static void octet_bit_field(logging_state_t *log, + const uint8_t *msg, + int bit_no, + const char *desc, + const char *yeah, + const char *neigh) +{ + char s[10] = ".... ...."; + int bit; + uint8_t octet; + const char *tag; + + /* Break out the octet and the bit number within it. */ + octet = msg[((bit_no - 1) >> 3) + 3]; + bit_no = (bit_no - 1) & 7; + /* Now get the actual bit. */ + bit = (octet >> bit_no) & 1; + /* Edit the bit string for display. */ + s[7 - bit_no + ((bit_no < 4) ? 1 : 0)] = (uint8_t) (bit + '0'); + /* Find the right tag to display. */ + if (bit) + { + if ((tag = yeah) == NULL) + tag = "Set"; + } + else + { + if ((tag = neigh) == NULL) + tag = "Not set"; + } + /* Eh, voila! */ + span_log(log, SPAN_LOG_FLOW, " %s= %s: %s\n", s, desc, tag); +} +/*- End of function --------------------------------------------------------*/ + +static void octet_field(logging_state_t *log, + const uint8_t *msg, + int start, + int end, + const char *desc, + const value_string_t tags[]) +{ + char s[10] = ".... ...."; + int i; + uint8_t octet; + const char *tag; + + /* Break out the octet and the bit number range within it. */ + octet = msg[((start - 1) >> 3) + 3]; + start = (start - 1) & 7; + end = ((end - 1) & 7) + 1; + + /* Edit the bit string for display. */ + for (i = start; i < end; i++) + s[7 - i + ((i < 4) ? 1 : 0)] = (uint8_t) ((octet >> i) & 1) + '0'; + + /* Find the right tag to display. */ + octet = (uint8_t) ((octet >> start) & ((0xFF + (1 << (end - start))) & 0xFF)); + tag = "Invalid"; + for (i = 0; tags[i].str; i++) + { + if (octet == tags[i].val) + { + tag = tags[i].str; + break; + } + } + /* Eh, voila! */ + span_log(log, SPAN_LOG_FLOW, " %s= %s: %s\n", s, desc, tag); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t30_decode_dis_dtc_dcs(t30_state_t *s, const uint8_t *pkt, int len) +{ + logging_state_t *log; + uint8_t frame_type; + static const value_string_t available_signalling_rate_tags[] = + { + { 0x00, "V.27 ter fall-back mode" }, + { 0x01, "V.29" }, + { 0x02, "V.27 ter" }, + { 0x03, "V.27 ter and V.29" }, + { 0x0B, "V.27 ter, V.29, and V.17" }, + { 0x06, "Reserved" }, + { 0x0A, "Reserved" }, + { 0x0E, "Reserved" }, + { 0x0F, "Reserved" }, + { 0x04, "Not used" }, + { 0x05, "Not used" }, + { 0x08, "Not used" }, + { 0x09, "Not used" }, + { 0x0C, "Not used" }, + { 0x0D, "Not used" }, + { 0x00, NULL } + }; + static const value_string_t selected_signalling_rate_tags[] = + { + { 0x00, "V.27ter 2400bps" }, + { 0x01, "V.29, 9600bps" }, + { 0x02, "V.27ter 4800bps" }, + { 0x03, "V.29 7200bps" }, + { 0x08, "V.17 14400bps" }, + { 0x09, "V.17 9600bps" }, + { 0x0A, "V.17 12000bps" }, + { 0x0B, "V.17 7200bps" }, + { 0x05, "Reserved" }, + { 0x07, "Reserved" }, + { 0x0C, "Reserved" }, + { 0x0D, "Reserved" }, + { 0x0E, "Reserved" }, + { 0x0F, "Reserved" }, + { 0x00, NULL } + }; + static const value_string_t available_scan_line_length_tags[] = + { + { 0x00, "215mm +- 1%" }, + { 0x01, "215mm +- 1% and 255mm +- 1%" }, + { 0x02, "215mm +- 1%, 255mm +- 1% and 303mm +- 1%" }, + { 0x00, NULL } + }; + static const value_string_t selected_scan_line_length_tags[] = + { + { 0x00, "215mm +- 1%" }, + { 0x01, "255mm +- 1%" }, + { 0x02, "303mm +- 1%" }, + { 0x00, NULL } + }; + static const value_string_t available_recording_length_tags[] = + { + { 0x00, "A4 (297mm)" }, + { 0x01, "A4 (297mm) and B4 (364mm)" }, + { 0x02, "Unlimited" }, + { 0x00, NULL } + }; + static const value_string_t selected_recording_length_tags[] = + { + { 0x00, "A4 (297mm)" }, + { 0x01, "B4 (364mm)" }, + { 0x02, "Unlimited" }, + { 0x00, NULL } + }; + static const value_string_t available_minimum_scan_line_time_tags[] = + { + { 0x00, "20ms at 3.85 l/mm; T7.7 = T3.85" }, + { 0x01, "5ms at 3.85 l/mm; T7.7 = T3.85" }, + { 0x02, "10ms at 3.85 l/mm; T7.7 = T3.85" }, + { 0x03, "20ms at 3.85 l/mm; T7.7 = 1/2 T3.85" }, + { 0x04, "40ms at 3.85 l/mm; T7.7 = T3.85" }, + { 0x05, "40ms at 3.85 l/mm; T7.7 = 1/2 T3.85" }, + { 0x06, "10ms at 3.85 l/mm; T7.7 = 1/2 T3.85" }, + { 0x07, "0ms at 3.85 l/mm; T7.7 = T3.85" }, + { 0x00, NULL } + }; + static const value_string_t selected_minimum_scan_line_time_tags[] = + { + { 0x00, "20ms" }, + { 0x01, "5ms" }, + { 0x02, "10ms" }, + { 0x04, "40ms" }, + { 0x07, "0ms" }, + { 0x00, NULL } + }; + static const value_string_t shared_data_memory_capacity_tags[] = + { + { 0x00, "Not available" }, + { 0x01, "Level 2 = 2.0 Mbytes" }, + { 0x02, "Level 1 = 1.0 Mbytes" }, + { 0x03, "Level 3 = unlimited (i.e. >= 32 Mbytes)" }, + { 0x00, NULL } + }; + static const value_string_t t89_profile_tags[] = + { + { 0x00, "Not used" }, + { 0x01, "Profiles 2 and 3" }, + { 0x02, "Profile 2" }, + { 0x04, "Profile 1" }, + { 0x06, "Profile 3" }, + { 0x03, "Reserved" }, + { 0x05, "Reserved" }, + { 0x07, "Reserved" }, + { 0x00, NULL } + }; + static const value_string_t t44_mixed_raster_content_tags[] = + { + { 0x00, "0" }, + { 0x01, "1" }, + { 0x02, "2" }, + { 0x32, "3" }, + { 0x04, "4" }, + { 0x05, "5" }, + { 0x06, "6" }, + { 0x07, "7" }, + { 0x00, NULL } + }; + + if (!span_log_test(&s->logging, SPAN_LOG_FLOW)) + return; + frame_type = pkt[2] & 0xFE; + log = &s->logging; + if (len <= 2) + { + span_log(log, SPAN_LOG_FLOW, " Frame is short\n"); + return; + } + + span_log(log, SPAN_LOG_FLOW, "%s:\n", t30_frametype(pkt[2])); + if (len <= 3) + { + span_log(log, SPAN_LOG_FLOW, " Frame is short\n"); + return; + } + octet_bit_field(log, pkt, 1, "Store and forward Internet fax (T.37)", NULL, NULL); + octet_reserved_bit(log, pkt, 2, 0); + octet_bit_field(log, pkt, 3, "Real-time Internet fax (T.38)", NULL, NULL); + octet_bit_field(log, pkt, 4, "3G mobile network", NULL, NULL); + octet_reserved_bit(log, pkt, 5, 0); + if (frame_type == T30_DCS) + { + octet_reserved_bit(log, pkt, 6, 0); + octet_reserved_bit(log, pkt, 7, 0); + } + else + { + octet_bit_field(log, pkt, 6, "V.8 capabilities", NULL, NULL); + octet_bit_field(log, pkt, 7, "Preferred octets", "64 octets", "256 octets"); + } + octet_reserved_bit(log, pkt, 8, 0); + if (len <= 4) + { + span_log(log, SPAN_LOG_FLOW, " Frame is short\n"); + return; + } + + if (frame_type == T30_DCS) + { + octet_reserved_bit(log, pkt, 9, 0); + octet_bit_field(log, pkt, 10, "Receive fax", NULL, NULL); + octet_field(log, pkt, 11, 14, "Selected data signalling rate", selected_signalling_rate_tags); + } + else + { + octet_bit_field(log, pkt, 9, "Ready to transmit a fax document (polling)", NULL, NULL); + octet_bit_field(log, pkt, 10, "Can receive fax", NULL, NULL); + octet_field(log, pkt, 11, 14, "Supported data signalling rates", available_signalling_rate_tags); + } + octet_bit_field(log, pkt, 15, "R8x7.7lines/mm and/or 200x200pels/25.4mm", NULL, NULL); + octet_bit_field(log, pkt, 16, "2-D coding", NULL, NULL); + if (len <= 5) + { + span_log(log, SPAN_LOG_FLOW, " Frame is short\n"); + return; + } + + if (frame_type == T30_DCS) + { + octet_field(log, pkt, 17, 18, "Recording width", selected_scan_line_length_tags); + octet_field(log, pkt, 19, 20, "Recording length", selected_recording_length_tags); + octet_field(log, pkt, 21, 23, "Minimum scan line time", selected_minimum_scan_line_time_tags); + } + else + { + octet_field(log, pkt, 17, 18, "Recording width", available_scan_line_length_tags); + octet_field(log, pkt, 19, 20, "Recording length", available_recording_length_tags); + octet_field(log, pkt, 21, 23, "Receiver's minimum scan line time", available_minimum_scan_line_time_tags); + } + octet_bit_field(log, pkt, 24, "Extension indicator", NULL, NULL); + if (!(pkt[5] & DISBIT8)) + return; + if (len <= 6) + { + span_log(log, SPAN_LOG_FLOW, " Frame is short\n"); + return; + } + + octet_reserved_bit(log, pkt, 25, 0); + octet_bit_field(log, pkt, 26, "Compressed/uncompressed mode", "Uncompressed", "Compressed"); + octet_bit_field(log, pkt, 27, "Error correction mode (ECM)", "ECM", "Non-ECM"); + if (frame_type == T30_DCS) + octet_bit_field(log, pkt, 28, "Frame size", "64 octets", "256 octets"); + else + octet_reserved_bit(log, pkt, 28, 0); + octet_reserved_bit(log, pkt, 29, 0); + octet_reserved_bit(log, pkt, 30, 0); + octet_bit_field(log, pkt, 31, "T.6 coding", NULL, NULL); + octet_bit_field(log, pkt, 32, "Extension indicator", NULL, NULL); + if (!(pkt[6] & DISBIT8)) + return; + if (len <= 7) + { + span_log(log, SPAN_LOG_FLOW, " Frame is short\n"); + return; + } + + octet_bit_field(log, pkt, 33, "\"Field not valid\" supported", NULL, NULL); + if (frame_type == T30_DCS) + { + octet_reserved_bit(log, pkt, 34, 0); + octet_reserved_bit(log, pkt, 35, 0); + } + else + { + octet_bit_field(log, pkt, 34, "Multiple selective polling", NULL, NULL); + octet_bit_field(log, pkt, 35, "Polled sub-address", NULL, NULL); + } + octet_bit_field(log, pkt, 36, "T.43 coding", NULL, NULL); + octet_bit_field(log, pkt, 37, "Plane interleave", NULL, NULL); + octet_bit_field(log, pkt, 38, "Voice coding with 32kbit/s ADPCM (Rec. G.726)", NULL, NULL); + octet_bit_field(log, pkt, 39, "Reserved for the use of extended voice coding set", NULL, NULL); + octet_bit_field(log, pkt, 40, "Extension indicator", NULL, NULL); + if (!(pkt[7] & DISBIT8)) + return; + if (len <= 8) + { + span_log(log, SPAN_LOG_FLOW, " Frame is short\n"); + return; + } + octet_bit_field(log, pkt, 41, "R8x15.4lines/mm", NULL, NULL); + octet_bit_field(log, pkt, 42, "300x300pels/25.4mm", NULL, NULL); + octet_bit_field(log, pkt, 43, "R16x15.4lines/mm and/or 400x400pels/25.4mm", NULL, NULL); + if (frame_type == T30_DCS) + { + octet_bit_field(log, pkt, 44, "Resolution type selection", "Inch", "Metric"); + octet_reserved_bit(log, pkt, 45, 0); + octet_reserved_bit(log, pkt, 46, 0); + octet_reserved_bit(log, pkt, 47, 0); + } + else + { + octet_bit_field(log, pkt, 44, "Inch-based resolution preferred", NULL, NULL); + octet_bit_field(log, pkt, 45, "Metric-based resolution preferred", NULL, NULL); + octet_bit_field(log, pkt, 46, "Minimum scan line time for higher resolutions", "T15.4 = 1/2 T7.7", "T15.4 = T7.7"); + octet_bit_field(log, pkt, 47, "Selective polling", NULL, NULL); + } + octet_bit_field(log, pkt, 48, "Extension indicator", NULL, NULL); + if (!(pkt[8] & DISBIT8)) + return; + if (len <= 9) + { + span_log(log, SPAN_LOG_FLOW, " Frame is short\n"); + return; + } + + octet_bit_field(log, pkt, 49, "Sub-addressing", NULL, NULL); + if (frame_type == T30_DCS) + { + octet_bit_field(log, pkt, 50, "Sender identification transmission", NULL, NULL); + octet_reserved_bit(log, pkt, 51, 0); + } + else + { + octet_bit_field(log, pkt, 50, "Password", NULL, NULL); + octet_bit_field(log, pkt, 51, "Ready to transmit a data file (polling)", NULL, NULL); + } + octet_reserved_bit(log, pkt, 52, 0); + octet_bit_field(log, pkt, 53, "Binary file transfer (BFT)", NULL, NULL); + octet_bit_field(log, pkt, 54, "Document transfer mode (DTM)", NULL, NULL); + octet_bit_field(log, pkt, 55, "Electronic data interchange (EDI)", NULL, NULL); + octet_bit_field(log, pkt, 56, "Extension indicator", NULL, NULL); + if (!(pkt[9] & DISBIT8)) + return; + if (len <= 10) + { + span_log(log, SPAN_LOG_FLOW, " Frame is short\n"); + return; + } + + octet_bit_field(log, pkt, 57, "Basic transfer mode (BTM)", NULL, NULL); + octet_reserved_bit(log, pkt, 58, 0); + if (frame_type == T30_DCS) + octet_reserved_bit(log, pkt, 59, 0); + else + octet_bit_field(log, pkt, 59, "Ready to transfer a character or mixed mode document (polling)", NULL, NULL); + octet_bit_field(log, pkt, 60, "Character mode", NULL, NULL); + octet_reserved_bit(log, pkt, 61, 0); + octet_bit_field(log, pkt, 62, "Mixed mode (Annex E/T.4)", NULL, NULL); + octet_reserved_bit(log, pkt, 63, 0); + octet_bit_field(log, pkt, 64, "Extension indicator", NULL, NULL); + if (!(pkt[10] & DISBIT8)) + return; + if (len <= 11) + { + span_log(log, SPAN_LOG_FLOW, " Frame is short\n"); + return; + } + + octet_bit_field(log, pkt, 65, "Processable mode 26 (Rec. T.505)", NULL, NULL); + octet_bit_field(log, pkt, 66, "Digital network capability", NULL, NULL); + octet_bit_field(log, pkt, 67, "Duplex capability", "Full", "Half only"); + if (frame_type == T30_DCS) + octet_bit_field(log, pkt, 68, "Full colour mode", NULL, NULL); + else + octet_bit_field(log, pkt, 68, "JPEG coding", NULL, NULL); + octet_bit_field(log, pkt, 69, "Full colour mode", NULL, NULL); + if (frame_type == T30_DCS) + octet_bit_field(log, pkt, 70, "Preferred Huffman tables", NULL, NULL); + else + octet_reserved_bit(log, pkt, 70, 0); + octet_bit_field(log, pkt, 71, "12bits/pel component", NULL, NULL); + octet_bit_field(log, pkt, 72, "Extension indicator", NULL, NULL); + if (!(pkt[11] & DISBIT8)) + return; + if (len <= 12) + { + span_log(log, SPAN_LOG_FLOW, " Frame is short\n"); + return; + } + + octet_bit_field(log, pkt, 73, "No subsampling (1:1:1)", NULL, NULL); + octet_bit_field(log, pkt, 74, "Custom illuminant", NULL, NULL); + octet_bit_field(log, pkt, 75, "Custom gamut range", NULL, NULL); + octet_bit_field(log, pkt, 76, "North American Letter (215.9mm x 279.4mm)", NULL, NULL); + octet_bit_field(log, pkt, 77, "North American Legal (215.9mm x 355.6mm)", NULL, NULL); + octet_bit_field(log, pkt, 78, "Single-progression sequential coding (Rec. T.85) basic", NULL, NULL); + octet_bit_field(log, pkt, 79, "Single-progression sequential coding (Rec. T.85) optional L0", NULL, NULL); + octet_bit_field(log, pkt, 80, "Extension indicator", NULL, NULL); + if (!(pkt[12] & DISBIT8)) + return; + if (len <= 13) + { + span_log(log, SPAN_LOG_FLOW, " Frame is short\n"); + return; + } + + octet_bit_field(log, pkt, 81, "HKM key management", NULL, NULL); + octet_bit_field(log, pkt, 82, "RSA key management", NULL, NULL); + octet_bit_field(log, pkt, 83, "Override", NULL, NULL); + octet_bit_field(log, pkt, 84, "HFX40 cipher", NULL, NULL); + octet_bit_field(log, pkt, 85, "Alternative cipher number 2", NULL, NULL); + octet_bit_field(log, pkt, 86, "Alternative cipher number 3", NULL, NULL); + octet_bit_field(log, pkt, 87, "HFX40-I hashing", NULL, NULL); + octet_bit_field(log, pkt, 88, "Extension indicator", NULL, NULL); + if (!(pkt[13] & DISBIT8)) + return; + if (len <= 14) + { + span_log(log, SPAN_LOG_FLOW, " Frame is short\n"); + return; + } + + octet_bit_field(log, pkt, 89, "Alternative hashing system 2", NULL, NULL); + octet_bit_field(log, pkt, 90, "Alternative hashing system 3", NULL, NULL); + octet_bit_field(log, pkt, 91, "Reserved for future security features", NULL, NULL); + octet_field(log, pkt, 92, 94, "T.44 (Mixed Raster Content)", t44_mixed_raster_content_tags); + octet_bit_field(log, pkt, 95, "Page length maximum stripe size for T.44 (Mixed Raster Content)", NULL, NULL); + octet_bit_field(log, pkt, 96, "Extension indicator", NULL, NULL); + if (!(pkt[14] & DISBIT8)) + return; + if (len <= 15) + { + span_log(log, SPAN_LOG_FLOW, " Frame is short\n"); + return; + } + + octet_bit_field(log, pkt, 97, "Colour/gray-scale 300pels/25.4mm x 300lines/25.4mm or 400pels/25.4mm x 400lines/25.4mm resolution", NULL, NULL); + octet_bit_field(log, pkt, 98, "100pels/25.4mm x 100lines/25.4mm for colour/gray scale", NULL, NULL); + octet_bit_field(log, pkt, 99, "Simple phase C BFT negotiations", NULL, NULL); + if (frame_type == T30_DCS) + { + octet_reserved_bit(log, pkt, 100, 0); + octet_reserved_bit(log, pkt, 101, 0); + } + else + { + octet_bit_field(log, pkt, 100, "Extended BFT Negotiations capable", NULL, NULL); + octet_bit_field(log, pkt, 101, "Internet Selective Polling address (ISP)", NULL, NULL); + } + octet_bit_field(log, pkt, 102, "Internet Routing Address (IRA)", NULL, NULL); + octet_reserved_bit(log, pkt, 103, 0); + octet_bit_field(log, pkt, 104, "Extension indicator", NULL, NULL); + if (!(pkt[15] & DISBIT8)) + return; + if (len <= 16) + { + span_log(log, SPAN_LOG_FLOW, " Frame is short\n"); + return; + } + + octet_bit_field(log, pkt, 105, "600pels/25.4mm x 600lines/25.4mm", NULL, NULL); + octet_bit_field(log, pkt, 106, "1200pels/25.4mm x 1200lines/25.4mm", NULL, NULL); + octet_bit_field(log, pkt, 107, "300pels/25.4mm x 600lines/25.4mm", NULL, NULL); + octet_bit_field(log, pkt, 108, "400pels/25.4mm x 800lines/25.4mm", NULL, NULL); + octet_bit_field(log, pkt, 109, "600pels/25.4mm x 1200lines/25.4mm", NULL, NULL); + octet_bit_field(log, pkt, 110, "Colour/gray scale 600pels/25.4mm x 600lines/25.4mm", NULL, NULL); + octet_bit_field(log, pkt, 111, "Colour/gray scale 1200pels/25.4mm x 1200lines/25.4mm", NULL, NULL); + octet_bit_field(log, pkt, 112, "Extension indicator", NULL, NULL); + if (!(pkt[16] & DISBIT8)) + return; + if (len <= 17) + { + span_log(log, SPAN_LOG_FLOW, " Frame is short\n"); + return; + } + + octet_bit_field(log, pkt, 113, "Double sided printing capability (alternate mode)", NULL, NULL); + octet_bit_field(log, pkt, 114, "Double sided printing capability (continuous mode)", NULL, NULL); + if (frame_type == T30_DCS) + octet_bit_field(log, pkt, 115, "Black and white mixed raster content profile (MRCbw)", NULL, NULL); + else + octet_reserved_bit(log, pkt, 115, 0); + octet_bit_field(log, pkt, 116, "T.45 (run length colour encoded)", NULL, NULL); + octet_field(log, pkt, 117, 118, "Shared memory", shared_data_memory_capacity_tags); + octet_bit_field(log, pkt, 119, "T.44 colour space", NULL, NULL); + octet_bit_field(log, pkt, 120, "Extension indicator", NULL, NULL); + if (!(pkt[17] & DISBIT8)) + return; + if (len <= 18) + { + span_log(log, SPAN_LOG_FLOW, " Frame is short\n"); + return; + } + + octet_bit_field(log, pkt, 121, "Flow control capability for T.38 communication", NULL, NULL); + octet_bit_field(log, pkt, 122, "K>4", NULL, NULL); + octet_bit_field(log, pkt, 123, "Internet aware T.38 mode fax (not affected by data signal rate bits)", NULL, NULL); + octet_field(log, pkt, 124, 126, "T.89 (Application profiles for ITU-T Rec T.88)", t89_profile_tags); + octet_bit_field(log, pkt, 127, "sYCC-JPEG coding", NULL, NULL); + octet_bit_field(log, pkt, 128, "Extension indicator", NULL, NULL); + if (!(pkt[18] & DISBIT8)) + return; + + span_log(log, SPAN_LOG_FLOW, " Extended beyond the current T.30 specification!\n"); +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/t31.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/t31.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,2648 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t31.c - A T.31 compatible class 1 FAX modem interface. + * + * Written by Steve Underwood + * + * Special thanks to Lee Howard + * for his great work debugging and polishing this code. + * + * Copyright (C) 2004, 2005, 2006, 2008 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t31.c,v 1.155.4.1 2009/12/19 10:44:10 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/bit_operations.h" +#include "spandsp/dc_restore.h" +#include "spandsp/queue.h" +#include "spandsp/power_meter.h" +#include "spandsp/complex.h" +#include "spandsp/tone_detect.h" +#include "spandsp/tone_generate.h" +#include "spandsp/async.h" +#include "spandsp/crc.h" +#include "spandsp/hdlc.h" +#include "spandsp/silence_gen.h" +#include "spandsp/fsk.h" +#include "spandsp/v29tx.h" +#include "spandsp/v29rx.h" +#include "spandsp/v27ter_tx.h" +#include "spandsp/v27ter_rx.h" +#include "spandsp/v17tx.h" +#include "spandsp/v17rx.h" +#include "spandsp/super_tone_rx.h" +#include "spandsp/modem_connect_tones.h" +#include "spandsp/t4_rx.h" +#include "spandsp/t4_tx.h" +#include "spandsp/t30.h" +#include "spandsp/t30_logging.h" +#include "spandsp/t38_core.h" + +#include "spandsp/at_interpreter.h" +#include "spandsp/fax_modems.h" +#include "spandsp/t31.h" +#include "spandsp/t30_fcf.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/t38_core.h" +#include "spandsp/private/silence_gen.h" +#include "spandsp/private/fsk.h" +#include "spandsp/private/v17tx.h" +#include "spandsp/private/v17rx.h" +#include "spandsp/private/v27ter_tx.h" +#include "spandsp/private/v27ter_rx.h" +#include "spandsp/private/v29tx.h" +#include "spandsp/private/v29rx.h" +#include "spandsp/private/modem_connect_tones.h" +#include "spandsp/private/hdlc.h" +#include "spandsp/private/fax_modems.h" +#include "spandsp/private/at_interpreter.h" +#include "spandsp/private/t31.h" + +/* Settings suitable for paced transmission over a UDP transport */ +/*! The default number of milliseconds per transmitted IFP when sending bulk T.38 data */ +#define MS_PER_TX_CHUNK 30 +/*! The number of transmissions of indicator IFP packets */ +#define INDICATOR_TX_COUNT 3 +/*! The number of transmissions of data IFP packets */ +#define DATA_TX_COUNT 1 +/*! The number of transmissions of terminating data IFP packets */ +#define DATA_END_TX_COUNT 3 +/*! The default DTE timeout, in seconds */ +#define DEFAULT_DTE_TIMEOUT 5 + +/* Settings suitable for unpaced transmission over a TCP transport */ +#define MAX_OCTETS_PER_UNPACED_CHUNK 300 + +/* Backstop timeout if reception of packets stops in the middle of a burst */ +#define MID_RX_TIMEOUT 15000 + +#define HDLC_FRAMING_OK_THRESHOLD 5 + +typedef const char *(*at_cmd_service_t)(t31_state_t *s, const char *cmd); + +enum +{ + ETX = 0x03, + DLE = 0x10, + SUB = 0x1A +}; + +enum +{ + DISBIT1 = 0x01, + DISBIT2 = 0x02, + DISBIT3 = 0x04, + DISBIT4 = 0x08, + DISBIT5 = 0x10, + DISBIT6 = 0x20, + DISBIT7 = 0x40, + DISBIT8 = 0x80 +}; + +enum +{ + T38_CHUNKING_MERGE_FCS_WITH_DATA = 0x0001, + T38_CHUNKING_WHOLE_FRAMES = 0x0002, + T38_CHUNKING_ALLOW_TEP_TIME = 0x0004 +}; + +enum +{ + T38_TIMED_STEP_NONE = 0, + T38_TIMED_STEP_NON_ECM_MODEM = 0x10, + T38_TIMED_STEP_NON_ECM_MODEM_2 = 0x11, + T38_TIMED_STEP_NON_ECM_MODEM_3 = 0x12, + T38_TIMED_STEP_NON_ECM_MODEM_4 = 0x13, + T38_TIMED_STEP_NON_ECM_MODEM_5 = 0x14, + T38_TIMED_STEP_HDLC_MODEM = 0x20, + T38_TIMED_STEP_HDLC_MODEM_2 = 0x21, + T38_TIMED_STEP_HDLC_MODEM_3 = 0x22, + T38_TIMED_STEP_HDLC_MODEM_4 = 0x23, + T38_TIMED_STEP_HDLC_MODEM_5 = 0x24, + T38_TIMED_STEP_FAKE_HDLC_MODEM = 0x30, + T38_TIMED_STEP_FAKE_HDLC_MODEM_2 = 0x31, + T38_TIMED_STEP_FAKE_HDLC_MODEM_3 = 0x32, + T38_TIMED_STEP_FAKE_HDLC_MODEM_4 = 0x33, + T38_TIMED_STEP_FAKE_HDLC_MODEM_5 = 0x34, + T38_TIMED_STEP_CED = 0x40, + T38_TIMED_STEP_CED_2 = 0x41, + T38_TIMED_STEP_CED_3 = 0x42, + T38_TIMED_STEP_CNG = 0x50, + T38_TIMED_STEP_CNG_2 = 0x51, + T38_TIMED_STEP_PAUSE = 0x60 +}; + +static int restart_modem(t31_state_t *s, int new_modem); +static void hdlc_accept_frame(void *user_data, const uint8_t *msg, int len, int ok); +static void set_rx_handler(t31_state_t *s, span_rx_handler_t *rx_handler, span_rx_fillin_handler_t *fillin_handler, void *user_data); +static void set_tx_handler(t31_state_t *s, span_tx_handler_t *handler, void *user_data); +static void set_next_tx_handler(t31_state_t *s, span_tx_handler_t *handler, void *user_data); +static int v17_v21_rx(void *user_data, const int16_t amp[], int len); +static int v17_v21_rx_fillin(void *user_data, int len); +static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len); +static int v27ter_v21_rx_fillin(void *user_data, int len); +static int v29_v21_rx(void *user_data, const int16_t amp[], int len); +static int v29_v21_rx_fillin(void *user_data, int len); +static int silence_rx(void *user_data, const int16_t amp[], int len); +static int cng_rx(void *user_data, const int16_t amp[], int len); +static void non_ecm_put_bit(void *user_data, int bit); +static void non_ecm_put_chunk(void *user_data, const uint8_t buf[], int len); +static int non_ecm_get_chunk(void *user_data, uint8_t buf[], int len); +static void non_ecm_rx_status(void *user_data, int status); +static void hdlc_rx_status(void *user_data, int status); + +static __inline__ void t31_set_at_rx_mode(t31_state_t *s, int new_mode) +{ + s->at_state.at_rx_mode = new_mode; +} +/*- End of function --------------------------------------------------------*/ + +#if 0 +static void monitor_control_messages(t31_state_t *s, const uint8_t *buf, int len) +{ + /* Monitor the control messages, at the point where we have the whole message, so we can + see what is happening to things like training success/failure. */ + span_log(&s->logging, SPAN_LOG_FLOW, "Monitoring %s\n", t30_frametype(buf[2])); + if (len < 3) + return; + /*endif*/ + switch (buf[2]) + { + case T30_DCS: + case T30_DCS | 1: + /* We need to know if ECM is about to be used, so we can fake HDLC stuff. */ + s->t38_fe.ecm_mode = (len >= 7) && (buf[6] & DISBIT3); + break; + default: + break; + } + /*endswitch*/ +} +/*- End of function --------------------------------------------------------*/ +#endif + +static void front_end_status(t31_state_t *s, int status) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "Front end status %d\n", status); + switch (status) + { + case T30_FRONT_END_SEND_STEP_COMPLETE: + switch (s->modem) + { + case FAX_MODEM_SILENCE_TX: + s->modem = FAX_MODEM_NONE; + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_OK); + if (s->at_state.do_hangup) + { + at_modem_control(&s->at_state, AT_MODEM_CONTROL_HANGUP, NULL); + t31_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND); + s->at_state.do_hangup = FALSE; + } + else + { + t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND); + } + break; + case FAX_MODEM_CED_TONE: + /* Go directly to V.21/HDLC transmit. */ + s->modem = FAX_MODEM_NONE; + restart_modem(s, FAX_MODEM_V21_TX); + t31_set_at_rx_mode(s, AT_MODE_HDLC); + break; + case FAX_MODEM_V21_TX: + case FAX_MODEM_V17_TX: + case FAX_MODEM_V27TER_TX: + case FAX_MODEM_V29_TX: + s->modem = FAX_MODEM_NONE; + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_OK); + t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND); + restart_modem(s, FAX_MODEM_SILENCE_TX); + break; + } + break; + case T30_FRONT_END_RECEIVE_COMPLETE: + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static int extra_bits_in_stuffed_frame(const uint8_t buf[], int len) +{ + int bitstream; + int ones; + int stuffed; + int i; + int j; + + bitstream = 0; + ones = 0; + stuffed = 0; + /* We should really append the CRC, and include the stuffed bits for that, to get + the exact number of bits in the frame. */ + //len = crc_itu16_append(buf, len); + for (i = 0; i < len; i++) + { + bitstream = buf[i]; + for (j = 0; j < 8; j++) + { + if ((bitstream & 1)) + { + if (++ones >= 5) + { + ones = 0; + stuffed++; + } + } + else + { + ones = 0; + } + bitstream >>= 1; + } + } + /* The total length of the frame is: + the number of bits in the body + + the number of additional bits in the body due to stuffing + + the number of bits in the CRC + + the number of additional bits in the CRC due to stuffing + + 16 bits for the two terminating flag octets. + Lets just allow 3 bits for the CRC, which is the worst case. It + avoids calculating the real CRC, and the worst it can do is cause + a flag octet's worth of additional output. + */ + return stuffed + 16 + 3 + 16; +} +/*- End of function --------------------------------------------------------*/ + +static int process_rx_missing(t38_core_state_t *t, void *user_data, int rx_seq_no, int expected_seq_no) +{ + t31_state_t *s; + + s = (t31_state_t *) user_data; + s->t38_fe.rx_data_missing = TRUE; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int process_rx_indicator(t38_core_state_t *t, void *user_data, int indicator) +{ + t31_state_t *s; + t31_t38_front_end_state_t *fe; + + s = (t31_state_t *) user_data; + fe = &s->t38_fe; + + if (t->current_rx_indicator == indicator) + { + /* This is probably due to the far end repeating itself, or slipping + preamble messages in between HDLC frames. T.38/V.1.3 tells us to + ignore it. Its harmless. */ + return 0; + } + /* In termination mode we don't care very much about indicators telling us training + is starting. We only care about V.21 preamble starting, for timeout control, and + the actual data. */ + switch (indicator) + { + case T38_IND_NO_SIGNAL: + if (t->current_rx_indicator == T38_IND_V21_PREAMBLE + && + (fe->current_rx_type == T30_MODEM_V21 || fe->current_rx_type == T30_MODEM_CNG)) + { + hdlc_rx_status(s, SIG_STATUS_CARRIER_DOWN); + } + fe->timeout_rx_samples = 0; + front_end_status(s, T30_FRONT_END_SIGNAL_ABSENT); + break; + case T38_IND_CNG: + front_end_status(s, T30_FRONT_END_CNG_PRESENT); + break; + case T38_IND_CED: + front_end_status(s, T30_FRONT_END_CED_PRESENT); + break; + case T38_IND_V21_PREAMBLE: + /* Some T.38 implementations insert these preamble indicators between HDLC frames, so + we need to be tolerant of that. */ + fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT); + front_end_status(s, T30_FRONT_END_SIGNAL_PRESENT); + break; + case T38_IND_V27TER_2400_TRAINING: + case T38_IND_V27TER_4800_TRAINING: + case T38_IND_V29_7200_TRAINING: + case T38_IND_V29_9600_TRAINING: + case T38_IND_V17_7200_SHORT_TRAINING: + case T38_IND_V17_7200_LONG_TRAINING: + case T38_IND_V17_9600_SHORT_TRAINING: + case T38_IND_V17_9600_LONG_TRAINING: + case T38_IND_V17_12000_SHORT_TRAINING: + case T38_IND_V17_12000_LONG_TRAINING: + case T38_IND_V17_14400_SHORT_TRAINING: + case T38_IND_V17_14400_LONG_TRAINING: + case T38_IND_V33_12000_TRAINING: + case T38_IND_V33_14400_TRAINING: + /* We really don't care what kind of modem is delivering the following image data. + We only care that some kind of fast modem signal is coming next. */ + fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT); + front_end_status(s, T30_FRONT_END_SIGNAL_PRESENT); + break; + case T38_IND_V8_ANSAM: + case T38_IND_V8_SIGNAL: + case T38_IND_V34_CNTL_CHANNEL_1200: + case T38_IND_V34_PRI_CHANNEL: + case T38_IND_V34_CC_RETRAIN: + /* V.34 support is a work in progress. */ + front_end_status(s, T30_FRONT_END_SIGNAL_PRESENT); + break; + default: + front_end_status(s, T30_FRONT_END_SIGNAL_ABSENT); + break; + } + fe->hdlc_rx.len = 0; + fe->rx_data_missing = FALSE; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, int field_type, const uint8_t *buf, int len) +{ + t31_state_t *s; + t31_t38_front_end_state_t *fe; +#if defined(_MSC_VER) + uint8_t *buf2 = (uint8_t *) _alloca(len); +#else + uint8_t buf2[len]; +#endif + + s = (t31_state_t *) user_data; + fe = &s->t38_fe; +#if 0 + /* In termination mode we don't care very much what the data type is. */ + switch (data_type) + { + case T38_DATA_V21: + case T38_DATA_V27TER_2400: + case T38_DATA_V27TER_4800: + case T38_DATA_V29_7200: + case T38_DATA_V29_9600: + case T38_DATA_V17_7200: + case T38_DATA_V17_9600: + case T38_DATA_V17_12000: + case T38_DATA_V17_14400: + case T38_DATA_V8: + case T38_DATA_V34_PRI_RATE: + case T38_DATA_V34_CC_1200: + case T38_DATA_V34_PRI_CH: + case T38_DATA_V33_12000: + case T38_DATA_V33_14400: + default: + break; + } +#endif + switch (field_type) + { + case T38_FIELD_HDLC_DATA: + if (fe->timeout_rx_samples == 0) + { + /* HDLC can just start without any signal indicator on some platforms, even when + there is zero packet lost. Nasty, but true. Its a good idea to be tolerant of + loss, though, so accepting a sudden start of HDLC data is the right thing to do. */ + fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT); + front_end_status(s, T30_FRONT_END_SIGNAL_PRESENT); + /* All real HDLC messages in the FAX world start with 0xFF. If this one is not starting + with 0xFF it would appear some octets must have been missed before this one. */ + if (len <= 0 || buf[0] != 0xFF) + fe->rx_data_missing = TRUE; + } + if (len > 0 && fe->hdlc_rx.len + len <= T31_T38_MAX_HDLC_LEN) + { + bit_reverse(fe->hdlc_rx.buf + fe->hdlc_rx.len, buf, len); + fe->hdlc_rx.len += len; + } + fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT); + break; + case T38_FIELD_HDLC_FCS_OK: + if (len > 0) + { + span_log(&s->logging, SPAN_LOG_WARNING, "There is data in a T38_FIELD_HDLC_FCS_OK!\n"); + /* The sender has incorrectly included data in this message. It is unclear what we should do + with it, to maximise tolerance of buggy implementations. */ + } + /* Some T.38 implementations send multiple T38_FIELD_HDLC_FCS_OK messages, in IFP packets with + incrementing sequence numbers, which are actually repeats. They get through to this point because + of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ + if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC OK (%s)\n", (fe->hdlc_rx.len >= 3) ? t30_frametype(fe->hdlc_rx.buf[2]) : "???", (fe->rx_data_missing) ? "missing octets" : "clean"); + crc_itu16_append(fe->hdlc_rx.buf, fe->hdlc_rx.len); + hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, !fe->rx_data_missing); + } + fe->hdlc_rx.len = 0; + fe->rx_data_missing = FALSE; + fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT); + break; + case T38_FIELD_HDLC_FCS_BAD: + if (len > 0) + { + span_log(&s->logging, SPAN_LOG_WARNING, "There is data in a T38_FIELD_HDLC_FCS_BAD!\n"); + /* The sender has incorrectly included data in this message. We can safely ignore it, as the + bad FCS means we will throw away the whole message, anyway. */ + } + /* Some T.38 implementations send multiple T38_FIELD_HDLC_FCS_BAD messages, in IFP packets with + incrementing sequence numbers, which are actually repeats. They get through to this point because + of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ + if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC bad (%s)\n", (fe->hdlc_rx.len >= 3) ? t30_frametype(fe->hdlc_rx.buf[2]) : "???", (fe->rx_data_missing) ? "missing octets" : "clean"); + hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE); + } + fe->hdlc_rx.len = 0; + fe->rx_data_missing = FALSE; + fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT); + break; + case T38_FIELD_HDLC_FCS_OK_SIG_END: + if (len > 0) + { + span_log(&s->logging, SPAN_LOG_WARNING, "There is data in a T38_FIELD_HDLC_FCS_OK_SIG_END!\n"); + /* The sender has incorrectly included data in this message. It is unclear what we should do + with it, to maximise tolerance of buggy implementations. */ + } + /* Some T.38 implementations send multiple T38_FIELD_HDLC_FCS_OK_SIG_END messages, in IFP packets with + incrementing sequence numbers, which are actually repeats. They get through to this point because + of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ + if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC OK, sig end (%s)\n", (fe->hdlc_rx.len >= 3) ? t30_frametype(fe->hdlc_rx.buf[2]) : "???", (fe->rx_data_missing) ? "missing octets" : "clean"); + crc_itu16_append(fe->hdlc_rx.buf, fe->hdlc_rx.len); + hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, !fe->rx_data_missing); + hdlc_rx_status(s, SIG_STATUS_CARRIER_DOWN); + } + fe->hdlc_rx.len = 0; + fe->rx_data_missing = FALSE; + fe->timeout_rx_samples = 0; + break; + case T38_FIELD_HDLC_FCS_BAD_SIG_END: + if (len > 0) + { + span_log(&s->logging, SPAN_LOG_WARNING, "There is data in a T38_FIELD_HDLC_FCS_BAD_SIG_END!\n"); + /* The sender has incorrectly included data in this message. We can safely ignore it, as the + bad FCS means we will throw away the whole message, anyway. */ + } + /* Some T.38 implementations send multiple T38_FIELD_HDLC_FCS_BAD_SIG_END messages, in IFP packets with + incrementing sequence numbers, which are actually repeats. They get through to this point because + of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ + if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC bad, sig end (%s)\n", (fe->hdlc_rx.len >= 3) ? t30_frametype(fe->hdlc_rx.buf[2]) : "???", (fe->rx_data_missing) ? "missing octets" : "clean"); + hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE); + hdlc_rx_status(s, SIG_STATUS_CARRIER_DOWN); + } + fe->hdlc_rx.len = 0; + fe->rx_data_missing = FALSE; + fe->timeout_rx_samples = 0; + break; + case T38_FIELD_HDLC_SIG_END: + if (len > 0) + { + span_log(&s->logging, SPAN_LOG_WARNING, "There is data in a T38_FIELD_HDLC_SIG_END!\n"); + /* The sender has incorrectly included data in this message, but there seems nothing meaningful + it could be. There could not be an FCS good/bad report beyond this. */ + } + /* Some T.38 implementations send multiple T38_FIELD_HDLC_SIG_END messages, in IFP packets with + incrementing sequence numbers, which are actually repeats. They get through to this point because + of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ + if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type) + { + /* WORKAROUND: At least some Mediatrix boxes have a bug, where they can send this message at the + end of non-ECM data. We need to tolerate this. We use the generic receive complete + indication, rather than the specific HDLC carrier down. */ + /* This message is expected under 2 circumstances. One is as an alternative to T38_FIELD_HDLC_FCS_OK_SIG_END - + i.e. they send T38_FIELD_HDLC_FCS_OK, and then T38_FIELD_HDLC_SIG_END when the carrier actually drops. + The other is because the HDLC signal drops unexpectedly - i.e. not just after a final frame. */ + fe->hdlc_rx.len = 0; + fe->rx_data_missing = FALSE; + fe->timeout_rx_samples = 0; + hdlc_rx_status(s, SIG_STATUS_CARRIER_DOWN); + } + break; + case T38_FIELD_T4_NON_ECM_DATA: + if (!s->at_state.rx_signal_present) + { + non_ecm_rx_status(s, SIG_STATUS_TRAINING_SUCCEEDED); + s->at_state.rx_signal_present = TRUE; + } + if (len > 0) + { + bit_reverse(buf2, buf, len); + non_ecm_put_chunk(s, buf, len); + } + fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT); + break; + case T38_FIELD_T4_NON_ECM_SIG_END: + /* Some T.38 implementations send multiple T38_FIELD_T4_NON_ECM_SIG_END messages, in IFP packets with + incrementing sequence numbers, which are actually repeats. They get through to this point because + of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ + if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type) + { + if (len > 0) + { + if (!s->at_state.rx_signal_present) + { + non_ecm_rx_status(s, SIG_STATUS_TRAINING_SUCCEEDED); + s->at_state.rx_signal_present = TRUE; + } + bit_reverse(buf2, buf, len); + non_ecm_put_chunk(s, buf, len); + } + /* WORKAROUND: At least some Mediatrix boxes have a bug, where they can send HDLC signal end where + they should send non-ECM signal end. It is possible they also do the opposite. + We need to tolerate this, so we use the generic receive complete + indication, rather than the specific non-ECM carrier down. */ + non_ecm_rx_status(s, SIG_STATUS_CARRIER_DOWN); + } + s->at_state.rx_signal_present = FALSE; + fe->timeout_rx_samples = 0; + break; + case T38_FIELD_CM_MESSAGE: + if (len >= 1) + span_log(&s->logging, SPAN_LOG_FLOW, "CM profile %d - %s\n", buf[0] - '0', t38_cm_profile_to_str(buf[0])); + else + span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for CM message - %d\n", len); + break; + case T38_FIELD_JM_MESSAGE: + if (len >= 2) + span_log(&s->logging, SPAN_LOG_FLOW, "JM - %s\n", t38_jm_to_str(buf, len)); + else + span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for JM message - %d\n", len); + break; + case T38_FIELD_CI_MESSAGE: + if (len >= 1) + span_log(&s->logging, SPAN_LOG_FLOW, "CI 0x%X\n", buf[0]); + else + span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for CI message - %d\n", len); + break; + case T38_FIELD_V34RATE: + if (len >= 3) + { + fe->t38.v34_rate = t38_v34rate_to_bps(buf, len); + span_log(&s->logging, SPAN_LOG_FLOW, "V.34 rate %d bps\n", fe->t38.v34_rate); + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for V34rate message - %d\n", len); + } + break; + default: + break; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void send_hdlc(void *user_data, const uint8_t *msg, int len) +{ + t31_state_t *s; + + s = (t31_state_t *) user_data; + if (len <= 0) + { + s->hdlc_tx.len = -1; + } + else + { + s->t38_fe.hdlc_tx.extra_bits = extra_bits_in_stuffed_frame(msg, len); + bit_reverse(s->hdlc_tx.buf, msg, len); + s->hdlc_tx.len = len; + s->hdlc_tx.ptr = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int bits_to_us(t31_state_t *s, int bits) +{ + if (s->t38_fe.ms_per_tx_chunk == 0 || s->t38_fe.tx_bit_rate == 0) + return 0; + return bits*1000000/s->t38_fe.tx_bit_rate; +} +/*- End of function --------------------------------------------------------*/ + +static void set_octets_per_data_packet(t31_state_t *s, int bit_rate) +{ + s->t38_fe.tx_bit_rate = bit_rate; + if (s->t38_fe.ms_per_tx_chunk) + { + s->t38_fe.octets_per_data_packet = s->t38_fe.ms_per_tx_chunk*bit_rate/(8*1000); + /* Make sure we have a positive number (i.e. we didn't truncate to zero). */ + if (s->t38_fe.octets_per_data_packet < 1) + s->t38_fe.octets_per_data_packet = 1; + } + else + { + s->t38_fe.octets_per_data_packet = MAX_OCTETS_PER_UNPACED_CHUNK; + } +} +/*- End of function --------------------------------------------------------*/ + +static int stream_non_ecm(t31_state_t *s) +{ + t31_t38_front_end_state_t *fe; + uint8_t buf[MAX_OCTETS_PER_UNPACED_CHUNK + 50]; + int delay; + int len; + + fe = &s->t38_fe; + for (delay = 0; delay == 0; ) + { + switch (fe->timed_step) + { + case T38_TIMED_STEP_NON_ECM_MODEM: + /* Create a 75ms silence */ + if (fe->t38.current_tx_indicator != T38_IND_NO_SIGNAL) + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); + fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_2; + fe->next_tx_samples = fe->samples; + break; + case T38_TIMED_STEP_NON_ECM_MODEM_2: + /* Switch on a fast modem, and give the training time to complete */ + delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator); + fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_3; + break; + case T38_TIMED_STEP_NON_ECM_MODEM_3: + /* Send a chunk of non-ECM image data */ + /* T.38 says it is OK to send the last of the non-ECM data in the signal end message. + However, I think the early versions of T.38 said the signal end message should not + contain data. Hopefully, following the current spec will not cause compatibility + issues. */ + len = non_ecm_get_chunk(s, buf, fe->octets_per_data_packet); + if (len > 0) + bit_reverse(buf, buf, len); + if (len < fe->octets_per_data_packet) + { + /* That's the end of the image data. */ + if (s->t38_fe.ms_per_tx_chunk) + { + /* Pad the end of the data with some zeros. If we just stop abruptly + at the end of the EOLs, some ATAs fail to clean up properly before + shutting down their transmit modem, and the last few rows of the image + are lost or corrupted. Simply delaying the no-signal message does not + help for all implentations. It is usually ignored, which is probably + the right thing to do after receiving a message saying the signal has + ended. */ + memset(buf + len, 0, fe->octets_per_data_packet - len); + fe->non_ecm_trailer_bytes = 3*fe->octets_per_data_packet + len; + len = fe->octets_per_data_packet; + fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_4; + } + else + { + /* If we are sending quickly there seems no point in doing any padding */ + t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA_END); + fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_5; + delay = 0; + } + } + t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA); + delay = bits_to_us(s, 8*len); + break; + case T38_TIMED_STEP_NON_ECM_MODEM_4: + /* Send padding */ + len = fe->octets_per_data_packet; + fe->non_ecm_trailer_bytes -= len; + if (fe->non_ecm_trailer_bytes <= 0) + { + len += fe->non_ecm_trailer_bytes; + memset(buf, 0, len); + t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA_END); + fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_5; + /* Allow a bit more time than the data will take to play out, to ensure the far ATA does not + cut things short. */ + delay = bits_to_us(s, 8*len); + if (s->t38_fe.ms_per_tx_chunk) + delay += 60000; + front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); + break; + } + memset(buf, 0, len); + t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA); + delay = bits_to_us(s, 8*len); + break; + case T38_TIMED_STEP_NON_ECM_MODEM_5: + /* This should not be needed, since the message above indicates the end of the signal, but it + seems like it can improve compatibility with quirky implementations. */ + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); + fe->timed_step = T38_TIMED_STEP_NONE; + return delay; + } + } + return delay; +} +/*- End of function --------------------------------------------------------*/ + +static int stream_hdlc(t31_state_t *s) +{ + t31_t38_front_end_state_t *fe; + uint8_t buf[MAX_OCTETS_PER_UNPACED_CHUNK + 50]; + t38_data_field_t data_fields[2]; + int previous; + int delay; + int i; + int category; + + fe = &s->t38_fe; + for (delay = 0; delay == 0; ) + { + switch (fe->timed_step) + { + case T38_TIMED_STEP_HDLC_MODEM: + /* Create a 75ms silence */ + if (fe->t38.current_tx_indicator != T38_IND_NO_SIGNAL) + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); + fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_2; + fe->next_tx_samples = fe->samples + ms_to_samples(75); + break; + case T38_TIMED_STEP_HDLC_MODEM_2: + /* Send HDLC preambling */ + delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator); + delay += t38_core_send_flags_delay(&fe->t38, fe->next_tx_indicator); + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT); + fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3; + break; + case T38_TIMED_STEP_HDLC_MODEM_3: + /* Send a chunk of HDLC data */ + if (s->hdlc_tx.len == 0) + { + /* We don't have a frame ready yet, so wait a little */ + delay = MS_PER_TX_CHUNK*1000; + break; + } + i = s->hdlc_tx.len - s->hdlc_tx.ptr; + if (fe->octets_per_data_packet >= i) + { + /* The last part of an HDLC frame */ + if (fe->chunking_modes & T38_CHUNKING_MERGE_FCS_WITH_DATA) + { + /* Copy the data, as we might be about to refill the buffer it is in */ + memcpy(buf, &s->hdlc_tx.buf[s->hdlc_tx.ptr], i); + data_fields[0].field_type = T38_FIELD_HDLC_DATA; + data_fields[0].field = buf; + data_fields[0].field_len = i; + + /* Now see about the next HDLC frame. This will tell us whether to send FCS_OK or FCS_OK_SIG_END */ + previous = fe->current_tx_data_type; + s->hdlc_tx.ptr = 0; + s->hdlc_tx.len = 0; + front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); + if (s->hdlc_tx.final) + { + data_fields[1].field_type = T38_FIELD_HDLC_FCS_OK_SIG_END; + data_fields[1].field = NULL; + data_fields[1].field_len = 0; + category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA_END : T38_PACKET_CATEGORY_IMAGE_DATA_END; + t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, category); + fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_5; + /* We add a bit of extra time here, as with some implementations + the carrier falling too abruptly causes data loss. */ + delay = bits_to_us(s, i*8 + fe->hdlc_tx.extra_bits); + if (s->t38_fe.ms_per_tx_chunk) + delay += 100000; + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_OK); + t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND); + } + else + { + data_fields[1].field_type = T38_FIELD_HDLC_FCS_OK; + data_fields[1].field = NULL; + data_fields[1].field_len = 0; + category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA : T38_PACKET_CATEGORY_IMAGE_DATA; + t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, category); + fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3; + delay = bits_to_us(s, i*8 + fe->hdlc_tx.extra_bits); + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT); + } + break; + } + category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA : T38_PACKET_CATEGORY_IMAGE_DATA; + t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &s->hdlc_tx.buf[s->hdlc_tx.ptr], i, category); + fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_4; + } + else + { + i = fe->octets_per_data_packet; + category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA : T38_PACKET_CATEGORY_IMAGE_DATA; + t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &s->hdlc_tx.buf[s->hdlc_tx.ptr], i, category); + s->hdlc_tx.ptr += i; + } + delay = bits_to_us(s, i*8); + break; + case T38_TIMED_STEP_HDLC_MODEM_4: + /* End of HDLC frame */ + previous = fe->current_tx_data_type; + s->hdlc_tx.ptr = 0; + s->hdlc_tx.len = 0; + if (s->hdlc_tx.final) + { + /* End of transmission */ + s->hdlc_tx.len = 0; + s->hdlc_tx.final = FALSE; + category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA : T38_PACKET_CATEGORY_IMAGE_DATA; + t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK, NULL, 0, category); + fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_5; + /* We add a bit of extra time here, as with some implementations + the carrier falling too abruptly causes data loss. */ + delay = bits_to_us(s, fe->hdlc_tx.extra_bits); + if (s->t38_fe.ms_per_tx_chunk) + delay += 100000; + front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); + break; + } + /* Finish the current frame off, and prepare for the next one. */ + category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA : T38_PACKET_CATEGORY_IMAGE_DATA; + t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK, NULL, 0, category); + fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3; + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT); + /* We should now wait enough time for everything to clear through an analogue modem at the far end. */ + delay = bits_to_us(s, fe->hdlc_tx.extra_bits); + if (s->hdlc_tx.len == 0) + span_log(&s->logging, SPAN_LOG_FLOW, "No new frame or end transmission condition.\n"); + break; + case T38_TIMED_STEP_HDLC_MODEM_5: + /* Note that some boxes do not like us sending a T38_FIELD_HDLC_SIG_END at this point. + A T38_IND_NO_SIGNAL should always be OK. */ + category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA_END : T38_PACKET_CATEGORY_IMAGE_DATA_END; + t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_SIG_END, NULL, 0, category); + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); + fe->timed_step = T38_TIMED_STEP_NONE; + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_OK); + t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND); + return 0; + } + } + return delay; +} +/*- End of function --------------------------------------------------------*/ + +static int stream_ced(t31_state_t *s) +{ + t31_t38_front_end_state_t *fe; + int delay; + + fe = &s->t38_fe; + for (delay = 0; delay == 0; ) + { + switch (fe->timed_step) + { + case T38_TIMED_STEP_CED: + /* It seems common practice to start with a no signal indicator, though + this is not a specified requirement. Since we should be sending 200ms + of silence, starting the delay with a no signal indication makes sense. + We do need a 200ms delay, as that is a specification requirement. */ + fe->timed_step = T38_TIMED_STEP_CED_2; + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); + delay = 200000; + fe->next_tx_samples = fe->samples; + break; + case T38_TIMED_STEP_CED_2: + /* Initial 200ms delay over. Send the CED indicator */ + fe->timed_step = T38_TIMED_STEP_CED_3; + delay = t38_core_send_indicator(&fe->t38, T38_IND_CED); + fe->current_tx_data_type = T38_DATA_NONE; + break; + case T38_TIMED_STEP_CED_3: + /* End of CED */ + fe->timed_step = T38_TIMED_STEP_NONE; + front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); + return 0; + } + } + return delay; +} +/*- End of function --------------------------------------------------------*/ + +static int stream_cng(t31_state_t *s) +{ + t31_t38_front_end_state_t *fe; + int delay; + + fe = &s->t38_fe; + for (delay = 0; delay == 0; ) + { + switch (fe->timed_step) + { + case T38_TIMED_STEP_CNG: + /* It seems common practice to start with a no signal indicator, though + this is not a specified requirement of the T.38 spec. Since we should + be sending 200ms of silence, according to T.30, starting that delay with + a no signal indication makes sense. */ + fe->timed_step = T38_TIMED_STEP_CNG_2; + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); + delay = 200000; + fe->next_tx_samples = fe->samples; + break; + case T38_TIMED_STEP_CNG_2: + /* Initial short delay over. Send the CNG indicator. CNG persists until something + coming the other way interrupts it, or a long timeout controlled by the T.30 engine + expires. */ + fe->timed_step = T38_TIMED_STEP_NONE; + delay = t38_core_send_indicator(&fe->t38, T38_IND_CNG); + fe->current_tx_data_type = T38_DATA_NONE; + return delay; + } + } + return delay; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t31_t38_send_timeout(t31_state_t *s, int samples) +{ + t31_t38_front_end_state_t *fe; + int delay; + + fe = &s->t38_fe; + if (fe->current_rx_type == T30_MODEM_DONE || fe->current_tx_type == T30_MODEM_DONE) + return TRUE; + + fe->samples += samples; + if (fe->timeout_rx_samples && fe->samples > fe->timeout_rx_samples) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Timeout mid-receive\n"); + fe->timeout_rx_samples = 0; + front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE); + } + if (fe->timed_step == T38_TIMED_STEP_NONE) + return FALSE; + /* Wait until the right time comes along, unless we are working in "no delays" mode, while talking to an + IAF terminal. */ + if (fe->ms_per_tx_chunk && fe->samples < fe->next_tx_samples) + return FALSE; + /* Its time to send something */ + delay = 0; + switch (fe->timed_step & 0xFFF0) + { + case T38_TIMED_STEP_NON_ECM_MODEM: + delay = stream_non_ecm(s); + break; + case T38_TIMED_STEP_HDLC_MODEM: + delay = stream_hdlc(s); + break; + //case T38_TIMED_STEP_FAKE_HDLC_MODEM: + // delay = stream_fake_hdlc(s); + // break; + case T38_TIMED_STEP_CED: + delay = stream_ced(s); + break; + case T38_TIMED_STEP_CNG: + delay = stream_cng(s); + break; + case T38_TIMED_STEP_PAUSE: + /* End of timed pause */ + fe->timed_step = T38_TIMED_STEP_NONE; + front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); + break; + } + fe->next_tx_samples += us_to_samples(delay); + return FALSE; +} +/*- End of function --------------------------------------------------------*/ + +static int t31_modem_control_handler(at_state_t *s, void *user_data, int op, const char *num) +{ + t31_state_t *t; + + t = (t31_state_t *) user_data; + switch (op) + { + case AT_MODEM_CONTROL_CALL: + t->call_samples = 0; + break; + case AT_MODEM_CONTROL_ANSWER: + t->call_samples = 0; + break; + case AT_MODEM_CONTROL_ONHOOK: + if (t->tx.holding) + { + t->tx.holding = FALSE; + /* Tell the application to release further data */ + at_modem_control(&t->at_state, AT_MODEM_CONTROL_CTS, (void *) 1); + } + if (t->at_state.rx_signal_present) + { + t->at_state.rx_data[t->at_state.rx_data_bytes++] = DLE; + t->at_state.rx_data[t->at_state.rx_data_bytes++] = ETX; + t->at_state.at_tx_handler(&t->at_state, + t->at_state.at_tx_user_data, + t->at_state.rx_data, + t->at_state.rx_data_bytes); + t->at_state.rx_data_bytes = 0; + } + restart_modem(t, FAX_MODEM_SILENCE_TX); + break; + case AT_MODEM_CONTROL_RESTART: + restart_modem(t, (int) (intptr_t) num); + return 0; + case AT_MODEM_CONTROL_DTE_TIMEOUT: + if (num) + t->dte_data_timeout = t->call_samples + ms_to_samples((intptr_t) num); + else + t->dte_data_timeout = 0; + return 0; + } + return t->modem_control_handler(t, t->modem_control_user_data, op, num); +} +/*- End of function --------------------------------------------------------*/ + +static void non_ecm_rx_status(void *user_data, int status) +{ + t31_state_t *s; + + s = (t31_state_t *) user_data; + switch (status) + { + case SIG_STATUS_TRAINING_IN_PROGRESS: + break; + case SIG_STATUS_TRAINING_FAILED: + s->at_state.rx_trained = FALSE; + break; + case SIG_STATUS_TRAINING_SUCCEEDED: + /* The modem is now trained */ + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT); + s->at_state.rx_signal_present = TRUE; + s->at_state.rx_trained = TRUE; + break; + case SIG_STATUS_CARRIER_UP: + break; + case SIG_STATUS_CARRIER_DOWN: + if (s->at_state.rx_signal_present) + { + s->at_state.rx_data[s->at_state.rx_data_bytes++] = DLE; + s->at_state.rx_data[s->at_state.rx_data_bytes++] = ETX; + s->at_state.at_tx_handler(&s->at_state, + s->at_state.at_tx_user_data, + s->at_state.rx_data, + s->at_state.rx_data_bytes); + s->at_state.rx_data_bytes = 0; + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_NO_CARRIER); + t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND); + } + s->at_state.rx_signal_present = FALSE; + s->at_state.rx_trained = FALSE; + break; + default: + if (s->at_state.p.result_code_format) + span_log(&s->logging, SPAN_LOG_FLOW, "Eh!\n"); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void non_ecm_put_bit(void *user_data, int bit) +{ + t31_state_t *s; + + if (bit < 0) + { + non_ecm_rx_status(user_data, bit); + return; + } + s = (t31_state_t *) user_data; + s->audio.current_byte = (s->audio.current_byte >> 1) | (bit << 7); + if (++s->audio.bit_no >= 8) + { + if (s->audio.current_byte == DLE) + s->at_state.rx_data[s->at_state.rx_data_bytes++] = DLE; + s->at_state.rx_data[s->at_state.rx_data_bytes++] = (uint8_t) s->audio.current_byte; + if (s->at_state.rx_data_bytes >= 250) + { + s->at_state.at_tx_handler(&s->at_state, + s->at_state.at_tx_user_data, + s->at_state.rx_data, + s->at_state.rx_data_bytes); + s->at_state.rx_data_bytes = 0; + } + s->audio.bit_no = 0; + s->audio.current_byte = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +static void non_ecm_put_chunk(void *user_data, const uint8_t buf[], int len) +{ + t31_state_t *s; + int i; + + s = (t31_state_t *) user_data; + /* Ignore any fractional bytes which may have accumulated */ + for (i = 0; i < len; i++) + { + if (buf[i] == DLE) + s->at_state.rx_data[s->at_state.rx_data_bytes++] = DLE; + s->at_state.rx_data[s->at_state.rx_data_bytes++] = buf[i]; + if (s->at_state.rx_data_bytes >= 250) + { + s->at_state.at_tx_handler(&s->at_state, + s->at_state.at_tx_user_data, + s->at_state.rx_data, + s->at_state.rx_data_bytes); + s->at_state.rx_data_bytes = 0; + } + } + s->audio.bit_no = 0; + s->audio.current_byte = 0; +} +/*- End of function --------------------------------------------------------*/ + +static int non_ecm_get_bit(void *user_data) +{ + t31_state_t *s; + int bit; + + s = (t31_state_t *) user_data; + if (s->audio.bit_no <= 0) + { + if (s->tx.out_bytes != s->tx.in_bytes) + { + /* There is real data available to send */ + s->audio.current_byte = s->tx.data[s->tx.out_bytes++]; + if (s->tx.out_bytes > T31_TX_BUF_LEN - 1) + { + s->tx.out_bytes = T31_TX_BUF_LEN - 1; + span_log(&s->logging, SPAN_LOG_FLOW, "End of transmit buffer reached!\n"); + } + if (s->tx.holding) + { + /* See if the buffer is approaching empty. It might be time to + release flow control. */ + if (s->tx.out_bytes > T31_TX_BUF_LOW_TIDE) + { + s->tx.holding = FALSE; + /* Tell the application to release further data */ + at_modem_control(&s->at_state, AT_MODEM_CONTROL_CTS, (void *) 1); + } + } + s->tx.data_started = TRUE; + } + else + { + if (s->tx.final) + { + s->tx.final = FALSE; + /* This will put the modem into its shutdown sequence. When + it has finally shut down, an OK response will be sent. */ + return SIG_STATUS_END_OF_DATA; + } + /* Fill with 0xFF bytes at the start of transmission, or 0x00 if we are in + the middle of transmission. This follows T.31 and T.30 practice. */ + s->audio.current_byte = (s->tx.data_started) ? 0x00 : 0xFF; + } + s->audio.bit_no = 8; + } + s->audio.bit_no--; + bit = s->audio.current_byte & 1; + s->audio.current_byte >>= 1; + return bit; +} +/*- End of function --------------------------------------------------------*/ + +static int non_ecm_get_chunk(void *user_data, uint8_t buf[], int len) +{ + t31_state_t *s; + int i; + + s = (t31_state_t *) user_data; + for (i = 0; i < len; i++) + { + if (s->tx.out_bytes != s->tx.in_bytes) + { + /* There is real data available to send */ + buf[i] = s->tx.data[s->tx.out_bytes++]; + if (s->tx.out_bytes > T31_TX_BUF_LEN - 1) + { + s->tx.out_bytes = T31_TX_BUF_LEN - 1; + span_log(&s->logging, SPAN_LOG_FLOW, "End of transmit buffer reached!\n"); + } + if (s->tx.holding) + { + /* See if the buffer is approaching empty. It might be time to release flow control. */ + if (s->tx.out_bytes > T31_TX_BUF_LOW_TIDE) + { + s->tx.holding = FALSE; + /* Tell the application to release further data */ + at_modem_control(&s->at_state, AT_MODEM_CONTROL_CTS, (void *) 1); + } + } + s->tx.data_started = TRUE; + } + else + { + if (s->tx.final) + { + s->tx.final = FALSE; + /* This will put the modem into its shutdown sequence. When + it has finally shut down, an OK response will be sent. */ + //return SIG_STATUS_END_OF_DATA; + return i; + } + /* Fill with 0xFF bytes at the start of transmission, or 0x00 if we are in + the middle of transmission. This follows T.31 and T.30 practice. */ + buf[i] = (s->tx.data_started) ? 0x00 : 0xFF; + } + } + s->audio.bit_no = 0; + s->audio.current_byte = 0; + return len; +} +/*- End of function --------------------------------------------------------*/ + +static void tone_detected(void *user_data, int tone, int level, int delay) +{ + t31_state_t *s; + + s = (t31_state_t *) user_data; + span_log(&s->logging, SPAN_LOG_FLOW, "%s detected (%ddBm0)\n", modem_connect_tone_to_str(tone), level); +} +/*- End of function --------------------------------------------------------*/ + +static void hdlc_tx_underflow(void *user_data) +{ + t31_state_t *s; + + s = (t31_state_t *) user_data; + if (s->hdlc_tx.final) + { + s->hdlc_tx.final = FALSE; + /* Schedule an orderly shutdown of the modem */ + hdlc_tx_frame(&(s->audio.modems.hdlc_tx), NULL, 0); + } + else + { + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT); + } +} +/*- End of function --------------------------------------------------------*/ + +static void hdlc_rx_status(void *user_data, int status) +{ + t31_state_t *s; + uint8_t buf[2]; + + s = (t31_state_t *) user_data; + switch (status) + { + case SIG_STATUS_TRAINING_IN_PROGRESS: + break; + case SIG_STATUS_TRAINING_FAILED: + s->at_state.rx_trained = FALSE; + break; + case SIG_STATUS_TRAINING_SUCCEEDED: + /* The modem is now trained */ + s->at_state.rx_signal_present = TRUE; + s->at_state.rx_trained = TRUE; + break; + case SIG_STATUS_CARRIER_UP: + if (s->modem == FAX_MODEM_CNG_TONE || s->modem == FAX_MODEM_NOCNG_TONE || s->modem == FAX_MODEM_V21_RX) + { + s->at_state.rx_signal_present = TRUE; + s->rx_frame_received = FALSE; + } + break; + case SIG_STATUS_CARRIER_DOWN: + if (s->rx_frame_received) + { + if (s->at_state.dte_is_waiting) + { + if (s->at_state.ok_is_pending) + { + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_OK); + s->at_state.ok_is_pending = FALSE; + } + else + { + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_NO_CARRIER); + } + s->at_state.dte_is_waiting = FALSE; + t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND); + } + else + { + buf[0] = AT_RESPONSE_CODE_NO_CARRIER; + queue_write_msg(s->rx_queue, buf, 1); + } + } + s->at_state.rx_signal_present = FALSE; + s->at_state.rx_trained = FALSE; + break; + case SIG_STATUS_FRAMING_OK: + if (s->modem == FAX_MODEM_CNG_TONE || s->modem == FAX_MODEM_NOCNG_TONE) + { + /* Once we get any valid HDLC the CNG tone stops, and we drop + to the V.21 receive modem on its own. */ + s->modem = FAX_MODEM_V21_RX; + s->at_state.transmit = FALSE; + } + if (s->modem == FAX_MODEM_V17_RX || s->modem == FAX_MODEM_V27TER_RX || s->modem == FAX_MODEM_V29_RX) + { + /* V.21 has been detected while expecting a different carrier. + If +FAR=0 then result +FCERROR and return to command-mode. + If +FAR=1 then report +FRH:3 and CONNECT, switching to + V.21 receive mode. */ + if (s->at_state.p.adaptive_receive) + { + s->at_state.rx_signal_present = TRUE; + s->rx_frame_received = TRUE; + s->modem = FAX_MODEM_V21_RX; + s->at_state.transmit = FALSE; + s->at_state.dte_is_waiting = TRUE; + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_FRH3); + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT); + } + else + { + s->modem = FAX_MODEM_SILENCE_TX; + t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND); + s->rx_frame_received = FALSE; + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_FCERROR); + } + } + else + { + if (!s->rx_frame_received) + { + if (s->at_state.dte_is_waiting) + { + /* Report CONNECT as soon as possible to avoid a timeout. */ + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT); + s->rx_frame_received = TRUE; + } + else + { + buf[0] = AT_RESPONSE_CODE_CONNECT; + queue_write_msg(s->rx_queue, buf, 1); + } + } + } + break; + case SIG_STATUS_ABORT: + /* Just ignore these */ + break; + default: + span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected HDLC rx status - %d!\n", status); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void hdlc_accept_frame(void *user_data, const uint8_t *msg, int len, int ok) +{ + t31_state_t *s; + uint8_t buf[256]; + int i; + + if (len < 0) + { + hdlc_rx_status(user_data, len); + return; + } + s = (t31_state_t *) user_data; + if (!s->rx_frame_received) + { + if (s->at_state.dte_is_waiting) + { + /* Report CONNECT as soon as possible to avoid a timeout. */ + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT); + s->rx_frame_received = TRUE; + } + else + { + buf[0] = AT_RESPONSE_CODE_CONNECT; + queue_write_msg(s->rx_queue, buf, 1); + } + } + /* If OK is pending then we just ignore whatever comes in */ + if (!s->at_state.ok_is_pending) + { + if (s->at_state.dte_is_waiting) + { + /* Send straight away */ + /* It is safe to look at the two bytes beyond the length of the message, + and expect to find the FCS there. */ + for (i = 0; i < len + 2; i++) + { + if (msg[i] == DLE) + s->at_state.rx_data[s->at_state.rx_data_bytes++] = DLE; + s->at_state.rx_data[s->at_state.rx_data_bytes++] = msg[i]; + } + s->at_state.rx_data[s->at_state.rx_data_bytes++] = DLE; + s->at_state.rx_data[s->at_state.rx_data_bytes++] = ETX; + s->at_state.at_tx_handler(&s->at_state, s->at_state.at_tx_user_data, s->at_state.rx_data, s->at_state.rx_data_bytes); + s->at_state.rx_data_bytes = 0; + if (msg[1] == 0x13 && ok) + { + /* This is the last frame. We don't send OK until the carrier drops to avoid + redetecting it later. */ + s->at_state.ok_is_pending = TRUE; + } + else + { + at_put_response_code(&s->at_state, (ok) ? AT_RESPONSE_CODE_OK : AT_RESPONSE_CODE_ERROR); + s->at_state.dte_is_waiting = FALSE; + s->rx_frame_received = FALSE; + } + } + else + { + /* Queue it */ + buf[0] = (ok) ? AT_RESPONSE_CODE_OK : AT_RESPONSE_CODE_ERROR; + /* It is safe to look at the two bytes beyond the length of the message, + and expect to find the FCS there. */ + memcpy(buf + 1, msg, len + 2); + queue_write_msg(s->rx_queue, buf, len + 3); + } + } + t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND); +} +/*- End of function --------------------------------------------------------*/ + +static void t31_v21_rx(t31_state_t *s) +{ + s->at_state.ok_is_pending = FALSE; + s->hdlc_tx.final = FALSE; + s->hdlc_tx.len = 0; + s->dled = FALSE; + hdlc_rx_init(&(s->audio.modems.hdlc_rx), FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, hdlc_accept_frame, s); + fsk_rx_init(&(s->audio.modems.v21_rx), &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) hdlc_rx_put_bit, &(s->audio.modems.hdlc_rx)); + fsk_rx_signal_cutoff(&(s->audio.modems.v21_rx), -39.09f); + s->at_state.transmit = TRUE; +} +/*- End of function --------------------------------------------------------*/ + +static int restart_modem(t31_state_t *s, int new_modem) +{ + int use_hdlc; + fax_modems_state_t *t; + + t = &s->audio.modems; + span_log(&s->logging, SPAN_LOG_FLOW, "Restart modem %d\n", new_modem); + if (s->modem == new_modem) + return 0; + queue_flush(s->rx_queue); + s->modem = new_modem; + s->tx.final = FALSE; + s->at_state.rx_signal_present = FALSE; + s->at_state.rx_trained = FALSE; + s->rx_frame_received = FALSE; + set_rx_handler(s, (span_rx_handler_t *) &span_dummy_rx, (span_rx_fillin_handler_t *) &span_dummy_rx_fillin, NULL); + use_hdlc = FALSE; + switch (s->modem) + { + case FAX_MODEM_CNG_TONE: + if (s->t38_mode) + { + s->t38_fe.next_tx_samples = s->t38_fe.samples; + s->t38_fe.timed_step = T38_TIMED_STEP_CNG; + s->t38_fe.current_tx_data_type = T38_DATA_NONE; + } + else + { + modem_connect_tones_tx_init(&t->connect_tx, MODEM_CONNECT_TONES_FAX_CNG); + /* CNG is special, since we need to receive V.21 HDLC messages while sending the + tone. Everything else in FAX processing sends only one way at a time. */ + /* Do V.21/HDLC receive in parallel. The other end may send its + first message at any time. The CNG tone will continue until + we get a valid preamble. */ + set_rx_handler(s, (span_rx_handler_t *) &cng_rx, (span_rx_fillin_handler_t *) &span_dummy_rx_fillin, s); + t31_v21_rx(s); + set_tx_handler(s, (span_tx_handler_t *) &modem_connect_tones_tx, &t->connect_tx); + set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + } + s->at_state.transmit = TRUE; + break; + case FAX_MODEM_NOCNG_TONE: + if (s->t38_mode) + { + } + else + { + set_rx_handler(s, (span_rx_handler_t *) &cng_rx, (span_rx_fillin_handler_t *) &span_dummy_rx_fillin, s); + t31_v21_rx(s); + silence_gen_set(&t->silence_gen, 0); + set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); + } + s->at_state.transmit = FALSE; + break; + case FAX_MODEM_CED_TONE: + if (s->t38_mode) + { + s->t38_fe.next_tx_samples = s->t38_fe.samples; + s->t38_fe.timed_step = T38_TIMED_STEP_CED; + s->t38_fe.current_tx_data_type = T38_DATA_NONE; + } + else + { + modem_connect_tones_tx_init(&t->connect_tx, MODEM_CONNECT_TONES_FAX_CED); + set_tx_handler(s, (span_tx_handler_t *) &modem_connect_tones_tx, &t->connect_tx); + set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + } + s->at_state.transmit = TRUE; + break; + case FAX_MODEM_V21_TX: + if (s->t38_mode) + { + s->t38_fe.next_tx_indicator = T38_IND_V21_PREAMBLE; + s->t38_fe.current_tx_data_type = T38_DATA_V21; + use_hdlc = TRUE; + s->t38_fe.timed_step = (use_hdlc) ? T38_TIMED_STEP_HDLC_MODEM : T38_TIMED_STEP_NON_ECM_MODEM; + set_octets_per_data_packet(s, 300); + } + else + { + hdlc_tx_init(&t->hdlc_tx, FALSE, 2, FALSE, hdlc_tx_underflow, s); + /* The spec says 1s +-15% of preamble. So, the minimum is 32 octets. */ + hdlc_tx_flags(&t->hdlc_tx, 32); + fsk_tx_init(&t->v21_tx, &preset_fsk_specs[FSK_V21CH2], (get_bit_func_t) hdlc_tx_get_bit, &t->hdlc_tx); + set_tx_handler(s, (span_tx_handler_t *) &fsk_tx, &t->v21_tx); + set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + } + s->hdlc_tx.final = FALSE; + s->hdlc_tx.len = 0; + s->dled = FALSE; + s->at_state.transmit = TRUE; + break; + case FAX_MODEM_V21_RX: + if (s->t38_mode) + { + } + else + { + set_rx_handler(s, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &t->v21_rx); + t31_v21_rx(s); + } + break; + case FAX_MODEM_V17_TX: + if (s->t38_mode) + { + switch (s->bit_rate) + { + case 7200: + s->t38_fe.next_tx_indicator = (s->short_train) ? T38_IND_V17_7200_SHORT_TRAINING : T38_IND_V17_7200_LONG_TRAINING; + s->t38_fe.current_tx_data_type = T38_DATA_V17_7200; + break; + case 9600: + s->t38_fe.next_tx_indicator = (s->short_train) ? T38_IND_V17_9600_SHORT_TRAINING : T38_IND_V17_9600_LONG_TRAINING; + s->t38_fe.current_tx_data_type = T38_DATA_V17_9600; + break; + case 12000: + s->t38_fe.next_tx_indicator = (s->short_train) ? T38_IND_V17_12000_SHORT_TRAINING : T38_IND_V17_12000_LONG_TRAINING; + s->t38_fe.current_tx_data_type = T38_DATA_V17_12000; + break; + case 14400: + s->t38_fe.next_tx_indicator = (s->short_train) ? T38_IND_V17_14400_SHORT_TRAINING : T38_IND_V17_14400_LONG_TRAINING; + s->t38_fe.current_tx_data_type = T38_DATA_V17_14400; + break; + } + set_octets_per_data_packet(s, s->bit_rate); + s->t38_fe.timed_step = (use_hdlc) ? T38_TIMED_STEP_HDLC_MODEM : T38_TIMED_STEP_NON_ECM_MODEM; + } + else + { + v17_tx_restart(&t->v17_tx, s->bit_rate, FALSE, s->short_train); + set_tx_handler(s, (span_tx_handler_t *) &v17_tx, &t->v17_tx); + set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + } + s->tx.out_bytes = 0; + s->tx.data_started = FALSE; + s->at_state.transmit = TRUE; + break; + case FAX_MODEM_V17_RX: + if (!s->t38_mode) + { + set_rx_handler(s, (span_rx_handler_t *) &v17_v21_rx, (span_rx_fillin_handler_t *) &v17_v21_rx_fillin, s); + v17_rx_restart(&t->v17_rx, s->bit_rate, s->short_train); + /* Allow for +FCERROR/+FRH:3 */ + t31_v21_rx(s); + } + s->at_state.transmit = FALSE; + break; + case FAX_MODEM_V27TER_TX: + if (s->t38_mode) + { + switch (s->bit_rate) + { + case 2400: + s->t38_fe.next_tx_indicator = T38_IND_V27TER_2400_TRAINING; + s->t38_fe.current_tx_data_type = T38_DATA_V27TER_2400; + break; + case 4800: + s->t38_fe.next_tx_indicator = T38_IND_V27TER_4800_TRAINING; + s->t38_fe.current_tx_data_type = T38_DATA_V27TER_4800; + break; + } + set_octets_per_data_packet(s, s->bit_rate); + s->t38_fe.timed_step = (use_hdlc) ? T38_TIMED_STEP_HDLC_MODEM : T38_TIMED_STEP_NON_ECM_MODEM; + } + else + { + v27ter_tx_restart(&t->v27ter_tx, s->bit_rate, FALSE); + set_tx_handler(s, (span_tx_handler_t *) &v27ter_tx, &t->v27ter_tx); + set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + } + s->tx.out_bytes = 0; + s->tx.data_started = FALSE; + s->at_state.transmit = TRUE; + break; + case FAX_MODEM_V27TER_RX: + if (!s->t38_mode) + { + set_rx_handler(s, (span_rx_handler_t *) &v27ter_v21_rx, (span_rx_fillin_handler_t *) &v27ter_v21_rx_fillin, s); + v27ter_rx_restart(&t->v27ter_rx, s->bit_rate, FALSE); + /* Allow for +FCERROR/+FRH:3 */ + t31_v21_rx(s); + } + s->at_state.transmit = FALSE; + break; + case FAX_MODEM_V29_TX: + if (s->t38_mode) + { + switch (s->bit_rate) + { + case 7200: + s->t38_fe.next_tx_indicator = T38_IND_V29_7200_TRAINING; + s->t38_fe.current_tx_data_type = T38_DATA_V29_7200; + break; + case 9600: + s->t38_fe.next_tx_indicator = T38_IND_V29_9600_TRAINING; + s->t38_fe.current_tx_data_type = T38_DATA_V29_9600; + break; + } + set_octets_per_data_packet(s, s->bit_rate); + s->t38_fe.timed_step = (use_hdlc) ? T38_TIMED_STEP_HDLC_MODEM : T38_TIMED_STEP_NON_ECM_MODEM; + } + else + { + v29_tx_restart(&t->v29_tx, s->bit_rate, FALSE); + set_tx_handler(s, (span_tx_handler_t *) &v29_tx, &t->v29_tx); + set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + } + s->tx.out_bytes = 0; + s->tx.data_started = FALSE; + s->at_state.transmit = TRUE; + break; + case FAX_MODEM_V29_RX: + if (!s->t38_mode) + { + set_rx_handler(s, (span_rx_handler_t *) &v29_v21_rx, (span_rx_fillin_handler_t *) &v29_v21_rx_fillin, s); + v29_rx_restart(&t->v29_rx, s->bit_rate, FALSE); + /* Allow for +FCERROR/+FRH:3 */ + t31_v21_rx(s); + } + s->at_state.transmit = FALSE; + break; + case FAX_MODEM_SILENCE_TX: + if (s->t38_mode) + { + t38_core_send_indicator(&s->t38_fe.t38, T38_IND_NO_SIGNAL); + s->t38_fe.next_tx_samples = s->t38_fe.samples + ms_to_samples(700); + s->t38_fe.timed_step = T38_TIMED_STEP_PAUSE; + s->t38_fe.current_tx_data_type = T38_DATA_NONE; + } + else + { + silence_gen_set(&t->silence_gen, 0); + set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + } + s->at_state.transmit = FALSE; + break; + case FAX_MODEM_SILENCE_RX: + if (!s->t38_mode) + { + set_rx_handler(s, (span_rx_handler_t *) &silence_rx, (span_rx_fillin_handler_t *) &span_dummy_rx_fillin, s); + silence_gen_set(&t->silence_gen, 0); + set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + } + s->at_state.transmit = FALSE; + break; + case FAX_MODEM_FLUSH: + /* Send 200ms of silence to "push" the last audio out */ + if (s->t38_mode) + { + t38_core_send_indicator(&s->t38_fe.t38, T38_IND_NO_SIGNAL); + } + else + { + s->modem = FAX_MODEM_SILENCE_TX; + silence_gen_alter(&t->silence_gen, ms_to_samples(200)); + set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + s->at_state.transmit = TRUE; + } + break; + } + s->audio.bit_no = 0; + s->audio.current_byte = 0xFF; + s->tx.in_bytes = 0; + s->tx.out_bytes = 0; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void dle_unstuff_hdlc(t31_state_t *s, const char *stuffed, int len) +{ + int i; + + for (i = 0; i < len; i++) + { + if (s->dled) + { + s->dled = FALSE; + if (stuffed[i] == ETX) + { + s->hdlc_tx.final = (s->hdlc_tx.buf[1] & 0x10); + if (s->t38_mode) + { + send_hdlc(s, s->hdlc_tx.buf, s->hdlc_tx.len); + } + else + { + hdlc_tx_frame(&(s->audio.modems.hdlc_tx), s->hdlc_tx.buf, s->hdlc_tx.len); + s->hdlc_tx.len = 0; + } + } + else if (stuffed[i] == SUB) + { + s->hdlc_tx.buf[s->hdlc_tx.len++] = DLE; + s->hdlc_tx.buf[s->hdlc_tx.len++] = DLE; + } + else + { + s->hdlc_tx.buf[s->hdlc_tx.len++] = stuffed[i]; + } + } + else + { + if (stuffed[i] == DLE) + s->dled = TRUE; + else + s->hdlc_tx.buf[s->hdlc_tx.len++] = stuffed[i]; + } + } +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void dle_unstuff(t31_state_t *s, const char *stuffed, int len) +{ + int i; + + for (i = 0; i < len; i++) + { + if (s->dled) + { + s->dled = FALSE; + if (stuffed[i] == ETX) + { + s->tx.final = TRUE; + t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND); + return; + } + } + else if (stuffed[i] == DLE) + { + s->dled = TRUE; + continue; + } + s->tx.data[s->tx.in_bytes++] = stuffed[i]; + if (s->tx.in_bytes > T31_TX_BUF_LEN - 1) + { + /* Oops. We hit the end of the buffer. Give up. Loose stuff. :-( */ + span_log(&s->logging, SPAN_LOG_FLOW, "No room in buffer for new data!\n"); + return; + } + } + if (!s->tx.holding) + { + /* See if the buffer is approaching full. We might need to apply flow control. */ + if (s->tx.in_bytes > T31_TX_BUF_HIGH_TIDE) + { + s->tx.holding = TRUE; + /* Tell the application to hold further data */ + at_modem_control(&s->at_state, AT_MODEM_CONTROL_CTS, (void *) 0); + } + } +} +/*- End of function --------------------------------------------------------*/ + +static int process_class1_cmd(at_state_t *t, void *user_data, int direction, int operation, int val) +{ + int new_modem; + int new_transmit; + int i; + int len; + int immediate_response; + t31_state_t *s; + uint8_t msg[256]; + + s = (t31_state_t *) user_data; + new_transmit = direction; + immediate_response = TRUE; + switch (operation) + { + case 'S': + s->at_state.transmit = new_transmit; + if (new_transmit) + { + /* Send a specified period of silence, to space transmissions. */ + restart_modem(s, FAX_MODEM_SILENCE_TX); + if (s->t38_mode) + s->t38_fe.next_tx_samples = s->t38_fe.samples + ms_to_samples(val*10); + else + silence_gen_alter(&(s->audio.modems.silence_gen), ms_to_samples(val*10)); + s->at_state.transmit = TRUE; + } + else + { + /* Wait until we have received a specified period of silence. */ + queue_flush(s->rx_queue); + s->silence_awaited = ms_to_samples(val*10); + t31_set_at_rx_mode(s, AT_MODE_DELIVERY); + if (s->t38_mode) + { + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_OK); + t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND); + } + else + { + restart_modem(s, FAX_MODEM_SILENCE_RX); + } + } + immediate_response = FALSE; + span_log(&s->logging, SPAN_LOG_FLOW, "Silence %dms\n", val*10); + break; + case 'H': + switch (val) + { + case 3: + new_modem = (new_transmit) ? FAX_MODEM_V21_TX : FAX_MODEM_V21_RX; + s->short_train = FALSE; + s->bit_rate = 300; + break; + default: + return -1; + } + span_log(&s->logging, SPAN_LOG_FLOW, "HDLC\n"); + if (new_modem != s->modem) + { + restart_modem(s, new_modem); + immediate_response = FALSE; + } + s->at_state.transmit = new_transmit; + if (new_transmit) + { + t31_set_at_rx_mode(s, AT_MODE_HDLC); + if (!s->t38_mode) + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT); + } + else + { + /* Send straight away, if there is something queued. */ + t31_set_at_rx_mode(s, AT_MODE_DELIVERY); + s->rx_frame_received = FALSE; + do + { + if (!queue_empty(s->rx_queue)) + { + len = queue_read_msg(s->rx_queue, msg, 256); + if (len > 1) + { + if (msg[0] == AT_RESPONSE_CODE_OK) + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT); + for (i = 1; i < len; i++) + { + if (msg[i] == DLE) + s->at_state.rx_data[s->at_state.rx_data_bytes++] = DLE; + s->at_state.rx_data[s->at_state.rx_data_bytes++] = msg[i]; + } + s->at_state.rx_data[s->at_state.rx_data_bytes++] = DLE; + s->at_state.rx_data[s->at_state.rx_data_bytes++] = ETX; + s->at_state.at_tx_handler(&s->at_state, s->at_state.at_tx_user_data, s->at_state.rx_data, s->at_state.rx_data_bytes); + s->at_state.rx_data_bytes = 0; + } + at_put_response_code(&s->at_state, msg[0]); + } + else + { + s->at_state.dte_is_waiting = TRUE; + break; + } + } + while (msg[0] == AT_RESPONSE_CODE_CONNECT); + } + immediate_response = FALSE; + break; + default: + switch (val) + { + case 24: + s->t38_fe.next_tx_indicator = T38_IND_V27TER_2400_TRAINING; + s->t38_fe.current_tx_data_type = T38_DATA_V27TER_2400; + new_modem = (new_transmit) ? FAX_MODEM_V27TER_TX : FAX_MODEM_V27TER_RX; + s->short_train = FALSE; + s->bit_rate = 2400; + break; + case 48: + s->t38_fe.next_tx_indicator = T38_IND_V27TER_4800_TRAINING; + s->t38_fe.current_tx_data_type = T38_DATA_V27TER_4800; + new_modem = (new_transmit) ? FAX_MODEM_V27TER_TX : FAX_MODEM_V27TER_RX; + s->short_train = FALSE; + s->bit_rate = 4800; + break; + case 72: + s->t38_fe.next_tx_indicator = T38_IND_V29_7200_TRAINING; + s->t38_fe.current_tx_data_type = T38_DATA_V29_7200; + new_modem = (new_transmit) ? FAX_MODEM_V29_TX : FAX_MODEM_V29_RX; + s->short_train = FALSE; + s->bit_rate = 7200; + break; + case 96: + s->t38_fe.next_tx_indicator = T38_IND_V29_9600_TRAINING; + s->t38_fe.current_tx_data_type = T38_DATA_V29_9600; + new_modem = (new_transmit) ? FAX_MODEM_V29_TX : FAX_MODEM_V29_RX; + s->short_train = FALSE; + s->bit_rate = 9600; + break; + case 73: + s->t38_fe.next_tx_indicator = T38_IND_V17_7200_LONG_TRAINING; + s->t38_fe.current_tx_data_type = T38_DATA_V17_7200; + new_modem = (new_transmit) ? FAX_MODEM_V17_TX : FAX_MODEM_V17_RX; + s->short_train = FALSE; + s->bit_rate = 7200; + break; + case 74: + s->t38_fe.next_tx_indicator = T38_IND_V17_7200_SHORT_TRAINING; + s->t38_fe.current_tx_data_type = T38_DATA_V17_7200; + new_modem = (new_transmit) ? FAX_MODEM_V17_TX : FAX_MODEM_V17_RX; + s->short_train = TRUE; + s->bit_rate = 7200; + break; + case 97: + s->t38_fe.next_tx_indicator = T38_IND_V17_9600_LONG_TRAINING; + s->t38_fe.current_tx_data_type = T38_DATA_V17_9600; + new_modem = (new_transmit) ? FAX_MODEM_V17_TX : FAX_MODEM_V17_RX; + s->short_train = FALSE; + s->bit_rate = 9600; + break; + case 98: + s->t38_fe.next_tx_indicator = T38_IND_V17_9600_SHORT_TRAINING; + s->t38_fe.current_tx_data_type = T38_DATA_V17_9600; + new_modem = (new_transmit) ? FAX_MODEM_V17_TX : FAX_MODEM_V17_RX; + s->short_train = TRUE; + s->bit_rate = 9600; + break; + case 121: + s->t38_fe.next_tx_indicator = T38_IND_V17_12000_LONG_TRAINING; + s->t38_fe.current_tx_data_type = T38_DATA_V17_12000; + new_modem = (new_transmit) ? FAX_MODEM_V17_TX : FAX_MODEM_V17_RX; + s->short_train = FALSE; + s->bit_rate = 12000; + break; + case 122: + s->t38_fe.next_tx_indicator = T38_IND_V17_12000_SHORT_TRAINING; + s->t38_fe.current_tx_data_type = T38_DATA_V17_12000; + new_modem = (new_transmit) ? FAX_MODEM_V17_TX : FAX_MODEM_V17_RX; + s->short_train = TRUE; + s->bit_rate = 12000; + break; + case 145: + s->t38_fe.next_tx_indicator = T38_IND_V17_14400_LONG_TRAINING; + s->t38_fe.current_tx_data_type = T38_DATA_V17_14400; + new_modem = (new_transmit) ? FAX_MODEM_V17_TX : FAX_MODEM_V17_RX; + s->short_train = FALSE; + s->bit_rate = 14400; + break; + case 146: + s->t38_fe.next_tx_indicator = T38_IND_V17_14400_SHORT_TRAINING; + s->t38_fe.current_tx_data_type = T38_DATA_V17_14400; + new_modem = (new_transmit) ? FAX_MODEM_V17_TX : FAX_MODEM_V17_RX; + s->short_train = TRUE; + s->bit_rate = 14400; + break; + default: + return -1; + } + span_log(&s->logging, SPAN_LOG_FLOW, "Short training = %d, bit rate = %d\n", s->short_train, s->bit_rate); + if (new_transmit) + { + t31_set_at_rx_mode(s, AT_MODE_STUFFED); + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT); + } + else + { + t31_set_at_rx_mode(s, AT_MODE_DELIVERY); + } + restart_modem(s, new_modem); + immediate_response = FALSE; + break; + } + return immediate_response; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t31_call_event(t31_state_t *s, int event) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "Call event %d received\n", event); + at_call_event(&s->at_state, event); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t31_at_rx(t31_state_t *s, const char *t, int len) +{ + if (s->dte_data_timeout) + s->dte_data_timeout = s->call_samples + ms_to_samples(5000); + switch (s->at_state.at_rx_mode) + { + case AT_MODE_ONHOOK_COMMAND: + case AT_MODE_OFFHOOK_COMMAND: + at_interpreter(&s->at_state, t, len); + break; + case AT_MODE_DELIVERY: + /* Data from the DTE in this state returns us to command mode */ + if (len) + { + if (s->at_state.rx_signal_present) + { + s->at_state.rx_data[s->at_state.rx_data_bytes++] = DLE; + s->at_state.rx_data[s->at_state.rx_data_bytes++] = ETX; + s->at_state.at_tx_handler(&s->at_state, s->at_state.at_tx_user_data, s->at_state.rx_data, s->at_state.rx_data_bytes); + } + s->at_state.rx_data_bytes = 0; + s->at_state.transmit = FALSE; + s->modem = FAX_MODEM_SILENCE_TX; + set_rx_handler(s, (span_rx_handler_t *) &span_dummy_rx, (span_rx_fillin_handler_t *) &span_dummy_rx_fillin, NULL); + t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND); + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_OK); + } + break; + case AT_MODE_HDLC: + dle_unstuff_hdlc(s, t, len); + break; + case AT_MODE_STUFFED: + if (s->tx.out_bytes) + { + /* Make room for new data in existing data buffer. */ + s->tx.in_bytes = &(s->tx.data[s->tx.in_bytes]) - &(s->tx.data[s->tx.out_bytes]); + memmove(&(s->tx.data[0]), &(s->tx.data[s->tx.out_bytes]), s->tx.in_bytes); + s->tx.out_bytes = 0; + } + dle_unstuff(s, t, len); + break; + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +static void set_rx_handler(t31_state_t *s, + span_rx_handler_t *rx_handler, + span_rx_fillin_handler_t *fillin_handler, + void *user_data) +{ + s->audio.modems.rx_handler = rx_handler; + s->audio.modems.rx_fillin_handler = fillin_handler; + s->audio.modems.rx_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +static void set_tx_handler(t31_state_t *s, span_tx_handler_t *handler, void *user_data) +{ + s->audio.modems.tx_handler = handler; + s->audio.modems.tx_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +static void set_next_tx_handler(t31_state_t *s, span_tx_handler_t *handler, void *user_data) +{ + s->audio.modems.next_tx_handler = handler; + s->audio.modems.next_tx_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +static int silence_rx(void *user_data, const int16_t amp[], int len) +{ + t31_state_t *s; + + /* Searching for a specified minimum period of silence. */ + s = (t31_state_t *) user_data; + if (s->silence_awaited && s->audio.silence_heard >= s->silence_awaited) + { + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_OK); + t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND); + s->audio.silence_heard = 0; + s->silence_awaited = 0; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int cng_rx(void *user_data, const int16_t amp[], int len) +{ + t31_state_t *s; + + s = (t31_state_t *) user_data; + if (s->call_samples > ms_to_samples(s->at_state.p.s_regs[7]*1000)) + { + /* After calling, S7 has elapsed... no carrier found. */ + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_NO_CARRIER); + restart_modem(s, FAX_MODEM_SILENCE_TX); + at_modem_control(&s->at_state, AT_MODEM_CONTROL_HANGUP, NULL); + t31_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND); + } + else + { + fsk_rx(&(s->audio.modems.v21_rx), amp, len); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int v17_v21_rx(void *user_data, const int16_t amp[], int len) +{ + t31_state_t *t; + fax_modems_state_t *s; + + t = (t31_state_t *) user_data; + s = &t->audio.modems; + v17_rx(&s->v17_rx, amp, len); + if (t->at_state.rx_trained) + { + /* The fast modem has trained, so we no longer need to run the slow + one in parallel. */ + span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.17 (%.2fdBm0)\n", v17_rx_signal_power(&s->v17_rx)); + set_rx_handler(t, (span_rx_handler_t *) &v17_rx, (span_rx_fillin_handler_t *) &v17_rx_fillin, &s->v17_rx); + } + else + { + fsk_rx(&s->v21_rx, amp, len); + if (t->rx_frame_received) + { + /* We have received something, and the fast modem has not trained. We must + be receiving valid V.21 */ + span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); + set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &s->v21_rx); + } + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +static int v17_v21_rx_fillin(void *user_data, int len) +{ + t31_state_t *t; + fax_modems_state_t *s; + + t = (t31_state_t *) user_data; + s = &t->audio.modems; + v17_rx_fillin(&s->v17_rx, len); + fsk_rx_fillin(&s->v21_rx, len); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len) +{ + t31_state_t *t; + fax_modems_state_t *s; + + t = (t31_state_t *) user_data; + s = &t->audio.modems; + v27ter_rx(&s->v27ter_rx, amp, len); + if (t->at_state.rx_trained) + { + /* The fast modem has trained, so we no longer need to run the slow + one in parallel. */ + span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.27ter (%.2fdBm0)\n", v27ter_rx_signal_power(&s->v27ter_rx)); + set_rx_handler(t, (span_rx_handler_t *) &v27ter_rx, (span_rx_fillin_handler_t *) &v27ter_rx_fillin, &s->v27ter_rx); + } + else + { + fsk_rx(&s->v21_rx, amp, len); + if (t->rx_frame_received) + { + /* We have received something, and the fast modem has not trained. We must + be receiving valid V.21 */ + span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); + set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &s->v21_rx); + } + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +static int v27ter_v21_rx_fillin(void *user_data, int len) +{ + t31_state_t *t; + fax_modems_state_t *s; + + t = (t31_state_t *) user_data; + s = &t->audio.modems; + v27ter_rx_fillin(&s->v27ter_rx, len); + fsk_rx_fillin(&s->v21_rx, len); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int v29_v21_rx(void *user_data, const int16_t amp[], int len) +{ + t31_state_t *t; + fax_modems_state_t *s; + + t = (t31_state_t *) user_data; + s = &t->audio.modems; + v29_rx(&s->v29_rx, amp, len); + if (t->at_state.rx_trained) + { + /* The fast modem has trained, so we no longer need to run the slow + one in parallel. */ + span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.29 (%.2fdBm0)\n", v29_rx_signal_power(&s->v29_rx)); + set_rx_handler(t, (span_rx_handler_t *) &v29_rx, (span_rx_fillin_handler_t *) &v29_rx_fillin, &s->v29_rx); + } + else + { + fsk_rx(&s->v21_rx, amp, len); + if (t->rx_frame_received) + { + /* We have received something, and the fast modem has not trained. We must + be receiving valid V.21 */ + span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); + set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &s->v21_rx); + } + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +static int v29_v21_rx_fillin(void *user_data, int len) +{ + t31_state_t *t; + fax_modems_state_t *s; + + t = (t31_state_t *) user_data; + s = &t->audio.modems; + v29_rx_fillin(&s->v29_rx, len); + fsk_rx_fillin(&s->v21_rx, len); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t31_rx(t31_state_t *s, int16_t amp[], int len) +{ + int i; + int32_t power; + + /* Monitor for received silence. Maximum needed detection is AT+FRS=255 (255*10ms). */ + /* We could probably only run this loop if (s->modem == FAX_MODEM_SILENCE_RX), however, + the spec says "when silence has been present on the line for the amount of + time specified". That means some of the silence may have occurred before + the AT+FRS=n command. This condition, however, is not likely to ever be the + case. (AT+FRS=n will usually be issued before the remote goes silent.) */ + for (i = 0; i < len; i++) + { + /* Clean up any DC influence. */ + power = power_meter_update(&(s->audio.rx_power), amp[i] - s->audio.last_sample); + s->audio.last_sample = amp[i]; + if (power > s->audio.silence_threshold_power) + { + s->audio.silence_heard = 0; + } + else + { + if (s->audio.silence_heard <= ms_to_samples(255*10)) + s->audio.silence_heard++; + } + } + + /* Time is determined by counting the samples in audio packets coming in. */ + s->call_samples += len; + + /* In HDLC transmit mode, if 5 seconds elapse without data from the DTE + we must treat this as an error. We return the result ERROR, and change + to command-mode. */ + if (s->dte_data_timeout && s->call_samples > s->dte_data_timeout) + { + t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND); + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_ERROR); + restart_modem(s, FAX_MODEM_SILENCE_TX); + } + + if (!s->at_state.transmit || s->modem == FAX_MODEM_CNG_TONE) + s->audio.modems.rx_handler(s->audio.modems.rx_user_data, amp, len); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t31_rx_fillin(t31_state_t *s, int len) +{ + /* To mitigate the effect of lost packets on a packet network we should + try to sustain the status quo. If there is no receive modem running, keep + things that way. If there is a receive modem running, try to sustain its + operation, without causing a phase hop, or letting its adaptive functions + diverge. */ + /* Time is determined by counting the samples in audio packets coming in. */ + s->call_samples += len; + + /* In HDLC transmit mode, if 5 seconds elapse without data from the DTE + we must treat this as an error. We return the result ERROR, and change + to command-mode. */ + if (s->dte_data_timeout && s->call_samples > s->dte_data_timeout) + { + t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND); + at_put_response_code(&s->at_state, AT_RESPONSE_CODE_ERROR); + restart_modem(s, FAX_MODEM_SILENCE_TX); + } + /* Call the fillin function of the current modem (if there is one). */ + switch (s->modem) + { + case FAX_MODEM_V21_RX: + len = fsk_rx_fillin(&s->audio.modems.v21_rx, len); + break; + case FAX_MODEM_V27TER_RX: + /* TODO: what about FSK in the early stages */ + len = v27ter_rx_fillin(&s->audio.modems.v27ter_rx, len); + break; + case FAX_MODEM_V29_RX: + /* TODO: what about FSK in the early stages */ + len = v29_rx_fillin(&s->audio.modems.v29_rx, len); + break; + case FAX_MODEM_V17_RX: + /* TODO: what about FSK in the early stages */ + len = v17_rx_fillin(&s->audio.modems.v17_rx, len); + break; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int set_next_tx_type(t31_state_t *s) +{ + if (s->audio.next_tx_handler) + { + set_tx_handler(s, s->audio.next_tx_handler, s->audio.next_tx_user_data); + set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + return 0; + } + /* There is nothing else to change to, so use zero length silence */ + silence_gen_alter(&(s->audio.modems.silence_gen), 0); + set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &s->audio.modems.silence_gen); + set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + return -1; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t31_tx(t31_state_t *s, int16_t amp[], int max_len) +{ + int len; + + len = 0; + if (s->at_state.transmit) + { + if ((len = s->audio.modems.tx_handler(s->audio.modems.tx_user_data, amp, max_len)) < max_len) + { + /* Allow for one change of tx handler within a block */ + set_next_tx_type(s); + if ((len += s->audio.modems.tx_handler(s->audio.modems.tx_user_data, amp + len, max_len - len)) < max_len) + front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); + } + } + if (s->audio.modems.transmit_on_idle) + { + /* Pad to the requested length with silence */ + memset(amp + len, 0, (max_len - len)*sizeof(int16_t)); + len = max_len; + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t31_set_transmit_on_idle(t31_state_t *s, int transmit_on_idle) +{ + s->audio.modems.transmit_on_idle = transmit_on_idle; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t31_set_tep_mode(t31_state_t *s, int use_tep) +{ + s->audio.modems.use_tep = use_tep; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t31_set_t38_config(t31_state_t *s, int without_pacing) +{ + if (without_pacing) + { + /* Continuous streaming mode, as used for TPKT over TCP transport */ + /* Inhibit indicator packets */ + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_INDICATOR, 0); + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA, 1); + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA_END, 1); + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_IMAGE_DATA, 1); + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_IMAGE_DATA_END, 1); + s->t38_fe.ms_per_tx_chunk = 0; + } + else + { + /* Paced streaming mode, as used for UDP transports */ + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_INDICATOR, INDICATOR_TX_COUNT); + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA, DATA_TX_COUNT); + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA_END, DATA_END_TX_COUNT); + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_IMAGE_DATA, DATA_TX_COUNT); + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_IMAGE_DATA_END, DATA_END_TX_COUNT); + s->t38_fe.ms_per_tx_chunk = MS_PER_TX_CHUNK; + } + set_octets_per_data_packet(s, 300); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t31_set_mode(t31_state_t *s, int t38_mode) +{ + s->t38_mode = t38_mode; + span_log(&s->logging, SPAN_LOG_FLOW, "Mode set to %d\n", s->t38_mode); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(logging_state_t *) t31_get_logging_state(t31_state_t *s) +{ + return &s->logging; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(t38_core_state_t *) t31_get_t38_core_state(t31_state_t *s) +{ + return &s->t38_fe.t38; +} +/*- End of function --------------------------------------------------------*/ + +static int t31_t38_fe_init(t31_state_t *t, + t38_tx_packet_handler_t *tx_packet_handler, + void *tx_packet_user_data) +{ + t31_t38_front_end_state_t *s; + + s = &t->t38_fe; + + t38_core_init(&s->t38, + process_rx_indicator, + process_rx_data, + process_rx_missing, + (void *) t, + tx_packet_handler, + tx_packet_user_data); + s->t38.fastest_image_data_rate = 14400; + + s->timed_step = T38_TIMED_STEP_NONE; + //s->iaf = T30_IAF_MODE_T37 | T30_IAF_MODE_T38; + s->iaf = T30_IAF_MODE_T38; + + s->current_tx_data_type = T38_DATA_NONE; + s->next_tx_samples = 0; + s->chunking_modes = T38_CHUNKING_ALLOW_TEP_TIME; + + t->hdlc_tx.ptr = 0; + + hdlc_tx_init(&s->hdlc_tx_term, + FALSE, + 1, + FALSE, + NULL, + NULL); + hdlc_rx_init(&s->hdlc_rx_term, + FALSE, + TRUE, + 2, + NULL, + NULL); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(t31_state_t *) t31_init(t31_state_t *s, + at_tx_handler_t *at_tx_handler, + void *at_tx_user_data, + t31_modem_control_handler_t *modem_control_handler, + void *modem_control_user_data, + t38_tx_packet_handler_t *tx_t38_packet_handler, + void *tx_t38_packet_user_data) +{ + int alloced; + + if (at_tx_handler == NULL || modem_control_handler == NULL) + return NULL; + + alloced = FALSE; + if (s == NULL) + { + if ((s = (t31_state_t *) malloc(sizeof (*s))) == NULL) + return NULL; + alloced = TRUE; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "T.31"); + + s->modem_control_handler = modem_control_handler; + s->modem_control_user_data = modem_control_user_data; + fax_modems_init(&s->audio.modems, + FALSE, + hdlc_accept_frame, + hdlc_tx_underflow, + non_ecm_put_bit, + non_ecm_get_bit, + tone_detected, + (void *) s); + power_meter_init(&(s->audio.rx_power), 4); + s->audio.last_sample = 0; + s->audio.silence_threshold_power = power_meter_level_dbm0(-36); + s->at_state.rx_signal_present = FALSE; + s->at_state.rx_trained = FALSE; + + s->at_state.do_hangup = FALSE; + s->at_state.line_ptr = 0; + s->audio.silence_heard = 0; + s->silence_awaited = 0; + s->call_samples = 0; + s->modem = FAX_MODEM_NONE; + s->at_state.transmit = TRUE; + + if ((s->rx_queue = queue_init(NULL, 4096, QUEUE_WRITE_ATOMIC | QUEUE_READ_ATOMIC)) == NULL) + { + if (alloced) + free(s); + return NULL; + } + at_init(&s->at_state, at_tx_handler, at_tx_user_data, t31_modem_control_handler, s); + at_set_class1_handler(&s->at_state, process_class1_cmd, s); + s->at_state.dte_inactivity_timeout = DEFAULT_DTE_TIMEOUT; + if (tx_t38_packet_handler) + { + t31_t38_fe_init(s, + tx_t38_packet_handler, + tx_t38_packet_user_data); + t31_set_t38_config(s, FALSE); + } + s->t38_mode = FALSE; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t31_release(t31_state_t *s) +{ + at_reset_call_info(&s->at_state); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t31_free(t31_state_t *s) +{ + t31_release(s); + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/t35.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/t35.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,910 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t35.c - ITU T.35 FAX non-standard facility processing. + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t35.c,v 1.31 2009/05/16 03:34:45 steveu Exp $ + */ + +/* + * The NSF data tables are adapted from the NSF handling in HylaFAX, which + * carries the following copyright notice: + * + * Created by Dmitry Bely, April 2000 + * Copyright (c) 1994-1996 Sam Leffler + * Copyright (c) 1994-1996 Silicon Graphics, Inc. + * HylaFAX is a trademark of Silicon Graphics + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the names of + * Sam Leffler and Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Sam Leffler and Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/bit_operations.h" +#include "spandsp/t35.h" + +/*! NSF pattern for FAX machine identification */ +typedef struct +{ + /*! The number of bytes of the NSF byte string to match */ + int model_id_size; + /*! The NSF byte string to expect */ + const char *model_id; + /*! The model name of the FAX terminal */ + const char *model_name; +} model_data_t; + +/*! NSF pattern for identifying the manufacturer of a FAX machine */ +typedef struct +{ + /*! The vendor ID byte string */ + const char *vendor_id; + /*! The length of the vendor ID byte string */ + int vendor_id_len; + /*! The vendor's name */ + const char *vendor_name; + /*! TRUE if the station ID for this vendor is reversed */ + int inverse_station_id_order; + /*! A pointer to a list of known models from this vendor */ + const model_data_t *known_models; +} nsf_data_t; + +const char *t35_country_codes[256] = +{ + "Japan", /* 0x00 */ + "Albania", + "Algeria", + "American Samoa", + "Germany", + "Anguilla", + "Antigua and Barbuda", + "Argentina", + "Ascension (see S. Helena)", + "Australia", + "Austria", + "Bahamas", + "Bahrain", + "Bangladesh", + "Barbados", + "Belgium", + "Belize", + "Benin (Republic of)", + "Bermudas", + "Bhutan (Kingdom of)", + "Bolivia", + "Botswana", + "Brazil", + "British Antarctic Territory", + "British Indian Ocean Territory", + "British Virgin Islands", + "Brunei Darussalam", + "Bulgaria", + "Myanmar (Union of)", + "Burundi", + "Byelorussia", + "Cameroon", + "Canada", /* 0x20 */ + "Cape Verde", + "Cayman Islands", + "Central African Republic", + "Chad", + "Chile", + "China", + "Colombia", + "Comoros", + "Congo", + "Cook Islands", + "Costa Rica", + "Cuba", + "Cyprus", + "Czech and Slovak Federal Republic", + "Cambodia", + "Democratic People's Republic of Korea", + "Denmark", + "Djibouti", + "Dominican Republic", + "Dominica", + "Ecuador", + "Egypt", + "El Salvador", + "Equatorial Guinea", + "Ethiopia", + "Falkland Islands", + "Fiji", + "Finland", + "France", + "French Polynesia", + "French Southern and Antarctic Lands", + "Gabon", /* 0x40 */ + "Gambia", + "Germany (Federal Republic of)", + "Angola", + "Ghana", + "Gibraltar", + "Greece", + "Grenada", + "Guam", + "Guatemala", + "Guernsey", + "Guinea", + "Guinea-Bissau", + "Guayana", + "Haiti", + "Honduras", + "Hong Kong", + "Hungary (Republic of)", + "Iceland", + "India", + "Indonesia", + "Iran (Islamic Republic of)", + "Iraq", + "Ireland", + "Israel", + "Italy", + "Cote d'Ivoire", + "Jamaica", + "Afghanistan", + "Jersey", + "Jordan", + "Kenya", + "Kiribati", /* 0x60 */ + "Korea (Republic of)", + "Kuwait", + "Lao (People's Democratic Republic)", + "Lebanon", + "Lesotho", + "Liberia", + "Libya", + "Liechtenstein", + "Luxembourg", + "Macau", + "Madagascar", + "Malaysia", + "Malawi", + "Maldives", + "Mali", + "Malta", + "Mauritania", + "Mauritius", + "Mexico", + "Monaco", + "Mongolia", + "Montserrat", + "Morocco", + "Mozambique", + "Nauru", + "Nepal", + "Netherlands", + "Netherlands Antilles", + "New Caledonia", + "New Zealand", + "Nicaragua", + "Niger", /* 0x80 */ + "Nigeria", + "Norway", + "Oman", + "Pakistan", + "Panama", + "Papua New Guinea", + "Paraguay", + "Peru", + "Philippines", + "Poland (Republic of)", + "Portugal", + "Puerto Rico", + "Qatar", + "Romania", + "Rwanda", + "Saint Kitts and Nevis", + "Saint Croix", + "Saint Helena and Ascension", + "Saint Lucia", + "San Marino", + "Saint Thomas", + "Sao Tome and Principe", + "Saint Vincent and the Grenadines", + "Saudi Arabia", + "Senegal", + "Seychelles", + "Sierra Leone", + "Singapore", + "Solomon Islands", + "Somalia", + "South Africa", + "Spain", /* 0xA0 */ + "Sri Lanka", + "Sudan", + "Suriname", + "Swaziland", + "Sweden", + "Switzerland", + "Syria", + "Tanzania", + "Thailand", + "Togo", + "Tonga", + "Trinidad and Tobago", + "Tunisia", + "Turkey", + "Turks and Caicos Islands", + "Tuvalu", + "Uganda", + "Ukraine", + "United Arab Emirates", + "United Kingdom", + "United States", + "Burkina Faso", + "Uruguay", + "U.S.S.R.", + "Vanuatu", + "Vatican City State", + "Venezuela", + "Viet Nam", + "Wallis and Futuna", + "Western Samoa", + "Yemen (Republic of)", + "Yemen (Republic of)", /* 0xC0 */ + "Yugoslavia", + "Zaire", + "Zambia", + "Zimbabwe" + "Slovakia", + "Slovenia", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", /* 0xD0 */ + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", /* 0xE0 */ + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", /* 0xF0 */ + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "(available)", + "Lithuania", + "Latvia", + "Estonia", + "US Virgin Islands", + "(available)", + "(available)", + "(Universal)", + "Taiwan", + "(extension)" +}; + +static const model_data_t Canon[] = +{ + {5, "\x80\x00\x80\x48\x00", "Faxphone B640"}, + {5, "\x80\x00\x80\x49\x10", "Fax B100"}, + {5, "\x80\x00\x8A\x49\x10", "Laser Class 9000 Series"}, + {0, NULL, NULL} +}; + +static const model_data_t Brother[] = +{ + {9, "\x55\x55\x00\x88\x90\x80\x5F\x00\x15\x51", "Intellifax 770"}, + {9, "\x55\x55\x00\x80\xB0\x80\x00\x00\x59\xD4", "Personal fax 190"}, + {9, "\x55\x55\x00\x8C\x90\x80\xF0\x02\x20", "MFC-8600"}, + {0, NULL, NULL} +}; + +static const model_data_t Panasonic0E[] = +{ + {10, "\x00\x00\x00\x96\x0F\x01\x02\x00\x10\x05\x02\x95\xC8\x08\x01\x49\x02\x41\x53\x54\x47", "KX-F90"}, + {10, "\x00\x00\x00\x96\x0F\x01\x03\x00\x10\x05\x02\x95\xC8\x08\x01\x49\x02 \x03", "KX-F230 or KX-FT21 or ..."}, + {10, "\x00\x00\x00\x16\x0F\x01\x03\x00\x10\x05\x02\x95\xC8\x08", "KX-F780"}, + {10, "\x00\x00\x00\x16\x0F\x01\x03\x00\x10\x00\x02\x95\x80\x08\x75\xB5", "KX-M260"}, + {10, "\x00\x00\x00\x16\x0F\x01\x02\x00\x10\x05\x02\x85\xC8\x08\xAD", "KX-F2050BS"}, + {0, NULL, NULL} +}; + +static const model_data_t Panasonic79[] = +{ + {10, "\x00\x00\x00\x02\x0F\x09\x12\x00\x10\x05\x02\x95\xC8\x88\x80\x80\x01", "UF-S10"}, + {10, "\x00\x00\x00\x16\x7F\x09\x13\x00\x10\x05\x16\x8D\xC0\xD0\xF8\x80\x01", "/Siemens Fax 940"}, + {10, "\x00\x00\x00\x16\x0F\x09\x13\x00\x10\x05\x06\x8D\xC0\x50\xCB", "Panafax UF-321"}, + {0, NULL, NULL} +}; + +static const model_data_t Ricoh[] = +{ + {10, "\x00\x00\x00\x12\x10\x0D\x02\x00\x50\x00\x2A\xB8\x2C", "/Nashuatec P394"}, + {0, NULL, NULL} +}; + +static const model_data_t Samsung16[] = +{ + {4, "\x00\x00\xA4\x01", "M545 6800"}, + {0, NULL, NULL} +}; + +static const model_data_t Samsung5A[] = +{ + {4, "\x00\x00\xC0\x00", "SF-5100"}, + {0, NULL, NULL} +}; + +static const model_data_t Samsung8C[] = +{ + {4, "\x00\x00\x01\x00", "SF-2010"}, + {0, NULL, NULL} +}; + +static const model_data_t SamsungA2[] = +{ + {4, "\x00\x00\x80\x00", "FX-4000"}, + {0, NULL, NULL} +}; + +static const model_data_t Sanyo[] = +{ + {10, "\x00\x00\x10\xB1\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x41\x26\xFF\xFF\x00\x00\x85\xA1", "SFX-107"}, + {10, "\x00\x00\x00\xB1\x12\xF2\x62\xB4\x82\x0A\xF2\x2A\x12\xD2\xA2\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x41\x4E\xFF\xFF\x00\x00", "MFP-510"}, + {0, NULL, NULL} +}; + +static const model_data_t HP[] = +{ + {5, "\x20\x00\x45\x00\x0C\x04\x70\xCD\x4F\x00\x7F\x49", "LaserJet 3150"}, + {5, "\x40\x80\x84\x01\xF0\x6A", "OfficeJet"}, + {5, "\xC0\x00\x00\x00\x00", "OfficeJet 500"}, + {5, "\xC0\x00\x00\x00\x00\x8B", "Fax-920"}, + {0, NULL, NULL} +}; + +static const model_data_t Sharp[] = +{ + {32, "\x00\xCE\xB8\x80\x80\x11\x85\x0D\xDD\x00\x00\xDD\xDD\x00\x00\xDD\xDD\x00\x00\x00\x00\x00\x00\x00\x00\xED\x22\xB0\x00\x00\x90\x00", "Sharp F0-10"}, + {33, "\x00\xCE\xB8\x80\x80\x11\x85\x0D\xDD\x00\x00\xDD\xDD\x00\x00\xDD\xDD\x00\x00\x00\x00\x00\x00\x00\x00\xED\x22\xB0\x00\x00\x90\x00\x8C", "Sharp UX-460"}, + {33, "\x00\x4E\xB8\x80\x80\x11\x84\x0D\xDD\x00\x00\xDD\xDD\x00\x00\xDD\xDD\x00\x00\x00\x00\x00\x00\x00\x00\xED\x22\xB0\x00\x00\x90\x00\xAD", "Sharp UX-177"}, + {33, "\x00\xCE\xB8\x00\x84\x0D\xDD\x00\x00\xDD\xDD\x00\x00\xDD\xDD\xDD\xDD\xDD\x02\x05\x28\x02\x22\x43\x29\xED\x23\x90\x00\x00\x90\x01\x00", "Sharp FO-4810"}, + {0, NULL, NULL} +}; + +static const model_data_t Xerox[] = +{ + {10, "\x00\x08\x2D\x43\x57\x50\x61\x75\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01\x1A\x02\x02\x10\x01\x82\x01\x30\x34", "635 Workcenter"}, + {0, NULL, NULL} +}; + +static const model_data_t XeroxDA[] = +{ + {4, "\x00\x00\xC0\x00", "Workcentre Pro 580"}, + {0, NULL, NULL} +}; + +static const model_data_t Lexmark[] = +{ + {4, "\x00\x80\xA0\x00", "X4270"}, + {0, NULL, NULL} +}; + +static const model_data_t JetFax[] = +{ + {6, "\x01\x00\x45\x00\x0D\x7F", "M910e"}, + {0, NULL, NULL} +}; + +static const model_data_t PitneyBowes[] = +{ + {6, "\x79\x91\xB1\xB8\x7A\xD8", "9550"}, + {0, NULL, NULL} +}; + +static const model_data_t Dialogic[] = +{ + {8, "\x56\x8B\x06\x55\x00\x15\x00\x00", "VFX/40ESC"}, + {0, NULL, NULL} +}; + +static const model_data_t Muratec45[] = +{ + {10, "\xF4\x91\xFF\xFF\xFF\x42\x2A\xBC\x01\x57", "M4700"}, + {0, NULL, NULL} +}; + +/* Muratec uses unregistered Japan code "00 00 48" */ +static const model_data_t Muratec48[] = +{ + {3, "\x53\x53\x61", "M620"}, + {0, NULL, NULL} +}; + +/* + * Country code first byte, then manufacturer is last two bytes. See T.35. + * Apparently Germany issued some manufacturer codes before the two-byte + * standard was accepted, and so some few German manufacturers are + * identified by a single manufacturer byte. + * + * T.30 5.3.6.2.7 (2003) states that the NSF FIF is transmitted + * in MSB2LSB order. Revisions of T.30 prior to 2003 did not + * contain explicit specification as to the transmit bit order. + * (Although it did otherwise state that all HDLC frame data should + * be in MSB order except as noted.) Because CSI, TSI, and other + * prologue frames were in LSB order by way of an exception to the + * general rule (T.30 5.3.6.2.4-11) many manufacturers assumed that + * NSF should also be in LSB order. Consequently there will be + * some country-code "masquerading" as a terminal may use the + * proper country-code, but with an inverted bit order. + * + * Thus, country code x61 (Korea) turns into x86 (Papua New Guinea), + * code xB5 (USA) turns into xAD (Tunisia), code x26 (China) turns + * into x64 (Lebanon), code x04 (Germany) turns into x20 (Canada), + * and code x3D (France) turns into xBC (Vietnam). + * + * For the most part it should be safe to identify a manufacturer + * both with the MSB and LSB ordered bits, as the "masqueraded" country + * is likely to not be actively assigning T.38 manufacturer codes. + * However, some manufacturers (e.g. Microsoft) may use MSB for the + * country code and LSB for the rest of the NSF, and so basically this + * table must be verified and corrected against actual real-world + * results. + */ +static const nsf_data_t known_nsf[] = +{ + /* Japan */ + {"\x00\x00\x00", 3, "Unknown - indeterminate", TRUE, NULL}, + {"\x00\x00\x01", 3, "Anjitsu", FALSE, NULL}, + {"\x00\x00\x02", 3, "Nippon Telephone", FALSE, NULL}, + {"\x00\x00\x05", 3, "Mitsuba Electric", FALSE, NULL}, + {"\x00\x00\x06", 3, "Master Net", FALSE, NULL}, + {"\x00\x00\x09", 3, "Xerox/Toshiba", TRUE, Xerox}, + {"\x00\x00\x0A", 3, "Kokusai", FALSE, NULL}, + {"\x00\x00\x0D", 3, "Logic System International", FALSE, NULL}, + {"\x00\x00\x0E", 3, "Panasonic", FALSE, Panasonic0E}, + {"\x00\x00\x11", 3, "Canon", FALSE, Canon}, + {"\x00\x00\x15", 3, "Toyotsushen Machinery", FALSE, NULL}, + {"\x00\x00\x16", 3, "System House Mind", FALSE, NULL}, + {"\x00\x00\x19", 3, "Xerox", TRUE, NULL}, + {"\x00\x00\x1D", 3, "Hitachi Software", FALSE, NULL}, + {"\x00\x00\x21", 3, "OKI Electric/Lanier", TRUE, NULL}, + {"\x00\x00\x25", 3, "Ricoh", TRUE, Ricoh}, + {"\x00\x00\x26", 3, "Konica", FALSE, NULL}, + {"\x00\x00\x29", 3, "Japan Wireless", FALSE, NULL}, + {"\x00\x00\x2D", 3, "Sony", FALSE, NULL}, + {"\x00\x00\x31", 3, "Sharp/Olivetti", FALSE, Sharp}, + {"\x00\x00\x35", 3, "Kogyu", FALSE, NULL}, + {"\x00\x00\x36", 3, "Japan Telecom", FALSE, NULL}, + {"\x00\x00\x3D", 3, "IBM Japan", FALSE, NULL}, + {"\x00\x00\x39", 3, "Panasonic", FALSE, NULL}, + {"\x00\x00\x41", 3, "Swasaki Communication", FALSE, NULL}, + {"\x00\x00\x45", 3, "Muratec", FALSE, Muratec45}, + {"\x00\x00\x46", 3, "Pheonix", FALSE, NULL}, + {"\x00\x00\x48", 3, "Muratec", FALSE, Muratec48}, // not registered + {"\x00\x00\x49", 3, "Japan Electric", FALSE, NULL}, + {"\x00\x00\x4D", 3, "Okura Electric", FALSE, NULL}, + {"\x00\x00\x51", 3, "Sanyo", FALSE, Sanyo}, + {"\x00\x00\x55", 3, "unknown - Japan 55", FALSE, NULL}, + {"\x00\x00\x56", 3, "Brother", FALSE, Brother}, + {"\x00\x00\x59", 3, "Fujitsu", FALSE, NULL}, + {"\x00\x00\x5D", 3, "Kuoni", FALSE, NULL}, + {"\x00\x00\x61", 3, "Casio", FALSE, NULL}, + {"\x00\x00\x65", 3, "Tateishi Electric", FALSE, NULL}, + {"\x00\x00\x66", 3, "Utax/Mita", TRUE, NULL}, + {"\x00\x00\x69", 3, "Hitachi Production", FALSE, NULL}, + {"\x00\x00\x6D", 3, "Hitachi Telecom", FALSE, NULL}, + {"\x00\x00\x71", 3, "Tamura Electric Works", FALSE, NULL}, + {"\x00\x00\x75", 3, "Tokyo Electric Corp.", FALSE, NULL}, + {"\x00\x00\x76", 3, "Advance", FALSE, NULL}, + {"\x00\x00\x79", 3, "Panasonic", FALSE, Panasonic79}, + {"\x00\x00\x7D", 3, "Seiko", FALSE, NULL}, + {"\x00\x08\x00", 3, "Daiko", FALSE, NULL}, + {"\x00\x10\x00", 3, "Funai Electric", FALSE, NULL}, + {"\x00\x20\x00", 3, "Eagle System", FALSE, NULL}, + {"\x00\x30\x00", 3, "Nippon Business Systems", FALSE, NULL}, + {"\x00\x40\x00", 3, "Comtron", FALSE, NULL}, + {"\x00\x48\x00", 3, "Cosmo Consulting", FALSE, NULL}, + {"\x00\x50\x00", 3, "Orion Electric", FALSE, NULL}, + {"\x00\x60\x00", 3, "Nagano Nippon", FALSE, NULL}, + {"\x00\x70\x00", 3, "Kyocera", FALSE, NULL}, + {"\x00\x80\x00", 3, "Kanda Networks", FALSE, NULL}, + {"\x00\x88\x00", 3, "Soft Front", FALSE, NULL}, + {"\x00\x90\x00", 3, "Arctic", FALSE, NULL}, + {"\x00\xA0\x00", 3, "Nakushima", FALSE, NULL}, + {"\x00\xB0\x00", 3, "Minolta", FALSE, NULL}, + {"\x00\xC0\x00", 3, "Tohoku Pioneer", FALSE, NULL}, + {"\x00\xD0\x00", 3, "USC", FALSE, NULL}, + {"\x00\xE0\x00", 3, "Hiboshi", FALSE, NULL}, + {"\x00\xF0\x00", 3, "Sumitomo Electric", FALSE, NULL}, + + /* Germany */ + {"\x20\x09", 2, "ITK Institut für Telekommunikation GmbH & Co KG", FALSE, NULL}, + {"\x20\x11", 2, "Dr. Neuhaus Mikroelektronik", FALSE, NULL}, + {"\x20\x21", 2, "ITO Communication", FALSE, NULL}, + {"\x20\x31", 2, "mbp Kommunikationssysteme GmbH", FALSE, NULL}, + {"\x20\x41", 2, "Siemens", FALSE, NULL}, + {"\x20\x42", 2, "Deutsche Telekom AG", FALSE, NULL}, + {"\x20\x51", 2, "mps Software", FALSE, NULL}, + {"\x20\x61", 2, "Hauni Elektronik", FALSE, NULL}, + {"\x20\x71", 2, "Digitronic computersysteme gmbh", FALSE, NULL}, + {"\x20\x81\x00", 3, "Innovaphone GmbH", FALSE, NULL}, + {"\x20\x81\x40", 3, "TEDAS Gesellschaft für Telekommunikations-, Daten- und Audiosysteme mbH", FALSE, NULL}, + {"\x20\x81\x80", 3, "AVM Audiovisuelles Marketing und Computersysteme GmbH", FALSE, NULL}, + {"\x20\x81\xC0", 3, "EICON Technology Research GmbH", FALSE, NULL}, + {"\x20\xB1", 2, "Schneider Rundfunkwerke AG", FALSE, NULL}, + {"\x20\xC2", 2, "Deutsche Telekom AG", FALSE, NULL}, + {"\x20\xD1", 2, "Ferrari electronik GmbH", FALSE, NULL}, + {"\x20\xF1", 2, "DeTeWe - Deutsche Telephonwerke AG & Co", FALSE, NULL}, + {"\x20\xFF", 2, "Germany Regional Code", FALSE, NULL}, + + /* China */ + {"\x64\x00\x00", 3, "unknown - China 00 00", FALSE, NULL}, + {"\x64\x01\x00", 3, "unknown - China 01 00", FALSE, NULL}, + {"\x64\x01\x01", 3, "unknown - China 01 01", FALSE, NULL}, + {"\x64\x01\x02", 3, "unknown - China 01 02", FALSE, NULL}, + + /* France */ + {"\xBC\x53\x01", 3, "Minolta", FALSE, NULL}, + + /* Korea */ + {"\x86\x00\x02", 3, "unknown - Korea 02", FALSE, NULL}, + {"\x86\x00\x06", 3, "unknown - Korea 06", FALSE, NULL}, + {"\x86\x00\x08", 3, "unknown - Korea 08", FALSE, NULL}, + {"\x86\x00\x0A", 3, "unknown - Korea 0A", FALSE, NULL}, + {"\x86\x00\x0E", 3, "unknown - Korea 0E", FALSE, NULL}, + {"\x86\x00\x10", 3, "Samsung", FALSE, NULL}, + {"\x86\x00\x11", 3, "unknown - Korea 11", FALSE, NULL}, + {"\x86\x00\x16", 3, "Samsung", FALSE, Samsung16}, + {"\x86\x00\x1A", 3, "unknown - Korea 1A", FALSE, NULL}, + {"\x86\x00\x40", 3, "unknown - Korea 40", FALSE, NULL}, + {"\x86\x00\x48", 3, "unknown - Korea 48", FALSE, NULL}, + {"\x86\x00\x52", 3, "unknown - Korea 52", FALSE, NULL}, + {"\x86\x00\x5A", 3, "Samsung", FALSE, Samsung5A}, + {"\x86\x00\x5E", 3, "unknown - Korea 5E", FALSE, NULL}, + {"\x86\x00\x66", 3, "unknown - Korea 66", FALSE, NULL}, + {"\x86\x00\x6E", 3, "unknown - Korea 6E", FALSE, NULL}, + {"\x86\x00\x82", 3, "unknown - Korea 82", FALSE, NULL}, + {"\x86\x00\x88", 3, "unknown - Korea 88", FALSE, NULL}, + {"\x86\x00\x8A", 3, "unknown - Korea 8A", FALSE, NULL}, + {"\x86\x00\x8C", 3, "Samsung", FALSE, Samsung8C}, + {"\x86\x00\x92", 3, "unknown - Korea 92", FALSE, NULL}, + {"\x86\x00\x98", 3, "Samsung", FALSE, NULL}, + {"\x86\x00\xA2", 3, "Samsung", FALSE, SamsungA2}, + {"\x86\x00\xA4", 3, "unknown - Korea A4", FALSE, NULL}, + {"\x86\x00\xC2", 3, "Samsung", FALSE, NULL}, + {"\x86\x00\xC9", 3, "unknown - Korea C9", FALSE, NULL}, + {"\x86\x00\xCC", 3, "unknown - Korea CC", FALSE, NULL}, + {"\x86\x00\xD2", 3, "unknown - Korea D2", FALSE, NULL}, + {"\x86\x00\xDA", 3, "Xerox", FALSE, XeroxDA}, + {"\x86\x00\xE2", 3, "unknown - Korea E2", FALSE, NULL}, + {"\x86\x00\xEC", 3, "unknown - Korea EC", FALSE, NULL}, + {"\x86\x00\xEE", 3, "unknown - Korea EE", FALSE, NULL}, + + /* United Kingdom */ + {"\xB4\x00\xB0", 3, "DCE", FALSE, NULL}, + {"\xB4\x00\xB1", 3, "Hasler", FALSE, NULL}, + {"\xB4\x00\xB2", 3, "Interquad", FALSE, NULL}, + {"\xB4\x00\xB3", 3, "Comwave", FALSE, NULL}, + {"\xB4\x00\xB4", 3, "Iconographic", FALSE, NULL}, + {"\xB4\x00\xB5", 3, "Wordcraft", FALSE, NULL}, + {"\xB4\x00\xB6", 3, "Acorn", FALSE, NULL}, + + /* United States */ + {"\xAD\x00\x00", 3, "Pitney Bowes", FALSE, PitneyBowes}, + {"\xAD\x00\x0C", 3, "Dialogic", FALSE, NULL}, + {"\xAD\x00\x15", 3, "Lexmark", FALSE, Lexmark}, + {"\xAD\x00\x16", 3, "JetFax", FALSE, JetFax}, + {"\xAD\x00\x24", 3, "Octel", FALSE, NULL}, + {"\xAD\x00\x36", 3, "HP", FALSE, HP}, + {"\xAD\x00\x42", 3, "FaxTalk", FALSE, NULL}, + {"\xAD\x00\x44", 3, NULL, TRUE, NULL}, + {"\xAD\x00\x46", 3, "BrookTrout", FALSE, NULL}, + {"\xAD\x00\x51", 3, "Telogy Networks", FALSE, NULL}, + {"\xAD\x00\x55", 3, "HylaFAX", FALSE, NULL}, + {"\xAD\x00\x5C", 3, "IBM", FALSE, NULL}, + {"\xAD\x00\x98", 3, "unknown - USA 98", TRUE, NULL}, + {"\xB5\x00\x01", 3, "Picturetel", FALSE, NULL}, + {"\xB5\x00\x20", 3, "Conexant", FALSE, NULL}, + {"\xB5\x00\x22", 3, "Comsat", FALSE, NULL}, + {"\xB5\x00\x24", 3, "Octel", FALSE, NULL}, + {"\xB5\x00\x26", 3, "ROLM", FALSE, NULL}, + {"\xB5\x00\x28", 3, "SOFNET", FALSE, NULL}, + {"\xB5\x00\x29", 3, "TIA TR-29 Committee", FALSE, NULL}, + {"\xB5\x00\x2A", 3, "STF Tech", FALSE, NULL}, + {"\xB5\x00\x2C", 3, "HKB", FALSE, NULL}, + {"\xB5\x00\x2E", 3, "Delrina", FALSE, NULL}, + {"\xB5\x00\x30", 3, "Dialogic", FALSE, NULL}, + {"\xB5\x00\x32", 3, "Applied Synergy", FALSE, NULL}, + {"\xB5\x00\x34", 3, "Syncro Development", FALSE, NULL}, + {"\xB5\x00\x36", 3, "Genoa", FALSE, NULL}, + {"\xB5\x00\x38", 3, "Texas Instruments", FALSE, NULL}, + {"\xB5\x00\x3A", 3, "IBM", FALSE, NULL}, + {"\xB5\x00\x3C", 3, "ViaSat", FALSE, NULL}, + {"\xB5\x00\x3E", 3, "Ericsson", FALSE, NULL}, + {"\xB5\x00\x42", 3, "Bogosian", FALSE, NULL}, + {"\xB5\x00\x44", 3, "Adobe", FALSE, NULL}, + {"\xB5\x00\x46", 3, "Fremont Communications", FALSE, NULL}, + {"\xB5\x00\x48", 3, "Hayes", FALSE, NULL}, + {"\xB5\x00\x4A", 3, "Lucent", FALSE, NULL}, + {"\xB5\x00\x4C", 3, "Data Race", FALSE, NULL}, + {"\xB5\x00\x4E", 3, "TRW", FALSE, NULL}, + {"\xB5\x00\x52", 3, "Audiofax", FALSE, NULL}, + {"\xB5\x00\x54", 3, "Computer Automation", FALSE, NULL}, + {"\xB5\x00\x56", 3, "Serca", FALSE, NULL}, + {"\xB5\x00\x58", 3, "Octocom", FALSE, NULL}, + {"\xB5\x00\x5C", 3, "Power Solutions", FALSE, NULL}, + {"\xB5\x00\x5A", 3, "Digital Sound", FALSE, NULL}, + {"\xB5\x00\x5E", 3, "Pacific Data", FALSE, NULL}, + {"\xB5\x00\x60", 3, "Commetrex", FALSE, NULL}, + {"\xB5\x00\x62", 3, "BrookTrout", FALSE, NULL}, + {"\xB5\x00\x64", 3, "Gammalink", FALSE, NULL}, + {"\xB5\x00\x66", 3, "Castelle", FALSE, NULL}, + {"\xB5\x00\x68", 3, "Hybrid Fax", FALSE, NULL}, + {"\xB5\x00\x6A", 3, "Omnifax", FALSE, NULL}, + {"\xB5\x00\x6C", 3, "HP", FALSE, NULL}, + {"\xB5\x00\x6E", 3, "Microsoft", FALSE, NULL}, + {"\xB5\x00\x72", 3, "Speaking Devices", FALSE, NULL}, + {"\xB5\x00\x74", 3, "Compaq", FALSE, NULL}, +/* + {"\xB5\x00\x76", 3, "Trust - Cryptek", FALSE, NULL}, // collision with Microsoft +*/ + {"\xB5\x00\x76", 3, "Microsoft", FALSE, NULL}, // uses LSB for country but MSB for manufacturer + {"\xB5\x00\x78", 3, "Cylink", FALSE, NULL}, + {"\xB5\x00\x7A", 3, "Pitney Bowes", FALSE, NULL}, + {"\xB5\x00\x7C", 3, "Digiboard", FALSE, NULL}, + {"\xB5\x00\x7E", 3, "Codex", FALSE, NULL}, + {"\xB5\x00\x82", 3, "Wang Labs", FALSE, NULL}, + {"\xB5\x00\x84", 3, "Netexpress Communications", FALSE, NULL}, + {"\xB5\x00\x86", 3, "Cable-Sat", FALSE, NULL}, + {"\xB5\x00\x88", 3, "MFPA", FALSE, NULL}, + {"\xB5\x00\x8A", 3, "Telogy Networks", FALSE, NULL}, + {"\xB5\x00\x8E", 3, "Telecom Multimedia Systems", FALSE, NULL}, + {"\xB5\x00\x8C", 3, "AT&T", FALSE, NULL}, + {"\xB5\x00\x92", 3, "Nuera", FALSE, NULL}, + {"\xB5\x00\x94", 3, "K56flex", FALSE, NULL}, + {"\xB5\x00\x96", 3, "MiBridge", FALSE, NULL}, + {"\xB5\x00\x98", 3, "Xerox", FALSE, NULL}, + {"\xB5\x00\x9A", 3, "Fujitsu", FALSE, NULL}, + {"\xB5\x00\x9B", 3, "Fujitsu", FALSE, NULL}, + {"\xB5\x00\x9C", 3, "Natural Microsystems", FALSE, NULL}, + {"\xB5\x00\x9E", 3, "CopyTele", FALSE, NULL}, + {"\xB5\x00\xA2", 3, "Murata", FALSE, NULL}, + {"\xB5\x00\xA4", 3, "Lanier", FALSE, NULL}, + {"\xB5\x00\xA6", 3, "Qualcomm", FALSE, NULL}, + {"\xB5\x00\xAA", 3, "HylaFAX", FALSE, NULL}, // we did it backwards for a while + {NULL, 0, NULL, FALSE, NULL} +}; + +#if 0 +SPAN_DECLARE(void) nsf_find_station_id(int reverse_order) +{ + const char *id = NULL; + int idSize = 0; + const char *maxId = NULL; + int maxIdSize = 0; + const char *p; + + /* Trying to find the longest printable ASCII sequence */ + for (p = (const char *) nsf + T35_VENDOR_ID_LEN, *end = p + nsf.length(); + p < end; + p++) + { + if (isprint(*p)) + { + if (!idSize++) + id = p; + if (idSize > maxIdSize) + { + max_id = id; + max_id_size = idSize; + } + } + else + { + id = NULL; + id_size = 0; + } + } + + /* Minimum acceptable id length */ + const int MinIdSize = 4; + + if (maxIdSize >= min_id_size) + { + stationId.resize(0); + const char *p; + int dir; + + if (reverseOrder) + { + p = maxId + maxIdSize - 1; + dir = -1; + } + else + { + p = maxId; + dir = 1; + } + for (int i = 0; i < maxIdSize; i++) + { + stationId.append(*p); + p += dir; + } + station_id_decoded = TRUE; + } +} +/*- End of function --------------------------------------------------------*/ +#endif + +SPAN_DECLARE(int) t35_decode(const uint8_t *msg, int len, const char **country, const char **vendor, const char **model) +{ + int vendor_decoded; + const nsf_data_t *p; + const model_data_t *pp; + + vendor_decoded = FALSE; + if (country) + *country = NULL; + if (vendor) + *vendor = NULL; + if (model) + *model = NULL; + if (country) + { + /* We need to apply realism over accuracy, though it blocks out some countries. + It is very rare to find a machine from any country but the following: + + Japan 0x00 (no confusion) + Germany 0x04 (0x20) (Canada/Germany confusion) + China 0x26 (0x64) (China/Lebanon confusion) + Korea 0x61 (0x86) (Korea/Papua New Guinea confusion) + UK 0xB4 (0x2D) (UK/Cyprus confusion) + USA 0xB5 (0xAD) (USA/Tunisia confusion) + France 0x3D (0xBC) (France/Vietnam confusion) + + If we force the most likely of the two possible countries (forward or bit reversed), + the only mixup with any realistic probability is the Canada/Germany confusion. We + will just live with this, and force the more likely countries. */ + switch (msg[0]) + { + case 0x20: + /* Force Germany */ + *country = t35_country_codes[0x04]; + break; + case 0x64: + /* Force China */ + *country = t35_country_codes[0x26]; + break; + case 0x86: + /* Force Korea */ + *country = t35_country_codes[0x61]; + break; + case 0x2D: + /* Force UK */ + *country = t35_country_codes[0xB4]; + break; + case 0xAD: + /* Force USA */ + *country = t35_country_codes[0xB5]; + break; + case 0xBC: + /* Force France */ + *country = t35_country_codes[0x3D]; + break; + default: + /* Try the country code at face value, then bit reversed */ + if (t35_country_codes[msg[0]]) + *country = t35_country_codes[msg[0]]; + else if (t35_country_codes[bit_reverse8(msg[0])]) + *country = t35_country_codes[bit_reverse8(msg[0])]; + break; + } + } + for (p = known_nsf; p->vendor_id; p++) + { + if (len >= p->vendor_id_len + && + memcmp(p->vendor_id, msg, p->vendor_id_len) == 0) + { + if (p->vendor_name && vendor) + *vendor = p->vendor_name; + if (p->known_models && model) + { + for (pp = p->known_models; pp->model_id; pp++) + { + if (len == p->vendor_id_len + pp->model_id_size + && + memcmp(pp->model_id, &msg[p->vendor_id_len], pp->model_id_size) == 0) + { + *model = pp->model_name; + break; + } + } + } +#if 0 + findStationId(p->inverse_station_id_order); +#endif + vendor_decoded = TRUE; + break; + } + } +#if 0 + if (!vendor_found()) + find_station_id(0); +#endif + return vendor_decoded; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/t38_core.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/t38_core.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1012 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t38_core.c - Encode and decode the ASN.1 of a T.38 IFP message + * + * Written by Steve Underwood + * + * Copyright (C) 2005, 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t38_core.c,v 1.54 2009/10/09 14:53:57 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/bit_operations.h" +#include "spandsp/t38_core.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/t38_core.h" + +#define ACCEPTABLE_SEQ_NO_OFFSET 2000 + +/* The times for training, the optional TEP, and the HDLC preamble, for all the modem options, in ms. + Note that the preamble for V.21 is 1s+-15%, and for the other modems is 200ms+100ms. */ +static const struct +{ + int tep; + int training; + int flags; +} modem_startup_time[] = +{ + { 0, 75000, 0}, /* T38_IND_NO_SIGNAL */ + { 0, 0, 0}, /* T38_IND_CNG */ + { 0, 3000000, 0}, /* T38_IND_CED */ + { 0, 0, 1000000}, /* T38_IND_V21_PREAMBLE */ /* TODO: 850ms should be OK for this, but it causes trouble with some ATAs. Why? */ + { 215000, 943000, 200000}, /* T38_IND_V27TER_2400_TRAINING */ + { 215000, 708000, 200000}, /* T38_IND_V27TER_4800_TRAINING */ + { 215000, 234000, 200000}, /* T38_IND_V29_7200_TRAINING */ + { 215000, 234000, 200000}, /* T38_IND_V29_9600_TRAINING */ + { 215000, 142000, 200000}, /* T38_IND_V17_7200_SHORT_TRAINING */ + { 215000, 1393000, 200000}, /* T38_IND_V17_7200_LONG_TRAINING */ + { 215000, 142000, 200000}, /* T38_IND_V17_9600_SHORT_TRAINING */ + { 215000, 1393000, 200000}, /* T38_IND_V17_9600_LONG_TRAINING */ + { 215000, 142000, 200000}, /* T38_IND_V17_12000_SHORT_TRAINING */ + { 215000, 1393000, 200000}, /* T38_IND_V17_12000_LONG_TRAINING */ + { 215000, 142000, 200000}, /* T38_IND_V17_14400_SHORT_TRAINING */ + { 215000, 1393000, 200000}, /* T38_IND_V17_14400_LONG_TRAINING */ + { 215000, 0, 0}, /* T38_IND_V8_ANSAM */ + { 215000, 0, 0}, /* T38_IND_V8_SIGNAL */ + { 215000, 0, 0}, /* T38_IND_V34_CNTL_CHANNEL_1200 */ + { 215000, 0, 0}, /* T38_IND_V34_PRI_CHANNEL */ + { 215000, 0, 0}, /* T38_IND_V34_CC_RETRAIN */ + { 215000, 0, 0}, /* T38_IND_V33_12000_TRAINING */ + { 215000, 0, 0} /* T38_IND_V33_14400_TRAINING */ +}; + +SPAN_DECLARE(const char *) t38_indicator_to_str(int indicator) +{ + switch (indicator) + { + case T38_IND_NO_SIGNAL: + return "no-signal"; + case T38_IND_CNG: + return "cng"; + case T38_IND_CED: + return "ced"; + case T38_IND_V21_PREAMBLE: + return "v21-preamble"; + case T38_IND_V27TER_2400_TRAINING: + return "v27-2400-training"; + case T38_IND_V27TER_4800_TRAINING: + return "v27-4800-training"; + case T38_IND_V29_7200_TRAINING: + return "v29-7200-training"; + case T38_IND_V29_9600_TRAINING: + return "v29-9600-training"; + case T38_IND_V17_7200_SHORT_TRAINING: + return "v17-7200-short-training"; + case T38_IND_V17_7200_LONG_TRAINING: + return "v17-7200-long-training"; + case T38_IND_V17_9600_SHORT_TRAINING: + return "v17-9600-short-training"; + case T38_IND_V17_9600_LONG_TRAINING: + return "v17-9600-long-training"; + case T38_IND_V17_12000_SHORT_TRAINING: + return "v17-12000-short-training"; + case T38_IND_V17_12000_LONG_TRAINING: + return "v17-12000-long-training"; + case T38_IND_V17_14400_SHORT_TRAINING: + return "v17-14400-short-training"; + case T38_IND_V17_14400_LONG_TRAINING: + return "v17-14400-long-training"; + case T38_IND_V8_ANSAM: + return "v8-ansam"; + case T38_IND_V8_SIGNAL: + return "v8-signal"; + case T38_IND_V34_CNTL_CHANNEL_1200: + return "v34-cntl-channel-1200"; + case T38_IND_V34_PRI_CHANNEL: + return "v34-pri-channel"; + case T38_IND_V34_CC_RETRAIN: + return "v34-CC-retrain"; + case T38_IND_V33_12000_TRAINING: + return "v33-12000-training"; + case T38_IND_V33_14400_TRAINING: + return "v33-14400-training"; + } + return "???"; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) t38_data_type_to_str(int data_type) +{ + switch (data_type) + { + case T38_DATA_V21: + return "v21"; + case T38_DATA_V27TER_2400: + return "v27-2400"; + case T38_DATA_V27TER_4800: + return "v27-4800"; + case T38_DATA_V29_7200: + return "v29-7200"; + case T38_DATA_V29_9600: + return "v29-9600"; + case T38_DATA_V17_7200: + return "v17-7200"; + case T38_DATA_V17_9600: + return "v17-9600"; + case T38_DATA_V17_12000: + return "v17-12000"; + case T38_DATA_V17_14400: + return "v17-14400"; + case T38_DATA_V8: + return "v8"; + case T38_DATA_V34_PRI_RATE: + return "v34-pri-rate"; + case T38_DATA_V34_CC_1200: + return "v34-CC-1200"; + case T38_DATA_V34_PRI_CH: + return "v34-pri-vh"; + case T38_DATA_V33_12000: + return "v33-12000"; + case T38_DATA_V33_14400: + return "v33-14400"; + } + return "???"; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) t38_field_type_to_str(int field_type) +{ + switch (field_type) + { + case T38_FIELD_HDLC_DATA: + return "hdlc-data"; + case T38_FIELD_HDLC_SIG_END: + return "hdlc-sig-end"; + case T38_FIELD_HDLC_FCS_OK: + return "hdlc-fcs-OK"; + case T38_FIELD_HDLC_FCS_BAD: + return "hdlc-fcs-BAD"; + case T38_FIELD_HDLC_FCS_OK_SIG_END: + return "hdlc-fcs-OK-sig-end"; + case T38_FIELD_HDLC_FCS_BAD_SIG_END: + return "hdlc-fcs-BAD-sig-end"; + case T38_FIELD_T4_NON_ECM_DATA: + return "t4-non-ecm-data"; + case T38_FIELD_T4_NON_ECM_SIG_END: + return "t4-non-ecm-sig-end"; + case T38_FIELD_CM_MESSAGE: + return "cm-message"; + case T38_FIELD_JM_MESSAGE: + return "jm-message"; + case T38_FIELD_CI_MESSAGE: + return "ci-message"; + case T38_FIELD_V34RATE: + return "v34rate"; + } + return "???"; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) t38_cm_profile_to_str(int profile) +{ + switch (profile) + { + case '1': + return "G3 FAX sending terminal"; + case '2': + return "G3 FAX receiving terminal"; + case '3': + return "V.34 HDX and G3 FAX sending terminal"; + case '4': + return "V.34 HDX and G3 FAX receiving terminal"; + case '5': + return "V.34 HDX-only FAX sending terminal"; + case '6': + return "V.34 HDX-only FAX receiving terminal"; + } + return "???"; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) t38_jm_to_str(const uint8_t *data, int len) +{ + if (len < 2) + return "???"; + switch (data[0]) + { + case 'A': + switch (data[1]) + { + case '0': + return "ACK"; + } + break; + case 'N': + switch (data[1]) + { + case '0': + return "NACK: No compatible mode available"; + case '1': + /* Response for profiles 1 and 2 */ + return "NACK: No V.34 FAX, use G3 FAX"; + case '2': + /* Response for profiles 5 and 6 */ + return "NACK: V.34 only FAX."; + } + break; + } + return "???"; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t38_v34rate_to_bps(const uint8_t *data, int len) +{ + int i; + int rate; + + if (len < 3) + return -1; + for (i = 0, rate = 0; i < 3; i++) + { + if (data[i] < '0' || data[i] > '9') + return -1; + rate = rate*10 + data[i] - '0'; + } + return rate*100; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int classify_seq_no_offset(int expected, int actual) +{ + /* Classify the mismatch between expected and actual sequence numbers + according to whether the actual is a little in the past (late), a + little in the future (some packets have been lost), or a large jump + that represents the sequence being lost (possibly when some RTP + gets dumped to a UDPTL port). */ + /* This assumes they are not equal */ + if (expected > actual) + { + if (expected > actual + 0x10000 - ACCEPTABLE_SEQ_NO_OFFSET) + { + /* In the near future */ + return 1; + } + if (expected < actual + ACCEPTABLE_SEQ_NO_OFFSET) + { + /* In the recent past */ + return -1; + } + } + else + { + if (expected + ACCEPTABLE_SEQ_NO_OFFSET > actual) + { + /* In the near future */ + return 1; + } + if (expected + 0x10000 - ACCEPTABLE_SEQ_NO_OFFSET < actual) + { + /* In the recent past */ + return -1; + } + } + /* There has been a huge step in the sequence */ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t38_core_rx_ifp_packet(t38_core_state_t *s, const uint8_t *buf, int len, uint16_t seq_no) +{ + int i; + int t30_indicator; + int t30_data; + int ptr; + int other_half; + int numocts; + int log_seq_no; + const uint8_t *msg; + unsigned int count; + unsigned int t30_field_type; + uint8_t type; + uint8_t data_field_present; + uint8_t field_data_present; + char tag[20]; + + log_seq_no = (s->check_sequence_numbers) ? seq_no : s->rx_expected_seq_no; + + if (span_log_test(&s->logging, SPAN_LOG_FLOW)) + { + sprintf(tag, "Rx %5d: IFP", log_seq_no); + span_log_buf(&s->logging, SPAN_LOG_FLOW, tag, buf, len); + } + if (len < 1) + { + span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Rx %5d: Bad packet length - %d\n", log_seq_no, len); + return -1; + } + if (s->check_sequence_numbers) + { + seq_no &= 0xFFFF; + if (seq_no != s->rx_expected_seq_no) + { + /* An expected value of -1 indicates this is the first received packet, and will accept + anything for that. We can't assume they will start from zero, even though they should. */ + if (s->rx_expected_seq_no != -1) + { + /* We have a packet with a serial number that is not in sequence. The cause could be: + - 1. a repeat copy of a recent packet. Many T.38 implementations can preduce quite a lot of these. + - 2. a late packet, whose point in the sequence we have already passed. + - 3. the result of a hop in the sequence numbers cause by something weird from the other + end. Stream switching might cause this + - 4. missing packets. + + In cases 1 and 2 we need to drop this packet. In case 2 it might make sense to try to do + something with it in the terminal case. Currently we don't. For gateway operation it will be + too late to do anything useful. + */ + if (((seq_no + 1) & 0xFFFF) == s->rx_expected_seq_no) + { + /* Assume this is truly a repeat packet, and don't bother checking its contents. */ + span_log(&s->logging, SPAN_LOG_FLOW, "Rx %5d: Repeat packet number\n", log_seq_no); + return 0; + } + /* Distinguish between a little bit out of sequence, and a huge hop. */ + switch (classify_seq_no_offset(s->rx_expected_seq_no, seq_no)) + { + case -1: + /* This packet is in the near past, so its late. */ + span_log(&s->logging, SPAN_LOG_FLOW, "Rx %5d: Late packet - expected %d\n", log_seq_no, s->rx_expected_seq_no); + return 0; + case 1: + /* This packet is in the near future, so some packets have been lost */ + span_log(&s->logging, SPAN_LOG_FLOW, "Rx %5d: Missing from %d\n", log_seq_no, s->rx_expected_seq_no); + s->rx_missing_handler(s, s->rx_user_data, s->rx_expected_seq_no, seq_no); + s->missing_packets += (seq_no - s->rx_expected_seq_no); + break; + default: + /* The sequence has jumped wildly */ + span_log(&s->logging, SPAN_LOG_FLOW, "Rx %5d: Sequence restart\n", log_seq_no); + s->rx_missing_handler(s, s->rx_user_data, -1, -1); + s->missing_packets++; + break; + } + } + s->rx_expected_seq_no = seq_no; + } + } + /* The sequence numbering is defined as rolling from 0xFFFF to 0x0000. Some implementations + of T.38 roll from 0xFFFF to 0x0001. Isn't standardisation a wonderful thing? The T.38 + document specifies only a small fraction of what it should, yet then they actually nail + something properly, people ignore it. Developers in this industry truly deserves the **** + **** **** **** **** **** documents they have to live with. Anyway, when the far end has a + broken rollover behaviour we will get a hiccup at the rollover point. Don't worry too + much. We will just treat the message in progress as one with some missing data. With any + luck a retry will ride over the problem. Rollovers don't occur that often. It takes quite + a few FAX pages to reach rollover. */ + s->rx_expected_seq_no = (s->rx_expected_seq_no + 1) & 0xFFFF; + data_field_present = (buf[0] >> 7) & 1; + type = (buf[0] >> 6) & 1; + ptr = 0; + switch (type) + { + case T38_TYPE_OF_MSG_T30_INDICATOR: + /* Indicators should never have a data field */ + if (data_field_present) + { + span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Rx %5d: Data field with indicator\n", log_seq_no); + return -1; + } + /* Any received indicator should mean we no longer have a valid concept of "last received data/field type". */ + s->current_rx_data_type = -1; + s->current_rx_field_type = -1; + if ((buf[0] & 0x20)) + { + /* Extension */ + if (len != 2) + { + span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Rx %5d: Invalid length for indicator (A)\n", log_seq_no); + return -1; + } + t30_indicator = T38_IND_V8_ANSAM + (((buf[0] << 2) & 0x3C) | ((buf[1] >> 6) & 0x3)); + if (t30_indicator > T38_IND_V33_14400_TRAINING) + { + span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Rx %5d: Unknown indicator - %d\n", log_seq_no, t30_indicator); + return -1; + } + } + else + { + if (len != 1) + { + span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Rx %5d: Invalid length for indicator (B)\n", log_seq_no); + return -1; + } + t30_indicator = (buf[0] >> 1) & 0xF; + } + span_log(&s->logging, SPAN_LOG_FLOW, "Rx %5d: indicator %s\n", log_seq_no, t38_indicator_to_str(t30_indicator)); + s->rx_indicator_handler(s, s->rx_user_data, t30_indicator); + /* This must come after the indicator handler, so the handler routine sees the existing state of the + indicator. */ + s->current_rx_indicator = t30_indicator; + break; + case T38_TYPE_OF_MSG_T30_DATA: + if ((buf[0] & 0x20)) + { + /* Extension */ + if (len < 2) + { + span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Rx %5d: Invalid length for data (A)\n", log_seq_no); + return -1; + } + t30_data = T38_DATA_V8 + (((buf[0] << 2) & 0x3C) | ((buf[1] >> 6) & 0x3)); + if (t30_data > T38_DATA_V33_14400) + { + span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Rx %5d: Unknown data type - %d\n", log_seq_no, t30_data); + return -1; + } + ptr = 2; + } + else + { + t30_data = (buf[0] >> 1) & 0xF; + if (t30_data > T38_DATA_V17_14400) + { + span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Rx %5d: Unknown data type - %d\n", log_seq_no, t30_data); + return -1; + } + ptr = 1; + } + if (!data_field_present) + { + /* This is kinda weird, but I guess if the length checks out we accept it. */ + span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Rx %5d: Data type with no data field\n", log_seq_no); + if (ptr != len) + { + span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Rx %5d: Invalid length for data (B)\n", log_seq_no); + return -1; + } + break; + } + if (ptr >= len) + { + span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Rx %5d: Invalid length for data (C)\n", log_seq_no); + return -1; + } + count = buf[ptr++]; + //printf("Count is %d\n", count); + other_half = FALSE; + t30_field_type = 0; + for (i = 0; i < (int) count; i++) + { + if (ptr >= len) + { + span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Rx %5d: Invalid length for data (D)\n", log_seq_no); + return -1; + } + if (s->t38_version == 0) + { + /* The original version of T.38 with a typo in the ASN.1 spec. */ + if (other_half) + { + /* The lack of a data field in the previous message means + we are currently in the middle of an octet. */ + field_data_present = (buf[ptr] >> 3) & 1; + /* Decode field_type */ + t30_field_type = buf[ptr] & 0x7; + ptr++; + other_half = FALSE; + } + else + { + field_data_present = (buf[ptr] >> 7) & 1; + /* Decode field_type */ + t30_field_type = (buf[ptr] >> 4) & 0x7; + if (field_data_present) + ptr++; + else + other_half = TRUE; + } + if (t30_field_type > T38_FIELD_T4_NON_ECM_SIG_END) + { + span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Rx %5d: Unknown field type - %d\n", log_seq_no, t30_field_type); + return -1; + } + } + else + { + field_data_present = (buf[ptr] >> 7) & 1; + /* Decode field_type */ + if ((buf[ptr] & 0x40)) + { + if (ptr > len - 2) + { + span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Rx %5d: Invalid length for data (E)\n", log_seq_no); + return -1; + } + t30_field_type = T38_FIELD_CM_MESSAGE + (((buf[ptr] << 2) & 0x3C) | ((buf[ptr + 1] >> 6) & 0x3)); + if (t30_field_type > T38_FIELD_V34RATE) + { + span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Rx %5d: Unknown field type - %d\n", log_seq_no, t30_field_type); + return -1; + } + ptr += 2; + } + else + { + t30_field_type = (buf[ptr++] >> 3) & 0x7; + } + } + /* Decode field_data */ + if (field_data_present) + { + if (ptr > len - 2) + { + span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Rx %5d: Invalid length for data (F)\n", log_seq_no); + return -1; + } + numocts = ((buf[ptr] << 8) | buf[ptr + 1]) + 1; + msg = buf + ptr + 2; + ptr += numocts + 2; + } + else + { + numocts = 0; + msg = NULL; + } + if (ptr > len) + { + span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Rx %5d: Invalid length for data (G)\n", log_seq_no); + return -1; + } + span_log(&s->logging, + SPAN_LOG_FLOW, + "Rx %5d: (%d) data %s/%s + %d byte(s)\n", + log_seq_no, + i, + t38_data_type_to_str(t30_data), + t38_field_type_to_str(t30_field_type), + numocts); + s->rx_data_handler(s, s->rx_user_data, t30_data, t30_field_type, msg, numocts); + s->current_rx_data_type = t30_data; + s->current_rx_field_type = t30_field_type; + } + if (ptr != len) + { + if (s->t38_version != 0 || ptr != (len - 1) || !other_half) + { + span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Rx %5d: Invalid length for data (H) - %d %d\n", log_seq_no, ptr, len); + return -1; + } + } + break; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int t38_encode_indicator(t38_core_state_t *s, uint8_t buf[], int indicator) +{ + int len; + + /* Build the IFP packet */ + /* Data field not present */ + /* Indicator packet */ + /* Type of indicator */ + if (indicator <= T38_IND_V17_14400_LONG_TRAINING) + { + buf[0] = (uint8_t) (indicator << 1); + len = 1; + } + else if (s->t38_version != 0 && indicator <= T38_IND_V33_14400_TRAINING) + { + buf[0] = (uint8_t) (0x20 | (((indicator - T38_IND_V8_ANSAM) & 0xF) >> 2)); + buf[1] = (uint8_t) (((indicator - T38_IND_V8_ANSAM) << 6) & 0xFF); + len = 2; + } + else + { + len = -1; + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +static int t38_encode_data(t38_core_state_t *s, uint8_t buf[], int data_type, const t38_data_field_t field[], int fields) +{ + int len; + int i; + int enclen; + int multiplier; + int data_field_no; + const t38_data_field_t *q; + unsigned int encoded_len; + unsigned int fragment_len; + unsigned int value; + uint8_t data_field_present; + uint8_t field_data_present; + char tag[20]; + + /* Build the IFP packet */ + + /* There seems no valid reason why a packet would ever be generated without a data field present */ + data_field_present = TRUE; + + for (data_field_no = 0; data_field_no < fields; data_field_no++) + { + span_log(&s->logging, + SPAN_LOG_FLOW, + "Tx %5d: (%d) data %s/%s + %d byte(s)\n", + s->tx_seq_no, + data_field_no, + t38_data_type_to_str(data_type), + t38_field_type_to_str(field[data_field_no].field_type), + field[data_field_no].field_len); + } + + data_field_no = 0; + len = 0; + /* Data field present */ + /* Data packet */ + /* Type of data */ + if (data_type <= T38_DATA_V17_14400) + { + buf[len++] = (uint8_t) ((data_field_present << 7) | 0x40 | (data_type << 1)); + } + else if (s->t38_version != 0 && data_type <= T38_DATA_V33_14400) + { + buf[len++] = (uint8_t) ((data_field_present << 7) | 0x60 | (((data_type - T38_DATA_V8) & 0xF) >> 2)); + buf[len++] = (uint8_t) (((data_type - T38_DATA_V8) << 6) & 0xFF); + } + else + { + return -1; + } + if (data_field_present) + { + encoded_len = 0; + data_field_no = 0; + do + { + value = fields - encoded_len; + if (value < 0x80) + { + /* 1 octet case */ + buf[len++] = (uint8_t) value; + enclen = value; + } + else if (value < 0x4000) + { + /* 2 octet case */ + buf[len++] = (uint8_t) (0x80 | ((value >> 8) & 0xFF)); + buf[len++] = (uint8_t) (value & 0xFF); + enclen = value; + } + else + { + /* Fragmentation case */ + multiplier = (value/0x4000 < 4) ? value/0x4000 : 4; + buf[len++] = (uint8_t) (0xC0 | multiplier); + enclen = 0x4000*multiplier; + } + + fragment_len = enclen; + encoded_len += fragment_len; + /* Encode the elements */ + for (i = 0; i < (int) encoded_len; i++) + { + q = &field[data_field_no]; + field_data_present = (uint8_t) (q->field_len > 0); + /* Encode field_type */ + if (s->t38_version == 0) + { + /* Original version of T.38 with a typo */ + if (q->field_type > T38_FIELD_T4_NON_ECM_SIG_END) + return -1; + buf[len++] = (uint8_t) ((field_data_present << 7) | (q->field_type << 4)); + } + else + { + if (q->field_type <= T38_FIELD_T4_NON_ECM_SIG_END) + { + buf[len++] = (uint8_t) ((field_data_present << 7) | (q->field_type << 3)); + } + else if (q->field_type <= T38_FIELD_V34RATE) + { + buf[len++] = (uint8_t) ((field_data_present << 7) | 0x40 | ((q->field_type - T38_FIELD_CM_MESSAGE) >> 2)); + buf[len++] = (uint8_t) (((q->field_type - T38_FIELD_CM_MESSAGE) << 6) & 0xC0); + } + else + { + return -1; + } + } + /* Encode field_data */ + if (field_data_present) + { + if (q->field_len < 1 || q->field_len > 65535) + return -1; + buf[len++] = (uint8_t) (((q->field_len - 1) >> 8) & 0xFF); + buf[len++] = (uint8_t) ((q->field_len - 1) & 0xFF); + memcpy(buf + len, q->field, q->field_len); + len += q->field_len; + } + data_field_no++; + } + } + while (fields != (int) encoded_len || fragment_len >= 16384); + } + + if (span_log_test(&s->logging, SPAN_LOG_FLOW)) + { + sprintf(tag, "Tx %5d: IFP", s->tx_seq_no); + span_log_buf(&s->logging, SPAN_LOG_FLOW, tag, buf, len); + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t38_core_send_indicator(t38_core_state_t *s, int indicator) +{ + uint8_t buf[100]; + int len; + int delay; + + delay = 0; + /* Only send an indicator if it represents a change of state. */ + if (s->current_tx_indicator != indicator) + { + /* Zero is a valid count, to suppress the transmission of indicators when the + transport means they are not needed - e.g. TPKT/TCP. */ + if (s->category_control[T38_PACKET_CATEGORY_INDICATOR]) + { + if ((len = t38_encode_indicator(s, buf, indicator)) < 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "T.38 indicator len is %d\n", len); + return len; + } + span_log(&s->logging, SPAN_LOG_FLOW, "Tx %5d: indicator %s\n", s->tx_seq_no, t38_indicator_to_str(indicator)); + s->tx_packet_handler(s, s->tx_packet_user_data, buf, len, s->category_control[T38_PACKET_CATEGORY_INDICATOR]); + s->tx_seq_no = (s->tx_seq_no + 1) & 0xFFFF; + delay = modem_startup_time[indicator].training; + if (s->allow_for_tep) + delay += modem_startup_time[indicator].tep; + } + s->current_tx_indicator = indicator; + } + return delay; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t38_core_send_flags_delay(t38_core_state_t *s, int indicator) +{ + return modem_startup_time[indicator].flags; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t38_core_send_data(t38_core_state_t *s, int data_type, int field_type, const uint8_t field[], int field_len, int category) +{ + t38_data_field_t field0; + uint8_t buf[1000]; + int len; + + field0.field_type = field_type; + field0.field = field; + field0.field_len = field_len; + if ((len = t38_encode_data(s, buf, data_type, &field0, 1)) < 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "T.38 data len is %d\n", len); + return len; + } + s->tx_packet_handler(s, s->tx_packet_user_data, buf, len, s->category_control[category]); + s->tx_seq_no = (s->tx_seq_no + 1) & 0xFFFF; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t38_core_send_data_multi_field(t38_core_state_t *s, int data_type, const t38_data_field_t field[], int fields, int category) +{ + uint8_t buf[1000]; + int len; + + if ((len = t38_encode_data(s, buf, data_type, field, fields)) < 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "T.38 data len is %d\n", len); + return len; + } + s->tx_packet_handler(s, s->tx_packet_user_data, buf, len, s->category_control[category]); + s->tx_seq_no = (s->tx_seq_no + 1) & 0xFFFF; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_set_data_rate_management_method(t38_core_state_t *s, int method) +{ + s->data_rate_management_method = method; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_set_data_transport_protocol(t38_core_state_t *s, int data_transport_protocol) +{ + s->data_transport_protocol = data_transport_protocol; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_set_fill_bit_removal(t38_core_state_t *s, int fill_bit_removal) +{ + s->fill_bit_removal = fill_bit_removal; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_set_mmr_transcoding(t38_core_state_t *s, int mmr_transcoding) +{ + s->mmr_transcoding = mmr_transcoding; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_set_jbig_transcoding(t38_core_state_t *s, int jbig_transcoding) +{ + s->jbig_transcoding = jbig_transcoding; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_set_max_buffer_size(t38_core_state_t *s, int max_buffer_size) +{ + s->max_buffer_size = max_buffer_size; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_set_max_datagram_size(t38_core_state_t *s, int max_datagram_size) +{ + s->max_datagram_size = max_datagram_size; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_set_t38_version(t38_core_state_t *s, int t38_version) +{ + s->t38_version = t38_version; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_set_sequence_number_handling(t38_core_state_t *s, int check) +{ + s->check_sequence_numbers = check; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_set_tep_handling(t38_core_state_t *s, int allow_for_tep) +{ + s->allow_for_tep = allow_for_tep; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_set_redundancy_control(t38_core_state_t *s, int category, int setting) +{ + s->category_control[category] = setting; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_set_fastest_image_data_rate(t38_core_state_t *s, int max_rate) +{ + s->fastest_image_data_rate = max_rate; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t38_get_fastest_image_data_rate(t38_core_state_t *s) +{ + return s->fastest_image_data_rate; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(logging_state_t *) t38_core_get_logging_state(t38_core_state_t *s) +{ + return &s->logging; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(t38_core_state_t *) t38_core_init(t38_core_state_t *s, + t38_rx_indicator_handler_t *rx_indicator_handler, + t38_rx_data_handler_t *rx_data_handler, + t38_rx_missing_handler_t *rx_missing_handler, + void *rx_user_data, + t38_tx_packet_handler_t *tx_packet_handler, + void *tx_packet_user_data) +{ + if (s == NULL) + { + if ((s = (t38_core_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "T.38"); + + /* Set some defaults for the parameters configurable from outside the + T.38 domain - e.g. from SDP data. */ + s->data_rate_management_method = T38_DATA_RATE_MANAGEMENT_TRANSFERRED_TCF; + s->data_transport_protocol = T38_TRANSPORT_UDPTL; + s->fill_bit_removal = FALSE; + s->mmr_transcoding = FALSE; + s->jbig_transcoding = FALSE; + s->max_buffer_size = 400; + s->max_datagram_size = 100; + s->t38_version = 0; + s->check_sequence_numbers = TRUE; + + /* Set some defaults */ + s->category_control[T38_PACKET_CATEGORY_INDICATOR] = 1; + s->category_control[T38_PACKET_CATEGORY_CONTROL_DATA] = 1; + s->category_control[T38_PACKET_CATEGORY_CONTROL_DATA_END] = 1; + s->category_control[T38_PACKET_CATEGORY_IMAGE_DATA] = 1; + s->category_control[T38_PACKET_CATEGORY_IMAGE_DATA_END] = 1; + + /* Set the initial current receive states to something invalid, so the + first data received is seen as a change of state. */ + s->current_rx_indicator = -1; + s->current_rx_data_type = -1; + s->current_rx_field_type = -1; + + /* Set the initial current indicator state to something invalid, so the + first attempt to send an indicator will work. */ + s->current_tx_indicator = -1; + + s->rx_indicator_handler = rx_indicator_handler; + s->rx_data_handler = rx_data_handler; + s->rx_missing_handler = rx_missing_handler; + s->rx_user_data = rx_user_data; + s->tx_packet_handler = tx_packet_handler; + s->tx_packet_user_data = tx_packet_user_data; + + /* We have no initial expectation of the received packet sequence number. + They most often start at 0 or 1 for a UDPTL transport, but random + starting numbers are possible. */ + s->rx_expected_seq_no = -1; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t38_core_release(t38_core_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t38_core_free(t38_core_state_t *s) +{ + if (s) + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/t38_gateway.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/t38_gateway.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,2352 @@ +//#define LOG_FAX_AUDIO +/* + * SpanDSP - a series of DSP components for telephony + * + * t38_gateway.c - A T.38 gateway, less the packet exchange part + * + * Written by Steve Underwood + * + * Copyright (C) 2005, 2006, 2007, 2008 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t38_gateway.c,v 1.171.4.2 2009/12/19 10:44:10 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include +#if defined(LOG_FAX_AUDIO) +#include +#endif +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/queue.h" +#include "spandsp/dc_restore.h" +#include "spandsp/bit_operations.h" +#include "spandsp/power_meter.h" +#include "spandsp/complex.h" +#include "spandsp/tone_detect.h" +#include "spandsp/tone_generate.h" +#include "spandsp/async.h" +#include "spandsp/crc.h" +#include "spandsp/hdlc.h" +#include "spandsp/silence_gen.h" +#include "spandsp/fsk.h" +#include "spandsp/v29tx.h" +#include "spandsp/v29rx.h" +#include "spandsp/v27ter_tx.h" +#include "spandsp/v27ter_rx.h" +#include "spandsp/v17tx.h" +#include "spandsp/v17rx.h" +#include "spandsp/super_tone_rx.h" +#include "spandsp/modem_connect_tones.h" +#include "spandsp/t4_rx.h" +#include "spandsp/t4_tx.h" +#include "spandsp/t30_fcf.h" +#include "spandsp/t35.h" +#include "spandsp/t30.h" +#include "spandsp/t30_logging.h" +#include "spandsp/fax_modems.h" +#include "spandsp/t38_core.h" +#include "spandsp/t38_non_ecm_buffer.h" +#include "spandsp/t38_gateway.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/silence_gen.h" +#include "spandsp/private/fsk.h" +#include "spandsp/private/v17tx.h" +#include "spandsp/private/v17rx.h" +#include "spandsp/private/v27ter_tx.h" +#include "spandsp/private/v27ter_rx.h" +#include "spandsp/private/v29tx.h" +#include "spandsp/private/v29rx.h" +#include "spandsp/private/modem_connect_tones.h" +#include "spandsp/private/hdlc.h" +#include "spandsp/private/fax_modems.h" +#include "spandsp/private/t4_rx.h" +#include "spandsp/private/t4_tx.h" +#include "spandsp/private/t30.h" +#include "spandsp/private/t38_core.h" +#include "spandsp/private/t38_non_ecm_buffer.h" +#include "spandsp/private/t38_gateway.h" + +/* This is the target time per transmission chunk. The actual + packet timing will sync to the data octets. */ +/*! The default number of milliseconds per transmitted IFP when sending bulk T.38 data */ +#define MS_PER_TX_CHUNK 30 +/*! The number of bytes which must be in the audio to T.38 HDLC buffer before we start + outputting them as IFP messages. */ +#define HDLC_START_BUFFER_LEVEL 8 + +/*! The number of transmissions of indicator IFP packets */ +#define INDICATOR_TX_COUNT 3 +/*! The number of transmissions of data IFP packets */ +#define DATA_TX_COUNT 1 +/*! The number of transmissions of terminating data IFP packets */ +#define DATA_END_TX_COUNT 3 + +enum +{ + DISBIT1 = 0x01, + DISBIT2 = 0x02, + DISBIT3 = 0x04, + DISBIT4 = 0x08, + DISBIT5 = 0x10, + DISBIT6 = 0x20, + DISBIT7 = 0x40, + DISBIT8 = 0x80 +}; + +enum +{ + T38_NONE, + T38_V27TER_RX, + T38_V29_RX, + T38_V17_RX +}; + +enum +{ + HDLC_FLAG_FINISHED = 0x01, + HDLC_FLAG_CORRUPT_CRC = 0x02, + HDLC_FLAG_PROCEED_WITH_OUTPUT = 0x04, + HDLC_FLAG_MISSING_DATA = 0x08 +}; + +enum +{ + FLAG_INDICATOR = 0x100, + FLAG_DATA = 0x200 +}; + +enum +{ + TIMED_MODE_STARTUP = 0, + TIMED_MODE_IDLE, + TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED, + TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_SEEN, + TIMED_MODE_TCF_PREDICTABLE_MODEM_START_PAST_V21_MODEM, + TIMED_MODE_TCF_PREDICTABLE_MODEM_START_BEGIN, +}; + +/*! The maximum number of bytes to be zapped, in order to corrupt NSF, + NSS and NSC messages, so the receiver does not recognise them. */ +#define MAX_NSX_SUPPRESSION 10 + +/*! The number of consecutive flags to declare HDLC framing is OK. */ +#define HDLC_FRAMING_OK_THRESHOLD 5 + +static uint8_t nsx_overwrite[2][MAX_NSX_SUPPRESSION] = +{ + {0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0}, +}; + +static int restart_rx_modem(t38_gateway_state_t *s); +static int process_rx_indicator(t38_core_state_t *t, void *user_data, int indicator); +static void hdlc_underflow_handler(void *user_data); +static void to_t38_buffer_init(t38_gateway_to_t38_state_t *s); +static void t38_hdlc_rx_put_bit(hdlc_rx_state_t *t, int new_bit); +static void non_ecm_put_bit(void *user_data, int bit); +static void non_ecm_remove_fill_and_put_bit(void *user_data, int bit); +static void non_ecm_push_residue(t38_gateway_state_t *s); +static void tone_detected(void *user_data, int tone, int level, int delay); + +static void set_rx_handler(t38_gateway_state_t *s, span_rx_handler_t *handler, void *user_data) +{ + if (s->audio.modems.rx_handler != span_dummy_rx) + s->audio.modems.rx_handler = handler; + s->audio.base_rx_handler = handler; + s->audio.modems.rx_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +static void set_tx_handler(t38_gateway_state_t *s, span_tx_handler_t *handler, void *user_data) +{ + s->audio.modems.tx_handler = handler; + s->audio.modems.tx_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +static void set_next_tx_handler(t38_gateway_state_t *s, span_tx_handler_t *handler, void *user_data) +{ + s->audio.modems.next_tx_handler = handler; + s->audio.modems.next_tx_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +static void set_rx_active(t38_gateway_state_t *s, int active) +{ + s->audio.modems.rx_handler = (active) ? s->audio.base_rx_handler : span_dummy_rx; +} +/*- End of function --------------------------------------------------------*/ + +static int v17_v21_rx(void *user_data, const int16_t amp[], int len) +{ + t38_gateway_state_t *t; + fax_modems_state_t *s; + + t = (t38_gateway_state_t *) user_data; + s = &t->audio.modems; + v17_rx(&s->v17_rx, amp, len); + if (s->rx_trained) + { + /* The fast modem has trained, so we no longer need to run the slow + one in parallel. */ + span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.17 (%.2fdBm0)\n", v17_rx_signal_power(&s->v17_rx)); + set_rx_handler(t, (span_rx_handler_t *) &v17_rx, &s->v17_rx); + } + else + { + fsk_rx(&s->v21_rx, amp, len); + if (s->rx_signal_present) + { + span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); + set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, &s->v21_rx); + } + /*endif*/ + } + /*endif*/ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len) +{ + t38_gateway_state_t *t; + fax_modems_state_t *s; + + t = (t38_gateway_state_t *) user_data; + s = &t->audio.modems; + v27ter_rx(&s->v27ter_rx, amp, len); + if (s->rx_trained) + { + /* The fast modem has trained, so we no longer need to run the slow + one in parallel. */ + span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.27ter (%.2fdBm0)\n", v27ter_rx_signal_power(&s->v27ter_rx)); + set_rx_handler(t, (span_rx_handler_t *) &v27ter_rx, &s->v27ter_rx); + } + else + { + fsk_rx(&s->v21_rx, amp, len); + if (s->rx_signal_present) + { + span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); + set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, &s->v21_rx); + } + /*endif*/ + } + /*endif*/ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int v29_v21_rx(void *user_data, const int16_t amp[], int len) +{ + t38_gateway_state_t *t; + fax_modems_state_t *s; + + t = (t38_gateway_state_t *) user_data; + s = &t->audio.modems; + v29_rx(&s->v29_rx, amp, len); + if (s->rx_trained) + { + /* The fast modem has trained, so we no longer need to run the slow + one in parallel. */ + span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.29 (%.2fdBm0)\n", v29_rx_signal_power(&s->v29_rx)); + set_rx_handler(t, (span_rx_handler_t *) &v29_rx, &s->v29_rx); + } + else + { + fsk_rx(&s->v21_rx, amp, len); + if (s->rx_signal_present) + { + span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); + set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, &s->v21_rx); + } + /*endif*/ + } + /*endif*/ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void tone_detected(void *user_data, int tone, int level, int delay) +{ + t38_gateway_state_t *s; + + s = (t38_gateway_state_t *) user_data; + span_log(&s->logging, SPAN_LOG_FLOW, "%s detected (%ddBm0)\n", modem_connect_tone_to_str(tone), level); +} +/*- End of function --------------------------------------------------------*/ + +static void hdlc_underflow_handler(void *user_data) +{ + t38_gateway_state_t *s; + t38_gateway_hdlc_state_t *t; + int old_data_type; + + s = (t38_gateway_state_t *) user_data; + t = &s->core.hdlc_to_modem; + span_log(&s->logging, SPAN_LOG_FLOW, "HDLC underflow at %d\n", t->out); + /* If the current HDLC buffer is not at the HDLC_FLAG_PROCEED_WITH_OUTPUT stage, this + underflow must be an end of preamble condition. */ + if ((t->buf[t->out].flags & HDLC_FLAG_PROCEED_WITH_OUTPUT)) + { + old_data_type = t->buf[t->out].contents; + t->buf[t->out].len = 0; + t->buf[t->out].flags = 0; + t->buf[t->out].contents = 0; + if (++t->out >= T38_TX_HDLC_BUFS) + t->out = 0; + span_log(&s->logging, SPAN_LOG_FLOW, "HDLC next is 0x%X\n", t->buf[t->out].contents); + if ((t->buf[t->out].contents & FLAG_INDICATOR)) + { + /* The next thing in the queue is an indicator, so we need to stop this modem. */ + span_log(&s->logging, SPAN_LOG_FLOW, "HDLC shutdown\n"); + hdlc_tx_frame(&s->audio.modems.hdlc_tx, NULL, 0); + } + else if ((t->buf[t->out].contents & FLAG_DATA)) + { + /* Check if we should start sending the next frame */ + if ((t->buf[t->out].flags & HDLC_FLAG_PROCEED_WITH_OUTPUT)) + { + /* This frame is ready to go, and uses the same modem we are running now. So, send + whatever we have. This might or might not be an entire frame. */ + span_log(&s->logging, SPAN_LOG_FLOW, "HDLC start next frame\n"); + hdlc_tx_frame(&s->audio.modems.hdlc_tx, t->buf[t->out].buf, t->buf[t->out].len); + if ((t->buf[t->out].flags & HDLC_FLAG_CORRUPT_CRC)) + hdlc_tx_corrupt_frame(&s->audio.modems.hdlc_tx); + /*endif*/ + } + /*endif*/ + } + /*endif*/ + } + /*endif*/ +} +/*- End of function --------------------------------------------------------*/ + +static int set_next_tx_type(t38_gateway_state_t *s) +{ + get_bit_func_t get_bit_func; + void *get_bit_user_data; + int indicator; + int short_train; + fax_modems_state_t *t; + t38_gateway_hdlc_state_t *u; + + t = &s->audio.modems; + u = &s->core.hdlc_to_modem; + t38_non_ecm_buffer_report_output_status(&s->core.non_ecm_to_modem, &s->logging); + if (t->next_tx_handler) + { + /* There is a handler queued, so that is the next one. */ + set_tx_handler(s, t->next_tx_handler, t->next_tx_user_data); + set_next_tx_handler(s, NULL, NULL); + if (t->tx_handler == (span_tx_handler_t *) &(silence_gen) + || + t->tx_handler == (span_tx_handler_t *) &(tone_gen)) + { + set_rx_active(s, TRUE); + } + else + { + set_rx_active(s, FALSE); + } + /*endif*/ + return TRUE; + } + /*endif*/ + if (u->in == u->out) + return FALSE; + /*endif*/ + if ((u->buf[u->out].contents & FLAG_INDICATOR) == 0) + return FALSE; + /*endif*/ + indicator = (u->buf[u->out].contents & 0xFF); + u->buf[u->out].len = 0; + u->buf[u->out].flags = 0; + u->buf[u->out].contents = 0; + if (++u->out >= T38_TX_HDLC_BUFS) + u->out = 0; + /*endif*/ + span_log(&s->logging, SPAN_LOG_FLOW, "Changing to %s\n", t38_indicator_to_str(indicator)); + if (s->core.image_data_mode && s->core.ecm_mode) + { + span_log(&s->logging, SPAN_LOG_FLOW, "HDLC mode\n"); + hdlc_tx_init(&t->hdlc_tx, FALSE, 2, TRUE, hdlc_underflow_handler, s); + get_bit_func = (get_bit_func_t) hdlc_tx_get_bit; + get_bit_user_data = (void *) &t->hdlc_tx; + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM mode\n"); + get_bit_func = t38_non_ecm_buffer_get_bit; + get_bit_user_data = (void *) &s->core.non_ecm_to_modem; + } + /*endif*/ + switch (indicator) + { + case T38_IND_NO_SIGNAL: + t->tx_bit_rate = 0; + /* Impose 75ms minimum on transmitted silence */ + //silence_gen_set(&t->silence_gen, ms_to_samples(75)); + set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + set_rx_active(s, TRUE); + break; + case T38_IND_CNG: + t->tx_bit_rate = 0; + modem_connect_tones_tx_init(&t->connect_tx, MODEM_CONNECT_TONES_FAX_CNG); + set_tx_handler(s, (span_tx_handler_t *) &modem_connect_tones_tx, &t->connect_tx); + silence_gen_set(&t->silence_gen, 0); + set_next_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); + set_rx_active(s, TRUE); + break; + case T38_IND_CED: + t->tx_bit_rate = 0; + modem_connect_tones_tx_init(&t->connect_tx, MODEM_CONNECT_TONES_FAX_CED); + set_tx_handler(s, (span_tx_handler_t *) &modem_connect_tones_tx, &t->connect_tx); + set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + set_rx_active(s, TRUE); + break; + case T38_IND_V21_PREAMBLE: + t->tx_bit_rate = 300; + hdlc_tx_init(&t->hdlc_tx, FALSE, 2, TRUE, hdlc_underflow_handler, s); + hdlc_tx_flags(&t->hdlc_tx, 32); + silence_gen_alter(&t->silence_gen, ms_to_samples(75)); + u->buf[u->in].len = 0; + fsk_tx_init(&t->v21_tx, &preset_fsk_specs[FSK_V21CH2], (get_bit_func_t) hdlc_tx_get_bit, &t->hdlc_tx); + set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t *) &fsk_tx, &t->v21_tx); + set_rx_active(s, TRUE); + break; + case T38_IND_V27TER_2400_TRAINING: + case T38_IND_V27TER_4800_TRAINING: + switch (indicator) + { + case T38_IND_V27TER_2400_TRAINING: + t->tx_bit_rate = 2400; + break; + case T38_IND_V27TER_4800_TRAINING: + t->tx_bit_rate = 2400; + break; + } + /*endswitch*/ + silence_gen_alter(&t->silence_gen, ms_to_samples(75)); + v27ter_tx_restart(&t->v27ter_tx, t->tx_bit_rate, t->use_tep); + v27ter_tx_set_get_bit(&t->v27ter_tx, get_bit_func, get_bit_user_data); + set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t *) &v27ter_tx, &t->v27ter_tx); + set_rx_active(s, TRUE); + break; + case T38_IND_V29_7200_TRAINING: + case T38_IND_V29_9600_TRAINING: + switch (indicator) + { + case T38_IND_V29_7200_TRAINING: + t->tx_bit_rate = 7200; + break; + case T38_IND_V29_9600_TRAINING: + t->tx_bit_rate = 9600; + break; + } + /*endswitch*/ + silence_gen_alter(&t->silence_gen, ms_to_samples(75)); + v29_tx_restart(&t->v29_tx, t->tx_bit_rate, t->use_tep); + v29_tx_set_get_bit(&t->v29_tx, get_bit_func, get_bit_user_data); + set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t *) &v29_tx, &t->v29_tx); + set_rx_active(s, TRUE); + break; + case T38_IND_V17_7200_SHORT_TRAINING: + case T38_IND_V17_7200_LONG_TRAINING: + case T38_IND_V17_9600_SHORT_TRAINING: + case T38_IND_V17_9600_LONG_TRAINING: + case T38_IND_V17_12000_SHORT_TRAINING: + case T38_IND_V17_12000_LONG_TRAINING: + case T38_IND_V17_14400_SHORT_TRAINING: + case T38_IND_V17_14400_LONG_TRAINING: + short_train = FALSE; + switch (indicator) + { + case T38_IND_V17_7200_SHORT_TRAINING: + short_train = TRUE; + t->tx_bit_rate = 7200; + break; + case T38_IND_V17_7200_LONG_TRAINING: + t->tx_bit_rate = 7200; + break; + case T38_IND_V17_9600_SHORT_TRAINING: + short_train = TRUE; + t->tx_bit_rate = 9600; + break; + case T38_IND_V17_9600_LONG_TRAINING: + t->tx_bit_rate = 9600; + break; + case T38_IND_V17_12000_SHORT_TRAINING: + short_train = TRUE; + t->tx_bit_rate = 12000; + break; + case T38_IND_V17_12000_LONG_TRAINING: + t->tx_bit_rate = 12000; + break; + case T38_IND_V17_14400_SHORT_TRAINING: + short_train = TRUE; + t->tx_bit_rate = 14400; + break; + case T38_IND_V17_14400_LONG_TRAINING: + t->tx_bit_rate = 14400; + break; + } + /*endswitch*/ + silence_gen_alter(&t->silence_gen, ms_to_samples(75)); + v17_tx_restart(&t->v17_tx, t->tx_bit_rate, t->use_tep, short_train); + v17_tx_set_get_bit(&t->v17_tx, get_bit_func, get_bit_user_data); + set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t *) &v17_tx, &t->v17_tx); + set_rx_active(s, TRUE); + break; + case T38_IND_V8_ANSAM: + t->tx_bit_rate = 300; + break; + case T38_IND_V8_SIGNAL: + t->tx_bit_rate = 300; + break; + case T38_IND_V34_CNTL_CHANNEL_1200: + t->tx_bit_rate = 1200; + break; + case T38_IND_V34_PRI_CHANNEL: + t->tx_bit_rate = 33600; + break; + case T38_IND_V34_CC_RETRAIN: + t->tx_bit_rate = 0; + break; + case T38_IND_V33_12000_TRAINING: + t->tx_bit_rate = 12000; + break; + case T38_IND_V33_14400_TRAINING: + t->tx_bit_rate = 14400; + break; + default: + break; + } + /*endswitch*/ + /* For any fast modem, set 200ms of preamble flags */ + if (t->tx_bit_rate > 300) + hdlc_tx_flags(&t->hdlc_tx, t->tx_bit_rate/(8*5)); + /*endif*/ + s->t38x.in_progress_rx_indicator = indicator; + return TRUE; +} +/*- End of function --------------------------------------------------------*/ + +static void finalise_hdlc_frame(t38_gateway_state_t *s, int good_fcs) +{ + t38_gateway_hdlc_buf_t *hdlc_buf; + + hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; + if (!good_fcs || (hdlc_buf->flags & HDLC_FLAG_MISSING_DATA)) + hdlc_buf->flags |= HDLC_FLAG_CORRUPT_CRC; + /*endif*/ + if (s->core.hdlc_to_modem.in == s->core.hdlc_to_modem.out) + { + /* This is the frame in progress at the output. */ + if ((hdlc_buf->flags & HDLC_FLAG_PROCEED_WITH_OUTPUT) == 0) + { + /* Output of this frame has not yet begun. Throw it all out now. */ + hdlc_tx_frame(&s->audio.modems.hdlc_tx, hdlc_buf->buf, hdlc_buf->len); + } + /*endif*/ + if ((hdlc_buf->flags & HDLC_FLAG_CORRUPT_CRC)) + hdlc_tx_corrupt_frame(&s->audio.modems.hdlc_tx); + /*endif*/ + } + /*endif*/ + hdlc_buf->flags |= (HDLC_FLAG_PROCEED_WITH_OUTPUT | HDLC_FLAG_FINISHED); + if (++s->core.hdlc_to_modem.in >= T38_TX_HDLC_BUFS) + s->core.hdlc_to_modem.in = 0; + /*endif*/ + hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; + hdlc_buf->len = 0; + hdlc_buf->flags = 0; + hdlc_buf->contents = 0; +} +/*- End of function --------------------------------------------------------*/ + +static void edit_control_messages(t38_gateway_state_t *s, int from_modem, uint8_t *buf, int len) +{ + /* Frames need to be fed to this routine byte by byte as they arrive. It basically just + edits the last byte received, based on the frame up to that point. */ + if (s->t38x.corrupt_current_frame[from_modem]) + { + /* We simply need to overwrite a section of the message, so it is not recognisable at + the receiver. This is used for the NSF, NSC, and NSS messages. Several strategies are + possible for the replacement data. If you have a manufacturer code of your own, the + sane thing is to overwrite the original data with that. */ + if (len <= s->t38x.suppress_nsx_len[from_modem]) + buf[len - 1] = nsx_overwrite[from_modem][len - 4]; + /*endif*/ + return; + } + /*endif*/ + /* Edit the message, if we need to control the communication between the end points. */ + switch (len) + { + case 3: + switch (buf[2]) + { + case T30_NSF: + case T30_NSC: + case T30_NSS: + if (s->t38x.suppress_nsx_len[from_modem]) + { + /* Corrupt the message, so it will be ignored by the far end. If it were + processed, 2 machines which recognise each other might do special things + we cannot handle as a middle man. */ + span_log(&s->logging, SPAN_LOG_FLOW, "Corrupting %s message to prevent recognition\n", t30_frametype(buf[2])); + s->t38x.corrupt_current_frame[from_modem] = TRUE; + } + /*endif*/ + break; + } + /*endswitch*/ + break; + case 4: + switch (buf[2]) + { + case T30_DIS: + /* Make sure the V.8 capability doesn't pass through. If it + did then two V.34 capable FAX machines might start some + V.8 re-negotiation. */ + buf[3] &= ~DISBIT6; + break; + } + /*endswitch*/ + break; + case 5: + switch (buf[2]) + { + case T30_DIS: + /* We may need to adjust the capabilities, so they do not exceed our own */ + span_log(&s->logging, SPAN_LOG_FLOW, "Applying fast modem type constraints.\n"); + switch (buf[4] & (DISBIT6 | DISBIT5 | DISBIT4 | DISBIT3)) + { + case 0: + case DISBIT4: + /* V.27ter only */ + break; + case DISBIT3: + case (DISBIT4 | DISBIT3): + /* V.27ter and V.29 */ + if (!(s->core.supported_modems & T30_SUPPORT_V29)) + buf[4] &= ~DISBIT3; + /*endif*/ + break; + case (DISBIT6 | DISBIT4 | DISBIT3): + /* V.27ter, V.29 and V.17 */ + if (!(s->core.supported_modems & T30_SUPPORT_V17)) + buf[4] &= ~DISBIT6; + /*endif*/ + if (!(s->core.supported_modems & T30_SUPPORT_V29)) + buf[4] &= ~DISBIT3; + /*endif*/ + break; + case (DISBIT5 | DISBIT4): + case (DISBIT6 | DISBIT4): + case (DISBIT6 | DISBIT5 | DISBIT4): + case (DISBIT6 | DISBIT5 | DISBIT4 | DISBIT3): + /* Reserved */ + buf[4] &= ~(DISBIT6 | DISBIT5); + buf[4] |= (DISBIT4 | DISBIT3); + break; + default: + /* Not used */ + buf[4] &= ~(DISBIT6 | DISBIT5); + buf[4] |= (DISBIT4 | DISBIT3); + break; + } + /*endswitch*/ + break; + } + /*endswitch*/ + break; + case 7: + switch (buf[2]) + { + case T30_DIS: + if (!s->core.ecm_allowed) + { + /* Do not allow ECM or T.6 coding */ + span_log(&s->logging, SPAN_LOG_FLOW, "Inhibiting ECM\n"); + buf[6] &= ~(DISBIT3 | DISBIT7); + } + /*endif*/ + break; + } + /*endswitch*/ + break; + } + /*endswitch*/ +} +/*- End of function --------------------------------------------------------*/ + +static void monitor_control_messages(t38_gateway_state_t *s, + int from_modem, + const uint8_t *buf, + int len) +{ + static const struct + { + int bit_rate; + int modem_type; + uint8_t dcs_code; + } modem_codes[] = + { + {14400, T38_V17_RX, DISBIT6}, + {12000, T38_V17_RX, (DISBIT6 | DISBIT4)}, + { 9600, T38_V17_RX, (DISBIT6 | DISBIT3)}, + { 9600, T38_V29_RX, DISBIT3}, + { 7200, T38_V17_RX, (DISBIT6 | DISBIT4 | DISBIT3)}, + { 7200, T38_V29_RX, (DISBIT4 | DISBIT3)}, + { 4800, T38_V27TER_RX, DISBIT4}, + { 2400, T38_V27TER_RX, 0}, + { 0, T38_NONE, 0} + }; + static const int minimum_scan_line_times[8] = + { + 20, + 5, + 10, + 0, + 40, + 0, + 0, + 0 + }; + int dcs_code; + int i; + int j; + + /* Monitor the control messages, at the point where we have the whole message, so we can + see what is happening to things like training success/failure. */ + span_log(&s->logging, SPAN_LOG_FLOW, "Monitoring %s\n", t30_frametype(buf[2])); + if (len < 3) + return; + /*endif*/ + s->core.timed_mode = TIMED_MODE_IDLE; + switch (buf[2]) + { + case T30_CFR: + /* We are changing from TCF exchange to image exchange */ + /* Successful training means we should change to short training */ + s->core.image_data_mode = TRUE; + s->core.short_train = TRUE; + span_log(&s->logging, SPAN_LOG_FLOW, "CFR - short train = %d, ECM = %d\n", s->core.short_train, s->core.ecm_mode); + if (!from_modem) + restart_rx_modem(s); + /*endif*/ + break; + case T30_RTN: + case T30_RTP: + /* We are going back to the exchange of fresh TCF */ + s->core.image_data_mode = FALSE; + s->core.short_train = FALSE; + break; + case T30_CTR: + /* T.30 says the first image data after this does full training, yet does not + return to TCF. This seems to be the sole case of long training for image + data. */ + s->core.short_train = FALSE; + break; + case T30_DTC: + case T30_DCS: + case T30_DCS | 1: + /* We need to check which modem type is about to be used, so we can start the + correct modem. */ + s->core.fast_bit_rate = 0; + s->core.fast_rx_modem = T38_NONE; + s->core.image_data_mode = FALSE; + s->core.short_train = FALSE; + if (from_modem) + s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_BEGIN; + /*endif*/ + if (len >= 5) + { + /* The table is short, and not searched often, so a brain-dead linear scan seems OK */ + dcs_code = buf[4] & (DISBIT6 | DISBIT5 | DISBIT4 | DISBIT3); + for (i = 0; modem_codes[i].bit_rate; i++) + { + if (modem_codes[i].dcs_code == dcs_code) + break; + /*endif*/ + } + /*endfor*/ + /* If we are processing a message from the modem side, the contents determine the fast receive modem. + we are to use. If it comes from the T.38 side the contents do not. */ + s->core.fast_bit_rate = modem_codes[i].bit_rate; + if (from_modem) + s->core.fast_rx_modem = modem_codes[i].modem_type; + /*endif*/ + } + /*endif*/ + if (len >= 6) + { + j = (buf[5] & (DISBIT7 | DISBIT6 | DISBIT5)) >> 4; + span_log(&s->logging, SPAN_LOG_FLOW, "Min bits test = 0x%X\n", buf[5]); + s->core.min_row_bits = (s->core.fast_bit_rate*minimum_scan_line_times[j])/1000; + } + else + { + s->core.min_row_bits = 0; + } + /*endif*/ + s->core.ecm_mode = (len >= 7) && (buf[6] & DISBIT3); + span_log(&s->logging, SPAN_LOG_FLOW, "Fast rx modem = %d/%d, ECM = %d, Min bits per row = %d\n", s->core.fast_rx_modem, s->core.fast_bit_rate, s->core.ecm_mode, s->core.min_row_bits); + break; + case T30_PPS: + case T30_PPS | 1: + switch (buf[3] & 0xFE) + { + case T30_EOP: + case T30_PRI_EOP: + case T30_EOM: + case T30_PRI_EOM: + case T30_EOS: +#if 0 + /* If we are hitting one of these conditions, it will take another DCS/DTC to select + the fast modem again, so abandon our idea of it. */ + s->core.fast_bit_rate = 0; + s->core.fast_rx_modem = T38_NONE; + s->core.image_data_mode = FALSE; + s->core.short_train = FALSE; +#endif + /* Fall through */ + case T30_MPS: + case T30_PRI_MPS: + s->core.count_page_on_mcf = TRUE; + break; + } + /*endswitch*/ + break; + case T30_EOP: + case T30_EOP | 1: + case T30_PRI_EOP: + case T30_PRI_EOP | 1: + case T30_EOM: + case T30_EOM | 1: + case T30_PRI_EOM: + case T30_PRI_EOM | 1: + case T30_EOS: + case T30_EOS | 1: +#if 0 + /* If we are hitting one of these conditions, it will take another DCS/DTC to select + the fast modem again, so abandon our idea of t. */ + s->core.fast_bit_rate = 0; + s->core.fast_rx_modem = T38_NONE; + s->core.image_data_mode = FALSE; + s->core.short_train = FALSE; +#endif + /* Fall through */ + case T30_MPS: + case T30_MPS | 1: + case T30_PRI_MPS: + case T30_PRI_MPS | 1: + s->core.count_page_on_mcf = TRUE; + break; + case T30_MCF: + case T30_MCF | 1: + if (s->core.count_page_on_mcf) + { + s->core.pages_confirmed++; + span_log(&s->logging, SPAN_LOG_FLOW, "Pages confirmed = %d\n", s->core.pages_confirmed); + s->core.count_page_on_mcf = FALSE; + } + /*endif*/ + break; + default: + break; + } + /*endswitch*/ +} +/*- End of function --------------------------------------------------------*/ + +static void queue_missing_indicator(t38_gateway_state_t *s, int data_type) +{ + t38_core_state_t *t; + int expected; + int expected_alt; + + t = &s->t38x.t38; + expected = -1; + expected_alt = -1; + /* Missing packets might have lost us the indicator that should have put us in + the required mode of operation. It might be a bit late to fill in such a gap + now, but we should try. We may also want to force indicators into the queue, + such as when the data says 'end of signal'. */ + /* We have an expectation of whether long or short training should occur, but be + tolerant of either kind of indicator being present. */ + switch (data_type) + { + case T38_DATA_NONE: + expected = T38_IND_NO_SIGNAL; + break; + case T38_DATA_V21: + expected = T38_IND_V21_PREAMBLE; + break; + case T38_DATA_V27TER_2400: + expected = T38_IND_V27TER_2400_TRAINING; + break; + case T38_DATA_V27TER_4800: + expected = T38_IND_V27TER_4800_TRAINING; + break; + case T38_DATA_V29_7200: + expected = T38_IND_V29_7200_TRAINING; + break; + case T38_DATA_V29_9600: + expected = T38_IND_V29_9600_TRAINING; + break; + case T38_DATA_V17_7200: + expected = (s->core.short_train) ? T38_IND_V17_7200_SHORT_TRAINING : T38_IND_V17_7200_LONG_TRAINING; + expected_alt = (s->core.short_train) ? T38_IND_V17_7200_LONG_TRAINING : T38_IND_V17_7200_SHORT_TRAINING; + break; + case T38_DATA_V17_9600: + expected = (s->core.short_train) ? T38_IND_V17_9600_SHORT_TRAINING : T38_IND_V17_9600_LONG_TRAINING; + expected_alt = (s->core.short_train) ? T38_IND_V17_9600_LONG_TRAINING : T38_IND_V17_9600_SHORT_TRAINING; + break; + case T38_DATA_V17_12000: + expected = (s->core.short_train) ? T38_IND_V17_12000_SHORT_TRAINING : T38_IND_V17_12000_LONG_TRAINING; + expected_alt = (s->core.short_train) ? T38_IND_V17_12000_LONG_TRAINING : T38_IND_V17_12000_SHORT_TRAINING; + break; + case T38_DATA_V17_14400: + expected = (s->core.short_train) ? T38_IND_V17_14400_SHORT_TRAINING : T38_IND_V17_14400_LONG_TRAINING; + expected_alt = (s->core.short_train) ? T38_IND_V17_14400_LONG_TRAINING : T38_IND_V17_14400_SHORT_TRAINING; + break; + case T38_DATA_V8: + break; + case T38_DATA_V34_PRI_RATE: + break; + case T38_DATA_V34_CC_1200: + break; + case T38_DATA_V34_PRI_CH: + break; + case T38_DATA_V33_12000: + break; + case T38_DATA_V33_14400: + break; + } + /*endswitch*/ + if (expected < 0) + return; + if (t->current_rx_indicator == expected) + return; + if (expected_alt >= 0 && t->current_rx_indicator == expected_alt) + return; + span_log(&s->logging, + SPAN_LOG_FLOW, + "Queuing missing indicator - %s\n", + t38_indicator_to_str(expected)); + process_rx_indicator(t, (void *) s, expected); + /* Force the indicator setting here, as the core won't set in when its missing. */ + t->current_rx_indicator = expected; +} +/*- End of function --------------------------------------------------------*/ + +static int process_rx_missing(t38_core_state_t *t, void *user_data, int rx_seq_no, int expected_seq_no) +{ + t38_gateway_state_t *s; + + s = (t38_gateway_state_t *) user_data; + s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in].flags |= HDLC_FLAG_MISSING_DATA; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int process_rx_indicator(t38_core_state_t *t, void *user_data, int indicator) +{ + t38_gateway_state_t *s; + + s = (t38_gateway_state_t *) user_data; + + t38_non_ecm_buffer_report_input_status(&s->core.non_ecm_to_modem, &s->logging); + if (t->current_rx_indicator == indicator) + { + /* This is probably due to the far end repeating itself. Ignore it. Its harmless */ + return 0; + } + /*endif*/ + if (s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in].contents) + { + if (++s->core.hdlc_to_modem.in >= T38_TX_HDLC_BUFS) + s->core.hdlc_to_modem.in = 0; + /*endif*/ + } + /*endif*/ + s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in].contents = (indicator | FLAG_INDICATOR); + if (++s->core.hdlc_to_modem.in >= T38_TX_HDLC_BUFS) + s->core.hdlc_to_modem.in = 0; + /*endif*/ + t38_non_ecm_buffer_set_mode(&s->core.non_ecm_to_modem, s->core.image_data_mode, s->core.min_row_bits); + + span_log(&s->logging, + SPAN_LOG_FLOW, + "Queued change - (%d) %s -> %s\n", + silence_gen_remainder(&(s->audio.modems.silence_gen)), + t38_indicator_to_str(t->current_rx_indicator), + t38_indicator_to_str(indicator)); + s->t38x.current_rx_field_class = T38_FIELD_CLASS_NONE; + /* We need to set this here, since we might have been called as a fake + indication when the real one was missing */ + t->current_rx_indicator = indicator; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, int field_type, const uint8_t *buf, int len) +{ + int i; + t38_gateway_state_t *s; + t38_gateway_t38_state_t *xx; + t38_gateway_hdlc_buf_t *hdlc_buf; + + s = (t38_gateway_state_t *) user_data; + xx = &s->t38x; + /* There are a couple of special cases of data type that need their own treatment. */ + switch (data_type) + { + case T38_DATA_V8: + switch (field_type) + { + case T38_FIELD_CM_MESSAGE: + if (len >= 1) + span_log(&s->logging, SPAN_LOG_FLOW, "CM profile %d - %s\n", buf[0] - '0', t38_cm_profile_to_str(buf[0])); + else + span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for CM message - %d\n", len); + /*endif*/ + break; + case T38_FIELD_JM_MESSAGE: + if (len >= 2) + span_log(&s->logging, SPAN_LOG_FLOW, "JM - %s\n", t38_jm_to_str(buf, len)); + else + span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for JM message - %d\n", len); + /*endif*/ + break; + case T38_FIELD_CI_MESSAGE: + if (len >= 1) + span_log(&s->logging, SPAN_LOG_FLOW, "CI 0x%X\n", buf[0]); + else + span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for CI message - %d\n", len); + /*endif*/ + break; + default: + break; + } + /*endswitch*/ + return 0; + case T38_DATA_V34_PRI_RATE: + switch (field_type) + { + case T38_FIELD_V34RATE: + if (len >= 3) + { + xx->t38.v34_rate = t38_v34rate_to_bps(buf, len); + span_log(&s->logging, SPAN_LOG_FLOW, "V.34 rate %d bps\n", xx->t38.v34_rate); + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for V34rate message - %d\n", len); + } + /*endif*/ + break; + default: + break; + } + /*endswitch*/ + return 0; + default: + break; + } + /*endswitch*/ + switch (field_type) + { + case T38_FIELD_HDLC_DATA: + xx->current_rx_field_class = T38_FIELD_CLASS_HDLC; + hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; + if (hdlc_buf->contents != (data_type | FLAG_DATA)) + { + queue_missing_indicator(s, data_type); + /* All real HDLC messages in the FAX world start with 0xFF. If this one is not starting + with 0xFF it would appear some octets must have been missed before this one. */ + if (len <= 0 || buf[0] != 0xFF) + s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in].flags |= HDLC_FLAG_MISSING_DATA; + hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; + } + /*endif*/ + /* Check if this data would overflow the buffer. */ + if (len <= 0 || hdlc_buf->len + len > T38_MAX_HDLC_LEN) + break; + /*endif*/ + hdlc_buf->contents = (data_type | FLAG_DATA); + bit_reverse(&hdlc_buf->buf[hdlc_buf->len], buf, len); + /* We need to send out the control messages as they are arriving. They are + too slow to capture a whole frame before starting to pass it on. + For the faster frames, take in the whole frame before sending it out. Also, there + is no need to monitor, or modify, the contents of the faster frames. */ + if (data_type == T38_DATA_V21) + { + for (i = 1; i <= len; i++) + edit_control_messages(s, 0, hdlc_buf->buf, hdlc_buf->len + i); + /*endfor*/ + /* Don't start pumping data into the actual output stream until there is + enough backlog to create some elasticity for jitter tolerance. */ + if (hdlc_buf->len + len >= HDLC_START_BUFFER_LEVEL) + { + if (s->core.hdlc_to_modem.in == s->core.hdlc_to_modem.out) + { + /* Output is not running, so kick it into life. */ + if ((hdlc_buf->flags & HDLC_FLAG_PROCEED_WITH_OUTPUT) == 0) + hdlc_tx_frame(&s->audio.modems.hdlc_tx, hdlc_buf->buf, hdlc_buf->len + len); + else + hdlc_tx_frame(&s->audio.modems.hdlc_tx, hdlc_buf->buf + hdlc_buf->len, len); + /*endif*/ + } + /*endif*/ + hdlc_buf->flags |= HDLC_FLAG_PROCEED_WITH_OUTPUT; + } + /*endif*/ + } + /*endif*/ + s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in].len += len; + break; + case T38_FIELD_HDLC_FCS_OK: + xx->current_rx_field_class = T38_FIELD_CLASS_HDLC; + hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; + if (len > 0) + { + span_log(&s->logging, SPAN_LOG_WARNING, "There is data in a T38_FIELD_HDLC_FCS_OK!\n"); + /* The sender has incorrectly included data in this message. It is unclear what we should do + with it, to maximise tolerance of buggy implementations. */ + } + /*endif*/ + /* Some T.38 implementations send multiple T38_FIELD_HDLC_FCS_OK messages, in IFP packets with + incrementing sequence numbers, which are actually repeats. They get through to this point because + of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ + if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type) + { + span_log(&s->logging, SPAN_LOG_FLOW, "HDLC frame type %s - CRC good\n", t30_frametype(hdlc_buf->buf[2])); + if (hdlc_buf->contents != (data_type | FLAG_DATA)) + { + queue_missing_indicator(s, data_type); + hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; + } + /*endif*/ + if (data_type == T38_DATA_V21) + { + if ((hdlc_buf->flags & HDLC_FLAG_MISSING_DATA) == 0) + { + monitor_control_messages(s, FALSE, hdlc_buf->buf, hdlc_buf->len); + if (s->core.real_time_frame_handler) + s->core.real_time_frame_handler(s, s->core.real_time_frame_user_data, FALSE, hdlc_buf->buf, hdlc_buf->len); + /*endif*/ + } + /*endif*/ + } + else + { + /* Make sure we go back to short training if CTC/CTR has kicked us into + long training. There has to be more than one value HDLC frame in a + chunk of image data, so just setting short training mode here should + be enough. */ + s->core.short_train = TRUE; + } + /*endif*/ + hdlc_buf->contents = (data_type | FLAG_DATA); + finalise_hdlc_frame(s, TRUE); + } + /*endif*/ + xx->corrupt_current_frame[0] = FALSE; + break; + case T38_FIELD_HDLC_FCS_BAD: + xx->current_rx_field_class = T38_FIELD_CLASS_HDLC; + hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; + if (len > 0) + { + span_log(&s->logging, SPAN_LOG_WARNING, "There is data in a T38_FIELD_HDLC_FCS_BAD!\n"); + /* The sender has incorrectly included data in this message. We can safely ignore it, as the + bad FCS means we will throw away the whole message, anyway. */ + } + /*endif*/ + /* Some T.38 implementations send multiple T38_FIELD_HDLC_FCS_BAD messages, in IFP packets with + incrementing sequence numbers, which are actually repeats. They get through to this point because + of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ + if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type) + { + span_log(&s->logging, SPAN_LOG_FLOW, "HDLC frame type %s - CRC bad\n", t30_frametype(hdlc_buf->buf[2])); + /* Only bother with frames that have a bad CRC, if they also have some content. */ + if (hdlc_buf->len > 0) + { + if (hdlc_buf->contents != (data_type | FLAG_DATA)) + { + queue_missing_indicator(s, data_type); + hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; + } + /*endif*/ + hdlc_buf->contents = (data_type | FLAG_DATA); + finalise_hdlc_frame(s, FALSE); + } + else + { + /* Just restart using the current frame buffer */ + hdlc_buf->contents = 0; + } + /*endif*/ + } + /*endif*/ + xx->corrupt_current_frame[0] = FALSE; + break; + case T38_FIELD_HDLC_FCS_OK_SIG_END: + xx->current_rx_field_class = T38_FIELD_CLASS_HDLC; + hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; + if (len > 0) + { + span_log(&s->logging, SPAN_LOG_WARNING, "There is data in a T38_FIELD_HDLC_FCS_OK_SIG_END!\n"); + /* The sender has incorrectly included data in this message. It is unclear what we should do + with it, to maximise tolerance of buggy implementations. */ + } + /*endif*/ + /* Some T.38 implementations send multiple T38_FIELD_HDLC_FCS_OK_SIG_END messages, in IFP packets with + incrementing sequence numbers, which are actually repeats. They get through to this point because + of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ + if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type) + { + span_log(&s->logging, SPAN_LOG_FLOW, "HDLC frame type %s - CRC OK, sig end\n", t30_frametype(hdlc_buf->buf[2])); + if (hdlc_buf->contents != (data_type | FLAG_DATA)) + { + queue_missing_indicator(s, data_type); + hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; + } + /*endif*/ + if (data_type == T38_DATA_V21) + { + if ((hdlc_buf->flags & HDLC_FLAG_MISSING_DATA) == 0) + { + monitor_control_messages(s, FALSE, hdlc_buf->buf, hdlc_buf->len); + if (s->core.real_time_frame_handler) + s->core.real_time_frame_handler(s, s->core.real_time_frame_user_data, FALSE, hdlc_buf->buf, hdlc_buf->len); + /*endif*/ + } + /*endif*/ + } + else + { + /* Make sure we go back to short training if CTC/CTR has kicked us into + long training. There has to be more than one value HDLC frame in a + chunk of image data, so just setting short training mode here should + be enough. */ + s->core.short_train = TRUE; + } + /*endif*/ + hdlc_buf->contents = (data_type | FLAG_DATA); + finalise_hdlc_frame(s, TRUE); + queue_missing_indicator(s, T38_DATA_NONE); + xx->current_rx_field_class = T38_FIELD_CLASS_NONE; + } + /*endif*/ + xx->corrupt_current_frame[0] = FALSE; + break; + case T38_FIELD_HDLC_FCS_BAD_SIG_END: + xx->current_rx_field_class = T38_FIELD_CLASS_HDLC; + hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; + if (len > 0) + { + span_log(&s->logging, SPAN_LOG_WARNING, "There is data in a T38_FIELD_HDLC_FCS_BAD_SIG_END!\n"); + /* The sender has incorrectly included data in this message. We can safely ignore it, as the + bad FCS means we will throw away the whole message, anyway. */ + } + /*endif*/ + /* Some T.38 implementations send multiple T38_FIELD_HDLC_FCS_BAD_SIG_END messages, in IFP packets with + incrementing sequence numbers, which are actually repeats. They get through to this point because + of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ + if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type) + { + span_log(&s->logging, SPAN_LOG_FLOW, "HDLC frame type %s - CRC bad, sig end\n", t30_frametype(hdlc_buf->buf[2])); + if (hdlc_buf->contents != (data_type | FLAG_DATA)) + { + queue_missing_indicator(s, data_type); + hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; + } + /*endif*/ + /* Only bother with frames that have a bad CRC, if they also have some content. */ + if (hdlc_buf->len > 0) + { + hdlc_buf->contents = (data_type | FLAG_DATA); + finalise_hdlc_frame(s, FALSE); + } + else + { + /* Just restart using the current frame buffer */ + hdlc_buf->contents = 0; + } + /*endif*/ + queue_missing_indicator(s, T38_DATA_NONE); + xx->current_rx_field_class = T38_FIELD_CLASS_NONE; + } + /*endif*/ + xx->corrupt_current_frame[0] = FALSE; + break; + case T38_FIELD_HDLC_SIG_END: + hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; + if (len > 0) + { + span_log(&s->logging, SPAN_LOG_WARNING, "There is data in a T38_FIELD_HDLC_SIG_END!\n"); + /* The sender has incorrectly included data in this message, but there seems nothing meaningful + it could be. There could not be an FCS good/bad report beyond this. */ + } + /*endif*/ + /* Some T.38 implementations send multiple T38_FIELD_HDLC_SIG_END messages, in IFP packets with + incrementing sequence numbers, which are actually repeats. They get through to this point because + of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ + if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type) + { + if (hdlc_buf->contents != (data_type | FLAG_DATA)) + { + queue_missing_indicator(s, data_type); + hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; + } + /* WORKAROUND: At least some Mediatrix boxes have a bug, where they can send this message at the + end of non-ECM data. We need to tolerate this. */ + if (xx->current_rx_field_class == T38_FIELD_CLASS_NON_ECM) + { + span_log(&s->logging, SPAN_LOG_WARNING, "T38_FIELD_HDLC_SIG_END received at the end of non-ECM data!\n"); + /* Don't flow control the data any more. Just pump out the remainder as fast as we can. */ + t38_non_ecm_buffer_push(&s->core.non_ecm_to_modem); + } + else + { + /* This message is expected under 2 circumstances. One is as an alternative to T38_FIELD_HDLC_FCS_OK_SIG_END - + i.e. they send T38_FIELD_HDLC_FCS_OK, and then T38_FIELD_HDLC_SIG_END when the carrier actually drops. + The other is because the HDLC signal drops unexpectedly - i.e. not just after a final frame. In + this case we just clear out any partial frame data that might be in the buffer. */ + /* TODO: what if any junk in the buffer has reached the HDLC_FLAG_PROCEED_WITH_OUTPUT stage? */ + hdlc_buf->len = 0; + hdlc_buf->flags = 0; + hdlc_buf->contents = 0; + } + /*endif*/ + queue_missing_indicator(s, T38_DATA_NONE); + xx->current_rx_field_class = T38_FIELD_CLASS_NONE; + } + /*endif*/ + xx->corrupt_current_frame[0] = FALSE; + break; + case T38_FIELD_T4_NON_ECM_DATA: + xx->current_rx_field_class = T38_FIELD_CLASS_NON_ECM; + hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; + if (hdlc_buf->contents != (data_type | FLAG_DATA)) + { + queue_missing_indicator(s, data_type); + hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; + } + if (len > 0) + t38_non_ecm_buffer_inject(&s->core.non_ecm_to_modem, buf, len); + xx->corrupt_current_frame[0] = FALSE; + break; + case T38_FIELD_T4_NON_ECM_SIG_END: + hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; + /* Some T.38 implementations send multiple T38_FIELD_T4_NON_ECM_SIG_END messages, in IFP packets with + incrementing sequence numbers, which are actually repeats. They get through to this point because + of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ + if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type) + { + /* WORKAROUND: At least some Mediatrix boxes have a bug, where they can send HDLC signal end where + they should send non-ECM signal end. It is possible they also do the opposite. + We need to tolerate this. */ + if (xx->current_rx_field_class == T38_FIELD_CLASS_NON_ECM) + { + if (len > 0) + { + if (hdlc_buf->contents != (data_type | FLAG_DATA)) + { + queue_missing_indicator(s, data_type); + hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; + } + /*endif*/ + t38_non_ecm_buffer_inject(&s->core.non_ecm_to_modem, buf, len); + } + /*endif*/ + if (hdlc_buf->contents != (data_type | FLAG_DATA)) + { + queue_missing_indicator(s, data_type); + hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; + } + /*endif*/ + /* Don't flow control the data any more. Just pump out the remainder as fast as we can. */ + t38_non_ecm_buffer_push(&s->core.non_ecm_to_modem); + } + else + { + span_log(&s->logging, SPAN_LOG_WARNING, "T38_FIELD_NON_ECM_SIG_END received at the end of HDLC data!\n"); + if (s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in].contents != (data_type | FLAG_DATA)) + { + queue_missing_indicator(s, data_type); + hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; + } + /*endif*/ + /* TODO: what if any junk in the buffer has reached the HDLC_FLAG_PROCEED_WITH_OUTPUT stage? */ + hdlc_buf->len = 0; + hdlc_buf->flags = 0; + hdlc_buf->contents = 0; + } + /*endif*/ + queue_missing_indicator(s, T38_DATA_NONE); + xx->current_rx_field_class = T38_FIELD_CLASS_NONE; + } + /*endif*/ + xx->corrupt_current_frame[0] = FALSE; + break; + default: + break; + } + /*endswitch*/ + +#if 0 + if (span_log_test(&s->logging, SPAN_LOG_FLOW)) + { + int i; + + if (len > 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Data: "); + for (i = 0; i < len; i++) + span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, " %02X", buf[i]); + /*endfor*/ + } + /*endif*/ + } + /*endif*/ + span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, "\n"); +#endif + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void set_octets_per_data_packet(t38_gateway_state_t *s, int bit_rate) +{ + int octets; + + octets = MS_PER_TX_CHUNK*bit_rate/(8*1000); + if (octets < 1) + octets = 1; + /*endif*/ + s->core.to_t38.octets_per_data_packet = octets; +} +/*- End of function --------------------------------------------------------*/ + +static int set_slow_packetisation(t38_gateway_state_t *s) +{ + set_octets_per_data_packet(s, 300); + s->t38x.current_tx_data_type = T38_DATA_V21; + return T38_IND_V21_PREAMBLE; +} +/*- End of function --------------------------------------------------------*/ + +static int set_fast_packetisation(t38_gateway_state_t *s) +{ + int ind; + + ind = T38_IND_NO_SIGNAL; + switch (s->core.fast_rx_active) + { + case T38_V17_RX: + set_octets_per_data_packet(s, s->core.fast_bit_rate); + switch (s->core.fast_bit_rate) + { + case 7200: + ind = (s->core.short_train) ? T38_IND_V17_7200_SHORT_TRAINING : T38_IND_V17_7200_LONG_TRAINING; + s->t38x.current_tx_data_type = T38_DATA_V17_7200; + break; + case 9600: + ind = (s->core.short_train) ? T38_IND_V17_9600_SHORT_TRAINING : T38_IND_V17_9600_LONG_TRAINING; + s->t38x.current_tx_data_type = T38_DATA_V17_9600; + break; + case 12000: + ind = (s->core.short_train) ? T38_IND_V17_12000_SHORT_TRAINING : T38_IND_V17_12000_LONG_TRAINING; + s->t38x.current_tx_data_type = T38_DATA_V17_12000; + break; + default: + case 14400: + ind = (s->core.short_train) ? T38_IND_V17_14400_SHORT_TRAINING : T38_IND_V17_14400_LONG_TRAINING; + s->t38x.current_tx_data_type = T38_DATA_V17_14400; + break; + } + break; + case T38_V27TER_RX: + set_octets_per_data_packet(s, s->core.fast_bit_rate); + switch (s->core.fast_bit_rate) + { + case 2400: + ind = T38_IND_V27TER_2400_TRAINING; + s->t38x.current_tx_data_type = T38_DATA_V27TER_2400; + break; + default: + case 4800: + ind = T38_IND_V27TER_4800_TRAINING; + s->t38x.current_tx_data_type = T38_DATA_V27TER_4800; + break; + } + break; + case T38_V29_RX: + set_octets_per_data_packet(s, s->core.fast_bit_rate); + switch (s->core.fast_bit_rate) + { + case 7200: + ind = T38_IND_V29_7200_TRAINING; + s->t38x.current_tx_data_type = T38_DATA_V29_7200; + break; + default: + case 9600: + ind = T38_IND_V29_9600_TRAINING; + s->t38x.current_tx_data_type = T38_DATA_V29_9600; + break; + } + break; + } + return ind; +} +/*- End of function --------------------------------------------------------*/ + +static void announce_training(t38_gateway_state_t *s) +{ + t38_core_send_indicator(&s->t38x.t38, set_fast_packetisation(s)); +} +/*- End of function --------------------------------------------------------*/ + +static void non_ecm_rx_status(void *user_data, int status) +{ + t38_gateway_state_t *s; + + s = (t38_gateway_state_t *) user_data; + span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM signal status is %s (%d)\n", signal_status_to_str(status), status); + switch (status) + { + case SIG_STATUS_TRAINING_IN_PROGRESS: + if (s->core.timed_mode == TIMED_MODE_IDLE) + { + announce_training(s); + } + else + { + if (s->core.timed_mode == TIMED_MODE_TCF_PREDICTABLE_MODEM_START_PAST_V21_MODEM) + s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_SEEN; + else + s->core.samples_to_timeout = ms_to_samples(500); + set_fast_packetisation(s); + } + break; + case SIG_STATUS_TRAINING_FAILED: + break; + case SIG_STATUS_TRAINING_SUCCEEDED: + /* The modem is now trained */ + s->audio.modems.rx_signal_present = TRUE; + s->audio.modems.rx_trained = TRUE; + s->core.timed_mode = TIMED_MODE_IDLE; + s->core.samples_to_timeout = 0; + to_t38_buffer_init(&s->core.to_t38); + break; + case SIG_STATUS_CARRIER_UP: + break; + case SIG_STATUS_CARRIER_DOWN: + switch (s->t38x.current_tx_data_type) + { + case T38_DATA_V17_7200: + case T38_DATA_V17_9600: + case T38_DATA_V17_12000: + case T38_DATA_V17_14400: + case T38_DATA_V27TER_2400: + case T38_DATA_V27TER_4800: + case T38_DATA_V29_7200: + case T38_DATA_V29_9600: + if (s->core.timed_mode != TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED) + { + /* TODO: If the carrier really did fall for good during the 500ms TEP blocking timeout, we + won't declare the no-signal condition. */ + non_ecm_push_residue(s); + t38_core_send_indicator(&s->t38x.t38, T38_IND_NO_SIGNAL); + } + restart_rx_modem(s); + break; + } + break; + default: + span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected non-ECM special bit - %d!\n", status); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void to_t38_buffer_init(t38_gateway_to_t38_state_t *s) +{ + s->data_ptr = 0; + s->bit_stream = 0xFFFF; + s->bit_no = 0; + + s->in_bits = 0; + s->out_octets = 0; +} +/*- End of function --------------------------------------------------------*/ + +static void non_ecm_push_residue(t38_gateway_state_t *t) +{ + t38_gateway_to_t38_state_t *s; + + s = &t->core.to_t38; + if (s->bit_no) + { + /* There is a fractional octet in progress. We might as well send every last bit we can. */ + s->data[s->data_ptr++] = (uint8_t) (s->bit_stream << (8 - s->bit_no)); + } + t38_core_send_data(&t->t38x.t38, t->t38x.current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, s->data, s->data_ptr, T38_PACKET_CATEGORY_IMAGE_DATA_END); + s->in_bits += s->bits_absorbed; + s->out_octets += s->data_ptr; + s->data_ptr = 0; +} +/*- End of function --------------------------------------------------------*/ + +static void non_ecm_push(t38_gateway_state_t *t) +{ + t38_gateway_to_t38_state_t *s; + + s = &t->core.to_t38; + if (s->data_ptr) + { + t38_core_send_data(&t->t38x.t38, t->t38x.current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, s->data, s->data_ptr, T38_PACKET_CATEGORY_IMAGE_DATA); + s->in_bits += s->bits_absorbed; + s->out_octets += s->data_ptr; + s->bits_absorbed = 0; + s->data_ptr = 0; + } + /*endif*/ +} +/*- End of function --------------------------------------------------------*/ + +static void non_ecm_put_bit(void *user_data, int bit) +{ + t38_gateway_state_t *t; + t38_gateway_to_t38_state_t *s; + + if (bit < 0) + { + non_ecm_rx_status(user_data, bit); + return; + } + t = (t38_gateway_state_t *) user_data; + s = &t->core.to_t38; + + s->in_bits++; + bit &= 1; + s->bit_stream = (s->bit_stream << 1) | bit; + if (++s->bit_no >= 8) + { + s->data[s->data_ptr++] = (uint8_t) s->bit_stream & 0xFF; + if (s->data_ptr >= s->octets_per_data_packet) + non_ecm_push(t); + s->bit_no = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +static void non_ecm_remove_fill_and_put_bit(void *user_data, int bit) +{ + t38_gateway_state_t *t; + t38_gateway_to_t38_state_t *s; + + if (bit < 0) + { + non_ecm_rx_status(user_data, bit); + return; + } + t = (t38_gateway_state_t *) user_data; + s = &t->core.to_t38; + + s->bits_absorbed++; + bit &= 1; + /* Drop any extra zero bits when we already have enough for an EOL symbol. */ + /* The snag here is that if we just look for 11 bits, a line ending with + a code that has trailing zero bits will cause problems. The longest run of + trailing zeros for any code is 3, so we need to look for at least 14 zeros + if we don't want to actually analyse the compressed data in depth. This means + we do not strip every fill bit, but we strip most of them. */ + if ((s->bit_stream & 0x3FFF) == 0 && bit == 0) + { + if (s->bits_absorbed > 2*8*s->octets_per_data_packet) + { + /* We need to pump out what we have, even though we have not accumulated a full + buffer of data. If we don't, we stand to delay rows excessively, so the far + end gateway (assuming the far end is a gateway) cannot play them out. */ + non_ecm_push(t); + } + return; + } + s->bit_stream = (s->bit_stream << 1) | bit; + if (++s->bit_no >= 8) + { + s->data[s->data_ptr++] = (uint8_t) s->bit_stream & 0xFF; + if (s->data_ptr >= s->octets_per_data_packet) + non_ecm_push(t); + s->bit_no = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +static void hdlc_rx_status(hdlc_rx_state_t *t, int status) +{ + t38_gateway_state_t *s; + int category; + + s = (t38_gateway_state_t *) t->frame_user_data; + span_log(&s->logging, SPAN_LOG_FLOW, "HDLC signal status is %s (%d)\n", signal_status_to_str(status), status); + switch (status) + { + case SIG_STATUS_TRAINING_IN_PROGRESS: + announce_training(s); + break; + case SIG_STATUS_TRAINING_FAILED: + break; + case SIG_STATUS_TRAINING_SUCCEEDED: + /* The modem is now trained. */ + s->audio.modems.rx_signal_present = TRUE; + s->audio.modems.rx_trained = TRUE; + /* Behave like HDLC preamble has been announced. */ + t->framing_ok_announced = TRUE; + to_t38_buffer_init(&s->core.to_t38); + break; + case SIG_STATUS_CARRIER_UP: + /* Reset the HDLC receiver. */ + t->raw_bit_stream = 0; + t->len = 0; + t->num_bits = 0; + t->flags_seen = 0; + t->framing_ok_announced = FALSE; + to_t38_buffer_init(&s->core.to_t38); + break; + case SIG_STATUS_CARRIER_DOWN: + if (t->framing_ok_announced) + { + category = (s->t38x.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA_END : T38_PACKET_CATEGORY_IMAGE_DATA_END; + t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_SIG_END, NULL, 0, category); + t38_core_send_indicator(&s->t38x.t38, T38_IND_NO_SIGNAL); + t->framing_ok_announced = FALSE; + } + restart_rx_modem(s); + if (s->core.timed_mode == TIMED_MODE_TCF_PREDICTABLE_MODEM_START_BEGIN) + { + /* If we are doing TCF, we need to announce the fast carrier training very + quickly, to ensure it starts 75+-20ms after the HDLC carrier ends. Waiting until + it trains will be too late. We need to announce the fast modem a fixed time after + the end of the V.21 carrier, in anticipation of its arrival. If we announce it, + and it doesn't arrive, we will worry about that later. */ + s->core.samples_to_timeout = ms_to_samples(75); + s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_PAST_V21_MODEM; + } + break; + default: + span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected HDLC special bit - %d!\n", status); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void rx_flag_or_abort(hdlc_rx_state_t *t) +{ + t38_gateway_state_t *s; + t38_gateway_to_t38_state_t *u; + int category; + + s = (t38_gateway_state_t *) t->frame_user_data; + u = &s->core.to_t38; + if ((t->raw_bit_stream & 0x80)) + { + /* Hit HDLC abort */ + t->rx_aborts++; + if (t->flags_seen < t->framing_ok_threshold) + t->flags_seen = 0; + else + t->flags_seen = t->framing_ok_threshold - 1; + /*endif*/ + } + else + { + /* Hit HDLC flag */ + if (t->flags_seen >= t->framing_ok_threshold) + { + category = (s->t38x.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA : T38_PACKET_CATEGORY_IMAGE_DATA; + if (t->len) + { + /* This is not back-to-back flags */ + if (t->len >= 2) + { + if (u->data_ptr) + { + bit_reverse(u->data, t->buffer + t->len - 2 - u->data_ptr, u->data_ptr); + t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_DATA, u->data, u->data_ptr, category); + } + /*endif*/ + if (t->num_bits != 7) + { + t->rx_crc_errors++; + span_log(&s->logging, SPAN_LOG_FLOW, "HDLC frame type %s, misaligned terminating flag at %d\n", t30_frametype(t->buffer[2]), t->len); + /* It seems some boxes may not like us sending a _SIG_END here, and then another + when the carrier actually drops. Lets just send T38_FIELD_HDLC_FCS_OK here. */ + if (t->len > 2) + t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_FCS_BAD, NULL, 0, category); + /*endif*/ + } + else if ((u->crc & 0xFFFF) != 0xF0B8) + { + t->rx_crc_errors++; + span_log(&s->logging, SPAN_LOG_FLOW, "HDLC frame type %s, bad CRC at %d\n", t30_frametype(t->buffer[2]), t->len); + /* It seems some boxes may not like us sending a _SIG_END here, and then another + when the carrier actually drops. Lets just send T38_FIELD_HDLC_FCS_OK here. */ + if (t->len > 2) + t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_FCS_BAD, NULL, 0, category); + /*endif*/ + } + else + { + t->rx_frames++; + t->rx_bytes += t->len - 2; + span_log(&s->logging, SPAN_LOG_FLOW, "HDLC frame type %s, CRC OK\n", t30_frametype(t->buffer[2])); + if (s->t38x.current_tx_data_type == T38_DATA_V21) + { + monitor_control_messages(s, TRUE, t->buffer, t->len - 2); + if (s->core.real_time_frame_handler) + s->core.real_time_frame_handler(s, s->core.real_time_frame_user_data, TRUE, t->buffer, t->len - 2); + /*endif*/ + } + else + { + /* Make sure we go back to short training if CTC/CTR has kicked us into + long training. Any successful HDLC frame received at a rate other than + V.21 is an adequate indication we should change. */ + s->core.short_train = TRUE; + } + /*endif*/ + /* It seems some boxes may not like us sending a _SIG_END here, and then another + when the carrier actually drops. Lets just send T38_FIELD_HDLC_FCS_OK here. */ + t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_FCS_OK, NULL, 0, category); + } + /*endif*/ + } + else + { + /* Frame too short */ + t->rx_length_errors++; + } + /*endif*/ + } + /*endif*/ + } + else + { + /* Check the flags are back-to-back when testing for valid preamble. This + greatly reduces the chances of false preamble detection, and anything + which doesn't send them back-to-back is badly broken. */ + if (t->num_bits != 7) + t->flags_seen = 0; + /*endif*/ + if (++t->flags_seen >= t->framing_ok_threshold && !t->framing_ok_announced) + { + if (s->t38x.current_tx_data_type == T38_DATA_V21) + { + t38_core_send_indicator(&s->t38x.t38, set_slow_packetisation(s)); + s->audio.modems.rx_signal_present = TRUE; + } + /*endif*/ + if (s->t38x.in_progress_rx_indicator == T38_IND_CNG) + set_next_tx_type(s); + /*endif*/ + t->framing_ok_announced = TRUE; + } + /*endif*/ + } + /*endif*/ + } + /*endif*/ + t->len = 0; + t->num_bits = 0; + u->crc = 0xFFFF; + u->data_ptr = 0; + s->t38x.corrupt_current_frame[1] = FALSE; +} +/*- End of function --------------------------------------------------------*/ + +static void t38_hdlc_rx_put_bit(hdlc_rx_state_t *t, int new_bit) +{ + t38_gateway_state_t *s; + t38_gateway_to_t38_state_t *u; + int category; + + if (new_bit < 0) + { + hdlc_rx_status(t, new_bit); + return; + } + /*endif*/ + t->raw_bit_stream = (t->raw_bit_stream << 1) | (new_bit & 1); + if ((t->raw_bit_stream & 0x3F) == 0x3E) + { + /* Its time to either skip a bit, for stuffing, or process a flag or abort */ + if ((t->raw_bit_stream & 0x40)) + rx_flag_or_abort(t); + return; + } + /*endif*/ + t->num_bits++; + if (!t->framing_ok_announced) + return; + /*endif*/ + t->byte_in_progress = (t->byte_in_progress >> 1) | ((t->raw_bit_stream & 0x01) << 7); + if (t->num_bits != 8) + return; + /*endif*/ + t->num_bits = 0; + if (t->len >= (int) sizeof(t->buffer)) + { + /* This is too long. Abandon the frame, and wait for the next flag octet. */ + t->rx_length_errors++; + t->flags_seen = t->framing_ok_threshold - 1; + t->len = 0; + return; + } + /*endif*/ + s = (t38_gateway_state_t *) t->frame_user_data; + u = &s->core.to_t38; + t->buffer[t->len] = (uint8_t) t->byte_in_progress; + /* Calculate the CRC progressively, before we start altering the frame */ + u->crc = crc_itu16_calc(&t->buffer[t->len], 1, u->crc); + /* Make the transmission lag by two octets, so we do not send the CRC, and + do not report the CRC result too late. */ + if (++t->len <= 2) + return; + /*endif*/ + if (s->t38x.current_tx_data_type == T38_DATA_V21) + { + /* The V.21 control messages need to be monitored, and possibly corrupted, to manage the + man-in-the-middle role of T.38 */ + edit_control_messages(s, 1, t->buffer, t->len); + } + if (++u->data_ptr >= u->octets_per_data_packet) + { + bit_reverse(u->data, t->buffer + t->len - 2 - u->data_ptr, u->data_ptr); + category = (s->t38x.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA : T38_PACKET_CATEGORY_IMAGE_DATA; + t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_DATA, u->data, u->data_ptr, category); + /* Since we delay transmission by 2 octets, we should now have sent the last of the data octets when + we have just received the last of the CRC octets. */ + u->data_ptr = 0; + } + /*endif*/ +} +/*- End of function --------------------------------------------------------*/ + +static int restart_rx_modem(t38_gateway_state_t *s) +{ + put_bit_func_t put_bit_func; + void *put_bit_user_data; + + if (s->core.to_t38.in_bits || s->core.to_t38.out_octets) + { + span_log(&s->logging, + SPAN_LOG_FLOW, + "%d incoming audio bits. %d outgoing T.38 octets\n", + s->core.to_t38.in_bits, + s->core.to_t38.out_octets); + s->core.to_t38.in_bits = 0; + s->core.to_t38.out_octets = 0; + } + span_log(&s->logging, SPAN_LOG_FLOW, "Restart rx modem - modem = %d, short train = %d, ECM = %d\n", s->core.fast_rx_modem, s->core.short_train, s->core.ecm_mode); + + hdlc_rx_init(&(s->audio.modems.hdlc_rx), FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, NULL, s); + s->audio.modems.rx_signal_present = FALSE; + s->audio.modems.rx_trained = FALSE; + /* Default to the transmit data being V.21, unless a faster modem pops up trained. */ + s->t38x.current_tx_data_type = T38_DATA_V21; + fsk_rx_init(&(s->audio.modems.v21_rx), &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) t38_hdlc_rx_put_bit, &(s->audio.modems.hdlc_rx)); +#if 0 + fsk_rx_signal_cutoff(&(s->audio.modems.v21_rx), -45.5f); +#endif + if (s->core.image_data_mode && s->core.ecm_mode) + { + put_bit_func = (put_bit_func_t) t38_hdlc_rx_put_bit; + put_bit_user_data = (void *) &(s->audio.modems.hdlc_rx); + } + else + { + if (s->core.image_data_mode && s->core.to_t38.fill_bit_removal) + put_bit_func = non_ecm_remove_fill_and_put_bit; + else + put_bit_func = non_ecm_put_bit; + put_bit_user_data = (void *) s; + } + /*endif*/ + to_t38_buffer_init(&s->core.to_t38); + s->core.to_t38.octets_per_data_packet = 1; + switch (s->core.fast_rx_modem) + { + case T38_V17_RX: + v17_rx_restart(&s->audio.modems.v17_rx, s->core.fast_bit_rate, s->core.short_train); + v17_rx_set_put_bit(&s->audio.modems.v17_rx, put_bit_func, put_bit_user_data); + set_rx_handler(s, (span_rx_handler_t *) &v17_v21_rx, s); + s->core.fast_rx_active = T38_V17_RX; + break; + case T38_V27TER_RX: + v27ter_rx_restart(&s->audio.modems.v27ter_rx, s->core.fast_bit_rate, FALSE); + v27ter_rx_set_put_bit(&s->audio.modems.v27ter_rx, put_bit_func, put_bit_user_data); + set_rx_handler(s, (span_rx_handler_t *) &v27ter_v21_rx, s); + s->core.fast_rx_active = T38_V27TER_RX; + break; + case T38_V29_RX: + v29_rx_restart(&s->audio.modems.v29_rx, s->core.fast_bit_rate, FALSE); + v29_rx_set_put_bit(&s->audio.modems.v29_rx, put_bit_func, put_bit_user_data); + set_rx_handler(s, (span_rx_handler_t *) &v29_v21_rx, s); + s->core.fast_rx_active = T38_V29_RX; + break; + default: + set_rx_handler(s, (span_rx_handler_t *) &fsk_rx, &(s->audio.modems.v21_rx)); + s->core.fast_rx_active = T38_NONE; + break; + } + /*endswitch*/ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t38_gateway_rx(t38_gateway_state_t *s, int16_t amp[], int len) +{ + int i; + +#if defined(LOG_FAX_AUDIO) + if (s->audio.modems.audio_rx_log >= 0) + write(s->audio.modems.audio_rx_log, amp, len*sizeof(int16_t)); + /*endif*/ +#endif + if (s->core.samples_to_timeout > 0) + { + if ((s->core.samples_to_timeout -= len) <= 0) + { + switch (s->core.timed_mode) + { + case TIMED_MODE_TCF_PREDICTABLE_MODEM_START_PAST_V21_MODEM: + /* Timed announcement of training, 75ms after the DCS carrier fell. */ + s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED; + announce_training(s); + break; + case TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_SEEN: + /* Timed announcement of training, 75ms after the DCS carrier fell. */ + /* Use a timeout to ride over TEP, if it is present */ + s->core.samples_to_timeout = ms_to_samples(500); + s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED; + announce_training(s); + break; + case TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED: + s->core.timed_mode = TIMED_MODE_IDLE; + span_log(&s->logging, SPAN_LOG_FLOW, "TEP jamming expired\n"); + break; + case TIMED_MODE_STARTUP: + /* Ensure a no-signal condition goes out the moment the received audio starts */ + t38_core_send_indicator(&s->t38x.t38, T38_IND_NO_SIGNAL); + s->core.timed_mode = TIMED_MODE_IDLE; + break; + } + /*endswitch*/ + } + /*endif*/ + } + /*endif*/ + for (i = 0; i < len; i++) + amp[i] = dc_restore(&(s->audio.modems.dc_restore), amp[i]); + /*endfor*/ + s->audio.modems.rx_handler(s->audio.modems.rx_user_data, amp, len); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t38_gateway_tx(t38_gateway_state_t *s, int16_t amp[], int max_len) +{ + int len; +#if defined(LOG_FAX_AUDIO) + int required_len; + + required_len = max_len; +#endif + if ((len = s->audio.modems.tx_handler(s->audio.modems.tx_user_data, amp, max_len)) < max_len) + { + if (set_next_tx_type(s)) + { + /* Give the new handler a chance to file the remaining buffer space */ + len += s->audio.modems.tx_handler(s->audio.modems.tx_user_data, amp + len, max_len - len); + if (len < max_len) + { + silence_gen_set(&(s->audio.modems.silence_gen), 0); + set_next_tx_type(s); + } + /*endif*/ + } + /*endif*/ + } + /*endif*/ + if (s->audio.modems.transmit_on_idle) + { + /* Pad to the requested length with silence */ + memset(amp + len, 0, (max_len - len)*sizeof(int16_t)); + len = max_len; + } + /*endif*/ +#if defined(LOG_FAX_AUDIO) + if (s->audio.modems.audio_tx_log >= 0) + { + if (len < required_len) + memset(amp + len, 0, (required_len - len)*sizeof(int16_t)); + /*endif*/ + write(s->audio.modems.audio_tx_log, amp, required_len*sizeof(int16_t)); + } + /*endif*/ +#endif + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_gateway_get_transfer_statistics(t38_gateway_state_t *s, t38_stats_t *t) +{ + memset(t, 0, sizeof(*t)); + t->bit_rate = s->core.fast_bit_rate; + t->error_correcting_mode = s->core.ecm_mode; + t->pages_transferred = s->core.pages_confirmed; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(t38_core_state_t *) t38_gateway_get_t38_core_state(t38_gateway_state_t *s) +{ + return &s->t38x.t38; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(logging_state_t *) t38_gateway_get_logging_state(t38_gateway_state_t *s) +{ + return &s->logging; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_gateway_set_ecm_capability(t38_gateway_state_t *s, int ecm_allowed) +{ + s->core.ecm_allowed = ecm_allowed; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_gateway_set_transmit_on_idle(t38_gateway_state_t *s, int transmit_on_idle) +{ + s->audio.modems.transmit_on_idle = transmit_on_idle; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_gateway_set_supported_modems(t38_gateway_state_t *s, int supported_modems) +{ + s->core.supported_modems = supported_modems; + if ((s->core.supported_modems & T30_SUPPORT_V17)) + t38_set_fastest_image_data_rate(&s->t38x.t38, 14400); + else if ((s->core.supported_modems & T30_SUPPORT_V29)) + t38_set_fastest_image_data_rate(&s->t38x.t38, 9600); + else + t38_set_fastest_image_data_rate(&s->t38x.t38, 4800); + /*endif*/ +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_gateway_set_nsx_suppression(t38_gateway_state_t *s, + const uint8_t *from_t38, + int from_t38_len, + const uint8_t *from_modem, + int from_modem_len) +{ + s->t38x.suppress_nsx_len[0] = (from_t38_len < 0 || from_t38_len < MAX_NSX_SUPPRESSION) ? (from_t38_len + 3) : 0; + s->t38x.suppress_nsx_len[1] = (from_modem_len < 0 || from_modem_len < MAX_NSX_SUPPRESSION) ? (from_modem_len + 3) : 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_gateway_set_tep_mode(t38_gateway_state_t *s, int use_tep) +{ + s->audio.modems.use_tep = use_tep; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_gateway_set_fill_bit_removal(t38_gateway_state_t *s, int remove) +{ + s->core.to_t38.fill_bit_removal = remove; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_gateway_set_real_time_frame_handler(t38_gateway_state_t *s, + t38_gateway_real_time_frame_handler_t *handler, + void *user_data) +{ + s->core.real_time_frame_handler = handler; + s->core.real_time_frame_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +static int t38_gateway_audio_init(t38_gateway_state_t *s) +{ + fax_modems_init(&s->audio.modems, + FALSE, + NULL, + hdlc_underflow_handler, + non_ecm_put_bit, + t38_non_ecm_buffer_get_bit, + tone_detected, + s); + /* We need to use progressive HDLC transmit, and a special HDLC receiver, which is different + from the other uses of FAX modems. */ + hdlc_tx_init(&s->audio.modems.hdlc_tx, FALSE, 2, TRUE, hdlc_underflow_handler, s); + fsk_rx_set_put_bit(&s->audio.modems.v21_rx, (put_bit_func_t) t38_hdlc_rx_put_bit, &s->audio.modems.hdlc_rx); + /* TODO: Don't use the very low cutoff levels we would like to. We get some quirks if we do. + We need to sort this out. */ + fsk_rx_signal_cutoff(&s->audio.modems.v21_rx, -30.0f); + v29_rx_signal_cutoff(&s->audio.modems.v29_rx, -28.5f); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int t38_gateway_t38_init(t38_gateway_state_t *t, + t38_tx_packet_handler_t *tx_packet_handler, + void *tx_packet_user_data) +{ + t38_gateway_t38_state_t *s; + + s = &t->t38x; + t38_core_init(&s->t38, + process_rx_indicator, + process_rx_data, + process_rx_missing, + (void *) t, + tx_packet_handler, + tx_packet_user_data); + t38_set_redundancy_control(&s->t38, T38_PACKET_CATEGORY_INDICATOR, INDICATOR_TX_COUNT); + t38_set_redundancy_control(&s->t38, T38_PACKET_CATEGORY_CONTROL_DATA, DATA_TX_COUNT); + t38_set_redundancy_control(&s->t38, T38_PACKET_CATEGORY_CONTROL_DATA_END, DATA_END_TX_COUNT); + t38_set_redundancy_control(&s->t38, T38_PACKET_CATEGORY_IMAGE_DATA, DATA_TX_COUNT); + t38_set_redundancy_control(&s->t38, T38_PACKET_CATEGORY_IMAGE_DATA_END, DATA_END_TX_COUNT); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(t38_gateway_state_t *) t38_gateway_init(t38_gateway_state_t *s, + t38_tx_packet_handler_t *tx_packet_handler, + void *tx_packet_user_data) +{ + if (tx_packet_handler == NULL) + return NULL; + /*endif*/ + if (s == NULL) + { + if ((s = (t38_gateway_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + /*endif*/ + } + /*endif*/ + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "T.38G"); + + t38_gateway_audio_init(s); + t38_gateway_t38_init(s, tx_packet_handler, tx_packet_user_data); + + set_rx_active(s, TRUE); + t38_gateway_set_supported_modems(s, T30_SUPPORT_V27TER | T30_SUPPORT_V29); + t38_gateway_set_nsx_suppression(s, (const uint8_t *) "\x00\x00\x00", 3, (const uint8_t *) "\x00\x00\x00", 3); + + s->core.to_t38.octets_per_data_packet = 1; + s->core.ecm_allowed = TRUE; + t38_non_ecm_buffer_init(&s->core.non_ecm_to_modem, FALSE, 0); + restart_rx_modem(s); + s->core.timed_mode = TIMED_MODE_STARTUP; + s->core.samples_to_timeout = 1; +#if defined(LOG_FAX_AUDIO) + { + char buf[100 + 1]; + struct tm *tm; + time_t now; + + time(&now); + tm = localtime(&now); + sprintf(buf, + "/tmp/t38-rx-audio-%p-%02d%02d%02d%02d%02d%02d", + s, + tm->tm_year%100, + tm->tm_mon + 1, + tm->tm_mday, + tm->tm_hour, + tm->tm_min, + tm->tm_sec); + s->audio.modems.audio_rx_log = open(buf, O_CREAT | O_TRUNC | O_WRONLY, 0666); + sprintf(buf, + "/tmp/t38-tx-audio-%p-%02d%02d%02d%02d%02d%02d", + s, + tm->tm_year%100, + tm->tm_mon + 1, + tm->tm_mday, + tm->tm_hour, + tm->tm_min, + tm->tm_sec); + s->audio.modems.audio_tx_log = open(buf, O_CREAT | O_TRUNC | O_WRONLY, 0666); + } +#endif + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t38_gateway_release(t38_gateway_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t38_gateway_free(t38_gateway_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/t38_non_ecm_buffer.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/t38_non_ecm_buffer.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,380 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t38_non_ecm_buffer.c - A rate adapting buffer for T.38 non-ECM image + * and TCF data + * + * Written by Steve Underwood + * + * Copyright (C) 2005, 2006, 2007, 2008 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t38_non_ecm_buffer.c,v 1.9.4.1 2009/12/19 06:43:28 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/queue.h" +#include "spandsp/dc_restore.h" +#include "spandsp/bit_operations.h" +#include "spandsp/async.h" +#include "spandsp/t38_non_ecm_buffer.h" + +#include "spandsp/private/t38_non_ecm_buffer.h" + +/* Phases */ +enum +{ + TCF_AT_INITIAL_ALL_ONES = 0, + TCF_AT_ALL_ZEROS = 1, + IMAGE_WAITING_FOR_FIRST_EOL = 2, + IMAGE_IN_PROGRESS = 3 +}; + +static void restart_buffer(t38_non_ecm_buffer_state_t *s) +{ + /* This should be called when draining the buffer is complete, which should + occur before any fresh data can possibly arrive to begin refilling it. */ + s->octet = 0xFF; + s->flow_control_fill_octet = 0xFF; + s->input_phase = (s->image_data_mode) ? IMAGE_WAITING_FOR_FIRST_EOL : TCF_AT_INITIAL_ALL_ONES; + s->bit_stream = 0xFFFF; + s->out_ptr = 0; + s->in_ptr = 0; + s->latest_eol_ptr = 0; + s->data_finished = FALSE; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) t38_non_ecm_buffer_get_bit(void *user_data) +{ + t38_non_ecm_buffer_state_t *s; + int bit; + + s = (t38_non_ecm_buffer_state_t *) user_data; + + if (s->bit_no <= 0) + { + /* We need another byte */ + if (s->out_ptr != s->latest_eol_ptr) + { + s->octet = s->data[s->out_ptr]; + s->out_ptr = (s->out_ptr + 1) & (T38_NON_ECM_TX_BUF_LEN - 1); + } + else + { + if (s->data_finished) + { + /* The queue is empty, and we have received the end of data signal. This must + really be the end to transmission. */ + restart_buffer(s); + return SIG_STATUS_END_OF_DATA; + } + /* The queue is blocked, but this does not appear to be the end of the data. Idle with + fill octets, which should be safe at this point. */ + s->octet = s->flow_control_fill_octet; + s->flow_control_fill_octets++; + } + s->out_octets++; + s->bit_no = 8; + } + s->bit_no--; + bit = (s->octet >> 7) & 1; + s->octet <<= 1; + return bit; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_non_ecm_buffer_push(t38_non_ecm_buffer_state_t *s) +{ + /* Don't flow control the data any more. Just push out the remainder of the data + in the buffer as fast as we can, and shut down. */ + s->latest_eol_ptr = s->in_ptr; + s->data_finished = TRUE; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_non_ecm_buffer_inject(t38_non_ecm_buffer_state_t *s, const uint8_t *buf, int len) +{ + int i; + int upper; + int lower; + + /* TCF consists of: + - zero or more ones, followed by + - about 1.5s of zeros + There may be a little junk at the end, as the modem shuts down. + + We can stuff with extra ones in the initial period of all ones, and we can stuff with extra + zeros once the zeros start. The thing we need to be wary about is the odd zero bit in the + midst of the ones, due to a bit error. */ + + /* Non-ECM image data consists of: + - zero or more ones, followed by + - zero or more zeros, followed by + - an EOL (end of line), which marks the start of the image, followed by + - a succession of data rows, with an EOL at the end of each, followed by + - an RTC (return to control) + There may be a little junk at the end, as the modem shuts down. + + An EOL 11 zeros followed by a one in a T.4 1D image or 11 zeros followed by a one followed + by a one or a zero in a T.4 2D image. An RTC consists of 6 EOLs in succession, with no + pixel data between them. + + We can stuff with ones until we get the first EOL into our buffer, then we can stuff with + zeros in front of each EOL at any point up the the RTC. We should not pad between the EOLs + which make up the RTC. Most FAX machines don't care about this, but a few will not recognise + the RTC if here is padding between the EOLs. + + We need to buffer whole rows before we output their beginning, so there is no possibility + of underflow mid-row. */ + + /* FoIP has latency issues, because of the fairly tight timeouts in the T.30 spec. We must + ensure our buffering does everything needed to avoid underflows, and to meet the minimum + row length requirements imposed by many mechanical FAX machines. We cannot, however, + afford to bulk up the data, by sending superfluous bytes. The resulting loop delay could + provoke an erroneous timeout of the acknowledgement signal. */ + + i = 0; + switch (s->input_phase) + { + case TCF_AT_INITIAL_ALL_ONES: + /* Dump initial 0xFF bytes. We will add enough of our own to makes things flow + smoothly. If we don't strip these off, we might end up delaying the start of + forwarding by a substantial amount, as we could end up with a large block of 0xFF + bytes before the real data begins. This is especially true with PC FAX + systems. This test is very simplistic, as bit errors could confuse it. */ + for ( ; i < len; i++) + { + if (buf[i] != 0xFF) + { + s->input_phase = TCF_AT_ALL_ZEROS; + s->flow_control_fill_octet = 0x00; + break; + } + } + /* Fall through */ + case TCF_AT_ALL_ZEROS: + for ( ; i < len; i++) + { + s->data[s->in_ptr] = buf[i]; + s->latest_eol_ptr = s->in_ptr; + /* TODO: We can't buffer overflow, since we wrap around. However, the tail could + overwrite itself if things fall badly behind. */ + s->in_ptr = (s->in_ptr + 1) & (T38_NON_ECM_TX_BUF_LEN - 1); + s->in_octets++; + } + break; + case IMAGE_WAITING_FOR_FIRST_EOL: + /* Dump anything up to the first EOL. Let the output side stuff with 0xFF bytes while waiting + for that first EOL. What occurs before the first EOL is expected to be a period of all ones + and then a period of all zeros. We really don't care what junk might be there. By definition, + the image only starts at the first EOL. */ + for ( ; i < len; i++) + { + if (buf[i]) + { + /* There might be an EOL here. Look for at least 11 zeros, followed by a one, split + between two octets. Between those two octets we can insert numerous zero octets + as a means of flow control. Note that we stuff in blocks of 8 bits, and not at + the minimal level. */ + /* Or'ing with 0x800 here is to avoid zero words looking like they have -1 + trailing zeros */ + upper = bottom_bit(s->bit_stream | 0x800); + lower = top_bit(buf[i]); + if ((upper - lower) > (11 - 8)) + { + /* This is an EOL - our first row is beginning. */ + s->input_phase = IMAGE_IN_PROGRESS; + /* Start a new row */ + s->row_bits = lower - 8; + s->latest_eol_ptr = s->in_ptr; + s->flow_control_fill_octet = 0x00; + + /* If we push out two bytes of zero, and our latest non-zero byte + we should definitely form a proper EOL to begin things, with a + few harmless extra zero bits at the front. */ + s->data[s->in_ptr] = 0x00; + s->in_ptr = (s->in_ptr + 1) & (T38_NON_ECM_TX_BUF_LEN - 1); + s->data[s->in_ptr] = 0x00; + s->in_ptr = (s->in_ptr + 1) & (T38_NON_ECM_TX_BUF_LEN - 1); + s->data[s->in_ptr] = buf[i]; + s->in_ptr = (s->in_ptr + 1) & (T38_NON_ECM_TX_BUF_LEN - 1); + s->in_octets += 3; + s->bit_stream = (s->bit_stream << 8) | buf[i]; + i++; + break; + } + } + s->bit_stream = (s->bit_stream << 8) | buf[i]; + } + if (i >= len) + break; + /* Fall through */ + case IMAGE_IN_PROGRESS: + /* Now we have seen an EOL, we can stuff with zeros just in front of that EOL, or any + subsequent EOL that does not immediately follow a previous EOL (i.e. a candidate RTC). + We need to track our way through the image data, allowing the output side to only send + up to the last EOL. This prevents the possibility of underflow mid-row, where we cannot + safely stuff anything in the bit stream. */ + for ( ; i < len; i++) + { + if (buf[i]) + { + /* There might be an EOL here. Look for at least 11 zeros, followed by a one, split + between two octets. Between those two octets we can insert numerous zero octets + as a means of flow control. Note that we stuff in blocks of 8 bits, and not at + the minimal level. */ + /* Or'ing with 0x800 here is to avoid zero words looking like they have -1 + trailing zeros */ + upper = bottom_bit(s->bit_stream | 0x800); + lower = top_bit(buf[i]); + if ((upper - lower) > (11 - 8)) + { + /* This is an EOL. */ + s->row_bits += (8 - lower); + /* Make sure we don't stretch back to back EOLs, as that could spoil the RTC. + This is a slightly crude check, as we don't know if we are processing a T.4 1D + or T.4 2D image. Accepting 12 or 12 bits apart as meaning back to back is fine, + as no 1D image row could be 1 bit long. */ + if (s->row_bits < 12 || s->row_bits > 13) + { + /* If the row is too short, extend it in chunks of a whole byte. */ + /* TODO: extend by the precise amount we should, instead of this + rough approach. */ + while (s->row_bits < s->min_bits_per_row) + { + s->min_row_bits_fill_octets++; + s->data[s->in_ptr] = 0; + s->row_bits += 8; + /* TODO: We can't buffer overflow, since we wrap around. However, + the tail could overwrite itself if things fall badly behind. */ + s->in_ptr = (s->in_ptr + 1) & (T38_NON_ECM_TX_BUF_LEN - 1); + } + /* This is now the limit for the output side, before it starts + stuffing. */ + s->latest_eol_ptr = s->in_ptr; + } + /* Start a new row */ + s->row_bits = lower - 8; + s->in_rows++; + } + } + s->bit_stream = (s->bit_stream << 8) | buf[i]; + s->data[s->in_ptr] = buf[i]; + s->row_bits += 8; + /* TODO: We can't buffer overflow, since we wrap around. However, the tail could overwrite + itself if things fall badly behind. */ + s->in_ptr = (s->in_ptr + 1) & (T38_NON_ECM_TX_BUF_LEN - 1); + s->in_octets++; + } + break; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_non_ecm_buffer_report_input_status(t38_non_ecm_buffer_state_t *s, logging_state_t *logging) +{ + if (s->in_octets || s->min_row_bits_fill_octets) + { + span_log(logging, + SPAN_LOG_FLOW, + "%d+%d incoming non-ECM octets, %d rows.\n", + s->in_octets, + s->min_row_bits_fill_octets, + s->in_rows); + s->in_octets = 0; + s->in_rows = 0; + s->min_row_bits_fill_octets = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_non_ecm_buffer_report_output_status(t38_non_ecm_buffer_state_t *s, logging_state_t *logging) +{ + if (s->out_octets || s->flow_control_fill_octets) + { + span_log(logging, + SPAN_LOG_FLOW, + "%d+%d outgoing non-ECM octets, %d rows.\n", + s->out_octets - s->flow_control_fill_octets, + s->flow_control_fill_octets, + s->out_rows); + s->out_octets = 0; + s->out_rows = 0; + s->flow_control_fill_octets = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_non_ecm_buffer_set_mode(t38_non_ecm_buffer_state_t *s, int mode, int min_bits_per_row) +{ + s->image_data_mode = mode; + s->min_bits_per_row = min_bits_per_row; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(t38_non_ecm_buffer_state_t *) t38_non_ecm_buffer_init(t38_non_ecm_buffer_state_t *s, int mode, int min_bits_per_row) +{ + if (s == NULL) + { + if ((s = (t38_non_ecm_buffer_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + s->image_data_mode = mode; + s->min_bits_per_row = min_bits_per_row; + restart_buffer(s); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t38_non_ecm_buffer_release(t38_non_ecm_buffer_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t38_non_ecm_buffer_free(t38_non_ecm_buffer_state_t *s) +{ + if (s) + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/t38_terminal.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/t38_terminal.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1204 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t38_terminal.c - T.38 termination, less the packet exchange part + * + * Written by Steve Underwood + * + * Copyright (C) 2005, 2006, 2008 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t38_terminal.c,v 1.129.4.2 2009/12/19 10:44:10 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/bit_operations.h" +#include "spandsp/queue.h" +#include "spandsp/power_meter.h" +#include "spandsp/complex.h" +#include "spandsp/tone_generate.h" +#include "spandsp/async.h" +#include "spandsp/hdlc.h" +#include "spandsp/fsk.h" +#include "spandsp/v29tx.h" +#include "spandsp/v29rx.h" +#include "spandsp/v27ter_tx.h" +#include "spandsp/v27ter_rx.h" +#include "spandsp/v17tx.h" +#include "spandsp/v17rx.h" +#include "spandsp/t4_rx.h" +#include "spandsp/t4_tx.h" +#include "spandsp/t30_fcf.h" +#include "spandsp/t35.h" +#include "spandsp/t30.h" +#include "spandsp/t30_api.h" +#include "spandsp/t30_logging.h" +#include "spandsp/t38_core.h" +#include "spandsp/t38_terminal.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/t4_rx.h" +#include "spandsp/private/t4_tx.h" +#include "spandsp/private/t30.h" +#include "spandsp/private/t38_core.h" +#include "spandsp/private/t38_terminal.h" + +/* Settings suitable for paced transmission over a UDP transport */ +#define MS_PER_TX_CHUNK 30 + +#define INDICATOR_TX_COUNT 3 +#define DATA_TX_COUNT 1 +#define DATA_END_TX_COUNT 3 + +/* Settings suitable for unpaced transmission over a TCP transport */ +#define MAX_OCTETS_PER_UNPACED_CHUNK 300 + +/* Backstop timeout if reception of packets stops in the middle of a burst */ +#define MID_RX_TIMEOUT 15000 + +enum +{ + T38_CHUNKING_MERGE_FCS_WITH_DATA = 0x0001, + T38_CHUNKING_WHOLE_FRAMES = 0x0002, + T38_CHUNKING_ALLOW_TEP_TIME = 0x0004 +}; + +enum +{ + T38_TIMED_STEP_NONE = 0, + T38_TIMED_STEP_NON_ECM_MODEM = 0x10, + T38_TIMED_STEP_NON_ECM_MODEM_2 = 0x11, + T38_TIMED_STEP_NON_ECM_MODEM_3 = 0x12, + T38_TIMED_STEP_NON_ECM_MODEM_4 = 0x13, + T38_TIMED_STEP_NON_ECM_MODEM_5 = 0x14, + T38_TIMED_STEP_HDLC_MODEM = 0x20, + T38_TIMED_STEP_HDLC_MODEM_2 = 0x21, + T38_TIMED_STEP_HDLC_MODEM_3 = 0x22, + T38_TIMED_STEP_HDLC_MODEM_4 = 0x23, + T38_TIMED_STEP_HDLC_MODEM_5 = 0x24, + T38_TIMED_STEP_CED = 0x30, + T38_TIMED_STEP_CED_2 = 0x31, + T38_TIMED_STEP_CED_3 = 0x32, + T38_TIMED_STEP_CNG = 0x40, + T38_TIMED_STEP_CNG_2 = 0x41, + T38_TIMED_STEP_PAUSE = 0x50 +}; + +static __inline__ void front_end_status(t38_terminal_state_t *s, int status) +{ + t30_front_end_status(&s->t30, status); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void hdlc_accept_frame(t38_terminal_state_t *s, const uint8_t *msg, int len, int ok) +{ + t30_hdlc_accept(&s->t30, msg, len, ok); +} +/*- End of function --------------------------------------------------------*/ + +static int extra_bits_in_stuffed_frame(const uint8_t buf[], int len) +{ + int bitstream; + int ones; + int stuffed; + int i; + int j; + + bitstream = 0; + ones = 0; + stuffed = 0; + /* We should really append the CRC, and include the stuffed bits for that, to get + the exact number of bits in the frame. */ + //len = crc_itu16_append(buf, len); + for (i = 0; i < len; i++) + { + bitstream = buf[i]; + for (j = 0; j < 8; j++) + { + if ((bitstream & 1)) + { + if (++ones >= 5) + { + ones = 0; + stuffed++; + } + } + else + { + ones = 0; + } + bitstream >>= 1; + } + } + /* The total length of the frame is: + the number of bits in the body + + the number of additional bits in the body due to stuffing + + the number of bits in the CRC + + the number of additional bits in the CRC due to stuffing + + 16 bits for the two terminating flag octets. + Lets just allow 3 bits for the CRC, which is the worst case. It + avoids calculating the real CRC, and the worst it can do is cause + a flag octet's worth of additional output. + */ + return stuffed + 16 + 3 + 16; +} +/*- End of function --------------------------------------------------------*/ + +static int process_rx_missing(t38_core_state_t *t, void *user_data, int rx_seq_no, int expected_seq_no) +{ + t38_terminal_state_t *s; + + s = (t38_terminal_state_t *) user_data; + s->t38_fe.rx_data_missing = TRUE; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int process_rx_indicator(t38_core_state_t *t, void *user_data, int indicator) +{ + t38_terminal_state_t *s; + t38_terminal_front_end_state_t *fe; + + s = (t38_terminal_state_t *) user_data; + fe = &s->t38_fe; + + if (t->current_rx_indicator == indicator) + { + /* This is probably due to the far end repeating itself, or slipping + preamble messages in between HDLC frames. T.38/V.1.3 tells us to + ignore it. Its harmless. */ + return 0; + } + /* In termination mode we don't care very much about indicators telling us training + is starting. We only care about V.21 preamble starting, for timeout control, and + the actual data. */ + switch (indicator) + { + case T38_IND_NO_SIGNAL: + if (t->current_rx_indicator == T38_IND_V21_PREAMBLE + && + (fe->current_rx_type == T30_MODEM_V21 || fe->current_rx_type == T30_MODEM_CNG)) + { + hdlc_accept_frame(s, NULL, SIG_STATUS_CARRIER_DOWN, TRUE); + } + fe->timeout_rx_samples = 0; + front_end_status(s, T30_FRONT_END_SIGNAL_ABSENT); + break; + case T38_IND_CNG: + /* We are completely indifferent to the startup tones. They serve no purpose for us. + We can't even assume that the existance of a tone means the far end is achieving + proper communication. Some T.38 gateways will just send out a CED or CNG indicator + without having seen anything from the far end FAX terminal. + Just report them for completeness. */ + front_end_status(s, T30_FRONT_END_CNG_PRESENT); + break; + case T38_IND_CED: + front_end_status(s, T30_FRONT_END_CED_PRESENT); + break; + case T38_IND_V21_PREAMBLE: + fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT); + front_end_status(s, T30_FRONT_END_SIGNAL_PRESENT); + break; + case T38_IND_V27TER_2400_TRAINING: + case T38_IND_V27TER_4800_TRAINING: + case T38_IND_V29_7200_TRAINING: + case T38_IND_V29_9600_TRAINING: + case T38_IND_V17_7200_SHORT_TRAINING: + case T38_IND_V17_7200_LONG_TRAINING: + case T38_IND_V17_9600_SHORT_TRAINING: + case T38_IND_V17_9600_LONG_TRAINING: + case T38_IND_V17_12000_SHORT_TRAINING: + case T38_IND_V17_12000_LONG_TRAINING: + case T38_IND_V17_14400_SHORT_TRAINING: + case T38_IND_V17_14400_LONG_TRAINING: + case T38_IND_V34_CNTL_CHANNEL_1200: + case T38_IND_V34_PRI_CHANNEL: + case T38_IND_V33_12000_TRAINING: + case T38_IND_V33_14400_TRAINING: + /* We really don't care what kind of modem is delivering the following image data. + We only care that some kind of fast modem signal is coming next. */ + fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT); + front_end_status(s, T30_FRONT_END_SIGNAL_PRESENT); + break; + case T38_IND_V8_ANSAM: + case T38_IND_V8_SIGNAL: + case T38_IND_V34_CC_RETRAIN: + /* V.34 support is a work in progress. */ + break; + default: + front_end_status(s, T30_FRONT_END_SIGNAL_ABSENT); + break; + } + /*endswitch*/ + fe->hdlc_rx.len = 0; + fe->rx_data_missing = FALSE; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int fake_rx_indicator(t38_core_state_t *t, t38_terminal_state_t *s, int indicator) +{ + int ret; + + ret = process_rx_indicator(t, s, indicator); + t->current_rx_indicator = indicator; + return ret; +} +/*- End of function --------------------------------------------------------*/ + +static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, int field_type, const uint8_t *buf, int len) +{ + t38_terminal_state_t *s; + t38_terminal_front_end_state_t *fe; +#if defined(_MSC_VER) + uint8_t *buf2 = (uint8_t *) _alloca(len); +#else + uint8_t buf2[len]; +#endif + + s = (t38_terminal_state_t *) user_data; + fe = &s->t38_fe; + /* In termination mode we don't care very much what the data type is apart from a couple of + special cases. */ + switch (data_type) + { + case T38_DATA_V8: + switch (field_type) + { + case T38_FIELD_CM_MESSAGE: + if (len >= 1) + span_log(&s->logging, SPAN_LOG_FLOW, "CM profile %d - %s\n", buf[0] - '0', t38_cm_profile_to_str(buf[0])); + else + span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for CM message - %d\n", len); + //front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE); + break; + case T38_FIELD_JM_MESSAGE: + if (len >= 2) + span_log(&s->logging, SPAN_LOG_FLOW, "JM - %s\n", t38_jm_to_str(buf, len)); + else + span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for JM message - %d\n", len); + //front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE); + break; + case T38_FIELD_CI_MESSAGE: + if (len >= 1) + span_log(&s->logging, SPAN_LOG_FLOW, "CI 0x%X\n", buf[0]); + else + span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for CI message - %d\n", len); + //front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE); + break; + default: + break; + } + /*endswitch*/ + return 0; + case T38_DATA_V34_PRI_RATE: + switch (field_type) + { + case T38_FIELD_V34RATE: + if (len >= 3) + { + /* Just get and store the rate. The front end has no real interest in the + actual bit rate. */ + fe->t38.v34_rate = t38_v34rate_to_bps(buf, len); + span_log(&s->logging, SPAN_LOG_FLOW, "V.34 rate %d bps\n", fe->t38.v34_rate); + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for V34rate message - %d\n", len); + } + break; + default: + break; + } + /*endswitch*/ + return 0; + default: + break; + } + /*endswitch*/ + switch (field_type) + { + case T38_FIELD_HDLC_DATA: + if (fe->timeout_rx_samples == 0) + { + /* HDLC can just start without any signal indicator on some platforms, even when + there is zero packet lost. Nasty, but true. Its a good idea to be tolerant of + loss, though, so accepting a sudden start of HDLC data is the right thing to do. */ + fake_rx_indicator(t, s, T38_IND_V21_PREAMBLE); + /* All real HDLC messages in the FAX world start with 0xFF. If this one is not starting + with 0xFF it would appear some octets must have been missed before this one. */ + if (len <= 0 || buf[0] != 0xFF) + fe->rx_data_missing = TRUE; + } + if (len > 0 && fe->hdlc_rx.len + len <= T38_MAX_HDLC_LEN) + { + bit_reverse(fe->hdlc_rx.buf + fe->hdlc_rx.len, buf, len); + fe->hdlc_rx.len += len; + } + fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT); + break; + case T38_FIELD_HDLC_FCS_OK: + if (len > 0) + { + span_log(&s->logging, SPAN_LOG_WARNING, "There is data in a T38_FIELD_HDLC_FCS_OK!\n"); + /* The sender has incorrectly included data in this message. It is unclear what we should do + with it, to maximise tolerance of buggy implementations. */ + } + /* Some T.38 implementations send multiple T38_FIELD_HDLC_FCS_OK messages, in IFP packets with + incrementing sequence numbers, which are actually repeats. They get through to this point because + of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ + if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC OK (%s)\n", (fe->hdlc_rx.len >= 3) ? t30_frametype(fe->hdlc_rx.buf[2]) : "???", (fe->rx_data_missing) ? "missing octets" : "clean"); + hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, !fe->rx_data_missing); + } + fe->hdlc_rx.len = 0; + fe->rx_data_missing = FALSE; + fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT); + break; + case T38_FIELD_HDLC_FCS_BAD: + if (len > 0) + { + span_log(&s->logging, SPAN_LOG_WARNING, "There is data in a T38_FIELD_HDLC_FCS_BAD!\n"); + /* The sender has incorrectly included data in this message. We can safely ignore it, as the + bad FCS means we will throw away the whole message, anyway. */ + } + /* Some T.38 implementations send multiple T38_FIELD_HDLC_FCS_BAD messages, in IFP packets with + incrementing sequence numbers, which are actually repeats. They get through to this point because + of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ + if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC bad (%s)\n", (fe->hdlc_rx.len >= 3) ? t30_frametype(fe->hdlc_rx.buf[2]) : "???", (fe->rx_data_missing) ? "missing octets" : "clean"); + hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE); + } + fe->hdlc_rx.len = 0; + fe->rx_data_missing = FALSE; + fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT); + break; + case T38_FIELD_HDLC_FCS_OK_SIG_END: + if (len > 0) + { + span_log(&s->logging, SPAN_LOG_WARNING, "There is data in a T38_FIELD_HDLC_FCS_OK_SIG_END!\n"); + /* The sender has incorrectly included data in this message. It is unclear what we should do + with it, to maximise tolerance of buggy implementations. */ + } + /* Some T.38 implementations send multiple T38_FIELD_HDLC_FCS_OK_SIG_END messages, in IFP packets with + incrementing sequence numbers, which are actually repeats. They get through to this point because + of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ + if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC OK, sig end (%s)\n", (fe->hdlc_rx.len >= 3) ? t30_frametype(fe->hdlc_rx.buf[2]) : "???", (fe->rx_data_missing) ? "missing octets" : "clean"); + hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, !fe->rx_data_missing); + hdlc_accept_frame(s, NULL, SIG_STATUS_CARRIER_DOWN, TRUE); + } + fe->hdlc_rx.len = 0; + fe->rx_data_missing = FALSE; + /* Treat this like a no signal indicator has occurred, so if the no signal indicator is missing, we are still OK */ + fake_rx_indicator(t, s, T38_IND_NO_SIGNAL); + break; + case T38_FIELD_HDLC_FCS_BAD_SIG_END: + if (len > 0) + { + span_log(&s->logging, SPAN_LOG_WARNING, "There is data in a T38_FIELD_HDLC_FCS_BAD_SIG_END!\n"); + /* The sender has incorrectly included data in this message. We can safely ignore it, as the + bad FCS means we will throw away the whole message, anyway. */ + } + /* Some T.38 implementations send multiple T38_FIELD_HDLC_FCS_BAD_SIG_END messages, in IFP packets with + incrementing sequence numbers, which are actually repeats. They get through to this point because + of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ + if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC bad, sig end (%s)\n", (fe->hdlc_rx.len >= 3) ? t30_frametype(fe->hdlc_rx.buf[2]) : "???", (fe->rx_data_missing) ? "missing octets" : "clean"); + hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE); + hdlc_accept_frame(s, NULL, SIG_STATUS_CARRIER_DOWN, TRUE); + } + fe->hdlc_rx.len = 0; + fe->rx_data_missing = FALSE; + /* Treat this like a no signal indicator has occurred, so if the no signal indicator is missing, we are still OK */ + fake_rx_indicator(t, s, T38_IND_NO_SIGNAL); + break; + case T38_FIELD_HDLC_SIG_END: + if (len > 0) + { + span_log(&s->logging, SPAN_LOG_WARNING, "There is data in a T38_FIELD_HDLC_SIG_END!\n"); + /* The sender has incorrectly included data in this message, but there seems nothing meaningful + it could be. There could not be an FCS good/bad report beyond this. */ + } + /* Some T.38 implementations send multiple T38_FIELD_HDLC_SIG_END messages, in IFP packets with + incrementing sequence numbers, which are actually repeats. They get through to this point because + of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ + if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type) + { + /* WORKAROUND: At least some Mediatrix boxes have a bug, where they can send this message at the + end of non-ECM data. We need to tolerate this. We use the generic receive complete + indication, rather than the specific HDLC carrier down. */ + /* This message is expected under 2 circumstances. One is as an alternative to T38_FIELD_HDLC_FCS_OK_SIG_END - + i.e. they send T38_FIELD_HDLC_FCS_OK, and then T38_FIELD_HDLC_SIG_END when the carrier actually drops. + The other is because the HDLC signal drops unexpectedly - i.e. not just after a final frame. */ + fe->hdlc_rx.len = 0; + fe->rx_data_missing = FALSE; + front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE); + } + /* Treat this like a no signal indicator has occurred, so if the no signal indicator is missing, we are still OK */ + fake_rx_indicator(t, s, T38_IND_NO_SIGNAL); + break; + case T38_FIELD_T4_NON_ECM_DATA: + if (!fe->rx_signal_present) + { + t30_non_ecm_put_bit(&s->t30, SIG_STATUS_TRAINING_SUCCEEDED); + fe->rx_signal_present = TRUE; + } + if (len > 0) + { + bit_reverse(buf2, buf, len); + t30_non_ecm_put_chunk(&s->t30, buf2, len); + } + fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT); + break; + case T38_FIELD_T4_NON_ECM_SIG_END: + /* Some T.38 implementations send multiple T38_FIELD_T4_NON_ECM_SIG_END messages, in IFP packets with + incrementing sequence numbers, which are actually repeats. They get through to this point because + of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ + if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type) + { + if (len > 0) + { + if (!fe->rx_signal_present) + { + t30_non_ecm_put_bit(&s->t30, SIG_STATUS_TRAINING_SUCCEEDED); + fe->rx_signal_present = TRUE; + } + bit_reverse(buf2, buf, len); + t30_non_ecm_put_chunk(&s->t30, buf2, len); + } + /* WORKAROUND: At least some Mediatrix boxes have a bug, where they can send HDLC signal end where + they should send non-ECM signal end. It is possible they also do the opposite. + We need to tolerate this, so we use the generic receive complete + indication, rather than the specific non-ECM carrier down. */ + front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE); + } + fe->rx_signal_present = FALSE; + /* Treat this like a no signal indicator has occurred, so if the no signal indicator is missing, we are still OK */ + fake_rx_indicator(t, s, T38_IND_NO_SIGNAL); + break; + default: + break; + } + /*endswitch*/ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void send_hdlc(void *user_data, const uint8_t *msg, int len) +{ + t38_terminal_state_t *s; + + s = (t38_terminal_state_t *) user_data; + if (len <= 0) + { + s->t38_fe.hdlc_tx.len = -1; + } + else + { + s->t38_fe.hdlc_tx.extra_bits = extra_bits_in_stuffed_frame(msg, len); + bit_reverse(s->t38_fe.hdlc_tx.buf, msg, len); + s->t38_fe.hdlc_tx.len = len; + s->t38_fe.hdlc_tx.ptr = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int bits_to_us(t38_terminal_state_t *s, int bits) +{ + if (s->t38_fe.ms_per_tx_chunk == 0 || s->t38_fe.tx_bit_rate == 0) + return 0; + return bits*1000000/s->t38_fe.tx_bit_rate; +} +/*- End of function --------------------------------------------------------*/ + +static void set_octets_per_data_packet(t38_terminal_state_t *s, int bit_rate) +{ + s->t38_fe.tx_bit_rate = bit_rate; + if (s->t38_fe.ms_per_tx_chunk) + { + s->t38_fe.octets_per_data_packet = s->t38_fe.ms_per_tx_chunk*bit_rate/(8*1000); + /* Make sure we have a positive number (i.e. we didn't truncate to zero). */ + if (s->t38_fe.octets_per_data_packet < 1) + s->t38_fe.octets_per_data_packet = 1; + } + else + { + s->t38_fe.octets_per_data_packet = MAX_OCTETS_PER_UNPACED_CHUNK; + } +} +/*- End of function --------------------------------------------------------*/ + +static int stream_non_ecm(t38_terminal_state_t *s) +{ + t38_terminal_front_end_state_t *fe; + uint8_t buf[MAX_OCTETS_PER_UNPACED_CHUNK + 50]; + int delay; + int len; + + fe = &s->t38_fe; + for (delay = 0; delay == 0; ) + { + switch (fe->timed_step) + { + case T38_TIMED_STEP_NON_ECM_MODEM: + /* Create a 75ms silence */ + if (fe->t38.current_tx_indicator != T38_IND_NO_SIGNAL) + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); + else + delay = 75000; + fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_2; + fe->next_tx_samples = fe->samples; + break; + case T38_TIMED_STEP_NON_ECM_MODEM_2: + /* Switch on a fast modem, and give the training time to complete */ + delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator); + fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_3; + break; + case T38_TIMED_STEP_NON_ECM_MODEM_3: + /* Send a chunk of non-ECM image data */ + /* T.38 says it is OK to send the last of the non-ECM data in the signal end message. + However, I think the early versions of T.38 said the signal end message should not + contain data. Hopefully, following the current spec will not cause compatibility + issues. */ + len = t30_non_ecm_get_chunk(&s->t30, buf, fe->octets_per_data_packet); + if (len > 0) + bit_reverse(buf, buf, len); + if (len < fe->octets_per_data_packet) + { + /* That's the end of the image data. */ + if (s->t38_fe.ms_per_tx_chunk) + { + /* Pad the end of the data with some zeros. If we just stop abruptly + at the end of the EOLs, some ATAs fail to clean up properly before + shutting down their transmit modem, and the last few rows of the image + are lost or corrupted. Simply delaying the no-signal message does not + help for all implentations. It is usually ignored, which is probably + the right thing to do after receiving a message saying the signal has + ended. */ + memset(buf + len, 0, fe->octets_per_data_packet - len); + fe->non_ecm_trailer_bytes = 3*fe->octets_per_data_packet + len; + len = fe->octets_per_data_packet; + fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_4; + } + else + { + /* If we are sending quickly there seems no point in doing any padding */ + t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA_END); + fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_5; + delay = 0; + break; + } + } + t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA); + delay = bits_to_us(s, 8*len); + break; + case T38_TIMED_STEP_NON_ECM_MODEM_4: + /* Send padding */ + len = fe->octets_per_data_packet; + fe->non_ecm_trailer_bytes -= fe->octets_per_data_packet; + if (fe->non_ecm_trailer_bytes <= 0) + { + len += fe->non_ecm_trailer_bytes; + memset(buf, 0, len); + t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA_END); + fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_5; + /* Allow a bit more time than the data will take to play out, to ensure the far ATA does not + cut things short. */ + delay = bits_to_us(s, 8*len); + if (s->t38_fe.ms_per_tx_chunk) + delay += 60000; + front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); + break; + } + memset(buf, 0, len); + t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA); + delay = bits_to_us(s, 8*len); + break; + case T38_TIMED_STEP_NON_ECM_MODEM_5: + /* This should not be needed, since the message above indicates the end of the signal, but it + seems like it can improve compatibility with quirky implementations. */ + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); + fe->timed_step = T38_TIMED_STEP_NONE; + return delay; + } + } + return delay; +} +/*- End of function --------------------------------------------------------*/ + +static int stream_hdlc(t38_terminal_state_t *s) +{ + t38_terminal_front_end_state_t *fe; + uint8_t buf[MAX_OCTETS_PER_UNPACED_CHUNK + 50]; + t38_data_field_t data_fields[2]; + int category; + int previous; + int delay; + int i; + + fe = &s->t38_fe; + for (delay = 0; delay == 0; ) + { + switch (fe->timed_step) + { + case T38_TIMED_STEP_HDLC_MODEM: + /* Create a 75ms silence */ + if (fe->t38.current_tx_indicator != T38_IND_NO_SIGNAL) + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); + else + delay = 75000; + fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_2; + fe->next_tx_samples = fe->samples; + break; + case T38_TIMED_STEP_HDLC_MODEM_2: + /* Send HDLC preambling */ + delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator); + delay += t38_core_send_flags_delay(&fe->t38, fe->next_tx_indicator); + fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3; + break; + case T38_TIMED_STEP_HDLC_MODEM_3: + /* Send a chunk of HDLC data */ + i = fe->hdlc_tx.len - fe->hdlc_tx.ptr; + if (fe->octets_per_data_packet >= i) + { + /* The last part of an HDLC frame */ + if (fe->chunking_modes & T38_CHUNKING_MERGE_FCS_WITH_DATA) + { + /* Copy the data, as we might be about to refill the buffer it is in */ + memcpy(buf, &fe->hdlc_tx.buf[fe->hdlc_tx.ptr], i); + data_fields[0].field_type = T38_FIELD_HDLC_DATA; + data_fields[0].field = buf; + data_fields[0].field_len = i; + + /* Now see about the next HDLC frame. This will tell us whether to send FCS_OK or FCS_OK_SIG_END */ + previous = fe->current_tx_data_type; + fe->hdlc_tx.ptr = 0; + fe->hdlc_tx.len = 0; + front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); + /* The above step should have got the next HDLC step ready - either another frame, or an instruction to stop transmission. */ + if (fe->hdlc_tx.len < 0) + { + data_fields[1].field_type = T38_FIELD_HDLC_FCS_OK_SIG_END; + data_fields[1].field = NULL; + data_fields[1].field_len = 0; + category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA_END : T38_PACKET_CATEGORY_IMAGE_DATA_END; + t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, category); + fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_5; + /* We add a bit of extra time here, as with some implementations + the carrier falling too abruptly causes data loss. */ + delay = bits_to_us(s, i*8 + fe->hdlc_tx.extra_bits); + if (s->t38_fe.ms_per_tx_chunk) + delay += 100000; + front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); + } + else + { + data_fields[1].field_type = T38_FIELD_HDLC_FCS_OK; + data_fields[1].field = NULL; + data_fields[1].field_len = 0; + category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA : T38_PACKET_CATEGORY_IMAGE_DATA; + t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, category); + fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3; + delay = bits_to_us(s, i*8 + fe->hdlc_tx.extra_bits); + } + break; + } + category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA : T38_PACKET_CATEGORY_IMAGE_DATA; + t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &fe->hdlc_tx.buf[fe->hdlc_tx.ptr], i, category); + fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_4; + } + else + { + i = fe->octets_per_data_packet; + category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA : T38_PACKET_CATEGORY_IMAGE_DATA; + t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &fe->hdlc_tx.buf[fe->hdlc_tx.ptr], i, category); + fe->hdlc_tx.ptr += i; + } + delay = bits_to_us(s, i*8); + break; + case T38_TIMED_STEP_HDLC_MODEM_4: + /* End of HDLC frame */ + previous = fe->current_tx_data_type; + fe->hdlc_tx.ptr = 0; + fe->hdlc_tx.len = 0; + front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); + /* The above step should have got the next HDLC step ready - either another frame, or an instruction to stop transmission. */ + if (fe->hdlc_tx.len < 0) + { + /* End of transmission */ + category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA_END : T38_PACKET_CATEGORY_IMAGE_DATA_END; + t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK_SIG_END, NULL, 0, category); + fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_5; + /* We add a bit of extra time here, as with some implementations + the carrier falling too abruptly causes data loss. */ + delay = bits_to_us(s, fe->hdlc_tx.extra_bits); + if (s->t38_fe.ms_per_tx_chunk) + delay += 100000; + front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); + break; + } + if (fe->hdlc_tx.len == 0) + { + /* Now, how did we get here? We have finished a frame, but have no new frame to + send, and no end of transmission condition. */ + span_log(&s->logging, SPAN_LOG_FLOW, "No new frame or end transmission condition.\n"); + } + /* Finish the current frame off, and prepare for the next one. */ + category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA : T38_PACKET_CATEGORY_IMAGE_DATA; + t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK, NULL, 0, category); + fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3; + /* We should now wait enough time for everything to clear through an analogue modem at the far end. */ + delay = bits_to_us(s, fe->hdlc_tx.extra_bits); + break; + case T38_TIMED_STEP_HDLC_MODEM_5: + /* Note that some boxes do not like us sending a T38_FIELD_HDLC_SIG_END at this point. + A T38_IND_NO_SIGNAL should always be OK. */ + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); + fe->timed_step = T38_TIMED_STEP_NONE; + return delay; + } + } + return delay; +} +/*- End of function --------------------------------------------------------*/ + +static int stream_ced(t38_terminal_state_t *s) +{ + t38_terminal_front_end_state_t *fe; + int delay; + + fe = &s->t38_fe; + for (delay = 0; delay == 0; ) + { + switch (fe->timed_step) + { + case T38_TIMED_STEP_CED: + /* It seems common practice to start with a no signal indicator, though + this is not a specified requirement. Since we should be sending 200ms + of silence, starting the delay with a no signal indication makes sense. + We do need a 200ms delay, as that is a specification requirement. */ + fe->timed_step = T38_TIMED_STEP_CED_2; + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); + delay = 200000; + fe->next_tx_samples = fe->samples; + break; + case T38_TIMED_STEP_CED_2: + /* Initial 200ms delay over. Send the CED indicator */ + fe->timed_step = T38_TIMED_STEP_CED_3; + delay = t38_core_send_indicator(&fe->t38, T38_IND_CED); + fe->current_tx_data_type = T38_DATA_NONE; + break; + case T38_TIMED_STEP_CED_3: + /* End of CED */ + fe->timed_step = T38_TIMED_STEP_NONE; + front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); + return 0; + } + } + return delay; +} +/*- End of function --------------------------------------------------------*/ + +static int stream_cng(t38_terminal_state_t *s) +{ + t38_terminal_front_end_state_t *fe; + int delay; + + fe = &s->t38_fe; + for (delay = 0; delay == 0; ) + { + switch (fe->timed_step) + { + case T38_TIMED_STEP_CNG: + /* It seems common practice to start with a no signal indicator, though + this is not a specified requirement of the T.38 spec. Since we should + be sending 200ms of silence, according to T.30, starting that delay with + a no signal indication makes sense. */ + fe->timed_step = T38_TIMED_STEP_CNG_2; + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); + delay = 200000; + fe->next_tx_samples = fe->samples; + break; + case T38_TIMED_STEP_CNG_2: + /* Initial short delay over. Send the CNG indicator. CNG persists until something + coming the other way interrupts it, or a long timeout controlled by the T.30 engine + expires. */ + fe->timed_step = T38_TIMED_STEP_NONE; + delay = t38_core_send_indicator(&fe->t38, T38_IND_CNG); + fe->current_tx_data_type = T38_DATA_NONE; + return delay; + } + } + return delay; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t38_terminal_send_timeout(t38_terminal_state_t *s, int samples) +{ + t38_terminal_front_end_state_t *fe; + int delay; + + fe = &s->t38_fe; + if (fe->current_rx_type == T30_MODEM_DONE || fe->current_tx_type == T30_MODEM_DONE) + return TRUE; + + fe->samples += samples; + t30_timer_update(&s->t30, samples); + if (fe->timeout_rx_samples && fe->samples > fe->timeout_rx_samples) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Timeout mid-receive\n"); + fe->timeout_rx_samples = 0; + front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE); + } + if (fe->timed_step == T38_TIMED_STEP_NONE) + return FALSE; + /* Wait until the right time comes along, unless we are working in "no delays" mode, while talking to an + IAF terminal. */ + if (fe->ms_per_tx_chunk && fe->samples < fe->next_tx_samples) + return FALSE; + /* Its time to send something */ + delay = 0; + switch (fe->timed_step & 0xFFF0) + { + case T38_TIMED_STEP_NON_ECM_MODEM: + delay = stream_non_ecm(s); + break; + case T38_TIMED_STEP_HDLC_MODEM: + delay = stream_hdlc(s); + break; + case T38_TIMED_STEP_CED: + delay = stream_ced(s); + break; + case T38_TIMED_STEP_CNG: + delay = stream_cng(s); + break; + case T38_TIMED_STEP_PAUSE: + /* End of timed pause */ + fe->timed_step = T38_TIMED_STEP_NONE; + front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); + break; + } + fe->next_tx_samples += us_to_samples(delay); + return FALSE; +} +/*- End of function --------------------------------------------------------*/ + +static void set_rx_type(void *user_data, int type, int bit_rate, int short_train, int use_hdlc) +{ + t38_terminal_state_t *s; + + s = (t38_terminal_state_t *) user_data; + span_log(&s->logging, SPAN_LOG_FLOW, "Set rx type %d\n", type); + s->t38_fe.current_rx_type = type; +} +/*- End of function --------------------------------------------------------*/ + +static void start_tx(t38_terminal_front_end_state_t *fe, int use_hdlc) +{ + /* The actual transmission process depends on whether we are sending at a paced manner, + for interaction with a traditional FAX machine, or streaming as fast as we can, normally + over a TCP connection to a machine directly connected to the internet. */ + if (fe->ms_per_tx_chunk) + { + /* Start the paced packet transmission process. */ + fe->timed_step = (use_hdlc) ? T38_TIMED_STEP_HDLC_MODEM : T38_TIMED_STEP_NON_ECM_MODEM; + if (fe->next_tx_samples < fe->samples) + fe->next_tx_samples = fe->samples; + } + else + { + /* Start the fast streaming transmission process. */ + } +} +/*- End of function --------------------------------------------------------*/ + +static void set_tx_type(void *user_data, int type, int bit_rate, int short_train, int use_hdlc) +{ + t38_terminal_state_t *s; + t38_terminal_front_end_state_t *fe; + + s = (t38_terminal_state_t *) user_data; + fe = &s->t38_fe; + span_log(&s->logging, SPAN_LOG_FLOW, "Set tx type %d\n", type); + if (fe->current_tx_type == type) + return; + + set_octets_per_data_packet(s, bit_rate); + switch (type) + { + case T30_MODEM_NONE: + /* If a "no signal" indicator is waiting to be played out, don't disturb it. */ + if (fe->timed_step != T38_TIMED_STEP_NON_ECM_MODEM_5 && fe->timed_step != T38_TIMED_STEP_HDLC_MODEM_5) + fe->timed_step = T38_TIMED_STEP_NONE; + fe->current_tx_data_type = T38_DATA_NONE; + break; + case T30_MODEM_PAUSE: + fe->next_tx_samples = fe->samples + ms_to_samples(short_train); + fe->timed_step = T38_TIMED_STEP_PAUSE; + fe->current_tx_data_type = T38_DATA_NONE; + break; + case T30_MODEM_CED: + fe->next_tx_samples = fe->samples; + fe->timed_step = T38_TIMED_STEP_CED; + fe->current_tx_data_type = T38_DATA_NONE; + break; + case T30_MODEM_CNG: + fe->next_tx_samples = fe->samples; + fe->timed_step = T38_TIMED_STEP_CNG; + fe->current_tx_data_type = T38_DATA_NONE; + break; + case T30_MODEM_V21: + fe->next_tx_indicator = T38_IND_V21_PREAMBLE; + fe->current_tx_data_type = T38_DATA_V21; + start_tx(fe, use_hdlc); + break; + case T30_MODEM_V27TER: + switch (bit_rate) + { + case 2400: + fe->next_tx_indicator = T38_IND_V27TER_2400_TRAINING; + fe->current_tx_data_type = T38_DATA_V27TER_2400; + break; + case 4800: + fe->next_tx_indicator = T38_IND_V27TER_4800_TRAINING; + fe->current_tx_data_type = T38_DATA_V27TER_4800; + break; + } + start_tx(fe, use_hdlc); + break; + case T30_MODEM_V29: + switch (bit_rate) + { + case 7200: + fe->next_tx_indicator = T38_IND_V29_7200_TRAINING; + fe->current_tx_data_type = T38_DATA_V29_7200; + break; + case 9600: + fe->next_tx_indicator = T38_IND_V29_9600_TRAINING; + fe->current_tx_data_type = T38_DATA_V29_9600; + break; + } + start_tx(fe, use_hdlc); + break; + case T30_MODEM_V17: + switch (bit_rate) + { + case 7200: + fe->next_tx_indicator = (short_train) ? T38_IND_V17_7200_SHORT_TRAINING : T38_IND_V17_7200_LONG_TRAINING; + fe->current_tx_data_type = T38_DATA_V17_7200; + break; + case 9600: + fe->next_tx_indicator = (short_train) ? T38_IND_V17_9600_SHORT_TRAINING : T38_IND_V17_9600_LONG_TRAINING; + fe->current_tx_data_type = T38_DATA_V17_9600; + break; + case 12000: + fe->next_tx_indicator = (short_train) ? T38_IND_V17_12000_SHORT_TRAINING : T38_IND_V17_12000_LONG_TRAINING; + fe->current_tx_data_type = T38_DATA_V17_12000; + break; + case 14400: + fe->next_tx_indicator = (short_train) ? T38_IND_V17_14400_SHORT_TRAINING : T38_IND_V17_14400_LONG_TRAINING; + fe->current_tx_data_type = T38_DATA_V17_14400; + break; + } + start_tx(fe, use_hdlc); + break; + case T30_MODEM_DONE: + span_log(&s->logging, SPAN_LOG_FLOW, "FAX exchange complete\n"); + fe->timed_step = T38_TIMED_STEP_NONE; + fe->current_tx_data_type = T38_DATA_NONE; + break; + } + fe->current_tx_type = type; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_terminal_set_config(t38_terminal_state_t *s, int without_pacing) +{ + if (without_pacing) + { + /* Continuous streaming mode, as used for TPKT over TCP transport */ + /* Inhibit indicator packets */ + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_INDICATOR, 0); + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA, 1); + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA_END, 1); + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_IMAGE_DATA, 1); + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_IMAGE_DATA_END, 1); + s->t38_fe.ms_per_tx_chunk = 0; + } + else + { + /* Paced streaming mode, as used for UDP transports */ + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_INDICATOR, INDICATOR_TX_COUNT); + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA, DATA_TX_COUNT); + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA_END, DATA_END_TX_COUNT); + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_IMAGE_DATA, DATA_TX_COUNT); + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_IMAGE_DATA_END, DATA_END_TX_COUNT); + s->t38_fe.ms_per_tx_chunk = MS_PER_TX_CHUNK; + } + set_octets_per_data_packet(s, 300); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_terminal_set_tep_mode(t38_terminal_state_t *s, int use_tep) +{ + if (use_tep) + s->t38_fe.chunking_modes |= T38_CHUNKING_ALLOW_TEP_TIME; + else + s->t38_fe.chunking_modes &= ~T38_CHUNKING_ALLOW_TEP_TIME; + t38_set_tep_handling(&s->t38_fe.t38, use_tep); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_terminal_set_fill_bit_removal(t38_terminal_state_t *s, int remove) +{ + if (remove) + s->t38_fe.iaf |= T30_IAF_MODE_NO_FILL_BITS; + else + s->t38_fe.iaf &= ~T30_IAF_MODE_NO_FILL_BITS; + t30_set_iaf_mode(&s->t30, s->t38_fe.iaf); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(t30_state_t *) t38_terminal_get_t30_state(t38_terminal_state_t *s) +{ + return &s->t30; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(t38_core_state_t *) t38_terminal_get_t38_core_state(t38_terminal_state_t *s) +{ + return &s->t38_fe.t38; +} +/*- End of function --------------------------------------------------------*/ + +static int t38_terminal_t38_fe_init(t38_terminal_state_t *t, + t38_tx_packet_handler_t *tx_packet_handler, + void *tx_packet_user_data) +{ + t38_terminal_front_end_state_t *s; + + s = &t->t38_fe; + t38_core_init(&s->t38, + process_rx_indicator, + process_rx_data, + process_rx_missing, + (void *) t, + tx_packet_handler, + tx_packet_user_data); + t38_set_fastest_image_data_rate(&s->t38, 14400); + + s->rx_signal_present = FALSE; + s->timed_step = T38_TIMED_STEP_NONE; + //s->iaf = T30_IAF_MODE_T37 | T30_IAF_MODE_T38; + s->iaf = T30_IAF_MODE_T38; + + s->current_tx_data_type = T38_DATA_NONE; + s->next_tx_samples = 0; + s->chunking_modes = T38_CHUNKING_ALLOW_TEP_TIME; + + s->hdlc_tx.ptr = 0; + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(logging_state_t *) t38_terminal_get_logging_state(t38_terminal_state_t *s) +{ + return &s->logging; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(t38_terminal_state_t *) t38_terminal_init(t38_terminal_state_t *s, + int calling_party, + t38_tx_packet_handler_t *tx_packet_handler, + void *tx_packet_user_data) +{ + if (tx_packet_handler == NULL) + return NULL; + + if (s == NULL) + { + if ((s = (t38_terminal_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "T.38T"); + + t38_terminal_t38_fe_init(s, tx_packet_handler, tx_packet_user_data); + + t38_terminal_set_config(s, FALSE); + + t30_init(&s->t30, + calling_party, + set_rx_type, + (void *) s, + set_tx_type, + (void *) s, + send_hdlc, + (void *) s); + t30_set_iaf_mode(&s->t30, s->t38_fe.iaf); + t30_set_supported_modems(&s->t30, + T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17 | T30_SUPPORT_IAF); + t30_restart(&s->t30); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t38_terminal_release(t38_terminal_state_t *s) +{ + t30_release(&s->t30); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t38_terminal_free(t38_terminal_state_t *s) +{ + t38_terminal_release(s); + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/t4_rx.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/t4_rx.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1227 @@ +//#define T4_STATE_DEBUGGING +/* + * SpanDSP - a series of DSP components for telephony + * + * t4_rx.c - ITU T.4 FAX receive processing + * + * Written by Steve Underwood + * + * Copyright (C) 2003, 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t4_rx.c,v 1.12.2.8 2009/12/21 17:18:39 steveu Exp $ + */ + +/* + * Much of this file is based on the T.4 and T.6 support in libtiff, which requires + * the following notice in any derived source code: + * + * Copyright (c) 1990-1997 Sam Leffler + * Copyright (c) 1991-1997 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the names of + * Sam Leffler and Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Sam Leffler and Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + * + * Decoder support is derived from code in Frank Cringle's viewfax program; + * Copyright (C) 1990, 1995 Frank D. Cringle. + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/bit_operations.h" +#include "spandsp/async.h" +#include "spandsp/t4_rx.h" +#include "spandsp/t4_tx.h" +#include "spandsp/version.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/t4_rx.h" +#include "spandsp/private/t4_tx.h" + +/*! The number of centimetres in one inch */ +#define CM_PER_INCH 2.54f + +/*! The number of EOLs to expect at the end of a T.4 page */ +#define EOLS_TO_END_ANY_RX_PAGE 6 +/*! The number of EOLs to check at the end of a T.4 page */ +#define EOLS_TO_END_T4_RX_PAGE 5 +/*! The number of EOLs to check at the end of a T.6 page */ +#define EOLS_TO_END_T6_RX_PAGE 2 + +#if defined(T4_STATE_DEBUGGING) +static void STATE_TRACE(const char *format, ...) +{ + va_list arg_ptr; + + va_start(arg_ptr, format); + vprintf(format, arg_ptr); + va_end(arg_ptr); +} +/*- End of function --------------------------------------------------------*/ +#else +#define STATE_TRACE(...) /**/ +#endif + +/*! T.4 run length table entry */ +typedef struct +{ + /*! Length of T.4 code, in bits */ + uint16_t length; + /*! T.4 code */ + uint16_t code; + /*! Run length, in bits */ + int16_t run_length; +} t4_run_table_entry_t; + +#include "t4_t6_decode_states.h" + +#if defined(HAVE_LIBTIFF) +static int set_tiff_directory_info(t4_state_t *s) +{ + time_t now; + struct tm *tm; + char buf[256 + 1]; + uint16_t resunit; + float x_resolution; + float y_resolution; + t4_tiff_state_t *t; + + t = &s->tiff; + /* Prepare the directory entry fully before writing the image, or libtiff complains */ + TIFFSetField(t->tiff_file, TIFFTAG_COMPRESSION, t->output_compression); + if (t->output_compression == COMPRESSION_CCITT_T4) + { + TIFFSetField(t->tiff_file, TIFFTAG_T4OPTIONS, t->output_t4_options); + TIFFSetField(t->tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF); + } + TIFFSetField(t->tiff_file, TIFFTAG_IMAGEWIDTH, s->image_width); + TIFFSetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, 1); + TIFFSetField(t->tiff_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); + TIFFSetField(t->tiff_file, TIFFTAG_SAMPLESPERPIXEL, 1); + if (t->output_compression == COMPRESSION_CCITT_T4 + || + t->output_compression == COMPRESSION_CCITT_T6) + { + TIFFSetField(t->tiff_file, TIFFTAG_ROWSPERSTRIP, -1L); + } + else + { + TIFFSetField(t->tiff_file, + TIFFTAG_ROWSPERSTRIP, + TIFFDefaultStripSize(t->tiff_file, 0)); + } + TIFFSetField(t->tiff_file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); + TIFFSetField(t->tiff_file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE); + TIFFSetField(t->tiff_file, TIFFTAG_FILLORDER, FILLORDER_LSB2MSB); + + x_resolution = s->x_resolution/100.0f; + y_resolution = s->y_resolution/100.0f; + /* Metric seems the sane thing to use in the 21st century, but a lot of lousy software + gets FAX resolutions wrong, and more get it wrong using metric than using inches. */ +#if 0 + TIFFSetField(t->tiff_file, TIFFTAG_XRESOLUTION, x_resolution); + TIFFSetField(t->tiff_file, TIFFTAG_YRESOLUTION, y_resolution); + resunit = RESUNIT_CENTIMETER; + TIFFSetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, resunit); +#else + TIFFSetField(t->tiff_file, TIFFTAG_XRESOLUTION, floorf(x_resolution*CM_PER_INCH + 0.5f)); + TIFFSetField(t->tiff_file, TIFFTAG_YRESOLUTION, floorf(y_resolution*CM_PER_INCH + 0.5f)); + resunit = RESUNIT_INCH; + TIFFSetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, resunit); +#endif + /* TODO: add the version of spandsp */ + TIFFSetField(t->tiff_file, TIFFTAG_SOFTWARE, "Spandsp " SPANDSP_RELEASE_DATETIME_STRING); + if (gethostname(buf, sizeof(buf)) == 0) + TIFFSetField(t->tiff_file, TIFFTAG_HOSTCOMPUTER, buf); + +#if defined(TIFFTAG_FAXDCS) + if (t->dcs) + TIFFSetField(t->tiff_file, TIFFTAG_FAXDCS, t->dcs); +#endif + if (t->sub_address) + TIFFSetField(t->tiff_file, TIFFTAG_FAXSUBADDRESS, t->sub_address); + if (t->far_ident) + TIFFSetField(t->tiff_file, TIFFTAG_IMAGEDESCRIPTION, t->far_ident); + if (t->vendor) + TIFFSetField(t->tiff_file, TIFFTAG_MAKE, t->vendor); + if (t->model) + TIFFSetField(t->tiff_file, TIFFTAG_MODEL, t->model); + + time(&now); + tm = localtime(&now); + sprintf(buf, + "%4d/%02d/%02d %02d:%02d:%02d", + tm->tm_year + 1900, + tm->tm_mon + 1, + tm->tm_mday, + tm->tm_hour, + tm->tm_min, + tm->tm_sec); + TIFFSetField(t->tiff_file, TIFFTAG_DATETIME, buf); + TIFFSetField(t->tiff_file, TIFFTAG_FAXRECVTIME, now - s->page_start_time); + + TIFFSetField(t->tiff_file, TIFFTAG_IMAGELENGTH, s->image_length); + /* Set the total pages to 1. For any one page document we will get this + right. For multi-page documents we will need to come back and fill in + the right answer when we know it. */ + TIFFSetField(t->tiff_file, TIFFTAG_PAGENUMBER, s->current_page++, 1); + s->tiff.pages_in_file = s->current_page; + if (t->output_compression == COMPRESSION_CCITT_T4) + { + if (s->t4_t6_rx.bad_rows) + { + TIFFSetField(t->tiff_file, TIFFTAG_BADFAXLINES, s->t4_t6_rx.bad_rows); + TIFFSetField(t->tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_REGENERATED); + TIFFSetField(t->tiff_file, TIFFTAG_CONSECUTIVEBADFAXLINES, s->t4_t6_rx.longest_bad_row_run); + } + else + { + TIFFSetField(t->tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN); + } + } + TIFFSetField(t->tiff_file, TIFFTAG_IMAGEWIDTH, s->image_width); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int open_tiff_output_file(t4_state_t *s, const char *file) +{ + if ((s->tiff.tiff_file = TIFFOpen(file, "w")) == NULL) + return -1; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void write_tiff_image(t4_state_t *s) +{ + /* Set up the TIFF directory info... */ + set_tiff_directory_info(s); + /* ..and then write the image... */ + if (TIFFWriteEncodedStrip(s->tiff.tiff_file, 0, s->image_buffer, s->image_length*s->bytes_per_row) < 0) + span_log(&s->logging, SPAN_LOG_WARNING, "%s: Error writing TIFF strip.\n", s->tiff.file); + /* ...then the directory entry, and libtiff is happy. */ + TIFFWriteDirectory(s->tiff.tiff_file); +} +/*- End of function --------------------------------------------------------*/ + +static int close_tiff_output_file(t4_state_t *s) +{ + int i; + t4_tiff_state_t *t; + + t = &s->tiff; + /* Perform any operations needed to tidy up a written TIFF file before + closure. */ + if (s->current_page > 1) + { + /* We need to edit the TIFF directories. Until now we did not know + the total page count, so the TIFF file currently says one. Now we + need to set the correct total page count associated with each page. */ + for (i = 0; i < s->current_page; i++) + { + TIFFSetDirectory(t->tiff_file, (tdir_t) i); + TIFFSetField(t->tiff_file, TIFFTAG_PAGENUMBER, i, s->current_page); + TIFFWriteDirectory(t->tiff_file); + } + } + TIFFClose(t->tiff_file); + t->tiff_file = NULL; + if (t->file) + { + /* Try not to leave a file behind, if we didn't receive any pages to + put in it. */ + if (s->current_page == 0) + remove(t->file); + free((char *) t->file); + t->file = NULL; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +#else + +static int set_tiff_directory_info(t4_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int get_tiff_directory_info(t4_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int test_tiff_directory_info(t4_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int open_tiff_input_file(t4_state_t *s, const char *file) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int read_tiff_image(t4_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int close_tiff_input_file(t4_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int open_tiff_output_file(t4_state_t *s, const char *file) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void write_tiff_image(t4_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int close_tiff_output_file(t4_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ +#endif + +static void update_row_bit_info(t4_state_t *s) +{ + if (s->row_bits > s->max_row_bits) + s->max_row_bits = s->row_bits; + if (s->row_bits < s->min_row_bits) + s->min_row_bits = s->row_bits; + s->row_bits = 0; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__powerpc__) +static __inline__ int run_length(unsigned int bits) +{ + return 7 - top_bit(bits); +} +/*- End of function --------------------------------------------------------*/ +#else +static __inline__ int run_length(unsigned int bits) +{ + static const uint8_t run_len[256] = + { + 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, /* 0x00 - 0x0F */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x10 - 0x1F */ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x20 - 0x2F */ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x30 - 0x3F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x40 - 0x4F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x50 - 0x5F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x60 - 0x6F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x70 - 0x7F */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 - 0x8F */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 - 0x9F */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 - 0xAF */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 - 0xBF */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 - 0xCF */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 - 0xDF */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 - 0xEF */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xF0 - 0xFF */ + }; + + return run_len[bits]; +} +/*- End of function --------------------------------------------------------*/ +#endif + +static int free_buffers(t4_state_t *s) +{ + if (s->image_buffer) + { + free(s->image_buffer); + s->image_buffer = NULL; + s->image_buffer_size = 0; + } + if (s->cur_runs) + { + free(s->cur_runs); + s->cur_runs = NULL; + } + if (s->ref_runs) + { + free(s->ref_runs); + s->ref_runs = NULL; + } + if (s->row_buf) + { + free(s->row_buf); + s->row_buf = NULL; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void add_run_to_row(t4_state_t *s) +{ + if (s->t4_t6_rx.run_length >= 0) + { + s->row_len += s->t4_t6_rx.run_length; + /* Don't allow rows to grow too long, and overflow the buffers */ + if (s->row_len <= s->image_width) + s->cur_runs[s->t4_t6_rx.a_cursor++] = s->t4_t6_rx.run_length; + } + s->t4_t6_rx.run_length = 0; +} +/*- End of function --------------------------------------------------------*/ + +static int put_decoded_row(t4_state_t *s) +{ + static const int msbmask[9] = + { + 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff + }; + uint8_t *t; + uint32_t i; + uint32_t *p; + int fudge; + int row_starts_at; + int x; + int j; + + if (s->t4_t6_rx.run_length) + add_run_to_row(s); +#if defined(T4_STATE_DEBUGGING) + /* Dump the runs of black and white for analysis */ + { + int total; + + total = 0; + for (x = 0; x < s->t4_t6_rx.b_cursor; x++) + total += s->ref_runs[x]; + printf("Ref (%d)", total); + for (x = 0; x < s->t4_t6_rx.b_cursor; x++) + printf(" %" PRIu32, s->ref_runs[x]); + printf("\n"); + total = 0; + for (x = 0; x < s->t4_t6_rx.a_cursor; x++) + total += s->cur_runs[x]; + printf("Cur (%d)", total); + for (x = 0; x < s->t4_t6_rx.a_cursor; x++) + printf(" %" PRIu32, s->cur_runs[x]); + printf("\n"); + } +#endif + row_starts_at = s->image_size; + /* Make sure there is enough room for another row */ + if (s->image_size + s->bytes_per_row >= s->image_buffer_size) + { + if ((t = realloc(s->image_buffer, s->image_buffer_size + 100*s->bytes_per_row)) == NULL) + return -1; + s->image_buffer_size += 100*s->bytes_per_row; + s->image_buffer = t; + } + if (s->row_len == s->image_width) + { + STATE_TRACE("%d Good row - %d %s\n", s->image_length, s->row_len, (s->row_is_2d) ? "2D" : "1D"); + if (s->t4_t6_rx.curr_bad_row_run) + { + if (s->t4_t6_rx.curr_bad_row_run > s->t4_t6_rx.longest_bad_row_run) + s->t4_t6_rx.longest_bad_row_run = s->t4_t6_rx.curr_bad_row_run; + s->t4_t6_rx.curr_bad_row_run = 0; + } + /* Convert the runs to a bit image of the row */ + /* White/black/white... runs, always starting with white. That means the first run could be + zero length. */ + for (x = 0, fudge = 0; x < s->t4_t6_rx.a_cursor; x++, fudge ^= 0xFF) + { + i = s->cur_runs[x]; + if ((int) i >= s->tx_bits) + { + s->tx_bitstream = (s->tx_bitstream << s->tx_bits) | (msbmask[s->tx_bits] & fudge); + for (i += (8 - s->tx_bits); i >= 8; i -= 8) + { + s->tx_bits = 8; + s->image_buffer[s->image_size++] = (uint8_t) s->tx_bitstream; + s->tx_bitstream = fudge; + } + } + s->tx_bitstream = (s->tx_bitstream << i) | (msbmask[i] & fudge); + s->tx_bits -= i; + } + s->image_length++; + } + else + { + STATE_TRACE("%d Bad row - %d %s\n", s->image_length, s->row_len, (s->row_is_2d) ? "2D" : "1D"); + /* Try to clean up the bad runs, and produce something reasonable as the reference + row for the next row. Use a copy of the previous good row as the actual current + row. If the row only fell apart near the end, reusing it might be the best + solution. */ + for (j = 0, fudge = 0; j < s->t4_t6_rx.a_cursor && fudge < s->image_width; j++) + fudge += s->cur_runs[j]; + if (fudge < s->image_width) + { + /* Try to pad with white, and avoid black, to minimise mess on the image. */ + if ((s->t4_t6_rx.a_cursor & 1)) + { + /* We currently finish in white. We could extend that, but it is probably of + the right length. Changing it would only further mess up what happens in the + next row. It seems better to add a black spot, and an extra white run. */ + s->cur_runs[s->t4_t6_rx.a_cursor++] = 1; + fudge++; + if (fudge < s->image_width) + s->cur_runs[s->t4_t6_rx.a_cursor++] = s->image_width - fudge; + } + else + { + /* We currently finish on black, so we add an extra white run to fill out the line. */ + s->cur_runs[s->t4_t6_rx.a_cursor++] = s->image_width - fudge; + } + } + else + { + /* Trim the last element to align with the proper image width */ + s->cur_runs[s->t4_t6_rx.a_cursor] += (s->image_width - fudge); + } + /* Ensure there is a previous line to copy from. */ + if (s->image_size != s->t4_t6_rx.last_row_starts_at) + { + /* Copy the previous row over this one */ + memcpy(s->image_buffer + s->image_size, s->image_buffer + s->t4_t6_rx.last_row_starts_at, s->bytes_per_row); + s->image_size += s->bytes_per_row; + s->image_length++; + } + s->t4_t6_rx.bad_rows++; + s->t4_t6_rx.curr_bad_row_run++; + } + + /* Pad the row as it becomes the reference row, so there are no odd runs to pick up if we + step off the end of the list. */ + s->cur_runs[s->t4_t6_rx.a_cursor] = 0; + s->cur_runs[s->t4_t6_rx.a_cursor + 1] = 0; + + /* Prepare the buffers for the next row. */ + s->t4_t6_rx.last_row_starts_at = row_starts_at; + /* Swap the buffers */ + p = s->cur_runs; + s->cur_runs = s->ref_runs; + s->ref_runs = p; + + s->t4_t6_rx.b_cursor = 1; + s->t4_t6_rx.a_cursor = 0; + s->t4_t6_rx.b1 = s->ref_runs[0]; + s->t4_t6_rx.a0 = 0; + + s->t4_t6_rx.run_length = 0; + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_rx_end_page(t4_state_t *s) +{ + int row; + int i; + + if (s->line_encoding == T4_COMPRESSION_ITU_T6) + { + /* Push enough zeros through the decoder to flush out any remaining codes */ + for (i = 0; i < 13; i++) + t4_rx_put_bit(s, 0); + } + if (s->t4_t6_rx.curr_bad_row_run) + { + if (s->t4_t6_rx.curr_bad_row_run > s->t4_t6_rx.longest_bad_row_run) + s->t4_t6_rx.longest_bad_row_run = s->t4_t6_rx.curr_bad_row_run; + s->t4_t6_rx.curr_bad_row_run = 0; + } + + if (s->image_size == 0) + return -1; + + if (s->t4_t6_rx.row_write_handler) + { + for (row = 0; row < s->image_length; row++) + { + if (s->t4_t6_rx.row_write_handler(s->t4_t6_rx.row_write_user_data, s->image_buffer + row*s->bytes_per_row, s->bytes_per_row) < 0) + { + span_log(&s->logging, SPAN_LOG_WARNING, "Write error at row %d.\n", row); + break; + } + } + /* Write a blank row to indicate the end of the image. */ + if (s->t4_t6_rx.row_write_handler(s->t4_t6_rx.row_write_user_data, NULL, 0) < 0) + span_log(&s->logging, SPAN_LOG_WARNING, "Write error at row %d.\n", row); + } + else + { + write_tiff_image(s); + } + s->t4_t6_rx.rx_bits = 0; + s->t4_t6_rx.rx_skip_bits = 0; + s->t4_t6_rx.rx_bitstream = 0; + s->t4_t6_rx.consecutive_eols = EOLS_TO_END_ANY_RX_PAGE; + + s->image_size = 0; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void drop_rx_bits(t4_state_t *s, int bits) +{ + /* Only remove one bit right now. The rest need to be removed step by step, + checking for a misaligned EOL along the way. This is time consuming, but + if we don't do it a single bit error can severely damage an image. */ + s->row_bits += bits; + s->t4_t6_rx.rx_skip_bits += (bits - 1); + s->t4_t6_rx.rx_bits--; + s->t4_t6_rx.rx_bitstream >>= 1; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void force_drop_rx_bits(t4_state_t *s, int bits) +{ + /* This should only be called to drop the bits of an EOL, as that is the + only place where it is safe to drop them all at once. */ + s->row_bits += bits; + s->t4_t6_rx.rx_skip_bits = 0; + s->t4_t6_rx.rx_bits -= bits; + s->t4_t6_rx.rx_bitstream >>= bits; +} +/*- End of function --------------------------------------------------------*/ + +static int rx_put_bits(t4_state_t *s, uint32_t bit_string, int quantity) +{ + int bits; + + /* We decompress bit by bit, as the data stream is received. We need to + scan continuously for EOLs, so we might as well work this way. */ + s->line_image_size += quantity; + s->t4_t6_rx.rx_bitstream |= (bit_string << s->t4_t6_rx.rx_bits); + /* The longest item we need to scan for is 13 bits long (a 2D EOL), so we + need a minimum of 13 bits in the buffer to proceed with any bit stream + analysis. */ + if ((s->t4_t6_rx.rx_bits += quantity) < 13) + return FALSE; + if (s->t4_t6_rx.consecutive_eols) + { + /* Check if the image has already terminated. */ + if (s->t4_t6_rx.consecutive_eols >= EOLS_TO_END_ANY_RX_PAGE) + return TRUE; + /* Check if the image hasn't even started. */ + if (s->t4_t6_rx.consecutive_eols < 0) + { + /* We are waiting for the very first EOL (1D or 2D only). */ + /* We need to take this bit by bit, as the EOL could be anywhere, + and any junk could preceed it. */ + while ((s->t4_t6_rx.rx_bitstream & 0xFFF) != 0x800) + { + s->t4_t6_rx.rx_bitstream >>= 1; + if (--s->t4_t6_rx.rx_bits < 13) + return FALSE; + } + /* We have an EOL, so now the page begins and we can proceed to + process the bit stream as image data. */ + s->t4_t6_rx.consecutive_eols = 0; + if (s->line_encoding == T4_COMPRESSION_ITU_T4_1D) + { + s->row_is_2d = FALSE; + force_drop_rx_bits(s, 12); + } + else + { + s->row_is_2d = !(s->t4_t6_rx.rx_bitstream & 0x1000); + force_drop_rx_bits(s, 13); + } + } + } + + while (s->t4_t6_rx.rx_bits >= 13) + { + /* We need to check for EOLs bit by bit through the whole stream. If + we just try looking between code words, we will miss an EOL when a bit + error has throw the code words completely out of step. The can mean + recovery takes many lines, and the image gets really messed up. */ + /* Although EOLs are not inserted at the end of each row of a T.6 image, + they are still perfectly valid, and can terminate an image. */ + if ((s->t4_t6_rx.rx_bitstream & 0x0FFF) == 0x0800) + { + STATE_TRACE("EOL\n"); + if (s->row_len == 0) + { + /* A zero length row - i.e. 2 consecutive EOLs - is distinctly + the end of page condition. That's all we actually get on a + T.6 page. However, there are a minimum of 6 EOLs at the end of + any T.4 page. We can look for more than 2 EOLs in case bit + errors simulate the end of page condition at the wrong point. + Such robust checking is irrelevant for a T.6 page, as it should + be error free. */ + /* Note that for a T.6 page we should get here on the very first + EOL, as the row length should be zero at that point. Therefore + we should count up both EOLs, unless there is some bogus partial + row ahead of them. */ + s->t4_t6_rx.consecutive_eols++; + if (s->line_encoding == T4_COMPRESSION_ITU_T6) + { + if (s->t4_t6_rx.consecutive_eols >= EOLS_TO_END_T6_RX_PAGE) + { + s->t4_t6_rx.consecutive_eols = EOLS_TO_END_ANY_RX_PAGE; + return TRUE; + } + } + else + { + if (s->t4_t6_rx.consecutive_eols >= EOLS_TO_END_T4_RX_PAGE) + { + s->t4_t6_rx.consecutive_eols = EOLS_TO_END_ANY_RX_PAGE; + return TRUE; + } + } + } + else + { + /* The EOLs are not back-to-back, so they are not part of the + end of page condition. */ + if (s->t4_t6_rx.run_length > 0) + add_run_to_row(s); + s->t4_t6_rx.consecutive_eols = 0; + if (put_decoded_row(s)) + return TRUE; + update_row_bit_info(s); + } + if (s->line_encoding == T4_COMPRESSION_ITU_T4_2D) + { + s->row_is_2d = !(s->t4_t6_rx.rx_bitstream & 0x1000); + force_drop_rx_bits(s, 13); + } + else + { + force_drop_rx_bits(s, 12); + } + s->t4_t6_rx.its_black = FALSE; + s->t4_t6_rx.black_white = 0; + s->t4_t6_rx.run_length = 0; + s->row_len = 0; + continue; + } + if (s->t4_t6_rx.rx_skip_bits) + { + /* We are clearing out the remaining bits of the last code word we + absorbed. */ + s->t4_t6_rx.rx_skip_bits--; + s->t4_t6_rx.rx_bits--; + s->t4_t6_rx.rx_bitstream >>= 1; + continue; + } + if (s->row_is_2d && s->t4_t6_rx.black_white == 0) + { + bits = s->t4_t6_rx.rx_bitstream & 0x7F; + STATE_TRACE("State %d, %d - ", + t4_2d_table[bits].state, + t4_2d_table[bits].width); + if (s->row_len >= s->image_width) + { + drop_rx_bits(s, t4_2d_table[bits].width); + continue; + } + if (s->t4_t6_rx.a_cursor) + { + /* Move past a0, always staying on the current colour */ + for ( ; s->t4_t6_rx.b1 <= s->t4_t6_rx.a0; s->t4_t6_rx.b_cursor += 2) + s->t4_t6_rx.b1 += (s->ref_runs[s->t4_t6_rx.b_cursor] + s->ref_runs[s->t4_t6_rx.b_cursor + 1]); + } + switch (t4_2d_table[bits].state) + { + case S_Horiz: + STATE_TRACE("Horiz %d %d %d\n", + s->image_width, + s->t4_t6_rx.a0, + s->t4_t6_rx.a_cursor); + /* We now need to extract a white/black or black/white pair of runs, using the 1D + method. If the first of the pair takes us exactly to the end of the row, there + should still be a zero length element for the second of the pair. */ + s->t4_t6_rx.its_black = s->t4_t6_rx.a_cursor & 1; + s->t4_t6_rx.black_white = 2; + break; + case S_Vert: + STATE_TRACE("Vert[%d] %d %d %d %d\n", + t4_2d_table[bits].param, + s->image_width, + s->t4_t6_rx.a0, + s->t4_t6_rx.b1, + s->t4_t6_rx.run_length); + s->t4_t6_rx.run_length += (s->t4_t6_rx.b1 - s->t4_t6_rx.a0 + t4_2d_table[bits].param); + s->t4_t6_rx.a0 = s->t4_t6_rx.b1 + t4_2d_table[bits].param; + add_run_to_row(s); + /* We need to move one step in one direction or the other, to change to the + opposite colour */ + if (t4_2d_table[bits].param >= 0) + { + s->t4_t6_rx.b1 += s->ref_runs[s->t4_t6_rx.b_cursor++]; + } + else + { + if (s->t4_t6_rx.b_cursor) + s->t4_t6_rx.b1 -= s->ref_runs[--s->t4_t6_rx.b_cursor]; + } + break; + case S_Pass: + STATE_TRACE("Pass %d %d %d %d %d\n", + s->image_width, + s->t4_t6_rx.a0, + s->t4_t6_rx.b1, + s->ref_runs[s->t4_t6_rx.b_cursor], + s->ref_runs[s->t4_t6_rx.b_cursor + 1]); + s->t4_t6_rx.b1 += s->ref_runs[s->t4_t6_rx.b_cursor++]; + s->t4_t6_rx.run_length += (s->t4_t6_rx.b1 - s->t4_t6_rx.a0); + s->t4_t6_rx.a0 = s->t4_t6_rx.b1; + s->t4_t6_rx.b1 += s->ref_runs[s->t4_t6_rx.b_cursor++]; + break; + case S_Ext: + /* We do not currently handle any kind of extension */ + STATE_TRACE("Ext %d %d %d 0x%x\n", + s->image_width, + s->t4_t6_rx.a0, + ((s->t4_t6_rx.rx_bitstream >> t4_2d_table[bits].width) & 0x7), + s->t4_t6_rx.rx_bitstream); + /* TODO: The uncompressed option should be implemented. */ + break; + case S_Null: + STATE_TRACE("Null\n"); + break; + default: + STATE_TRACE("Unexpected T.4 state\n"); + span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected T.4 state %d\n", t4_2d_table[bits].state); + break; + } + drop_rx_bits(s, t4_2d_table[bits].width); + } + else + { + if (s->t4_t6_rx.its_black) + { + bits = s->t4_t6_rx.rx_bitstream & 0x1FFF; + STATE_TRACE("State %d, %d - Black %d %d %d\n", + t4_1d_black_table[bits].state, + t4_1d_black_table[bits].width, + s->image_width, + s->t4_t6_rx.a0, + t4_1d_black_table[bits].param); + switch (t4_1d_black_table[bits].state) + { + case S_MakeUpB: + case S_MakeUp: + s->t4_t6_rx.run_length += t4_1d_black_table[bits].param; + s->t4_t6_rx.a0 += t4_1d_black_table[bits].param; + break; + case S_TermB: + s->t4_t6_rx.its_black = FALSE; + if (s->row_len < s->image_width) + { + s->t4_t6_rx.run_length += t4_1d_black_table[bits].param; + s->t4_t6_rx.a0 += t4_1d_black_table[bits].param; + add_run_to_row(s); + } + if (s->t4_t6_rx.black_white) + s->t4_t6_rx.black_white--; + break; + default: + /* Bad black */ + s->t4_t6_rx.black_white = 0; + break; + } + drop_rx_bits(s, t4_1d_black_table[bits].width); + } + else + { + bits = s->t4_t6_rx.rx_bitstream & 0xFFF; + STATE_TRACE("State %d, %d - White %d %d %d\n", + t4_1d_white_table[bits].state, + t4_1d_white_table[bits].width, + s->image_width, + s->t4_t6_rx.a0, + t4_1d_white_table[bits].param); + switch (t4_1d_white_table[bits].state) + { + case S_MakeUpW: + case S_MakeUp: + s->t4_t6_rx.run_length += t4_1d_white_table[bits].param; + s->t4_t6_rx.a0 += t4_1d_white_table[bits].param; + break; + case S_TermW: + s->t4_t6_rx.its_black = TRUE; + if (s->row_len < s->image_width) + { + s->t4_t6_rx.run_length += t4_1d_white_table[bits].param; + s->t4_t6_rx.a0 += t4_1d_white_table[bits].param; + add_run_to_row(s); + } + if (s->t4_t6_rx.black_white) + s->t4_t6_rx.black_white--; + break; + default: + /* Bad white */ + s->t4_t6_rx.black_white = 0; + break; + } + drop_rx_bits(s, t4_1d_white_table[bits].width); + } + } + if (s->t4_t6_rx.a0 >= s->image_width) + s->t4_t6_rx.a0 = s->image_width - 1; + + if (s->line_encoding == T4_COMPRESSION_ITU_T6) + { + /* T.6 has no EOL markers. We sense the end of a line by its length alone. */ + /* The last test here is a backstop protection, so a corrupt image cannot + cause us to do bad things. Bad encoders have actually been seen, which + demand such protection. */ + if (s->t4_t6_rx.black_white == 0 && s->row_len >= s->image_width) + { + STATE_TRACE("EOL T.6\n"); + if (s->t4_t6_rx.run_length > 0) + add_run_to_row(s); + update_row_bit_info(s); + if (put_decoded_row(s)) + return TRUE; + s->t4_t6_rx.its_black = FALSE; + s->t4_t6_rx.black_white = 0; + s->t4_t6_rx.run_length = 0; + s->row_len = 0; + } + } + } + return FALSE; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_rx_put_bit(t4_state_t *s, int bit) +{ + return rx_put_bits(s, bit & 1, 1); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_rx_put_byte(t4_state_t *s, uint8_t byte) +{ + return rx_put_bits(s, byte & 0xFF, 8); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_rx_put_chunk(t4_state_t *s, const uint8_t buf[], int len) +{ + int i; + uint8_t byte; + + for (i = 0; i < len; i++) + { + byte = buf[i]; + if (rx_put_bits(s, byte & 0xFF, 8)) + return TRUE; + } + return FALSE; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_rx_set_row_write_handler(t4_state_t *s, t4_row_write_handler_t handler, void *user_data) +{ + s->t4_t6_rx.row_write_handler = handler; + s->t4_t6_rx.row_write_user_data = user_data; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(t4_state_t *) t4_rx_init(t4_state_t *s, const char *file, int output_encoding) +{ + if (s == NULL) + { + if ((s = (t4_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "T.4"); + s->rx = TRUE; + + span_log(&s->logging, SPAN_LOG_FLOW, "Start rx document\n"); + + if (open_tiff_output_file(s, file) < 0) + return NULL; + + /* Save the file name for logging reports. */ + s->tiff.file = strdup(file); + /* Only provide for one form of coding throughout the file, even though the + coding on the wire could change between pages. */ + switch (output_encoding) + { + case T4_COMPRESSION_ITU_T4_1D: + s->tiff.output_compression = COMPRESSION_CCITT_T4; + s->tiff.output_t4_options = GROUP3OPT_FILLBITS; + break; + case T4_COMPRESSION_ITU_T4_2D: + s->tiff.output_compression = COMPRESSION_CCITT_T4; + s->tiff.output_t4_options = GROUP3OPT_FILLBITS | GROUP3OPT_2DENCODING; + break; + case T4_COMPRESSION_ITU_T6: + s->tiff.output_compression = COMPRESSION_CCITT_T6; + s->tiff.output_t4_options = 0; + break; + } + + /* Until we have a valid figure for the bytes per row, we need it to be set to a suitable + value to ensure it will be seen as changing when the real value is used. */ + s->bytes_per_row = 0; + + s->current_page = 0; + s->tiff.pages_in_file = 0; + s->tiff.start_page = 0; + s->tiff.stop_page = INT_MAX; + + s->image_buffer = NULL; + s->image_buffer_size = 0; + + /* Set some default values */ + s->x_resolution = T4_X_RESOLUTION_R8; + s->y_resolution = T4_Y_RESOLUTION_FINE; + s->image_width = T4_WIDTH_R8_A4; + + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_rx_start_page(t4_state_t *s) +{ + int bytes_per_row; + int run_space; + uint32_t *bufptr; + + span_log(&s->logging, SPAN_LOG_FLOW, "Start rx page - compression %d\n", s->line_encoding); + if (s->tiff.tiff_file == NULL) + return -1; + + /* Calculate the scanline/tile width. */ + bytes_per_row = (s->image_width + 7)/8; + run_space = (s->image_width + 4)*sizeof(uint32_t); + if (bytes_per_row != s->bytes_per_row) + { + /* Allocate the space required for decoding the new row length. */ + s->bytes_per_row = bytes_per_row; + if ((bufptr = (uint32_t *) realloc(s->cur_runs, run_space)) == NULL) + return -1; + s->cur_runs = bufptr; + if ((bufptr = (uint32_t *) realloc(s->ref_runs, run_space)) == NULL) + return -1; + s->ref_runs = bufptr; + } + memset(s->cur_runs, 0, run_space); + memset(s->ref_runs, 0, run_space); + + s->t4_t6_rx.rx_bits = 0; + s->t4_t6_rx.rx_skip_bits = 0; + s->t4_t6_rx.rx_bitstream = 0; + s->row_bits = 0; + s->min_row_bits = INT_MAX; + s->max_row_bits = 0; + + s->row_is_2d = (s->line_encoding == T4_COMPRESSION_ITU_T6); + /* We start at -1 EOLs for 1D and 2D decoding, as an indication we are waiting for the + first EOL. T.6 coding starts without any preamble. */ + s->t4_t6_rx.consecutive_eols = (s->line_encoding == T4_COMPRESSION_ITU_T6) ? 0 : -1; + + s->t4_t6_rx.bad_rows = 0; + s->t4_t6_rx.longest_bad_row_run = 0; + s->t4_t6_rx.curr_bad_row_run = 0; + s->image_length = 0; + s->tx_bitstream = 0; + s->tx_bits = 8; + s->image_size = 0; + s->line_image_size = 0; + s->t4_t6_rx.last_row_starts_at = 0; + + s->row_len = 0; + s->t4_t6_rx.its_black = FALSE; + s->t4_t6_rx.black_white = 0; + + /* Initialise the reference line to all white */ + s->ref_runs[0] = + s->ref_runs[1] = + s->ref_runs[2] = + s->ref_runs[3] = s->image_width; + + s->t4_t6_rx.b_cursor = 1; + s->t4_t6_rx.a_cursor = 0; + s->t4_t6_rx.b1 = s->ref_runs[0]; + s->t4_t6_rx.a0 = 0; + + s->t4_t6_rx.run_length = 0; + + time (&s->page_start_time); + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_rx_release(t4_state_t *s) +{ + if (!s->rx) + return -1; + if (s->tiff.tiff_file) + close_tiff_output_file(s); + free_buffers(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_rx_free(t4_state_t *s) +{ + int ret; + + ret = t4_rx_release(s); + free(s); + return ret; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_rx_set_rx_encoding(t4_state_t *s, int encoding) +{ + s->line_encoding = encoding; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_rx_set_image_width(t4_state_t *s, int width) +{ + s->image_width = width; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_rx_set_y_resolution(t4_state_t *s, int resolution) +{ + s->y_resolution = resolution; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_rx_set_x_resolution(t4_state_t *s, int resolution) +{ + s->x_resolution = resolution; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_rx_set_dcs(t4_state_t *s, const char *dcs) +{ + s->tiff.dcs = (dcs && dcs[0]) ? dcs : NULL; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_rx_set_sub_address(t4_state_t *s, const char *sub_address) +{ + s->tiff.sub_address = (sub_address && sub_address[0]) ? sub_address : NULL; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_rx_set_far_ident(t4_state_t *s, const char *ident) +{ + s->tiff.far_ident = (ident && ident[0]) ? ident : NULL; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_rx_set_vendor(t4_state_t *s, const char *vendor) +{ + s->tiff.vendor = vendor; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_rx_set_model(t4_state_t *s, const char *model) +{ + s->tiff.model = model; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_get_transfer_statistics(t4_state_t *s, t4_stats_t *t) +{ + t->pages_transferred = s->current_page - s->tiff.start_page; + t->pages_in_file = s->tiff.pages_in_file; + t->width = s->image_width; + t->length = s->image_length; + t->bad_rows = s->t4_t6_rx.bad_rows; + t->longest_bad_row_run = s->t4_t6_rx.longest_bad_row_run; + t->x_resolution = s->x_resolution; + t->y_resolution = s->y_resolution; + t->encoding = s->line_encoding; + t->line_image_size = s->line_image_size/8; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) t4_encoding_to_str(int encoding) +{ + switch (encoding) + { + case T4_COMPRESSION_ITU_T4_1D: + return "T.4 1-D"; + case T4_COMPRESSION_ITU_T4_2D: + return "T.4 2-D"; + case T4_COMPRESSION_ITU_T6: + return "T.6"; + } + return "???"; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/t4_t6_decode_states.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/t4_t6_decode_states.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,12486 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t4_t6_decode_states.h - state tables for T.4/T.6 FAX image decoding + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t4_t6_decode_states.h,v 1.1.2.4 2009/12/19 10:21:43 steveu Exp $ + */ + +/* Legitimate runs of zero bits which are the tail end of one code + plus the start of the next code do not exceed 10 bits. */ + +/* Finite state machine state codes */ +enum +{ + S_Null = 0, + S_Pass = 1, + S_Horiz = 2, + S_Vert = 3, + S_Ext = 4, + S_TermW = 5, + S_TermB = 6, + S_MakeUpW = 7, + S_MakeUpB = 8, + S_MakeUp = 9, + S_EOL = 10 +}; + +/*! T.4 finite state machine state table entry */ +typedef struct +{ + /*! State */ + uint8_t state; + /*! Width of code in bits */ + uint8_t width; + /*! Run length in bits */ + int16_t param; +} t4_table_entry_t; + +static const t4_table_entry_t t4_2d_table[128] = +{ + {S_Null, 1, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, -1}, + {S_Vert, 1, 0}, + {S_Horiz, 3, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, 1}, + {S_Vert, 1, 0}, + {S_Pass, 4, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, -1}, + {S_Vert, 1, 0}, + {S_Horiz, 3, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, 1}, + {S_Vert, 1, 0}, + {S_Vert, 6, -2}, + {S_Vert, 1, 0}, + {S_Vert, 3, -1}, + {S_Vert, 1, 0}, + {S_Horiz, 3, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, 1}, + {S_Vert, 1, 0}, + {S_Pass, 4, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, -1}, + {S_Vert, 1, 0}, + {S_Horiz, 3, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, 1}, + {S_Vert, 1, 0}, + {S_Vert, 7, -3}, + {S_Vert, 1, 0}, + {S_Vert, 3, -1}, + {S_Vert, 1, 0}, + {S_Horiz, 3, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, 1}, + {S_Vert, 1, 0}, + {S_Pass, 4, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, -1}, + {S_Vert, 1, 0}, + {S_Horiz, 3, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, 1}, + {S_Vert, 1, 0}, + {S_Vert, 6, 2}, + {S_Vert, 1, 0}, + {S_Vert, 3, -1}, + {S_Vert, 1, 0}, + {S_Horiz, 3, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, 1}, + {S_Vert, 1, 0}, + {S_Pass, 4, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, -1}, + {S_Vert, 1, 0}, + {S_Horiz, 3, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, 1}, + {S_Vert, 1, 0}, + {S_Ext, 7, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, -1}, + {S_Vert, 1, 0}, + {S_Horiz, 3, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, 1}, + {S_Vert, 1, 0}, + {S_Pass, 4, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, -1}, + {S_Vert, 1, 0}, + {S_Horiz, 3, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, 1}, + {S_Vert, 1, 0}, + {S_Vert, 6, -2}, + {S_Vert, 1, 0}, + {S_Vert, 3, -1}, + {S_Vert, 1, 0}, + {S_Horiz, 3, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, 1}, + {S_Vert, 1, 0}, + {S_Pass, 4, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, -1}, + {S_Vert, 1, 0}, + {S_Horiz, 3, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, 1}, + {S_Vert, 1, 0}, + {S_Vert, 7, 3}, + {S_Vert, 1, 0}, + {S_Vert, 3, -1}, + {S_Vert, 1, 0}, + {S_Horiz, 3, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, 1}, + {S_Vert, 1, 0}, + {S_Pass, 4, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, -1}, + {S_Vert, 1, 0}, + {S_Horiz, 3, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, 1}, + {S_Vert, 1, 0}, + {S_Vert, 6, 2}, + {S_Vert, 1, 0}, + {S_Vert, 3, -1}, + {S_Vert, 1, 0}, + {S_Horiz, 3, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, 1}, + {S_Vert, 1, 0}, + {S_Pass, 4, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, -1}, + {S_Vert, 1, 0}, + {S_Horiz, 3, 0}, + {S_Vert, 1, 0}, + {S_Vert, 3, 1}, + {S_Vert, 1, 0} +}; + +static const t4_table_entry_t t4_1d_white_table[4096] = +{ + {S_Null, 1, 0}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 39}, + {S_TermW, 6, 16}, + {S_MakeUpW, 8, 576}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 55}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 45}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 53}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 448}, + {S_TermW, 4, 6}, + {S_TermW, 8, 35}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 51}, + {S_TermW, 6, 15}, + {S_TermW, 8, 63}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1472}, + {S_TermW, 4, 5}, + {S_TermW, 8, 43}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1216}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 29}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 33}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 49}, + {S_TermW, 6, 14}, + {S_TermW, 8, 61}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 47}, + {S_TermW, 4, 3}, + {S_TermW, 8, 59}, + {S_TermW, 4, 5}, + {S_TermW, 8, 41}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 960}, + {S_TermW, 4, 6}, + {S_TermW, 8, 31}, + {S_TermW, 5, 8}, + {S_TermW, 8, 57}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 9, 704}, + {S_TermW, 4, 6}, + {S_TermW, 8, 37}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 320}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_MakeUp, 11, 1792}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 40}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 832}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 56}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 46}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 54}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 512}, + {S_TermW, 4, 6}, + {S_TermW, 8, 36}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 52}, + {S_TermW, 6, 15}, + {S_TermW, 8, 0}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1600}, + {S_TermW, 4, 5}, + {S_TermW, 8, 44}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1344}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 30}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 34}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 50}, + {S_TermW, 6, 14}, + {S_TermW, 8, 62}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 48}, + {S_TermW, 4, 3}, + {S_TermW, 8, 60}, + {S_TermW, 4, 5}, + {S_TermW, 8, 42}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1088}, + {S_TermW, 4, 6}, + {S_TermW, 8, 32}, + {S_TermW, 5, 8}, + {S_TermW, 8, 58}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 640}, + {S_TermW, 4, 6}, + {S_TermW, 8, 38}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 384}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_Null, 1, 0}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 39}, + {S_TermW, 6, 16}, + {S_MakeUpW, 8, 576}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 55}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 45}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 53}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 448}, + {S_TermW, 4, 6}, + {S_TermW, 8, 35}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 51}, + {S_TermW, 6, 15}, + {S_TermW, 8, 63}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1536}, + {S_TermW, 4, 5}, + {S_TermW, 8, 43}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1280}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 29}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 33}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 49}, + {S_TermW, 6, 14}, + {S_TermW, 8, 61}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 47}, + {S_TermW, 4, 3}, + {S_TermW, 8, 59}, + {S_TermW, 4, 5}, + {S_TermW, 8, 41}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1024}, + {S_TermW, 4, 6}, + {S_TermW, 8, 31}, + {S_TermW, 5, 8}, + {S_TermW, 8, 57}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 9, 768}, + {S_TermW, 4, 6}, + {S_TermW, 8, 37}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 320}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_MakeUp, 11, 1856}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 40}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 896}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 56}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 46}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 54}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 512}, + {S_TermW, 4, 6}, + {S_TermW, 8, 36}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 52}, + {S_TermW, 6, 15}, + {S_TermW, 8, 0}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1728}, + {S_TermW, 4, 5}, + {S_TermW, 8, 44}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1408}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 30}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 34}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 50}, + {S_TermW, 6, 14}, + {S_TermW, 8, 62}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 48}, + {S_TermW, 4, 3}, + {S_TermW, 8, 60}, + {S_TermW, 4, 5}, + {S_TermW, 8, 42}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1152}, + {S_TermW, 4, 6}, + {S_TermW, 8, 32}, + {S_TermW, 5, 8}, + {S_TermW, 8, 58}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 640}, + {S_TermW, 4, 6}, + {S_TermW, 8, 38}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 384}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_Null, 1, 0}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 39}, + {S_TermW, 6, 16}, + {S_MakeUpW, 8, 576}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 55}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 45}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 53}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 448}, + {S_TermW, 4, 6}, + {S_TermW, 8, 35}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 51}, + {S_TermW, 6, 15}, + {S_TermW, 8, 63}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1472}, + {S_TermW, 4, 5}, + {S_TermW, 8, 43}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1216}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 29}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 33}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 49}, + {S_TermW, 6, 14}, + {S_TermW, 8, 61}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 47}, + {S_TermW, 4, 3}, + {S_TermW, 8, 59}, + {S_TermW, 4, 5}, + {S_TermW, 8, 41}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 960}, + {S_TermW, 4, 6}, + {S_TermW, 8, 31}, + {S_TermW, 5, 8}, + {S_TermW, 8, 57}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 9, 704}, + {S_TermW, 4, 6}, + {S_TermW, 8, 37}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 320}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_MakeUp, 12, 2112}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 40}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 832}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 56}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 46}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 54}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 512}, + {S_TermW, 4, 6}, + {S_TermW, 8, 36}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 52}, + {S_TermW, 6, 15}, + {S_TermW, 8, 0}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1600}, + {S_TermW, 4, 5}, + {S_TermW, 8, 44}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1344}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 30}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 34}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 50}, + {S_TermW, 6, 14}, + {S_TermW, 8, 62}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 48}, + {S_TermW, 4, 3}, + {S_TermW, 8, 60}, + {S_TermW, 4, 5}, + {S_TermW, 8, 42}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1088}, + {S_TermW, 4, 6}, + {S_TermW, 8, 32}, + {S_TermW, 5, 8}, + {S_TermW, 8, 58}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 640}, + {S_TermW, 4, 6}, + {S_TermW, 8, 38}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 384}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_Null, 1, 0}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 39}, + {S_TermW, 6, 16}, + {S_MakeUpW, 8, 576}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 55}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 45}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 53}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 448}, + {S_TermW, 4, 6}, + {S_TermW, 8, 35}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 51}, + {S_TermW, 6, 15}, + {S_TermW, 8, 63}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1536}, + {S_TermW, 4, 5}, + {S_TermW, 8, 43}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1280}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 29}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 33}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 49}, + {S_TermW, 6, 14}, + {S_TermW, 8, 61}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 47}, + {S_TermW, 4, 3}, + {S_TermW, 8, 59}, + {S_TermW, 4, 5}, + {S_TermW, 8, 41}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1024}, + {S_TermW, 4, 6}, + {S_TermW, 8, 31}, + {S_TermW, 5, 8}, + {S_TermW, 8, 57}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 9, 768}, + {S_TermW, 4, 6}, + {S_TermW, 8, 37}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 320}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_MakeUp, 12, 2368}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 40}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 896}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 56}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 46}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 54}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 512}, + {S_TermW, 4, 6}, + {S_TermW, 8, 36}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 52}, + {S_TermW, 6, 15}, + {S_TermW, 8, 0}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1728}, + {S_TermW, 4, 5}, + {S_TermW, 8, 44}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1408}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 30}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 34}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 50}, + {S_TermW, 6, 14}, + {S_TermW, 8, 62}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 48}, + {S_TermW, 4, 3}, + {S_TermW, 8, 60}, + {S_TermW, 4, 5}, + {S_TermW, 8, 42}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1152}, + {S_TermW, 4, 6}, + {S_TermW, 8, 32}, + {S_TermW, 5, 8}, + {S_TermW, 8, 58}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 640}, + {S_TermW, 4, 6}, + {S_TermW, 8, 38}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 384}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_Null, 1, 0}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 39}, + {S_TermW, 6, 16}, + {S_MakeUpW, 8, 576}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 55}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 45}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 53}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 448}, + {S_TermW, 4, 6}, + {S_TermW, 8, 35}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 51}, + {S_TermW, 6, 15}, + {S_TermW, 8, 63}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1472}, + {S_TermW, 4, 5}, + {S_TermW, 8, 43}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1216}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 29}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 33}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 49}, + {S_TermW, 6, 14}, + {S_TermW, 8, 61}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 47}, + {S_TermW, 4, 3}, + {S_TermW, 8, 59}, + {S_TermW, 4, 5}, + {S_TermW, 8, 41}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 960}, + {S_TermW, 4, 6}, + {S_TermW, 8, 31}, + {S_TermW, 5, 8}, + {S_TermW, 8, 57}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 9, 704}, + {S_TermW, 4, 6}, + {S_TermW, 8, 37}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 320}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_MakeUp, 12, 1984}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 40}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 832}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 56}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 46}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 54}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 512}, + {S_TermW, 4, 6}, + {S_TermW, 8, 36}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 52}, + {S_TermW, 6, 15}, + {S_TermW, 8, 0}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1600}, + {S_TermW, 4, 5}, + {S_TermW, 8, 44}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1344}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 30}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 34}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 50}, + {S_TermW, 6, 14}, + {S_TermW, 8, 62}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 48}, + {S_TermW, 4, 3}, + {S_TermW, 8, 60}, + {S_TermW, 4, 5}, + {S_TermW, 8, 42}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1088}, + {S_TermW, 4, 6}, + {S_TermW, 8, 32}, + {S_TermW, 5, 8}, + {S_TermW, 8, 58}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 640}, + {S_TermW, 4, 6}, + {S_TermW, 8, 38}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 384}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_Null, 1, 0}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 39}, + {S_TermW, 6, 16}, + {S_MakeUpW, 8, 576}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 55}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 45}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 53}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 448}, + {S_TermW, 4, 6}, + {S_TermW, 8, 35}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 51}, + {S_TermW, 6, 15}, + {S_TermW, 8, 63}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1536}, + {S_TermW, 4, 5}, + {S_TermW, 8, 43}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1280}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 29}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 33}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 49}, + {S_TermW, 6, 14}, + {S_TermW, 8, 61}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 47}, + {S_TermW, 4, 3}, + {S_TermW, 8, 59}, + {S_TermW, 4, 5}, + {S_TermW, 8, 41}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1024}, + {S_TermW, 4, 6}, + {S_TermW, 8, 31}, + {S_TermW, 5, 8}, + {S_TermW, 8, 57}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 9, 768}, + {S_TermW, 4, 6}, + {S_TermW, 8, 37}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 320}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_MakeUp, 11, 1920}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 40}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 896}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 56}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 46}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 54}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 512}, + {S_TermW, 4, 6}, + {S_TermW, 8, 36}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 52}, + {S_TermW, 6, 15}, + {S_TermW, 8, 0}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1728}, + {S_TermW, 4, 5}, + {S_TermW, 8, 44}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1408}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 30}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 34}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 50}, + {S_TermW, 6, 14}, + {S_TermW, 8, 62}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 48}, + {S_TermW, 4, 3}, + {S_TermW, 8, 60}, + {S_TermW, 4, 5}, + {S_TermW, 8, 42}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1152}, + {S_TermW, 4, 6}, + {S_TermW, 8, 32}, + {S_TermW, 5, 8}, + {S_TermW, 8, 58}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 640}, + {S_TermW, 4, 6}, + {S_TermW, 8, 38}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 384}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_Null, 1, 0}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 39}, + {S_TermW, 6, 16}, + {S_MakeUpW, 8, 576}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 55}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 45}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 53}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 448}, + {S_TermW, 4, 6}, + {S_TermW, 8, 35}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 51}, + {S_TermW, 6, 15}, + {S_TermW, 8, 63}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1472}, + {S_TermW, 4, 5}, + {S_TermW, 8, 43}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1216}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 29}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 33}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 49}, + {S_TermW, 6, 14}, + {S_TermW, 8, 61}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 47}, + {S_TermW, 4, 3}, + {S_TermW, 8, 59}, + {S_TermW, 4, 5}, + {S_TermW, 8, 41}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 960}, + {S_TermW, 4, 6}, + {S_TermW, 8, 31}, + {S_TermW, 5, 8}, + {S_TermW, 8, 57}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 9, 704}, + {S_TermW, 4, 6}, + {S_TermW, 8, 37}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 320}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_MakeUp, 12, 2240}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 40}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 832}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 56}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 46}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 54}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 512}, + {S_TermW, 4, 6}, + {S_TermW, 8, 36}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 52}, + {S_TermW, 6, 15}, + {S_TermW, 8, 0}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1600}, + {S_TermW, 4, 5}, + {S_TermW, 8, 44}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1344}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 30}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 34}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 50}, + {S_TermW, 6, 14}, + {S_TermW, 8, 62}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 48}, + {S_TermW, 4, 3}, + {S_TermW, 8, 60}, + {S_TermW, 4, 5}, + {S_TermW, 8, 42}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1088}, + {S_TermW, 4, 6}, + {S_TermW, 8, 32}, + {S_TermW, 5, 8}, + {S_TermW, 8, 58}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 640}, + {S_TermW, 4, 6}, + {S_TermW, 8, 38}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 384}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_Null, 1, 0}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 39}, + {S_TermW, 6, 16}, + {S_MakeUpW, 8, 576}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 55}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 45}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 53}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 448}, + {S_TermW, 4, 6}, + {S_TermW, 8, 35}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 51}, + {S_TermW, 6, 15}, + {S_TermW, 8, 63}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1536}, + {S_TermW, 4, 5}, + {S_TermW, 8, 43}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1280}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 29}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 33}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 49}, + {S_TermW, 6, 14}, + {S_TermW, 8, 61}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 47}, + {S_TermW, 4, 3}, + {S_TermW, 8, 59}, + {S_TermW, 4, 5}, + {S_TermW, 8, 41}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1024}, + {S_TermW, 4, 6}, + {S_TermW, 8, 31}, + {S_TermW, 5, 8}, + {S_TermW, 8, 57}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 9, 768}, + {S_TermW, 4, 6}, + {S_TermW, 8, 37}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 320}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_MakeUp, 12, 2496}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 40}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 896}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 56}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 46}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 54}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 512}, + {S_TermW, 4, 6}, + {S_TermW, 8, 36}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 52}, + {S_TermW, 6, 15}, + {S_TermW, 8, 0}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1728}, + {S_TermW, 4, 5}, + {S_TermW, 8, 44}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1408}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 30}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 34}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 50}, + {S_TermW, 6, 14}, + {S_TermW, 8, 62}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 48}, + {S_TermW, 4, 3}, + {S_TermW, 8, 60}, + {S_TermW, 4, 5}, + {S_TermW, 8, 42}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1152}, + {S_TermW, 4, 6}, + {S_TermW, 8, 32}, + {S_TermW, 5, 8}, + {S_TermW, 8, 58}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 640}, + {S_TermW, 4, 6}, + {S_TermW, 8, 38}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 384}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_EOL, 12, 0}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 39}, + {S_TermW, 6, 16}, + {S_MakeUpW, 8, 576}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 55}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 45}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 53}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 448}, + {S_TermW, 4, 6}, + {S_TermW, 8, 35}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 51}, + {S_TermW, 6, 15}, + {S_TermW, 8, 63}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1472}, + {S_TermW, 4, 5}, + {S_TermW, 8, 43}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1216}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 29}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 33}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 49}, + {S_TermW, 6, 14}, + {S_TermW, 8, 61}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 47}, + {S_TermW, 4, 3}, + {S_TermW, 8, 59}, + {S_TermW, 4, 5}, + {S_TermW, 8, 41}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 960}, + {S_TermW, 4, 6}, + {S_TermW, 8, 31}, + {S_TermW, 5, 8}, + {S_TermW, 8, 57}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 9, 704}, + {S_TermW, 4, 6}, + {S_TermW, 8, 37}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 320}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_MakeUp, 11, 1792}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 40}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 832}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 56}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 46}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 54}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 512}, + {S_TermW, 4, 6}, + {S_TermW, 8, 36}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 52}, + {S_TermW, 6, 15}, + {S_TermW, 8, 0}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1600}, + {S_TermW, 4, 5}, + {S_TermW, 8, 44}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1344}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 30}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 34}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 50}, + {S_TermW, 6, 14}, + {S_TermW, 8, 62}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 48}, + {S_TermW, 4, 3}, + {S_TermW, 8, 60}, + {S_TermW, 4, 5}, + {S_TermW, 8, 42}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1088}, + {S_TermW, 4, 6}, + {S_TermW, 8, 32}, + {S_TermW, 5, 8}, + {S_TermW, 8, 58}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 640}, + {S_TermW, 4, 6}, + {S_TermW, 8, 38}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 384}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_Null, 1, 0}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 39}, + {S_TermW, 6, 16}, + {S_MakeUpW, 8, 576}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 55}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 45}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 53}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 448}, + {S_TermW, 4, 6}, + {S_TermW, 8, 35}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 51}, + {S_TermW, 6, 15}, + {S_TermW, 8, 63}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1536}, + {S_TermW, 4, 5}, + {S_TermW, 8, 43}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1280}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 29}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 33}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 49}, + {S_TermW, 6, 14}, + {S_TermW, 8, 61}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 47}, + {S_TermW, 4, 3}, + {S_TermW, 8, 59}, + {S_TermW, 4, 5}, + {S_TermW, 8, 41}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1024}, + {S_TermW, 4, 6}, + {S_TermW, 8, 31}, + {S_TermW, 5, 8}, + {S_TermW, 8, 57}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 9, 768}, + {S_TermW, 4, 6}, + {S_TermW, 8, 37}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 320}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_MakeUp, 11, 1856}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 40}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 896}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 56}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 46}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 54}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 512}, + {S_TermW, 4, 6}, + {S_TermW, 8, 36}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 52}, + {S_TermW, 6, 15}, + {S_TermW, 8, 0}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1728}, + {S_TermW, 4, 5}, + {S_TermW, 8, 44}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1408}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 30}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 34}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 50}, + {S_TermW, 6, 14}, + {S_TermW, 8, 62}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 48}, + {S_TermW, 4, 3}, + {S_TermW, 8, 60}, + {S_TermW, 4, 5}, + {S_TermW, 8, 42}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1152}, + {S_TermW, 4, 6}, + {S_TermW, 8, 32}, + {S_TermW, 5, 8}, + {S_TermW, 8, 58}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 640}, + {S_TermW, 4, 6}, + {S_TermW, 8, 38}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 384}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_Null, 1, 0}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 39}, + {S_TermW, 6, 16}, + {S_MakeUpW, 8, 576}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 55}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 45}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 53}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 448}, + {S_TermW, 4, 6}, + {S_TermW, 8, 35}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 51}, + {S_TermW, 6, 15}, + {S_TermW, 8, 63}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1472}, + {S_TermW, 4, 5}, + {S_TermW, 8, 43}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1216}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 29}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 33}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 49}, + {S_TermW, 6, 14}, + {S_TermW, 8, 61}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 47}, + {S_TermW, 4, 3}, + {S_TermW, 8, 59}, + {S_TermW, 4, 5}, + {S_TermW, 8, 41}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 960}, + {S_TermW, 4, 6}, + {S_TermW, 8, 31}, + {S_TermW, 5, 8}, + {S_TermW, 8, 57}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 9, 704}, + {S_TermW, 4, 6}, + {S_TermW, 8, 37}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 320}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_MakeUp, 12, 2176}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 40}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 832}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 56}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 46}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 54}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 512}, + {S_TermW, 4, 6}, + {S_TermW, 8, 36}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 52}, + {S_TermW, 6, 15}, + {S_TermW, 8, 0}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1600}, + {S_TermW, 4, 5}, + {S_TermW, 8, 44}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1344}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 30}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 34}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 50}, + {S_TermW, 6, 14}, + {S_TermW, 8, 62}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 48}, + {S_TermW, 4, 3}, + {S_TermW, 8, 60}, + {S_TermW, 4, 5}, + {S_TermW, 8, 42}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1088}, + {S_TermW, 4, 6}, + {S_TermW, 8, 32}, + {S_TermW, 5, 8}, + {S_TermW, 8, 58}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 640}, + {S_TermW, 4, 6}, + {S_TermW, 8, 38}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 384}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_Null, 1, 0}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 39}, + {S_TermW, 6, 16}, + {S_MakeUpW, 8, 576}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 55}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 45}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 53}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 448}, + {S_TermW, 4, 6}, + {S_TermW, 8, 35}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 51}, + {S_TermW, 6, 15}, + {S_TermW, 8, 63}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1536}, + {S_TermW, 4, 5}, + {S_TermW, 8, 43}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1280}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 29}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 33}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 49}, + {S_TermW, 6, 14}, + {S_TermW, 8, 61}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 47}, + {S_TermW, 4, 3}, + {S_TermW, 8, 59}, + {S_TermW, 4, 5}, + {S_TermW, 8, 41}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1024}, + {S_TermW, 4, 6}, + {S_TermW, 8, 31}, + {S_TermW, 5, 8}, + {S_TermW, 8, 57}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 9, 768}, + {S_TermW, 4, 6}, + {S_TermW, 8, 37}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 320}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_MakeUp, 12, 2432}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 40}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 896}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 56}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 46}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 54}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 512}, + {S_TermW, 4, 6}, + {S_TermW, 8, 36}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 52}, + {S_TermW, 6, 15}, + {S_TermW, 8, 0}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1728}, + {S_TermW, 4, 5}, + {S_TermW, 8, 44}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1408}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 30}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 34}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 50}, + {S_TermW, 6, 14}, + {S_TermW, 8, 62}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 48}, + {S_TermW, 4, 3}, + {S_TermW, 8, 60}, + {S_TermW, 4, 5}, + {S_TermW, 8, 42}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1152}, + {S_TermW, 4, 6}, + {S_TermW, 8, 32}, + {S_TermW, 5, 8}, + {S_TermW, 8, 58}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 640}, + {S_TermW, 4, 6}, + {S_TermW, 8, 38}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 384}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_Null, 1, 0}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 39}, + {S_TermW, 6, 16}, + {S_MakeUpW, 8, 576}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 55}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 45}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 53}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 448}, + {S_TermW, 4, 6}, + {S_TermW, 8, 35}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 51}, + {S_TermW, 6, 15}, + {S_TermW, 8, 63}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1472}, + {S_TermW, 4, 5}, + {S_TermW, 8, 43}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1216}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 29}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 33}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 49}, + {S_TermW, 6, 14}, + {S_TermW, 8, 61}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 47}, + {S_TermW, 4, 3}, + {S_TermW, 8, 59}, + {S_TermW, 4, 5}, + {S_TermW, 8, 41}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 960}, + {S_TermW, 4, 6}, + {S_TermW, 8, 31}, + {S_TermW, 5, 8}, + {S_TermW, 8, 57}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 9, 704}, + {S_TermW, 4, 6}, + {S_TermW, 8, 37}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 320}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_MakeUp, 12, 2048}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 40}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 832}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 56}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 46}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 54}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 512}, + {S_TermW, 4, 6}, + {S_TermW, 8, 36}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 52}, + {S_TermW, 6, 15}, + {S_TermW, 8, 0}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1600}, + {S_TermW, 4, 5}, + {S_TermW, 8, 44}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1344}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 30}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 34}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 50}, + {S_TermW, 6, 14}, + {S_TermW, 8, 62}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 48}, + {S_TermW, 4, 3}, + {S_TermW, 8, 60}, + {S_TermW, 4, 5}, + {S_TermW, 8, 42}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1088}, + {S_TermW, 4, 6}, + {S_TermW, 8, 32}, + {S_TermW, 5, 8}, + {S_TermW, 8, 58}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 640}, + {S_TermW, 4, 6}, + {S_TermW, 8, 38}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 384}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_Null, 1, 0}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 39}, + {S_TermW, 6, 16}, + {S_MakeUpW, 8, 576}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 55}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 45}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 53}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 448}, + {S_TermW, 4, 6}, + {S_TermW, 8, 35}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 51}, + {S_TermW, 6, 15}, + {S_TermW, 8, 63}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1536}, + {S_TermW, 4, 5}, + {S_TermW, 8, 43}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1280}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 29}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 33}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 49}, + {S_TermW, 6, 14}, + {S_TermW, 8, 61}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 47}, + {S_TermW, 4, 3}, + {S_TermW, 8, 59}, + {S_TermW, 4, 5}, + {S_TermW, 8, 41}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1024}, + {S_TermW, 4, 6}, + {S_TermW, 8, 31}, + {S_TermW, 5, 8}, + {S_TermW, 8, 57}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 9, 768}, + {S_TermW, 4, 6}, + {S_TermW, 8, 37}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 320}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_MakeUp, 11, 1920}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 40}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 896}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 56}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 46}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 54}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 512}, + {S_TermW, 4, 6}, + {S_TermW, 8, 36}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 52}, + {S_TermW, 6, 15}, + {S_TermW, 8, 0}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1728}, + {S_TermW, 4, 5}, + {S_TermW, 8, 44}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1408}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 30}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 34}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 50}, + {S_TermW, 6, 14}, + {S_TermW, 8, 62}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 48}, + {S_TermW, 4, 3}, + {S_TermW, 8, 60}, + {S_TermW, 4, 5}, + {S_TermW, 8, 42}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1152}, + {S_TermW, 4, 6}, + {S_TermW, 8, 32}, + {S_TermW, 5, 8}, + {S_TermW, 8, 58}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 640}, + {S_TermW, 4, 6}, + {S_TermW, 8, 38}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 384}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_Null, 1, 0}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 39}, + {S_TermW, 6, 16}, + {S_MakeUpW, 8, 576}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 55}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 45}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 53}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 448}, + {S_TermW, 4, 6}, + {S_TermW, 8, 35}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 51}, + {S_TermW, 6, 15}, + {S_TermW, 8, 63}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1472}, + {S_TermW, 4, 5}, + {S_TermW, 8, 43}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1216}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 29}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 33}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 49}, + {S_TermW, 6, 14}, + {S_TermW, 8, 61}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 47}, + {S_TermW, 4, 3}, + {S_TermW, 8, 59}, + {S_TermW, 4, 5}, + {S_TermW, 8, 41}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 960}, + {S_TermW, 4, 6}, + {S_TermW, 8, 31}, + {S_TermW, 5, 8}, + {S_TermW, 8, 57}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 9, 704}, + {S_TermW, 4, 6}, + {S_TermW, 8, 37}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 320}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_MakeUp, 12, 2304}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 40}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 832}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 56}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 46}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 54}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 512}, + {S_TermW, 4, 6}, + {S_TermW, 8, 36}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 52}, + {S_TermW, 6, 15}, + {S_TermW, 8, 0}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1600}, + {S_TermW, 4, 5}, + {S_TermW, 8, 44}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1344}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 30}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 34}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 50}, + {S_TermW, 6, 14}, + {S_TermW, 8, 62}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 48}, + {S_TermW, 4, 3}, + {S_TermW, 8, 60}, + {S_TermW, 4, 5}, + {S_TermW, 8, 42}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1088}, + {S_TermW, 4, 6}, + {S_TermW, 8, 32}, + {S_TermW, 5, 8}, + {S_TermW, 8, 58}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 640}, + {S_TermW, 4, 6}, + {S_TermW, 8, 38}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 384}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_Null, 1, 0}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 39}, + {S_TermW, 6, 16}, + {S_MakeUpW, 8, 576}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 55}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 45}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 53}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 448}, + {S_TermW, 4, 6}, + {S_TermW, 8, 35}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 51}, + {S_TermW, 6, 15}, + {S_TermW, 8, 63}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1536}, + {S_TermW, 4, 5}, + {S_TermW, 8, 43}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1280}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 29}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 33}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 49}, + {S_TermW, 6, 14}, + {S_TermW, 8, 61}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 47}, + {S_TermW, 4, 3}, + {S_TermW, 8, 59}, + {S_TermW, 4, 5}, + {S_TermW, 8, 41}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1024}, + {S_TermW, 4, 6}, + {S_TermW, 8, 31}, + {S_TermW, 5, 8}, + {S_TermW, 8, 57}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 9, 768}, + {S_TermW, 4, 6}, + {S_TermW, 8, 37}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 320}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_MakeUp, 12, 2560}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 7, 20}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 24}, + {S_TermW, 6, 14}, + {S_TermW, 7, 28}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 23}, + {S_TermW, 4, 3}, + {S_TermW, 7, 27}, + {S_TermW, 4, 5}, + {S_TermW, 8, 40}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 896}, + {S_TermW, 4, 6}, + {S_TermW, 7, 19}, + {S_TermW, 5, 8}, + {S_TermW, 8, 56}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 46}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 8, 54}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 512}, + {S_TermW, 4, 6}, + {S_TermW, 8, 36}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 52}, + {S_TermW, 6, 15}, + {S_TermW, 8, 0}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_MakeUpW, 9, 1728}, + {S_TermW, 4, 5}, + {S_TermW, 8, 44}, + {S_TermW, 6, 17}, + {S_MakeUpW, 9, 1408}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 30}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 6, 12}, + {S_TermW, 5, 9}, + {S_MakeUpW, 6, 1664}, + {S_TermW, 4, 6}, + {S_TermW, 8, 34}, + {S_MakeUpW, 5, 128}, + {S_TermW, 8, 50}, + {S_TermW, 6, 14}, + {S_TermW, 8, 62}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 8, 48}, + {S_TermW, 4, 3}, + {S_TermW, 8, 60}, + {S_TermW, 4, 5}, + {S_TermW, 8, 42}, + {S_TermW, 6, 16}, + {S_MakeUpW, 9, 1152}, + {S_TermW, 4, 6}, + {S_TermW, 8, 32}, + {S_TermW, 5, 8}, + {S_TermW, 8, 58}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 7, 22}, + {S_TermW, 4, 3}, + {S_TermW, 5, 11}, + {S_TermW, 4, 5}, + {S_TermW, 7, 26}, + {S_TermW, 5, 9}, + {S_MakeUpW, 8, 640}, + {S_TermW, 4, 6}, + {S_TermW, 8, 38}, + {S_MakeUpW, 5, 128}, + {S_TermW, 7, 25}, + {S_TermW, 6, 15}, + {S_MakeUpW, 8, 384}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7}, + {S_TermW, 6, 13}, + {S_TermW, 4, 3}, + {S_TermW, 7, 18}, + {S_TermW, 4, 5}, + {S_TermW, 7, 21}, + {S_TermW, 6, 17}, + {S_MakeUpW, 7, 256}, + {S_TermW, 4, 6}, + {S_TermW, 6, 1}, + {S_TermW, 5, 8}, + {S_MakeUpW, 6, 192}, + {S_MakeUpW, 5, 64}, + {S_TermW, 5, 10}, + {S_TermW, 4, 4}, + {S_TermW, 4, 2}, + {S_TermW, 4, 7} +}; + +static const t4_table_entry_t t4_1d_black_table[8192] = +{ + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 9, 15}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 18}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 17}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 11, 1792}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 23}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 20}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 25}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 12, 128}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 56}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 30}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 11, 1856}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 57}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 21}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 54}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 9, 15}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 52}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 48}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 12, 2112}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 44}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 36}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 12, 384}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 28}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 60}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 40}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 12, 2368}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 16}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 10, 64}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 9, 15}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 18}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 17}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 12, 1984}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 50}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 34}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 13, 1664}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 26}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 13, 1408}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 32}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 11, 1920}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 61}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 42}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 13, 1024}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 9, 15}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 13, 768}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 62}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 12, 2240}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 46}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 38}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 13, 512}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 19}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 24}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 22}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 12, 2496}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 16}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 10, 64}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_EOL, 12, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 9, 15}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 18}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 17}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 11, 1792}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 23}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 20}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 25}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 12, 192}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 13, 1280}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 31}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 11, 1856}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 58}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 21}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 13, 896}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 9, 15}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 13, 640}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 49}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 12, 2176}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 45}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 37}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 12, 448}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 29}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 13, 1536}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 41}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 12, 2432}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 16}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 10, 64}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 9, 15}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 18}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 17}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 12, 2048}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 51}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 35}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 12, 320}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 27}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 59}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 33}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 11, 1920}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 12, 256}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 43}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 13, 1152}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 9, 15}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 55}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 63}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 12, 2304}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 47}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 39}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 53}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 19}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 24}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 22}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 12, 2560}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 16}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 10, 64}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 9, 15}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 18}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 17}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 11, 1792}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 23}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 20}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 25}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 12, 128}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 56}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 30}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 11, 1856}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 57}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 21}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 54}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 9, 15}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 52}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 48}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 12, 2112}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 44}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 36}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 12, 384}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 28}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 60}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 40}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 12, 2368}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 16}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 10, 64}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 9, 15}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 18}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 17}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 12, 1984}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 50}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 34}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 13, 1728}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 26}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 13, 1472}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 32}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 11, 1920}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 61}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 42}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 13, 1088}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 9, 15}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 13, 832}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 62}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 12, 2240}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 46}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 38}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 13, 576}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 19}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 24}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 22}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 12, 2496}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 16}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 10, 64}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_EOL, 12, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 9, 15}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 18}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 17}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 11, 1792}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 23}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 20}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 25}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 12, 192}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 13, 1344}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 31}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 11, 1856}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 58}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 21}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 13, 960}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 9, 15}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 13, 704}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 49}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 12, 2176}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 45}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 37}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 12, 448}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 29}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 13, 1600}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 41}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 12, 2432}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 16}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 10, 64}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 9, 15}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 18}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 17}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 12, 2048}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 51}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 35}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 12, 320}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 27}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 59}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 33}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 11, 1920}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 12, 256}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 43}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 13, 1216}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 9, 15}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 55}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 63}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 12, 2304}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 47}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 39}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 12, 53}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_Null, 1, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 13}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 19}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 24}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 11, 22}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUp, 12, 2560}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 10}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 16}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 10, 0}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_MakeUpB, 10, 64}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 9}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 11}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 8, 14}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 6, 8}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 7, 12}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 6}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2}, + {S_TermB, 5, 7}, + {S_TermB, 2, 3}, + {S_TermB, 3, 1}, + {S_TermB, 2, 2}, + {S_TermB, 4, 5}, + {S_TermB, 2, 3}, + {S_TermB, 3, 4}, + {S_TermB, 2, 2} +}; + +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/t4_tx.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/t4_tx.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1539 @@ +//#define T4_STATE_DEBUGGING +/* + * SpanDSP - a series of DSP components for telephony + * + * t4_tx.c - ITU T.4 FAX transmit processing + * + * Written by Steve Underwood + * + * Copyright (C) 2003, 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t4_tx.c,v 1.13.2.9 2009/12/21 17:18:40 steveu Exp $ + */ + +/* + * Much of this file is based on the T.4 and T.6 support in libtiff, which requires + * the following notice in any derived source code: + * + * Copyright (c) 1990-1997 Sam Leffler + * Copyright (c) 1991-1997 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the names of + * Sam Leffler and Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Sam Leffler and Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/bit_operations.h" +#include "spandsp/async.h" +#include "spandsp/t4_rx.h" +#include "spandsp/t4_tx.h" +#include "spandsp/version.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/t4_rx.h" +#include "spandsp/private/t4_tx.h" + +/*! The number of centimetres in one inch */ +#define CM_PER_INCH 2.54f + +/*! The number of EOLs to be sent at the end of a T.4 page */ +#define EOLS_TO_END_T4_TX_PAGE 6 +/*! The number of EOLs to be sent at the end of a T.6 page */ +#define EOLS_TO_END_T6_TX_PAGE 2 + +#if defined(T4_STATE_DEBUGGING) +static void STATE_TRACE(const char *format, ...) +{ + va_list arg_ptr; + + va_start(arg_ptr, format); + vprintf(format, arg_ptr); + va_end(arg_ptr); +} +/*- End of function --------------------------------------------------------*/ +#else +#define STATE_TRACE(...) /**/ +#endif + +/*! T.4 run length table entry */ +typedef struct +{ + /*! Length of T.4 code, in bits */ + uint16_t length; + /*! T.4 code */ + uint16_t code; + /*! Run length, in bits */ + int16_t run_length; +} t4_run_table_entry_t; + +#include "faxfont.h" + +/* Legitimate runs of zero bits which are the tail end of one code + plus the start of the next code do not exceed 10 bits. */ + +/* + * Note that these tables are ordered such that the index into the table + * is known to be either the run length, or (run length / 64) + a fixed + * offset. + */ +static const t4_run_table_entry_t t4_white_codes[] = +{ + { 8, 0x00AC, 0}, /* 0011 0101 */ + { 6, 0x0038, 1}, /* 0001 11 */ + { 4, 0x000E, 2}, /* 0111 */ + { 4, 0x0001, 3}, /* 1000 */ + { 4, 0x000D, 4}, /* 1011 */ + { 4, 0x0003, 5}, /* 1100 */ + { 4, 0x0007, 6}, /* 1110 */ + { 4, 0x000F, 7}, /* 1111 */ + { 5, 0x0019, 8}, /* 1001 1 */ + { 5, 0x0005, 9}, /* 1010 0 */ + { 5, 0x001C, 10}, /* 0011 1 */ + { 5, 0x0002, 11}, /* 0100 0 */ + { 6, 0x0004, 12}, /* 0010 00 */ + { 6, 0x0030, 13}, /* 0000 11 */ + { 6, 0x000B, 14}, /* 1101 00 */ + { 6, 0x002B, 15}, /* 1101 01 */ + { 6, 0x0015, 16}, /* 1010 10 */ + { 6, 0x0035, 17}, /* 1010 11 */ + { 7, 0x0072, 18}, /* 0100 111 */ + { 7, 0x0018, 19}, /* 0001 100 */ + { 7, 0x0008, 20}, /* 0001 000 */ + { 7, 0x0074, 21}, /* 0010 111 */ + { 7, 0x0060, 22}, /* 0000 011 */ + { 7, 0x0010, 23}, /* 0000 100 */ + { 7, 0x000A, 24}, /* 0101 000 */ + { 7, 0x006A, 25}, /* 0101 011 */ + { 7, 0x0064, 26}, /* 0010 011 */ + { 7, 0x0012, 27}, /* 0100 100 */ + { 7, 0x000C, 28}, /* 0011 000 */ + { 8, 0x0040, 29}, /* 0000 0010 */ + { 8, 0x00C0, 30}, /* 0000 0011 */ + { 8, 0x0058, 31}, /* 0001 1010 */ + { 8, 0x00D8, 32}, /* 0001 1011 */ + { 8, 0x0048, 33}, /* 0001 0010 */ + { 8, 0x00C8, 34}, /* 0001 0011 */ + { 8, 0x0028, 35}, /* 0001 0100 */ + { 8, 0x00A8, 36}, /* 0001 0101 */ + { 8, 0x0068, 37}, /* 0001 0110 */ + { 8, 0x00E8, 38}, /* 0001 0111 */ + { 8, 0x0014, 39}, /* 0010 1000 */ + { 8, 0x0094, 40}, /* 0010 1001 */ + { 8, 0x0054, 41}, /* 0010 1010 */ + { 8, 0x00D4, 42}, /* 0010 1011 */ + { 8, 0x0034, 43}, /* 0010 1100 */ + { 8, 0x00B4, 44}, /* 0010 1101 */ + { 8, 0x0020, 45}, /* 0000 0100 */ + { 8, 0x00A0, 46}, /* 0000 0101 */ + { 8, 0x0050, 47}, /* 0000 1010 */ + { 8, 0x00D0, 48}, /* 0000 1011 */ + { 8, 0x004A, 49}, /* 0101 0010 */ + { 8, 0x00CA, 50}, /* 0101 0011 */ + { 8, 0x002A, 51}, /* 0101 0100 */ + { 8, 0x00AA, 52}, /* 0101 0101 */ + { 8, 0x0024, 53}, /* 0010 0100 */ + { 8, 0x00A4, 54}, /* 0010 0101 */ + { 8, 0x001A, 55}, /* 0101 1000 */ + { 8, 0x009A, 56}, /* 0101 1001 */ + { 8, 0x005A, 57}, /* 0101 1010 */ + { 8, 0x00DA, 58}, /* 0101 1011 */ + { 8, 0x0052, 59}, /* 0100 1010 */ + { 8, 0x00D2, 60}, /* 0100 1011 */ + { 8, 0x004C, 61}, /* 0011 0010 */ + { 8, 0x00CC, 62}, /* 0011 0011 */ + { 8, 0x002C, 63}, /* 0011 0100 */ + { 5, 0x001B, 64}, /* 1101 1 */ + { 5, 0x0009, 128}, /* 1001 0 */ + { 6, 0x003A, 192}, /* 0101 11 */ + { 7, 0x0076, 256}, /* 0110 111 */ + { 8, 0x006C, 320}, /* 0011 0110 */ + { 8, 0x00EC, 384}, /* 0011 0111 */ + { 8, 0x0026, 448}, /* 0110 0100 */ + { 8, 0x00A6, 512}, /* 0110 0101 */ + { 8, 0x0016, 576}, /* 0110 1000 */ + { 8, 0x00E6, 640}, /* 0110 0111 */ + { 9, 0x0066, 704}, /* 0110 0110 0 */ + { 9, 0x0166, 768}, /* 0110 0110 1 */ + { 9, 0x0096, 832}, /* 0110 1001 0 */ + { 9, 0x0196, 896}, /* 0110 1001 1 */ + { 9, 0x0056, 960}, /* 0110 1010 0 */ + { 9, 0x0156, 1024}, /* 0110 1010 1 */ + { 9, 0x00D6, 1088}, /* 0110 1011 0 */ + { 9, 0x01D6, 1152}, /* 0110 1011 1 */ + { 9, 0x0036, 1216}, /* 0110 1100 0 */ + { 9, 0x0136, 1280}, /* 0110 1100 1 */ + { 9, 0x00B6, 1344}, /* 0110 1101 0 */ + { 9, 0x01B6, 1408}, /* 0110 1101 1 */ + { 9, 0x0032, 1472}, /* 0100 1100 0 */ + { 9, 0x0132, 1536}, /* 0100 1100 1 */ + { 9, 0x00B2, 1600}, /* 0100 1101 0 */ + { 6, 0x0006, 1664}, /* 0110 00 */ + { 9, 0x01B2, 1728}, /* 0100 1101 1 */ + {11, 0x0080, 1792}, /* 0000 0001 000 */ + {11, 0x0180, 1856}, /* 0000 0001 100 */ + {11, 0x0580, 1920}, /* 0000 0001 101 */ + {12, 0x0480, 1984}, /* 0000 0001 0010 */ + {12, 0x0C80, 2048}, /* 0000 0001 0011 */ + {12, 0x0280, 2112}, /* 0000 0001 0100 */ + {12, 0x0A80, 2176}, /* 0000 0001 0101 */ + {12, 0x0680, 2240}, /* 0000 0001 0110 */ + {12, 0x0E80, 2304}, /* 0000 0001 0111 */ + {12, 0x0380, 2368}, /* 0000 0001 1100 */ + {12, 0x0B80, 2432}, /* 0000 0001 1101 */ + {12, 0x0780, 2496}, /* 0000 0001 1110 */ + {12, 0x0F80, 2560}, /* 0000 0001 1111 */ +}; + +static const t4_run_table_entry_t t4_black_codes[] = +{ + {10, 0x03B0, 0}, /* 0000 1101 11 */ + { 3, 0x0002, 1}, /* 010 */ + { 2, 0x0003, 2}, /* 11 */ + { 2, 0x0001, 3}, /* 10 */ + { 3, 0x0006, 4}, /* 011 */ + { 4, 0x000C, 5}, /* 0011 */ + { 4, 0x0004, 6}, /* 0010 */ + { 5, 0x0018, 7}, /* 0001 1 */ + { 6, 0x0028, 8}, /* 0001 01 */ + { 6, 0x0008, 9}, /* 0001 00 */ + { 7, 0x0010, 10}, /* 0000 100 */ + { 7, 0x0050, 11}, /* 0000 101 */ + { 7, 0x0070, 12}, /* 0000 111 */ + { 8, 0x0020, 13}, /* 0000 0100 */ + { 8, 0x00E0, 14}, /* 0000 0111 */ + { 9, 0x0030, 15}, /* 0000 1100 0 */ + {10, 0x03A0, 16}, /* 0000 0101 11 */ + {10, 0x0060, 17}, /* 0000 0110 00 */ + {10, 0x0040, 18}, /* 0000 0010 00 */ + {11, 0x0730, 19}, /* 0000 1100 111 */ + {11, 0x00B0, 20}, /* 0000 1101 000 */ + {11, 0x01B0, 21}, /* 0000 1101 100 */ + {11, 0x0760, 22}, /* 0000 0110 111 */ + {11, 0x00A0, 23}, /* 0000 0101 000 */ + {11, 0x0740, 24}, /* 0000 0010 111 */ + {11, 0x00C0, 25}, /* 0000 0011 000 */ + {12, 0x0530, 26}, /* 0000 1100 1010 */ + {12, 0x0D30, 27}, /* 0000 1100 1011 */ + {12, 0x0330, 28}, /* 0000 1100 1100 */ + {12, 0x0B30, 29}, /* 0000 1100 1101 */ + {12, 0x0160, 30}, /* 0000 0110 1000 */ + {12, 0x0960, 31}, /* 0000 0110 1001 */ + {12, 0x0560, 32}, /* 0000 0110 1010 */ + {12, 0x0D60, 33}, /* 0000 0110 1011 */ + {12, 0x04B0, 34}, /* 0000 1101 0010 */ + {12, 0x0CB0, 35}, /* 0000 1101 0011 */ + {12, 0x02B0, 36}, /* 0000 1101 0100 */ + {12, 0x0AB0, 37}, /* 0000 1101 0101 */ + {12, 0x06B0, 38}, /* 0000 1101 0110 */ + {12, 0x0EB0, 39}, /* 0000 1101 0111 */ + {12, 0x0360, 40}, /* 0000 0110 1100 */ + {12, 0x0B60, 41}, /* 0000 0110 1101 */ + {12, 0x05B0, 42}, /* 0000 1101 1010 */ + {12, 0x0DB0, 43}, /* 0000 1101 1011 */ + {12, 0x02A0, 44}, /* 0000 0101 0100 */ + {12, 0x0AA0, 45}, /* 0000 0101 0101 */ + {12, 0x06A0, 46}, /* 0000 0101 0110 */ + {12, 0x0EA0, 47}, /* 0000 0101 0111 */ + {12, 0x0260, 48}, /* 0000 0110 0100 */ + {12, 0x0A60, 49}, /* 0000 0110 0101 */ + {12, 0x04A0, 50}, /* 0000 0101 0010 */ + {12, 0x0CA0, 51}, /* 0000 0101 0011 */ + {12, 0x0240, 52}, /* 0000 0010 0100 */ + {12, 0x0EC0, 53}, /* 0000 0011 0111 */ + {12, 0x01C0, 54}, /* 0000 0011 1000 */ + {12, 0x0E40, 55}, /* 0000 0010 0111 */ + {12, 0x0140, 56}, /* 0000 0010 1000 */ + {12, 0x01A0, 57}, /* 0000 0101 1000 */ + {12, 0x09A0, 58}, /* 0000 0101 1001 */ + {12, 0x0D40, 59}, /* 0000 0010 1011 */ + {12, 0x0340, 60}, /* 0000 0010 1100 */ + {12, 0x05A0, 61}, /* 0000 0101 1010 */ + {12, 0x0660, 62}, /* 0000 0110 0110 */ + {12, 0x0E60, 63}, /* 0000 0110 0111 */ + {10, 0x03C0, 64}, /* 0000 0011 11 */ + {12, 0x0130, 128}, /* 0000 1100 1000 */ + {12, 0x0930, 192}, /* 0000 1100 1001 */ + {12, 0x0DA0, 256}, /* 0000 0101 1011 */ + {12, 0x0CC0, 320}, /* 0000 0011 0011 */ + {12, 0x02C0, 384}, /* 0000 0011 0100 */ + {12, 0x0AC0, 448}, /* 0000 0011 0101 */ + {13, 0x06C0, 512}, /* 0000 0011 0110 0 */ + {13, 0x16C0, 576}, /* 0000 0011 0110 1 */ + {13, 0x0A40, 640}, /* 0000 0010 0101 0 */ + {13, 0x1A40, 704}, /* 0000 0010 0101 1 */ + {13, 0x0640, 768}, /* 0000 0010 0110 0 */ + {13, 0x1640, 832}, /* 0000 0010 0110 1 */ + {13, 0x09C0, 896}, /* 0000 0011 1001 0 */ + {13, 0x19C0, 960}, /* 0000 0011 1001 1 */ + {13, 0x05C0, 1024}, /* 0000 0011 1010 0 */ + {13, 0x15C0, 1088}, /* 0000 0011 1010 1 */ + {13, 0x0DC0, 1152}, /* 0000 0011 1011 0 */ + {13, 0x1DC0, 1216}, /* 0000 0011 1011 1 */ + {13, 0x0940, 1280}, /* 0000 0010 1001 0 */ + {13, 0x1940, 1344}, /* 0000 0010 1001 1 */ + {13, 0x0540, 1408}, /* 0000 0010 1010 0 */ + {13, 0x1540, 1472}, /* 0000 0010 1010 1 */ + {13, 0x0B40, 1536}, /* 0000 0010 1101 0 */ + {13, 0x1B40, 1600}, /* 0000 0010 1101 1 */ + {13, 0x04C0, 1664}, /* 0000 0011 0010 0 */ + {13, 0x14C0, 1728}, /* 0000 0011 0010 1 */ + {11, 0x0080, 1792}, /* 0000 0001 000 */ + {11, 0x0180, 1856}, /* 0000 0001 100 */ + {11, 0x0580, 1920}, /* 0000 0001 101 */ + {12, 0x0480, 1984}, /* 0000 0001 0010 */ + {12, 0x0C80, 2048}, /* 0000 0001 0011 */ + {12, 0x0280, 2112}, /* 0000 0001 0100 */ + {12, 0x0A80, 2176}, /* 0000 0001 0101 */ + {12, 0x0680, 2240}, /* 0000 0001 0110 */ + {12, 0x0E80, 2304}, /* 0000 0001 0111 */ + {12, 0x0380, 2368}, /* 0000 0001 1100 */ + {12, 0x0B80, 2432}, /* 0000 0001 1101 */ + {12, 0x0780, 2496}, /* 0000 0001 1110 */ + {12, 0x0F80, 2560}, /* 0000 0001 1111 */ +}; + +static int encode_row(t4_state_t *s); + +static void make_header(t4_state_t *s, char *header) +{ + time_t now; + struct tm tm; + static const char *months[] = + { + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec" + }; + + time(&now); + tm = *localtime(&now); + snprintf(header, + 132, + " %2d-%s-%d %02d:%02d %-50s %-21s p.%d", + tm.tm_mday, + months[tm.tm_mon], + tm.tm_year + 1900, + tm.tm_hour, + tm.tm_min, + s->t4_t6_tx.header_info, + s->tiff.local_ident, + s->current_page + 1); +} +/*- End of function --------------------------------------------------------*/ + +static int t4_tx_put_fax_header(t4_state_t *s) +{ + int row; + int i; + int repeats; + int pattern; + int row_bufptr; + char *t; + char header[132 + 1]; + + /* Modify the resulting image to include a header line, typical of hardware FAX machines */ + make_header(s, header); + switch (s->y_resolution) + { + case T4_Y_RESOLUTION_1200: + repeats = 12; + break; + case T4_Y_RESOLUTION_800: + repeats = 8; + break; + case T4_Y_RESOLUTION_600: + repeats = 6; + break; + case T4_Y_RESOLUTION_SUPERFINE: + repeats = 4; + break; + case T4_Y_RESOLUTION_300: + repeats = 3; + break; + case T4_Y_RESOLUTION_FINE: + repeats = 2; + break; + default: + repeats = 1; + break; + } + for (row = 0; row < 16; row++) + { + t = header; + row_bufptr = 0; + for (t = header; *t && row_bufptr <= s->bytes_per_row - 2; t++) + { + pattern = header_font[(uint8_t) *t][row]; + s->row_buf[row_bufptr++] = (uint8_t) (pattern >> 8); + s->row_buf[row_bufptr++] = (uint8_t) (pattern & 0xFF); + } + for ( ; row_bufptr < s->bytes_per_row; ) + s->row_buf[row_bufptr++] = 0; + for (i = 0; i < repeats; i++) + { + if (encode_row(s)) + return -1; + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int test_resolution(int res_unit, float actual, float expected) +{ + if (res_unit == RESUNIT_INCH) + actual *= 1.0f/CM_PER_INCH; + return (expected*0.95f <= actual && actual <= expected*1.05f); +} +/*- End of function --------------------------------------------------------*/ + +static int get_tiff_directory_info(t4_state_t *s) +{ + static const struct + { + float resolution; + int code; + } x_res_table[] = + { + { 102.0f/CM_PER_INCH, T4_X_RESOLUTION_R4}, + { 204.0f/CM_PER_INCH, T4_X_RESOLUTION_R8}, + { 300.0f/CM_PER_INCH, T4_X_RESOLUTION_300}, + { 408.0f/CM_PER_INCH, T4_X_RESOLUTION_R16}, + { 600.0f/CM_PER_INCH, T4_X_RESOLUTION_600}, + { 800.0f/CM_PER_INCH, T4_X_RESOLUTION_800}, + {1200.0f/CM_PER_INCH, T4_X_RESOLUTION_1200}, + { -1.00f, -1} + }; + static const struct + { + float resolution; + int code; + int max_rows_to_next_1d_row; + } y_res_table[] = + { + { 38.50f, T4_Y_RESOLUTION_STANDARD, 2}, + { 77.00f, T4_Y_RESOLUTION_FINE, 4}, + { 300.0f/CM_PER_INCH, T4_Y_RESOLUTION_300, 6}, + { 154.00f, T4_Y_RESOLUTION_SUPERFINE, 8}, + { 600.0f/CM_PER_INCH, T4_Y_RESOLUTION_600, 12}, + { 800.0f/CM_PER_INCH, T4_Y_RESOLUTION_800, 16}, + {1200.0f/CM_PER_INCH, T4_Y_RESOLUTION_1200, 24}, + { -1.00f, -1, -1} + }; + uint16_t res_unit; + uint16_t parm16; + uint32_t parm32; + float x_resolution; + float y_resolution; + int i; + t4_tiff_state_t *t; + + t = &s->tiff; + parm16 = 0; + TIFFGetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, &parm16); + if (parm16 != 1) + return -1; + TIFFGetField(t->tiff_file, TIFFTAG_SAMPLESPERPIXEL, &parm16); + if (parm16 != 1) + return -1; + parm32 = 0; + TIFFGetField(t->tiff_file, TIFFTAG_IMAGEWIDTH, &parm32); + s->image_width = parm32; + s->bytes_per_row = (s->image_width + 7)/8; + parm32 = 0; + TIFFGetField(t->tiff_file, TIFFTAG_IMAGELENGTH, &parm32); + s->image_length = parm32; + x_resolution = 0.0f; + TIFFGetField(t->tiff_file, TIFFTAG_XRESOLUTION, &x_resolution); + y_resolution = 0.0f; + TIFFGetField(t->tiff_file, TIFFTAG_YRESOLUTION, &y_resolution); + res_unit = RESUNIT_INCH; + TIFFGetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, &res_unit); + t->photo_metric = PHOTOMETRIC_MINISWHITE; + TIFFGetField(t->tiff_file, TIFFTAG_PHOTOMETRIC, &t->photo_metric); + if (t->photo_metric != PHOTOMETRIC_MINISWHITE) + span_log(&s->logging, SPAN_LOG_FLOW, "%s: Photometric needs swapping.\n", t->file); + t->fill_order = FILLORDER_LSB2MSB; +#if 0 + TIFFGetField(t->tiff_file, TIFFTAG_FILLORDER, &t->fill_order); + if (t->fill_order != FILLORDER_LSB2MSB) + span_log(&s->logging, SPAN_LOG_FLOW, "%s: Fill order needs swapping.\n", t->file); +#endif + + /* Allow a little range for the X resolution in centimeters. The spec doesn't pin down the + precise value. The other value should be exact. */ + /* Treat everything we can't match as R8. Most FAXes are this resolution anyway. */ + s->x_resolution = T4_X_RESOLUTION_R8; + for (i = 0; x_res_table[i].code > 0; i++) + { + if (test_resolution(res_unit, x_resolution, x_res_table[i].resolution)) + { + s->x_resolution = x_res_table[i].code; + break; + } + } + + s->y_resolution = T4_Y_RESOLUTION_STANDARD; + s->t4_t6_tx.max_rows_to_next_1d_row = 2; + for (i = 0; y_res_table[i].code > 0; i++) + { + if (test_resolution(res_unit, y_resolution, y_res_table[i].resolution)) + { + s->y_resolution = y_res_table[i].code; + s->t4_t6_tx.max_rows_to_next_1d_row = y_res_table[i].max_rows_to_next_1d_row; + break; + } + } + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int test_tiff_directory_info(t4_state_t *s) +{ + static const struct + { + float resolution; + int code; + } x_res_table[] = + { + { 102.0f/CM_PER_INCH, T4_X_RESOLUTION_R4}, + { 204.0f/CM_PER_INCH, T4_X_RESOLUTION_R8}, + { 300.0f/CM_PER_INCH, T4_X_RESOLUTION_300}, + { 408.0f/CM_PER_INCH, T4_X_RESOLUTION_R16}, + { 600.0f/CM_PER_INCH, T4_X_RESOLUTION_600}, + { 800.0f/CM_PER_INCH, T4_X_RESOLUTION_800}, + {1200.0f/CM_PER_INCH, T4_X_RESOLUTION_1200}, + { -1.00f, -1} + }; + static const struct + { + float resolution; + int code; + int max_rows_to_next_1d_row; + } y_res_table[] = + { + { 38.50f, T4_Y_RESOLUTION_STANDARD, 2}, + { 77.00f, T4_Y_RESOLUTION_FINE, 4}, + { 300.0f/CM_PER_INCH, T4_Y_RESOLUTION_300, 6}, + { 154.00f, T4_Y_RESOLUTION_SUPERFINE, 8}, + { 600.0f/CM_PER_INCH, T4_Y_RESOLUTION_600, 12}, + { 800.0f/CM_PER_INCH, T4_Y_RESOLUTION_800, 16}, + {1200.0f/CM_PER_INCH, T4_Y_RESOLUTION_1200, 24}, + { -1.00f, -1, -1} + }; + uint16_t res_unit; + uint16_t parm16; + uint32_t parm32; + float x_resolution; + float y_resolution; + int i; + t4_tiff_state_t *t; + + t = &s->tiff; + parm16 = 0; + TIFFGetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, &parm16); + if (parm16 != 1) + return -1; + parm32 = 0; + TIFFGetField(t->tiff_file, TIFFTAG_IMAGEWIDTH, &parm32); + if (s->image_width != (int) parm32) + return 1; + x_resolution = 0.0f; + TIFFGetField(t->tiff_file, TIFFTAG_XRESOLUTION, &x_resolution); + y_resolution = 0.0f; + TIFFGetField(t->tiff_file, TIFFTAG_YRESOLUTION, &y_resolution); + res_unit = RESUNIT_INCH; + TIFFGetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, &res_unit); + + /* Allow a little range for the X resolution in centimeters. The spec doesn't pin down the + precise value. The other value should be exact. */ + /* Treat everything we can't match as R8. Most FAXes are this resolution anyway. */ + for (i = 0; x_res_table[i].code > 0; i++) + { + if (test_resolution(res_unit, x_resolution, x_res_table[i].resolution)) + break; + } + if (s->x_resolution != x_res_table[i].code) + return 1; + for (i = 0; y_res_table[i].code > 0; i++) + { + if (test_resolution(res_unit, y_resolution, y_res_table[i].resolution)) + break; + } + if (s->y_resolution != y_res_table[i].code) + return 1; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int get_tiff_total_pages(t4_state_t *s) +{ + int max; + + /* Each page *should* contain the total number of pages, but can this be + trusted? Some files say 0. Actually searching for the last page is + more reliable. */ + max = 0; + while (TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) max)) + max++; + /* Back to the previous page */ + if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page)) + return -1; + return max; +} +/*- End of function --------------------------------------------------------*/ + +static int open_tiff_input_file(t4_state_t *s, const char *file) +{ + if ((s->tiff.tiff_file = TIFFOpen(file, "r")) == NULL) + return -1; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int read_tiff_image(t4_state_t *s) +{ + int row; + int image_length; + int i; + + image_length = 0; + TIFFGetField(s->tiff.tiff_file, TIFFTAG_IMAGELENGTH, &image_length); + for (row = 0; row < image_length; row++) + { + if (TIFFReadScanline(s->tiff.tiff_file, s->row_buf, row, 0) <= 0) + { + span_log(&s->logging, SPAN_LOG_WARNING, "%s: Read error at row %d.\n", s->tiff.file, row); + break; + } + if (s->tiff.photo_metric != PHOTOMETRIC_MINISWHITE) + { + for (i = 0; i < s->bytes_per_row; i++) + s->row_buf[i] = ~s->row_buf[i]; + } + if (s->tiff.fill_order != FILLORDER_LSB2MSB) + bit_reverse(s->row_buf, s->row_buf, s->bytes_per_row); + if (encode_row(s)) + return -1; + } + return image_length; +} +/*- End of function --------------------------------------------------------*/ + +static int close_tiff_input_file(t4_state_t *s) +{ + TIFFClose(s->tiff.tiff_file); + s->tiff.tiff_file = NULL; + if (s->tiff.file) + free((char *) s->tiff.file); + s->tiff.file = NULL; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void update_row_bit_info(t4_state_t *s) +{ + if (s->row_bits > s->max_row_bits) + s->max_row_bits = s->row_bits; + if (s->row_bits < s->min_row_bits) + s->min_row_bits = s->row_bits; + s->row_bits = 0; +} +/*- End of function --------------------------------------------------------*/ + +static int free_buffers(t4_state_t *s) +{ + if (s->image_buffer) + { + free(s->image_buffer); + s->image_buffer = NULL; + s->image_buffer_size = 0; + } + if (s->cur_runs) + { + free(s->cur_runs); + s->cur_runs = NULL; + } + if (s->ref_runs) + { + free(s->ref_runs); + s->ref_runs = NULL; + } + if (s->row_buf) + { + free(s->row_buf); + s->row_buf = NULL; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int row_to_run_lengths(uint32_t list[], const uint8_t row[], int width) +{ + uint32_t flip; + uint32_t x; + int span; + int entry; + int frag; + int rem; + int limit; + int i; + int pos; + + /* Deal with whole words first. We know we are starting on a word boundary. */ + entry = 0; + flip = 0; + limit = (width >> 3) & ~3; + span = 0; + pos = 0; + for (i = 0; i < limit; i += sizeof(uint32_t)) + { + x = *((uint32_t *) &row[i]); + if (x != flip) + { + x = ((uint32_t) row[i] << 24) | ((uint32_t) row[i + 1] << 16) | ((uint32_t) row[i + 2] << 8) | ((uint32_t) row[i + 3]); + /* We know we are going to find at least one transition. */ + frag = 31 - top_bit(x ^ flip); + pos += ((i << 3) - span + frag); + list[entry++] = pos; + x <<= frag; + flip ^= 0xFFFFFFFF; + rem = 32 - frag; + /* Now see if there are any more */ + while ((frag = 31 - top_bit(x ^ flip)) < rem) + { + pos += frag; + list[entry++] = pos; + x <<= frag; + flip ^= 0xFFFFFFFF; + rem -= frag; + } + /* Save the remainder of the word */ + span = (i << 3) + 32 - rem; + } + } + /* Now deal with some whole bytes, if there are any left. */ + limit = width >> 3; + flip &= 0xFF000000; + if (i < limit) + { + for ( ; i < limit; i++) + { + x = (uint32_t) row[i] << 24; + if (x != flip) + { + /* We know we are going to find at least one transition. */ + frag = 31 - top_bit(x ^ flip); + pos += ((i << 3) - span + frag); + list[entry++] = pos; + x <<= frag; + flip ^= 0xFF000000; + rem = 8 - frag; + /* Now see if there are any more */ + while ((frag = 31 - top_bit(x ^ flip)) < rem) + { + pos += frag; + list[entry++] = pos; + x <<= frag; + flip ^= 0xFF000000; + rem -= frag; + } + /* Save the remainder of the word */ + span = (i << 3) + 8 - rem; + } + } + } + /* Deal with any left over fractional byte. */ + span = (i << 3) - span; + if ((rem = width & 7)) + { + x = row[i]; + x <<= 24; + do + { + frag = 31 - top_bit(x ^ flip); + if (frag > rem) + frag = rem; + pos += (span + frag); + list[entry++] = pos; + x <<= frag; + span = 0; + flip ^= 0xFF000000; + rem -= frag; + } + while (rem > 0); + } + else + { + if (span) + { + pos += span; + list[entry++] = pos; + } + } + return entry; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int put_encoded_bits(t4_state_t *s, uint32_t bits, int length) +{ + uint8_t *t; + + /* We might be called with a large length value, to spew out a mass of zero bits for + minimum row length padding. */ + s->tx_bitstream |= (bits << s->tx_bits); + s->tx_bits += length; + s->row_bits += length; + if ((s->image_size + (s->tx_bits + 7)/8) >= s->image_buffer_size) + { + if ((t = realloc(s->image_buffer, s->image_buffer_size + 100*s->bytes_per_row)) == NULL) + return -1; + s->image_buffer = t; + s->image_buffer_size += 100*s->bytes_per_row; + } + while (s->tx_bits >= 8) + { + s->image_buffer[s->image_size++] = (uint8_t) (s->tx_bitstream & 0xFF); + s->tx_bitstream >>= 8; + s->tx_bits -= 8; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +/* + * Write the sequence of codes that describes + * the specified span of zero's or one's. The + * appropriate table that holds the make-up and + * terminating codes is supplied. + */ +static __inline__ int put_1d_span(t4_state_t *s, int32_t span, const t4_run_table_entry_t *tab) +{ + const t4_run_table_entry_t *te; + + te = &tab[63 + (2560 >> 6)]; + while (span >= 2560 + 64) + { + if (put_encoded_bits(s, te->code, te->length)) + return -1; + span -= te->run_length; + } + te = &tab[63 + (span >> 6)]; + if (span >= 64) + { + if (put_encoded_bits(s, te->code, te->length)) + return -1; + span -= te->run_length; + } + if (put_encoded_bits(s, tab[span].code, tab[span].length)) + return -1; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +#define pixel_is_black(x,bit) (((x)[(bit) >> 3] << ((bit) & 7)) & 0x80) + +/* + * Write an EOL code to the output stream. We also handle writing the tag + * bit for the next scanline when doing 2D encoding. + */ +static void encode_eol(t4_state_t *s) +{ + uint32_t code; + int length; + + if (s->line_encoding == T4_COMPRESSION_ITU_T4_2D) + { + code = 0x0800 | ((!s->row_is_2d) << 12); + length = 13; + } + else + { + /* T.4 1D EOL, or T.6 EOFB */ + code = 0x800; + length = 12; + } + if (s->row_bits) + { + /* We may need to pad the row to a minimum length, unless we are in T.6 mode. + In T.6 we only come here at the end of the page to add the EOFB marker, which + is like two 1D EOLs. */ + if (s->line_encoding != T4_COMPRESSION_ITU_T6) + { + if (s->row_bits + length < s->t4_t6_tx.min_bits_per_row) + put_encoded_bits(s, 0, s->t4_t6_tx.min_bits_per_row - (s->row_bits + length)); + } + put_encoded_bits(s, code, length); + update_row_bit_info(s); + } + else + { + /* We don't pad zero length rows. They are the consecutive EOLs which end a page. */ + put_encoded_bits(s, code, length); + /* Don't do the full update row bit info, or the minimum suddenly drops to the + length of an EOL. Just clear the row bits, so we treat the next EOL as an + end of page EOL, with no padding. */ + s->row_bits = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +/* + * 2D-encode a row of pixels. Consult ITU specification T.4 for the algorithm. + */ +static void encode_2d_row(t4_state_t *s) +{ + static const t4_run_table_entry_t codes[] = + { + { 7, 0x60, 0 }, /* VR3 0000 011 */ + { 6, 0x30, 0 }, /* VR2 0000 11 */ + { 3, 0x06, 0 }, /* VR1 011 */ + { 1, 0x01, 0 }, /* V0 1 */ + { 3, 0x02, 0 }, /* VL1 010 */ + { 6, 0x10, 0 }, /* VL2 0000 10 */ + { 7, 0x20, 0 }, /* VL3 0000 010 */ + { 3, 0x04, 0 }, /* horizontal 001 */ + { 4, 0x08, 0 } /* pass 0001 */ + }; + + /* The reference or starting changing element on the coding line. At the start of the coding + line, a0 is set on an imaginary white changing element situated just before the first element + on the line. During the coding of the coding line, the position of a0 is defined by the + previous coding mode. (See T.4/4.2.1.3.2.) */ + int a0; + /* The next changing element to the right of a0 on the coding line. */ + int a1; + /* The next changing element to the right of a1 on the coding line. */ + int a2; + /* The first changing element on the reference line to the right of a0 and of opposite colour to a0. */ + int b1; + /* The next changing element to the right of b1 on the reference line. */ + int b2; + int diff; + int a_cursor; + int b_cursor; + int cur_steps; + uint32_t *p; + + /* + b1 b2 + XX XX XX XX XX -- -- -- -- -- XX XX XX -- -- -- -- -- + XX XX XX -- -- -- -- -- XX XX XX XX XX XX -- -- -- -- + a0 a1 a2 + + + a) Pass mode + This mode is identified when the position of b2 lies to the left of a1. When this mode + has been coded, a0 is set on the element of the coding line below b2 in preparation for + the next coding (i.e. on a0'). + + b1 b2 + XX XX XX XX -- -- XX XX XX -- -- -- -- -- + XX XX -- -- -- -- -- -- -- -- -- -- XX XX + a0 a0' a1 + Pass mode + + + However, the state where b2 occurs just above a1, as shown in the figure below, is not + considered as a pass mode. + + b1 b2 + XX XX XX XX -- -- XX XX XX -- -- -- -- -- + XX XX -- -- -- -- -- -- -- XX XX XX XX XX + a0 a1 + Not pass mode + + + b) Vertical mode + When this mode is identified, the position of a1 is coded relative to the position of b1. + The relative distance a1b1 can take on one of seven values V(0), VR(1), VR(2), VR(3), + VL(1), VL(2) and VL(3), each of which is represented by a separate code word. The + subscripts R and L indicate that a1 is to the right or left respectively of b1, and the + number in brackets indicates the value of the distance a1b1. After vertical mode coding + has occurred, the position of a0 is set on a1 (see figure below). + + c) Horizontal mode + When this mode is identified, both the run-lengths a0a1 and a1a2 are coded using the code + words H + M(a0a1) + M(a1a2). H is the flag code word 001 taken from the two-dimensional + code table. M(a0a1) and M(a1a2) are code words which represent the length and "colour" + of the runs a0a1 and a1a2 respectively and are taken from the appropriate white or black + one-dimensional code tables. After a horizontal mode coding, the position of a0 is set on + a2 (see figure below). + + Vertical + + b1 b2 + -- XX XX XX XX XX -- -- -- -- -- -- -- -- XX XX XX XX -- -- -- + -- -- -- -- -- -- -- -- -- -- -- -- XX XX XX XX XX XX XX -- -- + a0 a1 a2 + <-------- a0a1 --------><-------- a1a2 ------------> + Horizontal mode + Vertical and horizontal modes + */ + /* The following implements the 2-D encoding section of the flow chart in Figure7/T.4 */ + cur_steps = row_to_run_lengths(s->cur_runs, s->row_buf, s->image_width); + /* Stretch the row a little, so when we step by 2 we are guaranteed to + hit an entry showing the row length */ + s->cur_runs[cur_steps] = + s->cur_runs[cur_steps + 1] = + s->cur_runs[cur_steps + 2] = s->cur_runs[cur_steps - 1]; + + a0 = 0; + a1 = s->cur_runs[0]; + b1 = s->ref_runs[0]; + a_cursor = 0; + b_cursor = 0; + for (;;) + { + b2 = s->ref_runs[b_cursor + 1]; + if (b2 >= a1) + { + diff = b1 - a1; + if (abs(diff) <= 3) + { + /* Vertical mode coding */ + put_encoded_bits(s, codes[diff + 3].code, codes[diff + 3].length); + a0 = a1; + a_cursor++; + } + else + { + /* Horizontal mode coding */ + a2 = s->cur_runs[a_cursor + 1]; + put_encoded_bits(s, codes[7].code, codes[7].length); + if (a0 + a1 == 0 || pixel_is_black(s->row_buf, a0) == 0) + { + put_1d_span(s, a1 - a0, t4_white_codes); + put_1d_span(s, a2 - a1, t4_black_codes); + } + else + { + put_1d_span(s, a1 - a0, t4_black_codes); + put_1d_span(s, a2 - a1, t4_white_codes); + } + a0 = a2; + a_cursor += 2; + } + if (a0 >= s->image_width) + break; + if (a_cursor >= cur_steps) + a_cursor = cur_steps - 1; + a1 = s->cur_runs[a_cursor]; + } + else + { + /* Pass mode coding */ + put_encoded_bits(s, codes[8].code, codes[8].length); + /* We now set a0 to somewhere in the middle of its current run, + but we know are aren't moving beyond that run. */ + a0 = b2; + if (a0 >= s->image_width) + break; + } + /* We need to hunt for the correct position in the reference row, as the + runs there have no particular alignment with the runs in the current + row. */ + if (pixel_is_black(s->row_buf, a0)) + b_cursor |= 1; + else + b_cursor &= ~1; + if (a0 < (int) s->ref_runs[b_cursor]) + { + for ( ; b_cursor >= 0; b_cursor -= 2) + { + if (a0 >= (int) s->ref_runs[b_cursor]) + break; + } + b_cursor += 2; + } + else + { + for ( ; b_cursor < s->t4_t6_tx.ref_steps; b_cursor += 2) + { + if (a0 < (int) s->ref_runs[b_cursor]) + break; + } + if (b_cursor >= s->t4_t6_tx.ref_steps) + b_cursor = s->t4_t6_tx.ref_steps - 1; + } + b1 = s->ref_runs[b_cursor]; + } + /* Swap the buffers */ + s->t4_t6_tx.ref_steps = cur_steps; + p = s->cur_runs; + s->cur_runs = s->ref_runs; + s->ref_runs = p; +} +/*- End of function --------------------------------------------------------*/ + +/* + * 1D-encode a row of pixels. The encoding is a sequence of all-white or + * all-black spans of pixels encoded with Huffman codes. + */ +static void encode_1d_row(t4_state_t *s) +{ + int i; + + /* Do our work in the reference row buffer, and it is already in place if + we need a reference row for a following 2D encoded row. */ + s->t4_t6_tx.ref_steps = row_to_run_lengths(s->ref_runs, s->row_buf, s->image_width); + put_1d_span(s, s->ref_runs[0], t4_white_codes); + for (i = 1; i < s->t4_t6_tx.ref_steps; i++) + put_1d_span(s, s->ref_runs[i] - s->ref_runs[i - 1], (i & 1) ? t4_black_codes : t4_white_codes); + /* Stretch the row a little, so when we step by 2 we are guaranteed to + hit an entry showing the row length */ + s->ref_runs[s->t4_t6_tx.ref_steps] = + s->ref_runs[s->t4_t6_tx.ref_steps + 1] = + s->ref_runs[s->t4_t6_tx.ref_steps + 2] = s->ref_runs[s->t4_t6_tx.ref_steps - 1]; +} +/*- End of function --------------------------------------------------------*/ + +static int encode_row(t4_state_t *s) +{ + switch (s->line_encoding) + { + case T4_COMPRESSION_ITU_T6: + /* T.6 compression is a trivial step up from T.4 2D, so we just + throw it in here. T.6 is only used with error correction, + so it does not need independantly compressed (i.e. 1D) lines + to recover from data errors. It doesn't need EOLs, either. */ + if (s->row_bits) + update_row_bit_info(s); + encode_2d_row(s); + break; + case T4_COMPRESSION_ITU_T4_2D: + encode_eol(s); + if (s->row_is_2d) + { + encode_2d_row(s); + s->t4_t6_tx.rows_to_next_1d_row--; + } + else + { + encode_1d_row(s); + s->row_is_2d = TRUE; + } + if (s->t4_t6_tx.rows_to_next_1d_row <= 0) + { + /* Insert a row of 1D encoding */ + s->row_is_2d = FALSE; + s->t4_t6_tx.rows_to_next_1d_row = s->t4_t6_tx.max_rows_to_next_1d_row - 1; + } + break; + default: + case T4_COMPRESSION_ITU_T4_1D: + encode_eol(s); + encode_1d_row(s); + break; + } + s->row++; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_set_row_read_handler(t4_state_t *s, t4_row_read_handler_t handler, void *user_data) +{ + s->t4_t6_tx.row_read_handler = handler; + s->t4_t6_tx.row_read_user_data = user_data; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(t4_state_t *) t4_tx_init(t4_state_t *s, const char *file, int start_page, int stop_page) +{ + int run_space; + + if (s == NULL) + { + if ((s = (t4_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "T.4"); + s->rx = FALSE; + + span_log(&s->logging, SPAN_LOG_FLOW, "Start tx document\n"); + + if (open_tiff_input_file(s, file) < 0) + return NULL; + s->tiff.file = strdup(file); + s->current_page = + s->tiff.start_page = (start_page >= 0) ? start_page : 0; + s->tiff.stop_page = (stop_page >= 0) ? stop_page : INT_MAX; + + if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page)) + return NULL; + if (get_tiff_directory_info(s)) + { + close_tiff_input_file(s); + return NULL; + } + + s->t4_t6_tx.rows_to_next_1d_row = s->t4_t6_tx.max_rows_to_next_1d_row - 1; + + s->tiff.pages_in_file = -1; + + run_space = (s->image_width + 4)*sizeof(uint32_t); + if ((s->cur_runs = (uint32_t *) malloc(run_space)) == NULL) + return NULL; + if ((s->ref_runs = (uint32_t *) malloc(run_space)) == NULL) + { + free_buffers(s); + close_tiff_input_file(s); + return NULL; + } + if ((s->row_buf = malloc(s->bytes_per_row)) == NULL) + { + free_buffers(s); + close_tiff_input_file(s); + return NULL; + } + s->ref_runs[0] = + s->ref_runs[1] = + s->ref_runs[2] = + s->ref_runs[3] = s->image_width; + s->t4_t6_tx.ref_steps = 1; + s->image_buffer_size = 0; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_start_page(t4_state_t *s) +{ + int row; + int i; + int run_space; + int len; + int old_image_width; + uint8_t *bufptr8; + uint32_t *bufptr; + + span_log(&s->logging, SPAN_LOG_FLOW, "Start tx page %d\n", s->current_page); + if (s->current_page > s->tiff.stop_page) + return -1; + if (s->tiff.tiff_file == NULL) + return -1; + old_image_width = s->image_width; + if (s->t4_t6_tx.row_read_handler == NULL) + { +#if defined(HAVE_LIBTIFF) + if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page)) + return -1; + get_tiff_directory_info(s); +#endif + } + s->image_size = 0; + s->tx_bitstream = 0; + s->tx_bits = 0; + s->row_is_2d = (s->line_encoding == T4_COMPRESSION_ITU_T6); + s->t4_t6_tx.rows_to_next_1d_row = s->t4_t6_tx.max_rows_to_next_1d_row - 1; + + /* Allow for pages being of different width. */ + run_space = (s->image_width + 4)*sizeof(uint32_t); + if (old_image_width != s->image_width) + { + s->bytes_per_row = (s->image_width + 7)/8; + + if ((bufptr = (uint32_t *) realloc(s->cur_runs, run_space)) == NULL) + return -1; + s->cur_runs = bufptr; + if ((bufptr = (uint32_t *) realloc(s->ref_runs, run_space)) == NULL) + return -1; + s->ref_runs = bufptr; + if ((bufptr8 = realloc(s->row_buf, s->bytes_per_row)) == NULL) + return -1; + s->row_buf = bufptr8; + } + s->ref_runs[0] = + s->ref_runs[1] = + s->ref_runs[2] = + s->ref_runs[3] = s->image_width; + s->t4_t6_tx.ref_steps = 1; + + s->row_bits = 0; + s->min_row_bits = INT_MAX; + s->max_row_bits = 0; + + if (s->t4_t6_tx.header_info && s->t4_t6_tx.header_info[0]) + { + if (t4_tx_put_fax_header(s)) + return -1; + } + if (s->t4_t6_tx.row_read_handler) + { + for (row = 0; ; row++) + { + if ((len = s->t4_t6_tx.row_read_handler(s->t4_t6_tx.row_read_user_data, s->row_buf, s->bytes_per_row)) < 0) + { + span_log(&s->logging, SPAN_LOG_WARNING, "%s: Read error at row %d.\n", s->tiff.file, row); + break; + } + if (len == 0) + break; + if (encode_row(s)) + return -1; + } + s->image_length = row; + } + else + { + if ((s->image_length = read_tiff_image(s)) < 0) + return -1; + } + if (s->line_encoding == T4_COMPRESSION_ITU_T6) + { + /* Attach an EOFB (end of facsimile block == 2 x EOLs) to the end of the page */ + for (i = 0; i < EOLS_TO_END_T6_TX_PAGE; i++) + encode_eol(s); + } + else + { + /* Attach an RTC (return to control == 6 x EOLs) to the end of the page */ + s->row_is_2d = FALSE; + for (i = 0; i < EOLS_TO_END_T4_TX_PAGE; i++) + encode_eol(s); + } + + /* Force any partial byte in progress to flush using ones. Any post EOL padding when + sending is normally ones, so this is consistent. */ + put_encoded_bits(s, 0xFF, 7); + s->t4_t6_tx.bit_pos = 7; + s->t4_t6_tx.bit_ptr = 0; + s->line_image_size = s->image_size*8; + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_next_page_has_different_format(t4_state_t *s) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "Checking for the existance of page %d\n", s->current_page + 1); + if (s->current_page >= s->tiff.stop_page) + return -1; + if (s->t4_t6_tx.row_read_handler == NULL) + { +#if defined(HAVE_LIBTIFF) + if (s->tiff.tiff_file == NULL) + return -1; + if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page + 1)) + return -1; + return test_tiff_directory_info(s); +#endif + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_restart_page(t4_state_t *s) +{ + s->t4_t6_tx.bit_pos = 7; + s->t4_t6_tx.bit_ptr = 0; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_end_page(t4_state_t *s) +{ + s->current_page++; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_get_bit(t4_state_t *s) +{ + int bit; + + if (s->t4_t6_tx.bit_ptr >= s->image_size) + return SIG_STATUS_END_OF_DATA; + bit = (s->image_buffer[s->t4_t6_tx.bit_ptr] >> (7 - s->t4_t6_tx.bit_pos)) & 1; + if (--s->t4_t6_tx.bit_pos < 0) + { + s->t4_t6_tx.bit_pos = 7; + s->t4_t6_tx.bit_ptr++; + } + return bit; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_get_byte(t4_state_t *s) +{ + if (s->t4_t6_tx.bit_ptr >= s->image_size) + return 0x100; + return s->image_buffer[s->t4_t6_tx.bit_ptr++]; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_get_chunk(t4_state_t *s, uint8_t buf[], int max_len) +{ + if (s->t4_t6_tx.bit_ptr >= s->image_size) + return 0; + if (s->t4_t6_tx.bit_ptr + max_len > s->image_size) + max_len = s->image_size - s->t4_t6_tx.bit_ptr; + memcpy(buf, &s->image_buffer[s->t4_t6_tx.bit_ptr], max_len); + s->t4_t6_tx.bit_ptr += max_len; + return max_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_check_bit(t4_state_t *s) +{ + int bit; + + if (s->t4_t6_tx.bit_ptr >= s->image_size) + return SIG_STATUS_END_OF_DATA; + bit = (s->image_buffer[s->t4_t6_tx.bit_ptr] >> s->t4_t6_tx.bit_pos) & 1; + return bit; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_release(t4_state_t *s) +{ + if (s->rx) + return -1; + if (s->tiff.tiff_file) + close_tiff_input_file(s); + free_buffers(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_free(t4_state_t *s) +{ + int ret; + + ret = t4_tx_release(s); + free(s); + return ret; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_tx_set_tx_encoding(t4_state_t *s, int encoding) +{ + s->line_encoding = encoding; + s->t4_t6_tx.rows_to_next_1d_row = s->t4_t6_tx.max_rows_to_next_1d_row - 1; + s->row_is_2d = FALSE; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_tx_set_min_row_bits(t4_state_t *s, int bits) +{ + s->t4_t6_tx.min_bits_per_row = bits; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_tx_set_local_ident(t4_state_t *s, const char *ident) +{ + s->tiff.local_ident = (ident && ident[0]) ? ident : NULL; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_tx_set_header_info(t4_state_t *s, const char *info) +{ + s->t4_t6_tx.header_info = (info && info[0]) ? info : NULL; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_get_y_resolution(t4_state_t *s) +{ + return s->y_resolution; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_get_x_resolution(t4_state_t *s) +{ + return s->x_resolution; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_get_image_width(t4_state_t *s) +{ + return s->image_width; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_get_pages_in_file(t4_state_t *s) +{ + int max; + + max = 0; + if (s->t4_t6_tx.row_read_handler == NULL) + max = get_tiff_total_pages(s); + if (max >= 0) + s->tiff.pages_in_file = max; + return max; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_get_current_page_in_file(t4_state_t *s) +{ + return s->current_page; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/testcpuid.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/testcpuid.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,209 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * testcpuid.c - Check the CPU type, to identify special features, like SSE. + * + * Written by Steve Underwood + * Stitched together from bits of testing code found here and there + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: testcpuid.c,v 1.13 2009/01/05 13:48:31 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include + +/* Make this file just disappear if we are not on an x86 machine */ +#if defined(__i386__) // || defined(__x86_64__) + +#define X86_EFLAGS_CF 0x00000001 /* Carry Flag */ +#define X86_EFLAGS_PF 0x00000004 /* Parity Flag */ +#define X86_EFLAGS_AF 0x00000010 /* Auxillary carry Flag */ +#define X86_EFLAGS_ZF 0x00000040 /* Zero Flag */ +#define X86_EFLAGS_SF 0x00000080 /* Sign Flag */ +#define X86_EFLAGS_TF 0x00000100 /* Trap Flag */ +#define X86_EFLAGS_IF 0x00000200 /* Interrupt Flag */ +#define X86_EFLAGS_DF 0x00000400 /* Direction Flag */ +#define X86_EFLAGS_OF 0x00000800 /* Overflow Flag */ +#define X86_EFLAGS_IOPL 0x00003000 /* IOPL mask */ +#define X86_EFLAGS_NT 0x00004000 /* Nested Task */ +#define X86_EFLAGS_RF 0x00010000 /* Resume Flag */ +#define X86_EFLAGS_VM 0x00020000 /* Virtual Mode */ +#define X86_EFLAGS_AC 0x00040000 /* Alignment Check */ +#define X86_EFLAGS_VIF 0x00080000 /* Virtual Interrupt Flag */ +#define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */ +#define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */ + +/* Standard macro to see if a specific flag is changeable */ +static __inline__ int flag_is_changeable_p(uint32_t flag) +{ + uint32_t f1; + uint32_t f2; + + __asm__ __volatile__ ( + " pushfl\n" + " pushfl\n" + " popl %0\n" + " movl %0,%1\n" + " xorl %2,%0\n" + " pushl %0\n" + " popfl\n" + " pushfl\n" + " popl %0\n" + " popfl\n" + : "=&r" (f1), "=&r" (f2) + : "ir" (flag)); + + return ((f1^f2) & flag) != 0; +} +/*- End of function --------------------------------------------------------*/ + +/* Probe for the CPUID instruction */ +static int have_cpuid_p(void) +{ + return flag_is_changeable_p(X86_EFLAGS_ID); +} +/*- End of function --------------------------------------------------------*/ + +int has_MMX(void) +{ + int result; + + if (!have_cpuid_p()) + return 0; + /*endif*/ + __asm__ __volatile__ ( + " push %%ebx;\n" + " mov $1,%%eax;\n" + " cpuid;\n" + " xor %%eax,%%eax;\n" + " test $0x800000,%%edx;\n" + " jz 1f;\n" /* no MMX support */ + " inc %%eax;\n" /* MMX support */ + "1:\n" + " pop %%ebx;\n" + : "=a" (result) + : + : "ecx", "edx"); + return result; +} +/*- End of function --------------------------------------------------------*/ + +int has_SIMD(void) +{ + int result; + + if (!have_cpuid_p()) + return 0; + /*endif*/ + __asm__ __volatile__ ( + " push %%ebx;\n" + " mov $1,%%eax;\n" + " cpuid;\n" + " xor %%eax,%%eax;\n" + " test $0x02000000,%%edx;\n" + " jz 1f;\n" /* no SIMD support */ + " inc %%eax;\n" /* SIMD support */ + "1:\n" + " pop %%ebx;\n" + : "=a" (result) + : + : "ecx", "edx"); + return result; +} +/*- End of function --------------------------------------------------------*/ + +int has_SIMD2(void) +{ + int result; + + if (!have_cpuid_p()) + return 0; + /*endif*/ + __asm__ __volatile__ ( + " push %%ebx;\n" + " mov $1,%%eax;\n" + " cpuid;\n" + " xor %%eax,%%eax;\n" + " test $0x04000000,%%edx;\n" + " jz 1f;\n" /* no SIMD2 support */ + " inc %%eax;\n" /* SIMD2 support */ + "1:\n" + " pop %%ebx;\n" + : "=a" (result) + : + : "ecx", "edx"); + return result; +} +/*- End of function --------------------------------------------------------*/ + +int has_3DNow(void) +{ + int result; + + if (!have_cpuid_p()) + return 0; + /*endif*/ + __asm__ __volatile__ ( + " push %%ebx;\n" + " mov $0x80000000,%%eax;\n" + " cpuid;\n" + " xor %%ecx,%%ecx;\n" + " cmp $0x80000000,%%eax;\n" + " jbe 1f;\n" /* no extended MSR(1), so no 3DNow! */ + " mov $0x80000001,%%eax;\n" + " cpuid;\n" + " xor %%ecx,%%ecx;\n" + " test $0x80000000,%%edx;\n" + " jz 1f;\n" /* no 3DNow! support */ + " inc %%ecx;\n" /* 3DNow! support */ + "1:\n" + " pop %%ebx;\n" + : "=c" (result) + : + : "eax", "edx"); + return result; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(TESTBED) +int main(int argc, char *argv[]) +{ + int result; + + result = has_MMX(); + printf("MMX is %x\n", result); + result = has_SIMD(); + printf("SIMD is %x\n", result); + result = has_SIMD2(); + printf("SIMD2 is %x\n", result); + result = has_3DNow(); + printf("3DNow is %x\n", result); + return 0; +} +/*- End of function --------------------------------------------------------*/ +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/time_scale.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/time_scale.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,287 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * time_scale.c - Time scaling for linear speech data + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: time_scale.c,v 1.30 2009/02/10 13:06:47 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/time_scale.h" +#include "spandsp/saturated.h" + +#include "spandsp/private/time_scale.h" + +/* + Time scaling for speech, based on the Pointer Interval Controlled + OverLap and Add (PICOLA) method, developed by Morita Naotaka. + */ + +static __inline__ int amdf_pitch(int min_pitch, int max_pitch, int16_t amp[], int len) +{ + int i; + int j; + int acc; + int min_acc; + int pitch; + + pitch = min_pitch; + min_acc = INT_MAX; + for (i = max_pitch; i <= min_pitch; i++) + { + acc = 0; + for (j = 0; j < len; j++) + acc += abs(amp[i + j] - amp[j]); + if (acc < min_acc) + { + min_acc = acc; + pitch = i; + } + } + return pitch; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void overlap_add(int16_t amp1[], int16_t amp2[], int len) +{ + int i; + float weight; + float step; + + step = 1.0f/len; + weight = 0.0f; + for (i = 0; i < len; i++) + { + /* TODO: saturate */ + amp2[i] = (int16_t) ((float) amp1[i]*(1.0f - weight) + (float) amp2[i]*weight); + weight += step; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) time_scale_rate(time_scale_state_t *s, float playout_rate) +{ + if (playout_rate <= 0.0f) + return -1; + /*endif*/ + if (playout_rate >= 0.99f && playout_rate <= 1.01f) + { + /* Treat rate close to normal speed as exactly normal speed, and + avoid divide by zero, and other numerical problems. */ + playout_rate = 1.0f; + } + else if (playout_rate < 1.0f) + { + s->rcomp = playout_rate/(1.0f - playout_rate); + } + else + { + s->rcomp = 1.0f/(playout_rate - 1.0f); + } + /*endif*/ + s->playout_rate = playout_rate; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(time_scale_state_t *) time_scale_init(time_scale_state_t *s, int sample_rate, float playout_rate) +{ + int alloced; + + if (sample_rate > TIME_SCALE_MAX_SAMPLE_RATE) + return NULL; + alloced = FALSE; + if (s == NULL) + { + if ((s = (time_scale_state_t *) malloc(sizeof (*s))) == NULL) + return NULL; + /*endif*/ + alloced = TRUE; + } + /*endif*/ + s->sample_rate = sample_rate; + s->min_pitch = sample_rate/TIME_SCALE_MIN_PITCH; + s->max_pitch = sample_rate/TIME_SCALE_MAX_PITCH; + s->buf_len = 2*sample_rate/TIME_SCALE_MIN_PITCH; + if (time_scale_rate(s, playout_rate)) + { + if (alloced) + free(s); + return NULL; + } + /*endif*/ + s->rate_nudge = 0.0f; + s->fill = 0; + s->lcp = 0; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) time_scale_release(time_scale_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) time_scale_free(time_scale_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) time_scale(time_scale_state_t *s, int16_t out[], int16_t in[], int len) +{ + double lcpf; + int pitch; + int out_len; + int in_len; + int k; + + out_len = 0; + in_len = 0; + + /* Top up the buffer */ + if (s->fill + len < s->buf_len) + { + /* Cannot continue without more samples */ + memcpy(s->buf + s->fill, in, sizeof(int16_t)*len); + s->fill += len; + return out_len; + } + k = s->buf_len - s->fill; + memcpy(s->buf + s->fill, in, sizeof(int16_t)*k); + in_len += k; + s->fill = s->buf_len; + while (s->fill == s->buf_len) + { + while (s->lcp >= s->buf_len) + { + memcpy(out + out_len, s->buf, sizeof(int16_t)*s->buf_len); + out_len += s->buf_len; + if (len - in_len < s->buf_len) + { + /* Cannot continue without more samples */ + memcpy(s->buf, in + in_len, sizeof(int16_t)*(len - in_len)); + s->fill = len - in_len; + s->lcp -= s->buf_len; + return out_len; + } + memcpy(s->buf, in + in_len, sizeof(int16_t)*s->buf_len); + in_len += s->buf_len; + s->lcp -= s->buf_len; + } + if (s->lcp > 0) + { + memcpy(out + out_len, s->buf, sizeof(int16_t)*s->lcp); + out_len += s->lcp; + memcpy(s->buf, s->buf + s->lcp, sizeof(int16_t)*(s->buf_len - s->lcp)); + if (len - in_len < s->lcp) + { + /* Cannot continue without more samples */ + memcpy(s->buf + (s->buf_len - s->lcp), in + in_len, sizeof(int16_t)*(len - in_len)); + s->fill = s->buf_len - s->lcp + len - in_len; + s->lcp = 0; + return out_len; + } + memcpy(s->buf + (s->buf_len - s->lcp), in + in_len, sizeof(int16_t)*s->lcp); + in_len += s->lcp; + s->lcp = 0; + } + if (s->playout_rate == 1.0f) + { + s->lcp = 0x7FFFFFFF; + } + else + { + pitch = amdf_pitch(s->min_pitch, s->max_pitch, s->buf, s->min_pitch); + lcpf = (double) pitch*s->rcomp; + /* Nudge around to compensate for fractional samples */ + s->lcp = (int) lcpf; + /* Note that s->lcp and lcpf are not the same, as lcpf has a fractional part, and s->lcp doesn't */ + s->rate_nudge += s->lcp - lcpf; + if (s->rate_nudge >= 0.5f) + { + s->lcp--; + s->rate_nudge -= 1.0f; + } + else if (s->rate_nudge <= -0.5f) + { + s->lcp++; + s->rate_nudge += 1.0f; + } + if (s->playout_rate < 1.0f) + { + /* Speed up - drop a chunk of data */ + overlap_add(s->buf, s->buf + pitch, pitch); + memcpy(&s->buf[pitch], &s->buf[2*pitch], sizeof(int16_t)*(s->buf_len - 2*pitch)); + if (len - in_len < pitch) + { + /* Cannot continue without more samples */ + memcpy(s->buf + s->buf_len - pitch, in + in_len, sizeof(int16_t)*(len - in_len)); + s->fill += (len - in_len - pitch); + return out_len; + } + memcpy(s->buf + s->buf_len - pitch, in + in_len, sizeof(int16_t)*pitch); + in_len += pitch; + } + else + { + /* Slow down - insert a chunk of data */ + memcpy(out + out_len, s->buf, sizeof(int16_t)*pitch); + out_len += pitch; + overlap_add(s->buf + pitch, s->buf, pitch); + } + } + } + return out_len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) time_scale_max_output_len(time_scale_state_t *s, int input_len) +{ + return (int) (input_len*s->playout_rate + s->min_pitch + 1); +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/tone_detect.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/tone_detect.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,302 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * tone_detect.c - General telephony tone detection. + * + * Written by Steve Underwood + * + * Copyright (C) 2001-2003, 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: tone_detect.c,v 1.53 2009/04/12 09:12:10 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/complex.h" +#include "spandsp/complex_vector_float.h" +#include "spandsp/tone_detect.h" +#include "spandsp/tone_generate.h" + +#include "spandsp/private/tone_detect.h" + +#if !defined(M_PI) +/* C99 systems may not define M_PI */ +#define M_PI 3.14159265358979323846264338327 +#endif + +SPAN_DECLARE(void) make_goertzel_descriptor(goertzel_descriptor_t *t, float freq, int samples) +{ +#if defined(SPANDSP_USE_FIXED_POINT) + t->fac = 16383.0f*2.0f*cosf(2.0f*M_PI*(freq/(float) SAMPLE_RATE)); +#else + t->fac = 2.0f*cosf(2.0f*M_PI*(freq/(float) SAMPLE_RATE)); +#endif + t->samples = samples; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(goertzel_state_t *) goertzel_init(goertzel_state_t *s, + goertzel_descriptor_t *t) +{ + if (s == NULL) + { + if ((s = (goertzel_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } +#if defined(SPANDSP_USE_FIXED_POINT) + s->v2 = + s->v3 = 0; +#else + s->v2 = + s->v3 = 0.0f; +#endif + s->fac = t->fac; + s->samples = t->samples; + s->current_sample = 0; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) goertzel_release(goertzel_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) goertzel_free(goertzel_state_t *s) +{ + if (s) + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) goertzel_reset(goertzel_state_t *s) +{ +#if defined(SPANDSP_USE_FIXED_POINT) + s->v2 = + s->v3 = 0; +#else + s->v2 = + s->v3 = 0.0f; +#endif + s->current_sample = 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) goertzel_update(goertzel_state_t *s, + const int16_t amp[], + int samples) +{ + int i; +#if defined(SPANDSP_USE_FIXED_POINT) + int16_t x; + int16_t v1; +#else + float v1; +#endif + + if (samples > s->samples - s->current_sample) + samples = s->samples - s->current_sample; + for (i = 0; i < samples; i++) + { + v1 = s->v2; + s->v2 = s->v3; +#if defined(SPANDSP_USE_FIXED_POINT) + x = (((int32_t) s->fac*s->v2) >> 14); + /* Scale down the input signal to avoid overflows. 9 bits is enough to + monitor the signals of interest with adequate dynamic range and + resolution. In telephony we generally only start with 13 or 14 bits, + anyway. */ + s->v3 = x - v1 + (amp[i] >> 7); +#else + s->v3 = s->fac*s->v2 - v1 + amp[i]; +#endif + } + s->current_sample += samples; + return samples; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINT) +SPAN_DECLARE(int32_t) goertzel_result(goertzel_state_t *s) +#else +SPAN_DECLARE(float) goertzel_result(goertzel_state_t *s) +#endif +{ +#if defined(SPANDSP_USE_FIXED_POINT) + int16_t v1; + int32_t x; + int32_t y; +#else + float v1; +#endif + + /* Push a zero through the process to finish things off. */ + v1 = s->v2; + s->v2 = s->v3; +#if defined(SPANDSP_USE_FIXED_POINT) + x = (((int32_t) s->fac*s->v2) >> 14); + s->v3 = x - v1; +#else + s->v3 = s->fac*s->v2 - v1; +#endif + /* Now calculate the non-recursive side of the filter. */ + /* The result here is not scaled down to allow for the magnification + effect of the filter (the usual DFT magnification effect). */ +#if defined(SPANDSP_USE_FIXED_POINT) + x = (int32_t) s->v3*s->v3; + y = (int32_t) s->v2*s->v2; + x += y; + y = ((int32_t) s->v3*s->fac) >> 14; + y *= s->v2; + x -= y; + x <<= 1; + goertzel_reset(s); + /* The number returned in a floating point build will be 16384^2 times + as big as for a fixed point build, due to the 14 bit shifts + (or the square of the 7 bit shifts, depending how you look at it). */ + return x; +#else + v1 = s->v3*s->v3 + s->v2*s->v2 - s->v2*s->v3*s->fac; + v1 *= 2.0; + goertzel_reset(s); + return v1; +#endif +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(complexf_t) periodogram(const complexf_t coeffs[], const complexf_t amp[], int len) +{ + complexf_t sum; + complexf_t diff; + complexf_t x; + int i; + + x = complex_setf(0.0f, 0.0f); + for (i = 0; i < len/2; i++) + { + sum = complex_addf(&[i], &[len - 1 - i]); + diff = complex_subf(&[i], &[len - 1 - i]); + x.re += (coeffs[i].re*sum.re - coeffs[i].im*diff.im); + x.im += (coeffs[i].re*sum.im + coeffs[i].im*diff.re); + } + return x; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) periodogram_prepare(complexf_t sum[], complexf_t diff[], const complexf_t amp[], int len) +{ + int i; + + for (i = 0; i < len/2; i++) + { + sum[i] = complex_addf(&[i], &[len - 1 - i]); + diff[i] = complex_subf(&[i], &[len - 1 - i]); + } + return len/2; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(complexf_t) periodogram_apply(const complexf_t coeffs[], const complexf_t sum[], const complexf_t diff[], int len) +{ + complexf_t x; + int i; + + x = complex_setf(0.0f, 0.0f); + for (i = 0; i < len/2; i++) + { + x.re += (coeffs[i].re*sum[i].re - coeffs[i].im*diff[i].im); + x.im += (coeffs[i].re*sum[i].im + coeffs[i].im*diff[i].re); + } + return x; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) periodogram_generate_coeffs(complexf_t coeffs[], float freq, int sample_rate, int window_len) +{ + float window; + float sum; + float x; + int i; + + sum = 0.0f; + for (i = 0; i < window_len/2; i++) + { + /* Apply a Hamming window as we go */ + window = 0.53836f - 0.46164f*cosf(2.0f*3.1415926535f*i/(window_len - 1.0f)); + x = (i - window_len/2.0f + 0.5f)*freq*2.0f*3.1415926535f/sample_rate; + coeffs[i].re = cosf(x)*window; + coeffs[i].im = -sinf(x)*window; + sum += window; + } + /* Rescale for unity gain in the periodogram. The 2.0 factor is to allow for the full window, + rather than just the half over which we have summed the coefficients. */ + sum = 1.0f/(2.0f*sum); + for (i = 0; i < window_len/2; i++) + { + coeffs[i].re *= sum; + coeffs[i].im *= sum; + } + return window_len/2; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) periodogram_generate_phase_offset(complexf_t *offset, float freq, int sample_rate, int interval) +{ + float x; + + /* The phase offset is how far the phase rotates in one frame */ + x = 2.0f*3.1415926535f*(float) interval/(float) sample_rate; + offset->re = cosf(freq*x); + offset->im = sinf(freq*x); + return 1.0f/x; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) periodogram_freq_error(const complexf_t *phase_offset, float scale, const complexf_t *last_result, const complexf_t *result) +{ + complexf_t prediction; + + /* Rotate the last result by the expected phasor offset to the current result. Then + find the difference between that predicted position, and the actual one. When + scaled by the current signal level, this gives us the frequency error. */ + prediction = complex_mulf(last_result, phase_offset); + return scale*(result->im*prediction.re - result->re*prediction.im)/(result->re*result->re + result->im*result->im); +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/tone_generate.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/tone_generate.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,239 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * tone_generate.c - General telephony tone generation. + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: tone_generate.c,v 1.53.4.1 2009/12/23 14:23:49 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/dc_restore.h" +#include "spandsp/complex.h" +#include "spandsp/dds.h" +#include "spandsp/tone_generate.h" + +#include "spandsp/private/tone_generate.h" + +#if !defined(M_PI) +/* C99 systems may not define M_PI */ +#define M_PI 3.14159265358979323846264338327 +#endif + +SPAN_DECLARE(void) make_tone_gen_descriptor(tone_gen_descriptor_t *s, + int f1, + int l1, + int f2, + int l2, + int d1, + int d2, + int d3, + int d4, + int repeat) +{ + memset(s, 0, sizeof(*s)); + if (f1) + { +#if defined(SPANDSP_USE_FIXED_POINT) + s->tone[0].phase_rate = dds_phase_rate((float) f1); + if (f2 < 0) + s->tone[0].phase_rate = -s->tone[0].phase_rate; + s->tone[0].gain = dds_scaling_dbm0((float) l1); +#else + s->tone[0].phase_rate = dds_phase_ratef((float) f1); + if (f2 < 0) + s->tone[0].phase_rate = -s->tone[0].phase_rate; + s->tone[0].gain = dds_scaling_dbm0f((float) l1); +#endif + } + if (f2) + { +#if defined(SPANDSP_USE_FIXED_POINT) + s->tone[1].phase_rate = dds_phase_rate((float) abs(f2)); + s->tone[1].gain = (f2 < 0) ? (float) 32767.0f*l2/100.0f : dds_scaling_dbm0((float) l2); +#else + s->tone[1].phase_rate = dds_phase_ratef((float) abs(f2)); + s->tone[1].gain = (f2 < 0) ? (float) l2/100.0f : dds_scaling_dbm0f((float) l2); +#endif + } + + s->duration[0] = d1*SAMPLE_RATE/1000; + s->duration[1] = d2*SAMPLE_RATE/1000; + s->duration[2] = d3*SAMPLE_RATE/1000; + s->duration[3] = d4*SAMPLE_RATE/1000; + + s->repeat = repeat; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(tone_gen_state_t *) tone_gen_init(tone_gen_state_t *s, tone_gen_descriptor_t *t) +{ + int i; + + if (s == NULL) + return NULL; + for (i = 0; i < 4; i++) + { + s->tone[i] = t->tone[i]; + s->phase[i] = 0; + } + + for (i = 0; i < 4; i++) + s->duration[i] = t->duration[i]; + s->repeat = t->repeat; + + s->current_section = 0; + s->current_position = 0; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) tone_gen_release(tone_gen_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) tone_gen_free(tone_gen_state_t *s) +{ + if (s) + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) tone_gen(tone_gen_state_t *s, int16_t amp[], int max_samples) +{ + int samples; + int limit; +#if defined(SPANDSP_USE_FIXED_POINT) + int16_t xamp; +#else + float xamp; +#endif + int i; + + if (s->current_section < 0) + return 0; + + for (samples = 0; samples < max_samples; ) + { + limit = samples + s->duration[s->current_section] - s->current_position; + if (limit > max_samples) + limit = max_samples; + + s->current_position += (limit - samples); + if (s->current_section & 1) + { + /* A silent section */ + for ( ; samples < limit; samples++) + amp[samples] = 0; + } + else + { + if (s->tone[0].phase_rate < 0) + { + /* Modulated tone */ + for ( ; samples < limit; samples++) + { + /* There must be two, and only two, tones */ +#if defined(SPANDSP_USE_FIXED_POINT) + xamp = ((int32_t) dds_mod(&s->phase[0], -s->tone[0].phase_rate, s->tone[0].gain, 0) + *(32767 + (int32_t) dds_mod(&s->phase[1], s->tone[1].phase_rate, s->tone[1].gain, 0))) >> 15; + amp[samples] = xamp; +#else + xamp = dds_modf(&s->phase[0], -s->tone[0].phase_rate, s->tone[0].gain, 0) + *(1.0f + dds_modf(&s->phase[1], s->tone[1].phase_rate, s->tone[1].gain, 0)); + amp[samples] = (int16_t) lfastrintf(xamp); +#endif + } + } + else + { + for ( ; samples < limit; samples++) + { +#if defined(SPANDSP_USE_FIXED_POINT) + xamp = 0; +#else + xamp = 0.0f; +#endif + for (i = 0; i < 4; i++) + { + if (s->tone[i].phase_rate == 0) + break; +#if defined(SPANDSP_USE_FIXED_POINT) + xamp += dds_mod(&s->phase[i], s->tone[i].phase_rate, s->tone[i].gain, 0); +#else + xamp += dds_modf(&s->phase[i], s->tone[i].phase_rate, s->tone[i].gain, 0); +#endif + } + /* Saturation of the answer is the right thing at this point. + However, we are normally generating well controlled tones, + that cannot clip. So, the overhead of doing saturation is + a waste of valuable time. */ +#if defined(SPANDSP_USE_FIXED_POINT) + amp[samples] = xamp; +#else + amp[samples] = (int16_t) lfastrintf(xamp); +#endif + } + } + } + if (s->current_position >= s->duration[s->current_section]) + { + s->current_position = 0; + if (++s->current_section > 3 || s->duration[s->current_section] == 0) + { + if (!s->repeat) + { + /* Force a quick exit */ + s->current_section = -1; + break; + } + s->current_section = 0; + } + } + } + return samples; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/v17_v32bis_rx_constellation_maps.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/v17_v32bis_rx_constellation_maps.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,6889 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v17rx_v32bis_constellation_maps.h - ITU V.17 and V.32bis modems + * receive part. + * Constellation mapping. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v17_v32bis_rx_constellation_maps.h,v 1.1.4.1 2009/12/24 16:52:30 steveu Exp $ + */ + +/* The following table maps the 8 soft-decisions associated with every possible point in the + constellation space. If you look at the constellations carefully, all 4 can be accurately + mapped at 0.5 unit resolution. */ +static const uint8_t constel_maps[4][36][36][8] = +{ + { /* 14,400bps map */ + { + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f}, + {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x05, 0x66, 0x5f}, + {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x05, 0x66, 0x5f}, + {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x66, 0x7f}, + {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x66, 0x7f}, + {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x76, 0x7f}, + {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x76, 0x7f}, + {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x0d, 0x76, 0x7f}, + {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x0d, 0x76, 0x7f}, + {0x08, 0x41, 0x6a, 0x73, 0x44, 0x0d, 0x76, 0x7f}, + {0x08, 0x41, 0x6a, 0x73, 0x44, 0x0d, 0x76, 0x7f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x76, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x76, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f} + }, + { + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f}, + {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x05, 0x66, 0x5f}, + {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x05, 0x66, 0x5f}, + {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x66, 0x7f}, + {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x66, 0x7f}, + {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x76, 0x7f}, + {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x76, 0x7f}, + {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x0d, 0x76, 0x7f}, + {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x0d, 0x76, 0x7f}, + {0x08, 0x41, 0x6a, 0x73, 0x44, 0x0d, 0x76, 0x7f}, + {0x08, 0x41, 0x6a, 0x73, 0x44, 0x0d, 0x76, 0x7f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x76, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x76, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f} + }, + { + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f}, + {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x05, 0x66, 0x5f}, + {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x05, 0x66, 0x5f}, + {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x66, 0x7f}, + {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x66, 0x7f}, + {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x76, 0x7f}, + {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x76, 0x7f}, + {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x0d, 0x76, 0x7f}, + {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x0d, 0x76, 0x7f}, + {0x08, 0x41, 0x6a, 0x73, 0x44, 0x0d, 0x76, 0x7f}, + {0x08, 0x41, 0x6a, 0x73, 0x44, 0x0d, 0x76, 0x7f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x76, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x76, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f} + }, + { + {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x05, 0x66, 0x5f}, + {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x05, 0x66, 0x5f}, + {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x05, 0x66, 0x5f}, + {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x66, 0x7f}, + {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x66, 0x7f}, + {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x76, 0x7f}, + {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x05, 0x76, 0x7f}, + {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x0d, 0x76, 0x7f}, + {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x0d, 0x76, 0x7f}, + {0x08, 0x41, 0x6a, 0x73, 0x44, 0x0d, 0x76, 0x7f}, + {0x08, 0x41, 0x6a, 0x73, 0x44, 0x0d, 0x76, 0x7f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x76, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x76, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x0d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f} + }, + { + {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x15, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x4c, 0x15, 0x66, 0x5f}, + {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x15, 0x66, 0x5f}, + {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x15, 0x66, 0x5f}, + {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x15, 0x66, 0x7f}, + {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x15, 0x66, 0x7f}, + {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x15, 0x76, 0x7f}, + {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x15, 0x76, 0x7f}, + {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x1d, 0x76, 0x7f}, + {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x1d, 0x76, 0x7f}, + {0x08, 0x41, 0x6a, 0x73, 0x44, 0x1d, 0x76, 0x7f}, + {0x08, 0x41, 0x6a, 0x73, 0x44, 0x1d, 0x76, 0x7f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x1d, 0x76, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x1d, 0x76, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x1d, 0x56, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x1d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f} + }, + { + {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x15, 0x66, 0x5f}, + {0x00, 0x49, 0x5a, 0x63, 0x6c, 0x15, 0x66, 0x5f}, + {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x15, 0x66, 0x5f}, + {0x00, 0x49, 0x7a, 0x63, 0x4c, 0x15, 0x66, 0x5f}, + {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x15, 0x66, 0x7f}, + {0x00, 0x49, 0x7a, 0x73, 0x4c, 0x15, 0x66, 0x7f}, + {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x15, 0x76, 0x7f}, + {0x08, 0x49, 0x7a, 0x73, 0x4c, 0x15, 0x76, 0x7f}, + {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x1d, 0x76, 0x7f}, + {0x08, 0x41, 0x7a, 0x73, 0x4c, 0x1d, 0x76, 0x7f}, + {0x08, 0x41, 0x6a, 0x73, 0x44, 0x1d, 0x76, 0x7f}, + {0x08, 0x41, 0x6a, 0x73, 0x44, 0x1d, 0x76, 0x7f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x1d, 0x76, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x1d, 0x76, 0x6f}, + {0x08, 0x41, 0x6a, 0x53, 0x44, 0x1d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x1d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x44, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f} + }, + { + {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x10, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x10, 0x49, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x10, 0x49, 0x5a, 0x63, 0x6c, 0x15, 0x66, 0x5f}, + {0x10, 0x49, 0x5a, 0x63, 0x6c, 0x15, 0x66, 0x5f}, + {0x10, 0x49, 0x7a, 0x63, 0x2c, 0x15, 0x66, 0x5f}, + {0x10, 0x49, 0x7a, 0x63, 0x2c, 0x15, 0x66, 0x5f}, + {0x10, 0x49, 0x7a, 0x73, 0x2c, 0x15, 0x66, 0x7f}, + {0x10, 0x49, 0x7a, 0x73, 0x2c, 0x15, 0x66, 0x7f}, + {0x18, 0x49, 0x7a, 0x73, 0x2c, 0x15, 0x76, 0x7f}, + {0x18, 0x49, 0x7a, 0x73, 0x2c, 0x15, 0x76, 0x7f}, + {0x18, 0x41, 0x7a, 0x73, 0x2c, 0x1d, 0x76, 0x7f}, + {0x18, 0x41, 0x7a, 0x73, 0x2c, 0x1d, 0x76, 0x7f}, + {0x18, 0x41, 0x6a, 0x73, 0x24, 0x1d, 0x76, 0x7f}, + {0x18, 0x41, 0x6a, 0x73, 0x24, 0x1d, 0x76, 0x7f}, + {0x18, 0x41, 0x6a, 0x53, 0x24, 0x1d, 0x76, 0x6f}, + {0x18, 0x41, 0x6a, 0x53, 0x24, 0x1d, 0x76, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x24, 0x1d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x24, 0x1d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x24, 0x5d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x24, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f} + }, + { + {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f}, + {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x10, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x10, 0x69, 0x5a, 0x63, 0x6c, 0x55, 0x66, 0x5f}, + {0x10, 0x49, 0x5a, 0x63, 0x6c, 0x15, 0x66, 0x5f}, + {0x10, 0x49, 0x5a, 0x63, 0x6c, 0x15, 0x66, 0x5f}, + {0x10, 0x49, 0x7a, 0x63, 0x2c, 0x15, 0x66, 0x5f}, + {0x10, 0x49, 0x7a, 0x63, 0x2c, 0x15, 0x66, 0x5f}, + {0x10, 0x49, 0x7a, 0x73, 0x2c, 0x15, 0x66, 0x7f}, + {0x10, 0x49, 0x7a, 0x73, 0x2c, 0x15, 0x66, 0x7f}, + {0x18, 0x49, 0x7a, 0x73, 0x2c, 0x15, 0x76, 0x7f}, + {0x18, 0x49, 0x7a, 0x73, 0x2c, 0x15, 0x76, 0x7f}, + {0x18, 0x41, 0x7a, 0x73, 0x2c, 0x1d, 0x76, 0x7f}, + {0x18, 0x41, 0x7a, 0x73, 0x2c, 0x1d, 0x76, 0x7f}, + {0x18, 0x41, 0x6a, 0x73, 0x24, 0x1d, 0x76, 0x7f}, + {0x18, 0x41, 0x6a, 0x73, 0x24, 0x1d, 0x76, 0x7f}, + {0x18, 0x41, 0x6a, 0x53, 0x24, 0x1d, 0x76, 0x6f}, + {0x18, 0x41, 0x6a, 0x53, 0x24, 0x1d, 0x76, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x24, 0x1d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x24, 0x1d, 0x56, 0x6f}, + {0x58, 0x41, 0x6a, 0x53, 0x24, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x24, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x53, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f} + }, + { + {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f}, + {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f}, + {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x5a, 0x23, 0x6c, 0x55, 0x66, 0x5f}, + {0x50, 0x69, 0x5a, 0x23, 0x6c, 0x55, 0x66, 0x5f}, + {0x10, 0x69, 0x5a, 0x23, 0x6c, 0x55, 0x66, 0x5f}, + {0x10, 0x69, 0x5a, 0x23, 0x6c, 0x55, 0x66, 0x5f}, + {0x10, 0x29, 0x5a, 0x23, 0x6c, 0x15, 0x66, 0x5f}, + {0x10, 0x29, 0x5a, 0x23, 0x6c, 0x15, 0x66, 0x5f}, + {0x10, 0x29, 0x7a, 0x23, 0x2c, 0x15, 0x66, 0x5f}, + {0x10, 0x29, 0x7a, 0x23, 0x2c, 0x15, 0x66, 0x5f}, + {0x10, 0x29, 0x7a, 0x33, 0x2c, 0x15, 0x66, 0x7f}, + {0x10, 0x29, 0x7a, 0x33, 0x2c, 0x15, 0x66, 0x7f}, + {0x18, 0x29, 0x7a, 0x33, 0x2c, 0x15, 0x76, 0x7f}, + {0x18, 0x29, 0x7a, 0x33, 0x2c, 0x15, 0x76, 0x7f}, + {0x18, 0x21, 0x7a, 0x33, 0x2c, 0x1d, 0x76, 0x7f}, + {0x18, 0x21, 0x7a, 0x33, 0x2c, 0x1d, 0x76, 0x7f}, + {0x18, 0x21, 0x6a, 0x33, 0x24, 0x1d, 0x76, 0x7f}, + {0x18, 0x21, 0x6a, 0x33, 0x24, 0x1d, 0x76, 0x7f}, + {0x18, 0x21, 0x6a, 0x13, 0x24, 0x1d, 0x76, 0x6f}, + {0x18, 0x21, 0x6a, 0x13, 0x24, 0x1d, 0x76, 0x6f}, + {0x58, 0x21, 0x6a, 0x13, 0x24, 0x1d, 0x56, 0x6f}, + {0x58, 0x21, 0x6a, 0x13, 0x24, 0x1d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x13, 0x24, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x13, 0x24, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x13, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x13, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f} + }, + { + {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f}, + {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f}, + {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f}, + {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x5a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x5a, 0x23, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x5a, 0x23, 0x6c, 0x55, 0x66, 0x5f}, + {0x10, 0x69, 0x5a, 0x23, 0x6c, 0x55, 0x66, 0x5f}, + {0x10, 0x69, 0x5a, 0x23, 0x6c, 0x55, 0x66, 0x5f}, + {0x10, 0x29, 0x5a, 0x23, 0x6c, 0x15, 0x66, 0x5f}, + {0x10, 0x29, 0x5a, 0x23, 0x6c, 0x15, 0x66, 0x5f}, + {0x10, 0x29, 0x7a, 0x23, 0x2c, 0x15, 0x66, 0x5f}, + {0x10, 0x29, 0x7a, 0x23, 0x2c, 0x15, 0x66, 0x5f}, + {0x10, 0x29, 0x7a, 0x33, 0x2c, 0x15, 0x66, 0x7f}, + {0x10, 0x29, 0x7a, 0x33, 0x2c, 0x15, 0x66, 0x7f}, + {0x18, 0x29, 0x7a, 0x33, 0x2c, 0x15, 0x76, 0x7f}, + {0x18, 0x29, 0x7a, 0x33, 0x2c, 0x15, 0x76, 0x7f}, + {0x18, 0x21, 0x7a, 0x33, 0x2c, 0x1d, 0x76, 0x7f}, + {0x18, 0x21, 0x7a, 0x33, 0x2c, 0x1d, 0x76, 0x7f}, + {0x18, 0x21, 0x6a, 0x33, 0x24, 0x1d, 0x76, 0x7f}, + {0x18, 0x21, 0x6a, 0x33, 0x24, 0x1d, 0x76, 0x7f}, + {0x18, 0x21, 0x6a, 0x13, 0x24, 0x1d, 0x76, 0x6f}, + {0x18, 0x21, 0x6a, 0x13, 0x24, 0x1d, 0x76, 0x6f}, + {0x58, 0x21, 0x6a, 0x13, 0x24, 0x1d, 0x56, 0x6f}, + {0x58, 0x21, 0x6a, 0x13, 0x24, 0x1d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x13, 0x24, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x13, 0x24, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x6a, 0x13, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x13, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x56, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f} + }, + { + {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f}, + {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f}, + {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f}, + {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f}, + {0x50, 0x69, 0x1a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x1a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x1a, 0x23, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x1a, 0x23, 0x6c, 0x55, 0x46, 0x5f}, + {0x10, 0x69, 0x1a, 0x23, 0x6c, 0x55, 0x26, 0x5f}, + {0x10, 0x69, 0x1a, 0x23, 0x6c, 0x55, 0x26, 0x5f}, + {0x10, 0x29, 0x1a, 0x23, 0x6c, 0x15, 0x26, 0x5f}, + {0x10, 0x29, 0x1a, 0x23, 0x6c, 0x15, 0x26, 0x5f}, + {0x10, 0x29, 0x3a, 0x23, 0x2c, 0x15, 0x26, 0x5f}, + {0x10, 0x29, 0x3a, 0x23, 0x2c, 0x15, 0x26, 0x5f}, + {0x10, 0x29, 0x3a, 0x33, 0x2c, 0x15, 0x26, 0x7f}, + {0x10, 0x29, 0x3a, 0x33, 0x2c, 0x15, 0x26, 0x7f}, + {0x18, 0x29, 0x3a, 0x33, 0x2c, 0x15, 0x36, 0x7f}, + {0x18, 0x29, 0x3a, 0x33, 0x2c, 0x15, 0x36, 0x7f}, + {0x18, 0x21, 0x3a, 0x33, 0x2c, 0x1d, 0x36, 0x7f}, + {0x18, 0x21, 0x3a, 0x33, 0x2c, 0x1d, 0x36, 0x7f}, + {0x18, 0x21, 0x2a, 0x33, 0x24, 0x1d, 0x36, 0x7f}, + {0x18, 0x21, 0x2a, 0x33, 0x24, 0x1d, 0x36, 0x7f}, + {0x18, 0x21, 0x2a, 0x13, 0x24, 0x1d, 0x36, 0x6f}, + {0x18, 0x21, 0x2a, 0x13, 0x24, 0x1d, 0x36, 0x6f}, + {0x58, 0x21, 0x2a, 0x13, 0x24, 0x1d, 0x16, 0x6f}, + {0x58, 0x21, 0x2a, 0x13, 0x24, 0x1d, 0x16, 0x6f}, + {0x58, 0x61, 0x2a, 0x13, 0x24, 0x5d, 0x16, 0x6f}, + {0x58, 0x61, 0x2a, 0x13, 0x24, 0x5d, 0x16, 0x6f}, + {0x58, 0x61, 0x4a, 0x13, 0x64, 0x5d, 0x16, 0x6f}, + {0x58, 0x61, 0x4a, 0x13, 0x64, 0x5d, 0x16, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x16, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x16, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f} + }, + { + {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f}, + {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f}, + {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f}, + {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x55, 0x46, 0x0f}, + {0x50, 0x69, 0x1a, 0x43, 0x6c, 0x55, 0x46, 0x0f}, + {0x50, 0x69, 0x1a, 0x43, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x1a, 0x23, 0x6c, 0x55, 0x46, 0x5f}, + {0x50, 0x69, 0x1a, 0x23, 0x6c, 0x55, 0x46, 0x5f}, + {0x10, 0x69, 0x1a, 0x23, 0x6c, 0x55, 0x26, 0x5f}, + {0x10, 0x69, 0x1a, 0x23, 0x6c, 0x55, 0x26, 0x5f}, + {0x10, 0x29, 0x1a, 0x23, 0x6c, 0x15, 0x26, 0x5f}, + {0x10, 0x29, 0x1a, 0x23, 0x6c, 0x15, 0x26, 0x5f}, + {0x10, 0x29, 0x3a, 0x23, 0x2c, 0x15, 0x26, 0x5f}, + {0x10, 0x29, 0x3a, 0x23, 0x2c, 0x15, 0x26, 0x5f}, + {0x10, 0x29, 0x3a, 0x33, 0x2c, 0x15, 0x26, 0x7f}, + {0x10, 0x29, 0x3a, 0x33, 0x2c, 0x15, 0x26, 0x7f}, + {0x18, 0x29, 0x3a, 0x33, 0x2c, 0x15, 0x36, 0x7f}, + {0x18, 0x29, 0x3a, 0x33, 0x2c, 0x15, 0x36, 0x7f}, + {0x18, 0x21, 0x3a, 0x33, 0x2c, 0x1d, 0x36, 0x7f}, + {0x18, 0x21, 0x3a, 0x33, 0x2c, 0x1d, 0x36, 0x7f}, + {0x18, 0x21, 0x2a, 0x33, 0x24, 0x1d, 0x36, 0x7f}, + {0x18, 0x21, 0x2a, 0x33, 0x24, 0x1d, 0x36, 0x7f}, + {0x18, 0x21, 0x2a, 0x13, 0x24, 0x1d, 0x36, 0x6f}, + {0x18, 0x21, 0x2a, 0x13, 0x24, 0x1d, 0x36, 0x6f}, + {0x58, 0x21, 0x2a, 0x13, 0x24, 0x1d, 0x16, 0x6f}, + {0x58, 0x21, 0x2a, 0x13, 0x24, 0x1d, 0x16, 0x6f}, + {0x58, 0x61, 0x2a, 0x13, 0x24, 0x5d, 0x16, 0x6f}, + {0x58, 0x61, 0x2a, 0x13, 0x24, 0x5d, 0x16, 0x6f}, + {0x58, 0x61, 0x4a, 0x13, 0x64, 0x5d, 0x16, 0x6f}, + {0x58, 0x61, 0x4a, 0x13, 0x64, 0x5d, 0x16, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x16, 0x6f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x16, 0x4f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x5d, 0x06, 0x4f} + }, + { + {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x75, 0x46, 0x0f}, + {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x75, 0x46, 0x0f}, + {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x75, 0x46, 0x0f}, + {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x75, 0x46, 0x0f}, + {0x50, 0x69, 0x1a, 0x43, 0x6c, 0x75, 0x46, 0x0f}, + {0x50, 0x69, 0x1a, 0x43, 0x6c, 0x75, 0x46, 0x0f}, + {0x50, 0x69, 0x1a, 0x23, 0x6c, 0x75, 0x46, 0x1f}, + {0x50, 0x69, 0x1a, 0x23, 0x6c, 0x75, 0x46, 0x1f}, + {0x10, 0x69, 0x1a, 0x23, 0x6c, 0x75, 0x26, 0x1f}, + {0x10, 0x69, 0x1a, 0x23, 0x6c, 0x75, 0x26, 0x1f}, + {0x10, 0x29, 0x1a, 0x23, 0x6c, 0x35, 0x26, 0x1f}, + {0x10, 0x29, 0x1a, 0x23, 0x6c, 0x35, 0x26, 0x1f}, + {0x10, 0x29, 0x3a, 0x23, 0x2c, 0x35, 0x26, 0x1f}, + {0x10, 0x29, 0x3a, 0x23, 0x2c, 0x35, 0x26, 0x1f}, + {0x10, 0x29, 0x3a, 0x33, 0x2c, 0x35, 0x26, 0x3f}, + {0x10, 0x29, 0x3a, 0x33, 0x2c, 0x35, 0x26, 0x3f}, + {0x18, 0x29, 0x3a, 0x33, 0x2c, 0x35, 0x36, 0x3f}, + {0x18, 0x29, 0x3a, 0x33, 0x2c, 0x35, 0x36, 0x3f}, + {0x18, 0x21, 0x3a, 0x33, 0x2c, 0x3d, 0x36, 0x3f}, + {0x18, 0x21, 0x3a, 0x33, 0x2c, 0x3d, 0x36, 0x3f}, + {0x18, 0x21, 0x2a, 0x33, 0x24, 0x3d, 0x36, 0x3f}, + {0x18, 0x21, 0x2a, 0x33, 0x24, 0x3d, 0x36, 0x3f}, + {0x18, 0x21, 0x2a, 0x13, 0x24, 0x3d, 0x36, 0x2f}, + {0x18, 0x21, 0x2a, 0x13, 0x24, 0x3d, 0x36, 0x2f}, + {0x58, 0x21, 0x2a, 0x13, 0x24, 0x3d, 0x16, 0x2f}, + {0x58, 0x21, 0x2a, 0x13, 0x24, 0x3d, 0x16, 0x2f}, + {0x58, 0x61, 0x2a, 0x13, 0x24, 0x7d, 0x16, 0x2f}, + {0x58, 0x61, 0x2a, 0x13, 0x24, 0x7d, 0x16, 0x2f}, + {0x58, 0x61, 0x4a, 0x13, 0x64, 0x7d, 0x16, 0x2f}, + {0x58, 0x61, 0x4a, 0x13, 0x64, 0x7d, 0x16, 0x2f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x16, 0x4f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x16, 0x4f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x06, 0x4f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x06, 0x4f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x06, 0x4f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x06, 0x4f} + }, + { + {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x75, 0x46, 0x0f}, + {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x75, 0x46, 0x0f}, + {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x75, 0x46, 0x0f}, + {0x50, 0x69, 0x0a, 0x43, 0x6c, 0x75, 0x46, 0x0f}, + {0x50, 0x69, 0x1a, 0x43, 0x6c, 0x75, 0x46, 0x0f}, + {0x50, 0x69, 0x1a, 0x43, 0x6c, 0x75, 0x46, 0x0f}, + {0x50, 0x69, 0x1a, 0x23, 0x6c, 0x75, 0x46, 0x1f}, + {0x50, 0x69, 0x1a, 0x23, 0x6c, 0x75, 0x46, 0x1f}, + {0x10, 0x69, 0x1a, 0x23, 0x6c, 0x75, 0x26, 0x1f}, + {0x10, 0x69, 0x1a, 0x23, 0x6c, 0x75, 0x26, 0x1f}, + {0x10, 0x29, 0x1a, 0x23, 0x6c, 0x35, 0x26, 0x1f}, + {0x10, 0x29, 0x1a, 0x23, 0x6c, 0x35, 0x26, 0x1f}, + {0x10, 0x29, 0x3a, 0x23, 0x2c, 0x35, 0x26, 0x1f}, + {0x10, 0x29, 0x3a, 0x23, 0x2c, 0x35, 0x26, 0x1f}, + {0x10, 0x29, 0x3a, 0x33, 0x2c, 0x35, 0x26, 0x3f}, + {0x10, 0x29, 0x3a, 0x33, 0x2c, 0x35, 0x26, 0x3f}, + {0x18, 0x29, 0x3a, 0x33, 0x2c, 0x35, 0x36, 0x3f}, + {0x18, 0x29, 0x3a, 0x33, 0x2c, 0x35, 0x36, 0x3f}, + {0x18, 0x21, 0x3a, 0x33, 0x2c, 0x3d, 0x36, 0x3f}, + {0x18, 0x21, 0x3a, 0x33, 0x2c, 0x3d, 0x36, 0x3f}, + {0x18, 0x21, 0x2a, 0x33, 0x24, 0x3d, 0x36, 0x3f}, + {0x18, 0x21, 0x2a, 0x33, 0x24, 0x3d, 0x36, 0x3f}, + {0x18, 0x21, 0x2a, 0x13, 0x24, 0x3d, 0x36, 0x2f}, + {0x18, 0x21, 0x2a, 0x13, 0x24, 0x3d, 0x36, 0x2f}, + {0x58, 0x21, 0x2a, 0x13, 0x24, 0x3d, 0x16, 0x2f}, + {0x58, 0x21, 0x2a, 0x13, 0x24, 0x3d, 0x16, 0x2f}, + {0x58, 0x61, 0x2a, 0x13, 0x24, 0x7d, 0x16, 0x2f}, + {0x58, 0x61, 0x2a, 0x13, 0x24, 0x7d, 0x16, 0x2f}, + {0x58, 0x61, 0x4a, 0x13, 0x64, 0x7d, 0x16, 0x2f}, + {0x58, 0x61, 0x4a, 0x13, 0x64, 0x7d, 0x16, 0x2f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x16, 0x4f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x16, 0x4f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x06, 0x4f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x06, 0x4f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x06, 0x4f}, + {0x58, 0x61, 0x4a, 0x03, 0x64, 0x7d, 0x06, 0x4f} + }, + { + {0x70, 0x69, 0x0a, 0x43, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x69, 0x0a, 0x43, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x69, 0x0a, 0x43, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x69, 0x0a, 0x43, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x69, 0x1a, 0x43, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x69, 0x1a, 0x43, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x69, 0x1a, 0x23, 0x7c, 0x75, 0x46, 0x1f}, + {0x70, 0x69, 0x1a, 0x23, 0x7c, 0x75, 0x46, 0x1f}, + {0x30, 0x69, 0x1a, 0x23, 0x7c, 0x75, 0x26, 0x1f}, + {0x30, 0x69, 0x1a, 0x23, 0x7c, 0x75, 0x26, 0x1f}, + {0x30, 0x29, 0x1a, 0x23, 0x7c, 0x35, 0x26, 0x1f}, + {0x30, 0x29, 0x1a, 0x23, 0x7c, 0x35, 0x26, 0x1f}, + {0x30, 0x29, 0x3a, 0x23, 0x3c, 0x35, 0x26, 0x1f}, + {0x30, 0x29, 0x3a, 0x23, 0x3c, 0x35, 0x26, 0x1f}, + {0x30, 0x29, 0x3a, 0x33, 0x3c, 0x35, 0x26, 0x3f}, + {0x30, 0x29, 0x3a, 0x33, 0x3c, 0x35, 0x26, 0x3f}, + {0x38, 0x29, 0x3a, 0x33, 0x3c, 0x35, 0x36, 0x3f}, + {0x38, 0x29, 0x3a, 0x33, 0x3c, 0x35, 0x36, 0x3f}, + {0x38, 0x21, 0x3a, 0x33, 0x3c, 0x3d, 0x36, 0x3f}, + {0x38, 0x21, 0x3a, 0x33, 0x3c, 0x3d, 0x36, 0x3f}, + {0x38, 0x21, 0x2a, 0x33, 0x34, 0x3d, 0x36, 0x3f}, + {0x38, 0x21, 0x2a, 0x33, 0x34, 0x3d, 0x36, 0x3f}, + {0x38, 0x21, 0x2a, 0x13, 0x34, 0x3d, 0x36, 0x2f}, + {0x38, 0x21, 0x2a, 0x13, 0x34, 0x3d, 0x36, 0x2f}, + {0x78, 0x21, 0x2a, 0x13, 0x34, 0x3d, 0x16, 0x2f}, + {0x78, 0x21, 0x2a, 0x13, 0x34, 0x3d, 0x16, 0x2f}, + {0x78, 0x61, 0x2a, 0x13, 0x34, 0x7d, 0x16, 0x2f}, + {0x78, 0x61, 0x2a, 0x13, 0x34, 0x7d, 0x16, 0x2f}, + {0x78, 0x61, 0x4a, 0x13, 0x74, 0x7d, 0x16, 0x2f}, + {0x78, 0x61, 0x4a, 0x13, 0x74, 0x7d, 0x16, 0x2f}, + {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x16, 0x4f}, + {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x16, 0x4f}, + {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x06, 0x4f}, + {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x06, 0x4f}, + {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x06, 0x4f}, + {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x06, 0x4f} + }, + { + {0x70, 0x69, 0x0a, 0x43, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x69, 0x0a, 0x43, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x69, 0x0a, 0x43, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x69, 0x0a, 0x43, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x69, 0x1a, 0x43, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x69, 0x1a, 0x43, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x69, 0x1a, 0x23, 0x7c, 0x75, 0x46, 0x1f}, + {0x70, 0x69, 0x1a, 0x23, 0x7c, 0x75, 0x46, 0x1f}, + {0x30, 0x69, 0x1a, 0x23, 0x7c, 0x75, 0x26, 0x1f}, + {0x30, 0x69, 0x1a, 0x23, 0x7c, 0x75, 0x26, 0x1f}, + {0x30, 0x29, 0x1a, 0x23, 0x7c, 0x35, 0x26, 0x1f}, + {0x30, 0x29, 0x1a, 0x23, 0x7c, 0x35, 0x26, 0x1f}, + {0x30, 0x29, 0x3a, 0x23, 0x3c, 0x35, 0x26, 0x1f}, + {0x30, 0x29, 0x3a, 0x23, 0x3c, 0x35, 0x26, 0x1f}, + {0x30, 0x29, 0x3a, 0x33, 0x3c, 0x35, 0x26, 0x3f}, + {0x30, 0x29, 0x3a, 0x33, 0x3c, 0x35, 0x26, 0x3f}, + {0x38, 0x29, 0x3a, 0x33, 0x3c, 0x35, 0x36, 0x3f}, + {0x38, 0x29, 0x3a, 0x33, 0x3c, 0x35, 0x36, 0x3f}, + {0x38, 0x21, 0x3a, 0x33, 0x3c, 0x3d, 0x36, 0x3f}, + {0x38, 0x21, 0x3a, 0x33, 0x3c, 0x3d, 0x36, 0x3f}, + {0x38, 0x21, 0x2a, 0x33, 0x34, 0x3d, 0x36, 0x3f}, + {0x38, 0x21, 0x2a, 0x33, 0x34, 0x3d, 0x36, 0x3f}, + {0x38, 0x21, 0x2a, 0x13, 0x34, 0x3d, 0x36, 0x2f}, + {0x38, 0x21, 0x2a, 0x13, 0x34, 0x3d, 0x36, 0x2f}, + {0x78, 0x21, 0x2a, 0x13, 0x34, 0x3d, 0x16, 0x2f}, + {0x78, 0x21, 0x2a, 0x13, 0x34, 0x3d, 0x16, 0x2f}, + {0x78, 0x61, 0x2a, 0x13, 0x34, 0x7d, 0x16, 0x2f}, + {0x78, 0x61, 0x2a, 0x13, 0x34, 0x7d, 0x16, 0x2f}, + {0x78, 0x61, 0x4a, 0x13, 0x74, 0x7d, 0x16, 0x2f}, + {0x78, 0x61, 0x4a, 0x13, 0x74, 0x7d, 0x16, 0x2f}, + {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x16, 0x4f}, + {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x16, 0x4f}, + {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x06, 0x4f}, + {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x06, 0x4f}, + {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x06, 0x4f}, + {0x78, 0x61, 0x4a, 0x03, 0x74, 0x7d, 0x06, 0x4f} + }, + { + {0x70, 0x79, 0x0a, 0x4b, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x79, 0x0a, 0x4b, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x79, 0x0a, 0x4b, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x79, 0x0a, 0x4b, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x79, 0x1a, 0x4b, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x79, 0x1a, 0x4b, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x79, 0x1a, 0x2b, 0x7c, 0x75, 0x46, 0x1f}, + {0x70, 0x79, 0x1a, 0x2b, 0x7c, 0x75, 0x46, 0x1f}, + {0x30, 0x79, 0x1a, 0x2b, 0x7c, 0x75, 0x26, 0x1f}, + {0x30, 0x79, 0x1a, 0x2b, 0x7c, 0x75, 0x26, 0x1f}, + {0x30, 0x39, 0x1a, 0x2b, 0x7c, 0x35, 0x26, 0x1f}, + {0x30, 0x39, 0x1a, 0x2b, 0x7c, 0x35, 0x26, 0x1f}, + {0x30, 0x39, 0x3a, 0x2b, 0x3c, 0x35, 0x26, 0x1f}, + {0x30, 0x39, 0x3a, 0x2b, 0x3c, 0x35, 0x26, 0x1f}, + {0x30, 0x39, 0x3a, 0x3b, 0x3c, 0x35, 0x26, 0x3f}, + {0x30, 0x39, 0x3a, 0x3b, 0x3c, 0x35, 0x26, 0x3f}, + {0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x35, 0x36, 0x3f}, + {0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x35, 0x36, 0x3f}, + {0x38, 0x31, 0x3a, 0x3b, 0x3c, 0x3d, 0x36, 0x3f}, + {0x38, 0x31, 0x3a, 0x3b, 0x3c, 0x3d, 0x36, 0x3f}, + {0x38, 0x31, 0x2a, 0x3b, 0x34, 0x3d, 0x36, 0x3f}, + {0x38, 0x31, 0x2a, 0x3b, 0x34, 0x3d, 0x36, 0x3f}, + {0x38, 0x31, 0x2a, 0x1b, 0x34, 0x3d, 0x36, 0x2f}, + {0x38, 0x31, 0x2a, 0x1b, 0x34, 0x3d, 0x36, 0x2f}, + {0x78, 0x31, 0x2a, 0x1b, 0x34, 0x3d, 0x16, 0x2f}, + {0x78, 0x31, 0x2a, 0x1b, 0x34, 0x3d, 0x16, 0x2f}, + {0x78, 0x71, 0x2a, 0x1b, 0x34, 0x7d, 0x16, 0x2f}, + {0x78, 0x71, 0x2a, 0x1b, 0x34, 0x7d, 0x16, 0x2f}, + {0x78, 0x71, 0x4a, 0x1b, 0x74, 0x7d, 0x16, 0x2f}, + {0x78, 0x71, 0x4a, 0x1b, 0x74, 0x7d, 0x16, 0x2f}, + {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x16, 0x4f}, + {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x16, 0x4f}, + {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x06, 0x4f}, + {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x06, 0x4f}, + {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x06, 0x4f}, + {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x06, 0x4f} + }, + { + {0x70, 0x79, 0x0a, 0x4b, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x79, 0x0a, 0x4b, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x79, 0x0a, 0x4b, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x79, 0x0a, 0x4b, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x79, 0x1a, 0x4b, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x79, 0x1a, 0x4b, 0x7c, 0x75, 0x46, 0x0f}, + {0x70, 0x79, 0x1a, 0x2b, 0x7c, 0x75, 0x46, 0x1f}, + {0x70, 0x79, 0x1a, 0x2b, 0x7c, 0x75, 0x46, 0x1f}, + {0x30, 0x79, 0x1a, 0x2b, 0x7c, 0x75, 0x26, 0x1f}, + {0x30, 0x79, 0x1a, 0x2b, 0x7c, 0x75, 0x26, 0x1f}, + {0x30, 0x39, 0x1a, 0x2b, 0x7c, 0x35, 0x26, 0x1f}, + {0x30, 0x39, 0x1a, 0x2b, 0x7c, 0x35, 0x26, 0x1f}, + {0x30, 0x39, 0x3a, 0x2b, 0x3c, 0x35, 0x26, 0x1f}, + {0x30, 0x39, 0x3a, 0x2b, 0x3c, 0x35, 0x26, 0x1f}, + {0x30, 0x39, 0x3a, 0x3b, 0x3c, 0x35, 0x26, 0x3f}, + {0x30, 0x39, 0x3a, 0x3b, 0x3c, 0x35, 0x26, 0x3f}, + {0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x35, 0x36, 0x3f}, + {0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x35, 0x36, 0x3f}, + {0x38, 0x31, 0x3a, 0x3b, 0x3c, 0x3d, 0x36, 0x3f}, + {0x38, 0x31, 0x3a, 0x3b, 0x3c, 0x3d, 0x36, 0x3f}, + {0x38, 0x31, 0x2a, 0x3b, 0x34, 0x3d, 0x36, 0x3f}, + {0x38, 0x31, 0x2a, 0x3b, 0x34, 0x3d, 0x36, 0x3f}, + {0x38, 0x31, 0x2a, 0x1b, 0x34, 0x3d, 0x36, 0x2f}, + {0x38, 0x31, 0x2a, 0x1b, 0x34, 0x3d, 0x36, 0x2f}, + {0x78, 0x31, 0x2a, 0x1b, 0x34, 0x3d, 0x16, 0x2f}, + {0x78, 0x31, 0x2a, 0x1b, 0x34, 0x3d, 0x16, 0x2f}, + {0x78, 0x71, 0x2a, 0x1b, 0x34, 0x7d, 0x16, 0x2f}, + {0x78, 0x71, 0x2a, 0x1b, 0x34, 0x7d, 0x16, 0x2f}, + {0x78, 0x71, 0x4a, 0x1b, 0x74, 0x7d, 0x16, 0x2f}, + {0x78, 0x71, 0x4a, 0x1b, 0x74, 0x7d, 0x16, 0x2f}, + {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x16, 0x4f}, + {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x16, 0x4f}, + {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x06, 0x4f}, + {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x06, 0x4f}, + {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x06, 0x4f}, + {0x78, 0x71, 0x4a, 0x0b, 0x74, 0x7d, 0x06, 0x4f} + }, + { + {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x75, 0x4e, 0x0f}, + {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x75, 0x4e, 0x0f}, + {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x75, 0x4e, 0x0f}, + {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x75, 0x4e, 0x0f}, + {0x70, 0x79, 0x12, 0x4b, 0x7c, 0x75, 0x4e, 0x0f}, + {0x70, 0x79, 0x12, 0x4b, 0x7c, 0x75, 0x4e, 0x0f}, + {0x70, 0x79, 0x12, 0x2b, 0x7c, 0x75, 0x4e, 0x1f}, + {0x70, 0x79, 0x12, 0x2b, 0x7c, 0x75, 0x4e, 0x1f}, + {0x30, 0x79, 0x12, 0x2b, 0x7c, 0x75, 0x2e, 0x1f}, + {0x30, 0x79, 0x12, 0x2b, 0x7c, 0x75, 0x2e, 0x1f}, + {0x30, 0x39, 0x12, 0x2b, 0x7c, 0x35, 0x2e, 0x1f}, + {0x30, 0x39, 0x12, 0x2b, 0x7c, 0x35, 0x2e, 0x1f}, + {0x30, 0x39, 0x32, 0x2b, 0x3c, 0x35, 0x2e, 0x1f}, + {0x30, 0x39, 0x32, 0x2b, 0x3c, 0x35, 0x2e, 0x1f}, + {0x30, 0x39, 0x32, 0x3b, 0x3c, 0x35, 0x2e, 0x3f}, + {0x30, 0x39, 0x32, 0x3b, 0x3c, 0x35, 0x2e, 0x3f}, + {0x38, 0x39, 0x32, 0x3b, 0x3c, 0x35, 0x3e, 0x3f}, + {0x38, 0x39, 0x32, 0x3b, 0x3c, 0x35, 0x3e, 0x3f}, + {0x38, 0x31, 0x32, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f}, + {0x38, 0x31, 0x32, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f}, + {0x38, 0x31, 0x22, 0x3b, 0x34, 0x3d, 0x3e, 0x3f}, + {0x38, 0x31, 0x22, 0x3b, 0x34, 0x3d, 0x3e, 0x3f}, + {0x38, 0x31, 0x22, 0x1b, 0x34, 0x3d, 0x3e, 0x2f}, + {0x38, 0x31, 0x22, 0x1b, 0x34, 0x3d, 0x3e, 0x2f}, + {0x78, 0x31, 0x22, 0x1b, 0x34, 0x3d, 0x1e, 0x2f}, + {0x78, 0x31, 0x22, 0x1b, 0x34, 0x3d, 0x1e, 0x2f}, + {0x78, 0x71, 0x22, 0x1b, 0x34, 0x7d, 0x1e, 0x2f}, + {0x78, 0x71, 0x22, 0x1b, 0x34, 0x7d, 0x1e, 0x2f}, + {0x78, 0x71, 0x42, 0x1b, 0x74, 0x7d, 0x1e, 0x2f}, + {0x78, 0x71, 0x42, 0x1b, 0x74, 0x7d, 0x1e, 0x2f}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x1e, 0x4f}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x1e, 0x4f}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x0e, 0x4f}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x0e, 0x4f}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x0e, 0x4f}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x0e, 0x4f} + }, + { + {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x75, 0x4e, 0x0f}, + {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x75, 0x4e, 0x0f}, + {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x75, 0x4e, 0x0f}, + {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x75, 0x4e, 0x0f}, + {0x70, 0x79, 0x12, 0x4b, 0x7c, 0x75, 0x4e, 0x0f}, + {0x70, 0x79, 0x12, 0x4b, 0x7c, 0x75, 0x4e, 0x0f}, + {0x70, 0x79, 0x12, 0x2b, 0x7c, 0x75, 0x4e, 0x1f}, + {0x70, 0x79, 0x12, 0x2b, 0x7c, 0x75, 0x4e, 0x1f}, + {0x30, 0x79, 0x12, 0x2b, 0x7c, 0x75, 0x2e, 0x1f}, + {0x30, 0x79, 0x12, 0x2b, 0x7c, 0x75, 0x2e, 0x1f}, + {0x30, 0x39, 0x12, 0x2b, 0x7c, 0x35, 0x2e, 0x1f}, + {0x30, 0x39, 0x12, 0x2b, 0x7c, 0x35, 0x2e, 0x1f}, + {0x30, 0x39, 0x32, 0x2b, 0x3c, 0x35, 0x2e, 0x1f}, + {0x30, 0x39, 0x32, 0x2b, 0x3c, 0x35, 0x2e, 0x1f}, + {0x30, 0x39, 0x32, 0x3b, 0x3c, 0x35, 0x2e, 0x3f}, + {0x30, 0x39, 0x32, 0x3b, 0x3c, 0x35, 0x2e, 0x3f}, + {0x38, 0x39, 0x32, 0x3b, 0x3c, 0x35, 0x3e, 0x3f}, + {0x38, 0x39, 0x32, 0x3b, 0x3c, 0x35, 0x3e, 0x3f}, + {0x38, 0x31, 0x32, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f}, + {0x38, 0x31, 0x32, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f}, + {0x38, 0x31, 0x22, 0x3b, 0x34, 0x3d, 0x3e, 0x3f}, + {0x38, 0x31, 0x22, 0x3b, 0x34, 0x3d, 0x3e, 0x3f}, + {0x38, 0x31, 0x22, 0x1b, 0x34, 0x3d, 0x3e, 0x2f}, + {0x38, 0x31, 0x22, 0x1b, 0x34, 0x3d, 0x3e, 0x2f}, + {0x78, 0x31, 0x22, 0x1b, 0x34, 0x3d, 0x1e, 0x2f}, + {0x78, 0x31, 0x22, 0x1b, 0x34, 0x3d, 0x1e, 0x2f}, + {0x78, 0x71, 0x22, 0x1b, 0x34, 0x7d, 0x1e, 0x2f}, + {0x78, 0x71, 0x22, 0x1b, 0x34, 0x7d, 0x1e, 0x2f}, + {0x78, 0x71, 0x42, 0x1b, 0x74, 0x7d, 0x1e, 0x2f}, + {0x78, 0x71, 0x42, 0x1b, 0x74, 0x7d, 0x1e, 0x2f}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x1e, 0x4f}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x1e, 0x4f}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x0e, 0x4f}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x0e, 0x4f}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x0e, 0x4f}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x7d, 0x0e, 0x4f} + }, + { + {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x65, 0x4e, 0x07}, + {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x65, 0x4e, 0x07}, + {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x65, 0x4e, 0x07}, + {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x65, 0x4e, 0x07}, + {0x70, 0x79, 0x12, 0x4b, 0x7c, 0x65, 0x4e, 0x07}, + {0x70, 0x79, 0x12, 0x4b, 0x7c, 0x65, 0x4e, 0x07}, + {0x70, 0x79, 0x12, 0x2b, 0x7c, 0x65, 0x4e, 0x17}, + {0x70, 0x79, 0x12, 0x2b, 0x7c, 0x65, 0x4e, 0x17}, + {0x30, 0x79, 0x12, 0x2b, 0x7c, 0x65, 0x2e, 0x17}, + {0x30, 0x79, 0x12, 0x2b, 0x7c, 0x65, 0x2e, 0x17}, + {0x30, 0x39, 0x12, 0x2b, 0x7c, 0x25, 0x2e, 0x17}, + {0x30, 0x39, 0x12, 0x2b, 0x7c, 0x25, 0x2e, 0x17}, + {0x30, 0x39, 0x32, 0x2b, 0x3c, 0x25, 0x2e, 0x17}, + {0x30, 0x39, 0x32, 0x2b, 0x3c, 0x25, 0x2e, 0x17}, + {0x30, 0x39, 0x32, 0x3b, 0x3c, 0x25, 0x2e, 0x37}, + {0x30, 0x39, 0x32, 0x3b, 0x3c, 0x25, 0x2e, 0x37}, + {0x38, 0x39, 0x32, 0x3b, 0x3c, 0x25, 0x3e, 0x37}, + {0x38, 0x39, 0x32, 0x3b, 0x3c, 0x25, 0x3e, 0x37}, + {0x38, 0x31, 0x32, 0x3b, 0x3c, 0x2d, 0x3e, 0x37}, + {0x38, 0x31, 0x32, 0x3b, 0x3c, 0x2d, 0x3e, 0x37}, + {0x38, 0x31, 0x22, 0x3b, 0x34, 0x2d, 0x3e, 0x37}, + {0x38, 0x31, 0x22, 0x3b, 0x34, 0x2d, 0x3e, 0x37}, + {0x38, 0x31, 0x22, 0x1b, 0x34, 0x2d, 0x3e, 0x27}, + {0x38, 0x31, 0x22, 0x1b, 0x34, 0x2d, 0x3e, 0x27}, + {0x78, 0x31, 0x22, 0x1b, 0x34, 0x2d, 0x1e, 0x27}, + {0x78, 0x31, 0x22, 0x1b, 0x34, 0x2d, 0x1e, 0x27}, + {0x78, 0x71, 0x22, 0x1b, 0x34, 0x6d, 0x1e, 0x27}, + {0x78, 0x71, 0x22, 0x1b, 0x34, 0x6d, 0x1e, 0x27}, + {0x78, 0x71, 0x42, 0x1b, 0x74, 0x6d, 0x1e, 0x27}, + {0x78, 0x71, 0x42, 0x1b, 0x74, 0x6d, 0x1e, 0x27}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x1e, 0x47}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x1e, 0x47}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x0e, 0x47}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x0e, 0x47}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x0e, 0x47}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x0e, 0x47} + }, + { + {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x65, 0x4e, 0x07}, + {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x65, 0x4e, 0x07}, + {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x65, 0x4e, 0x07}, + {0x70, 0x79, 0x02, 0x4b, 0x7c, 0x65, 0x4e, 0x07}, + {0x70, 0x79, 0x12, 0x4b, 0x7c, 0x65, 0x4e, 0x07}, + {0x70, 0x79, 0x12, 0x4b, 0x7c, 0x65, 0x4e, 0x07}, + {0x70, 0x79, 0x12, 0x2b, 0x7c, 0x65, 0x4e, 0x17}, + {0x70, 0x79, 0x12, 0x2b, 0x7c, 0x65, 0x4e, 0x17}, + {0x30, 0x79, 0x12, 0x2b, 0x7c, 0x65, 0x2e, 0x17}, + {0x30, 0x79, 0x12, 0x2b, 0x7c, 0x65, 0x2e, 0x17}, + {0x30, 0x39, 0x12, 0x2b, 0x7c, 0x25, 0x2e, 0x17}, + {0x30, 0x39, 0x12, 0x2b, 0x7c, 0x25, 0x2e, 0x17}, + {0x30, 0x39, 0x32, 0x2b, 0x3c, 0x25, 0x2e, 0x17}, + {0x30, 0x39, 0x32, 0x2b, 0x3c, 0x25, 0x2e, 0x17}, + {0x30, 0x39, 0x32, 0x3b, 0x3c, 0x25, 0x2e, 0x37}, + {0x30, 0x39, 0x32, 0x3b, 0x3c, 0x25, 0x2e, 0x37}, + {0x38, 0x39, 0x32, 0x3b, 0x3c, 0x25, 0x3e, 0x37}, + {0x38, 0x39, 0x32, 0x3b, 0x3c, 0x25, 0x3e, 0x37}, + {0x38, 0x31, 0x32, 0x3b, 0x3c, 0x2d, 0x3e, 0x37}, + {0x38, 0x31, 0x32, 0x3b, 0x3c, 0x2d, 0x3e, 0x37}, + {0x38, 0x31, 0x22, 0x3b, 0x34, 0x2d, 0x3e, 0x37}, + {0x38, 0x31, 0x22, 0x3b, 0x34, 0x2d, 0x3e, 0x37}, + {0x38, 0x31, 0x22, 0x1b, 0x34, 0x2d, 0x3e, 0x27}, + {0x38, 0x31, 0x22, 0x1b, 0x34, 0x2d, 0x3e, 0x27}, + {0x78, 0x31, 0x22, 0x1b, 0x34, 0x2d, 0x1e, 0x27}, + {0x78, 0x31, 0x22, 0x1b, 0x34, 0x2d, 0x1e, 0x27}, + {0x78, 0x71, 0x22, 0x1b, 0x34, 0x6d, 0x1e, 0x27}, + {0x78, 0x71, 0x22, 0x1b, 0x34, 0x6d, 0x1e, 0x27}, + {0x78, 0x71, 0x42, 0x1b, 0x74, 0x6d, 0x1e, 0x27}, + {0x78, 0x71, 0x42, 0x1b, 0x74, 0x6d, 0x1e, 0x27}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x1e, 0x47}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x1e, 0x47}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x0e, 0x47}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x0e, 0x47}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x0e, 0x47}, + {0x78, 0x71, 0x42, 0x0b, 0x74, 0x6d, 0x0e, 0x47} + }, + { + {0x60, 0x79, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x79, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x79, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x79, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x79, 0x12, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x79, 0x12, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x79, 0x12, 0x2b, 0x5c, 0x65, 0x4e, 0x17}, + {0x60, 0x79, 0x12, 0x2b, 0x5c, 0x65, 0x4e, 0x17}, + {0x20, 0x79, 0x12, 0x2b, 0x5c, 0x65, 0x2e, 0x17}, + {0x20, 0x79, 0x12, 0x2b, 0x5c, 0x65, 0x2e, 0x17}, + {0x20, 0x39, 0x12, 0x2b, 0x5c, 0x25, 0x2e, 0x17}, + {0x20, 0x39, 0x12, 0x2b, 0x5c, 0x25, 0x2e, 0x17}, + {0x20, 0x39, 0x32, 0x2b, 0x1c, 0x25, 0x2e, 0x17}, + {0x20, 0x39, 0x32, 0x2b, 0x1c, 0x25, 0x2e, 0x17}, + {0x20, 0x39, 0x32, 0x3b, 0x1c, 0x25, 0x2e, 0x37}, + {0x20, 0x39, 0x32, 0x3b, 0x1c, 0x25, 0x2e, 0x37}, + {0x28, 0x39, 0x32, 0x3b, 0x1c, 0x25, 0x3e, 0x37}, + {0x28, 0x39, 0x32, 0x3b, 0x1c, 0x25, 0x3e, 0x37}, + {0x28, 0x31, 0x32, 0x3b, 0x1c, 0x2d, 0x3e, 0x37}, + {0x28, 0x31, 0x32, 0x3b, 0x1c, 0x2d, 0x3e, 0x37}, + {0x28, 0x31, 0x22, 0x3b, 0x14, 0x2d, 0x3e, 0x37}, + {0x28, 0x31, 0x22, 0x3b, 0x14, 0x2d, 0x3e, 0x37}, + {0x28, 0x31, 0x22, 0x1b, 0x14, 0x2d, 0x3e, 0x27}, + {0x28, 0x31, 0x22, 0x1b, 0x14, 0x2d, 0x3e, 0x27}, + {0x68, 0x31, 0x22, 0x1b, 0x14, 0x2d, 0x1e, 0x27}, + {0x68, 0x31, 0x22, 0x1b, 0x14, 0x2d, 0x1e, 0x27}, + {0x68, 0x71, 0x22, 0x1b, 0x14, 0x6d, 0x1e, 0x27}, + {0x68, 0x71, 0x22, 0x1b, 0x14, 0x6d, 0x1e, 0x27}, + {0x68, 0x71, 0x42, 0x1b, 0x54, 0x6d, 0x1e, 0x27}, + {0x68, 0x71, 0x42, 0x1b, 0x54, 0x6d, 0x1e, 0x27}, + {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x1e, 0x47}, + {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x1e, 0x47}, + {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}, + {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}, + {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}, + {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47} + }, + { + {0x60, 0x79, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x79, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x79, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x79, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x79, 0x12, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x79, 0x12, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x79, 0x12, 0x2b, 0x5c, 0x65, 0x4e, 0x17}, + {0x60, 0x79, 0x12, 0x2b, 0x5c, 0x65, 0x4e, 0x17}, + {0x20, 0x79, 0x12, 0x2b, 0x5c, 0x65, 0x2e, 0x17}, + {0x20, 0x79, 0x12, 0x2b, 0x5c, 0x65, 0x2e, 0x17}, + {0x20, 0x39, 0x12, 0x2b, 0x5c, 0x25, 0x2e, 0x17}, + {0x20, 0x39, 0x12, 0x2b, 0x5c, 0x25, 0x2e, 0x17}, + {0x20, 0x39, 0x32, 0x2b, 0x1c, 0x25, 0x2e, 0x17}, + {0x20, 0x39, 0x32, 0x2b, 0x1c, 0x25, 0x2e, 0x17}, + {0x20, 0x39, 0x32, 0x3b, 0x1c, 0x25, 0x2e, 0x37}, + {0x20, 0x39, 0x32, 0x3b, 0x1c, 0x25, 0x2e, 0x37}, + {0x28, 0x39, 0x32, 0x3b, 0x1c, 0x25, 0x3e, 0x37}, + {0x28, 0x39, 0x32, 0x3b, 0x1c, 0x25, 0x3e, 0x37}, + {0x28, 0x31, 0x32, 0x3b, 0x1c, 0x2d, 0x3e, 0x37}, + {0x28, 0x31, 0x32, 0x3b, 0x1c, 0x2d, 0x3e, 0x37}, + {0x28, 0x31, 0x22, 0x3b, 0x14, 0x2d, 0x3e, 0x37}, + {0x28, 0x31, 0x22, 0x3b, 0x14, 0x2d, 0x3e, 0x37}, + {0x28, 0x31, 0x22, 0x1b, 0x14, 0x2d, 0x3e, 0x27}, + {0x28, 0x31, 0x22, 0x1b, 0x14, 0x2d, 0x3e, 0x27}, + {0x68, 0x31, 0x22, 0x1b, 0x14, 0x2d, 0x1e, 0x27}, + {0x68, 0x31, 0x22, 0x1b, 0x14, 0x2d, 0x1e, 0x27}, + {0x68, 0x71, 0x22, 0x1b, 0x14, 0x6d, 0x1e, 0x27}, + {0x68, 0x71, 0x22, 0x1b, 0x14, 0x6d, 0x1e, 0x27}, + {0x68, 0x71, 0x42, 0x1b, 0x54, 0x6d, 0x1e, 0x27}, + {0x68, 0x71, 0x42, 0x1b, 0x54, 0x6d, 0x1e, 0x27}, + {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x1e, 0x47}, + {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x1e, 0x47}, + {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}, + {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}, + {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}, + {0x68, 0x71, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47} + }, + { + {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x12, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x12, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x12, 0x6b, 0x5c, 0x65, 0x4e, 0x17}, + {0x60, 0x59, 0x12, 0x6b, 0x5c, 0x65, 0x4e, 0x17}, + {0x20, 0x59, 0x12, 0x6b, 0x5c, 0x65, 0x2e, 0x17}, + {0x20, 0x59, 0x12, 0x6b, 0x5c, 0x65, 0x2e, 0x17}, + {0x20, 0x19, 0x12, 0x6b, 0x5c, 0x25, 0x2e, 0x17}, + {0x20, 0x19, 0x12, 0x6b, 0x5c, 0x25, 0x2e, 0x17}, + {0x20, 0x19, 0x32, 0x6b, 0x1c, 0x25, 0x2e, 0x17}, + {0x20, 0x19, 0x32, 0x6b, 0x1c, 0x25, 0x2e, 0x17}, + {0x20, 0x19, 0x32, 0x7b, 0x1c, 0x25, 0x2e, 0x37}, + {0x20, 0x19, 0x32, 0x7b, 0x1c, 0x25, 0x2e, 0x37}, + {0x28, 0x19, 0x32, 0x7b, 0x1c, 0x25, 0x3e, 0x37}, + {0x28, 0x19, 0x32, 0x7b, 0x1c, 0x25, 0x3e, 0x37}, + {0x28, 0x11, 0x32, 0x7b, 0x1c, 0x2d, 0x3e, 0x37}, + {0x28, 0x11, 0x32, 0x7b, 0x1c, 0x2d, 0x3e, 0x37}, + {0x28, 0x11, 0x22, 0x7b, 0x14, 0x2d, 0x3e, 0x37}, + {0x28, 0x11, 0x22, 0x7b, 0x14, 0x2d, 0x3e, 0x37}, + {0x28, 0x11, 0x22, 0x5b, 0x14, 0x2d, 0x3e, 0x27}, + {0x28, 0x11, 0x22, 0x5b, 0x14, 0x2d, 0x3e, 0x27}, + {0x68, 0x11, 0x22, 0x5b, 0x14, 0x2d, 0x1e, 0x27}, + {0x68, 0x11, 0x22, 0x5b, 0x14, 0x2d, 0x1e, 0x27}, + {0x68, 0x51, 0x22, 0x5b, 0x14, 0x6d, 0x1e, 0x27}, + {0x68, 0x51, 0x22, 0x5b, 0x14, 0x6d, 0x1e, 0x27}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x1e, 0x27}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x1e, 0x27}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x1e, 0x47}, + {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x1e, 0x47}, + {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}, + {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}, + {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}, + {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47} + }, + { + {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x12, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x12, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x12, 0x6b, 0x5c, 0x65, 0x4e, 0x17}, + {0x60, 0x59, 0x12, 0x6b, 0x5c, 0x65, 0x4e, 0x17}, + {0x20, 0x59, 0x12, 0x6b, 0x5c, 0x65, 0x2e, 0x17}, + {0x20, 0x59, 0x12, 0x6b, 0x5c, 0x65, 0x2e, 0x17}, + {0x20, 0x19, 0x12, 0x6b, 0x5c, 0x25, 0x2e, 0x17}, + {0x20, 0x19, 0x12, 0x6b, 0x5c, 0x25, 0x2e, 0x17}, + {0x20, 0x19, 0x32, 0x6b, 0x1c, 0x25, 0x2e, 0x17}, + {0x20, 0x19, 0x32, 0x6b, 0x1c, 0x25, 0x2e, 0x17}, + {0x20, 0x19, 0x32, 0x7b, 0x1c, 0x25, 0x2e, 0x37}, + {0x20, 0x19, 0x32, 0x7b, 0x1c, 0x25, 0x2e, 0x37}, + {0x28, 0x19, 0x32, 0x7b, 0x1c, 0x25, 0x3e, 0x37}, + {0x28, 0x19, 0x32, 0x7b, 0x1c, 0x25, 0x3e, 0x37}, + {0x28, 0x11, 0x32, 0x7b, 0x1c, 0x2d, 0x3e, 0x37}, + {0x28, 0x11, 0x32, 0x7b, 0x1c, 0x2d, 0x3e, 0x37}, + {0x28, 0x11, 0x22, 0x7b, 0x14, 0x2d, 0x3e, 0x37}, + {0x28, 0x11, 0x22, 0x7b, 0x14, 0x2d, 0x3e, 0x37}, + {0x28, 0x11, 0x22, 0x5b, 0x14, 0x2d, 0x3e, 0x27}, + {0x28, 0x11, 0x22, 0x5b, 0x14, 0x2d, 0x3e, 0x27}, + {0x68, 0x11, 0x22, 0x5b, 0x14, 0x2d, 0x1e, 0x27}, + {0x68, 0x11, 0x22, 0x5b, 0x14, 0x2d, 0x1e, 0x27}, + {0x68, 0x51, 0x22, 0x5b, 0x14, 0x6d, 0x1e, 0x27}, + {0x68, 0x51, 0x22, 0x5b, 0x14, 0x6d, 0x1e, 0x27}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x1e, 0x27}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x1e, 0x27}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x1e, 0x47}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x1e, 0x47}, + {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}, + {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}, + {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}, + {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47} + }, + { + {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x17}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x17}, + {0x20, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x17}, + {0x20, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x17}, + {0x20, 0x19, 0x52, 0x6b, 0x5c, 0x25, 0x6e, 0x17}, + {0x20, 0x19, 0x52, 0x6b, 0x5c, 0x25, 0x6e, 0x17}, + {0x20, 0x19, 0x72, 0x6b, 0x1c, 0x25, 0x6e, 0x17}, + {0x20, 0x19, 0x72, 0x6b, 0x1c, 0x25, 0x6e, 0x17}, + {0x20, 0x19, 0x72, 0x7b, 0x1c, 0x25, 0x6e, 0x37}, + {0x20, 0x19, 0x72, 0x7b, 0x1c, 0x25, 0x6e, 0x37}, + {0x28, 0x19, 0x72, 0x7b, 0x1c, 0x25, 0x7e, 0x37}, + {0x28, 0x19, 0x72, 0x7b, 0x1c, 0x25, 0x7e, 0x37}, + {0x28, 0x11, 0x72, 0x7b, 0x1c, 0x2d, 0x7e, 0x37}, + {0x28, 0x11, 0x72, 0x7b, 0x1c, 0x2d, 0x7e, 0x37}, + {0x28, 0x11, 0x62, 0x7b, 0x14, 0x2d, 0x7e, 0x37}, + {0x28, 0x11, 0x62, 0x7b, 0x14, 0x2d, 0x7e, 0x37}, + {0x28, 0x11, 0x62, 0x5b, 0x14, 0x2d, 0x7e, 0x27}, + {0x28, 0x11, 0x62, 0x5b, 0x14, 0x2d, 0x7e, 0x27}, + {0x68, 0x11, 0x62, 0x5b, 0x14, 0x2d, 0x5e, 0x27}, + {0x68, 0x11, 0x62, 0x5b, 0x14, 0x2d, 0x5e, 0x27}, + {0x68, 0x51, 0x62, 0x5b, 0x14, 0x6d, 0x5e, 0x27}, + {0x68, 0x51, 0x62, 0x5b, 0x14, 0x6d, 0x5e, 0x27}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x27}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x27}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47}, + {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}, + {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}, + {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47} + }, + { + {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x17}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x17}, + {0x20, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x17}, + {0x20, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x17}, + {0x20, 0x19, 0x52, 0x6b, 0x5c, 0x25, 0x6e, 0x17}, + {0x20, 0x19, 0x52, 0x6b, 0x5c, 0x25, 0x6e, 0x17}, + {0x20, 0x19, 0x72, 0x6b, 0x1c, 0x25, 0x6e, 0x17}, + {0x20, 0x19, 0x72, 0x6b, 0x1c, 0x25, 0x6e, 0x17}, + {0x20, 0x19, 0x72, 0x7b, 0x1c, 0x25, 0x6e, 0x37}, + {0x20, 0x19, 0x72, 0x7b, 0x1c, 0x25, 0x6e, 0x37}, + {0x28, 0x19, 0x72, 0x7b, 0x1c, 0x25, 0x7e, 0x37}, + {0x28, 0x19, 0x72, 0x7b, 0x1c, 0x25, 0x7e, 0x37}, + {0x28, 0x11, 0x72, 0x7b, 0x1c, 0x2d, 0x7e, 0x37}, + {0x28, 0x11, 0x72, 0x7b, 0x1c, 0x2d, 0x7e, 0x37}, + {0x28, 0x11, 0x62, 0x7b, 0x14, 0x2d, 0x7e, 0x37}, + {0x28, 0x11, 0x62, 0x7b, 0x14, 0x2d, 0x7e, 0x37}, + {0x28, 0x11, 0x62, 0x5b, 0x14, 0x2d, 0x7e, 0x27}, + {0x28, 0x11, 0x62, 0x5b, 0x14, 0x2d, 0x7e, 0x27}, + {0x68, 0x11, 0x62, 0x5b, 0x14, 0x2d, 0x5e, 0x27}, + {0x68, 0x11, 0x62, 0x5b, 0x14, 0x2d, 0x5e, 0x27}, + {0x68, 0x51, 0x62, 0x5b, 0x14, 0x6d, 0x5e, 0x27}, + {0x68, 0x51, 0x62, 0x5b, 0x14, 0x6d, 0x5e, 0x27}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x27}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x27}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47}, + {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}, + {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47} + }, + { + {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x20, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x20, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x20, 0x19, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x20, 0x19, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x20, 0x19, 0x72, 0x6b, 0x1c, 0x45, 0x6e, 0x57}, + {0x20, 0x19, 0x72, 0x6b, 0x1c, 0x45, 0x6e, 0x57}, + {0x20, 0x19, 0x72, 0x7b, 0x1c, 0x45, 0x6e, 0x77}, + {0x20, 0x19, 0x72, 0x7b, 0x1c, 0x45, 0x6e, 0x77}, + {0x28, 0x19, 0x72, 0x7b, 0x1c, 0x45, 0x7e, 0x77}, + {0x28, 0x19, 0x72, 0x7b, 0x1c, 0x45, 0x7e, 0x77}, + {0x28, 0x11, 0x72, 0x7b, 0x1c, 0x4d, 0x7e, 0x77}, + {0x28, 0x11, 0x72, 0x7b, 0x1c, 0x4d, 0x7e, 0x77}, + {0x28, 0x11, 0x62, 0x7b, 0x14, 0x4d, 0x7e, 0x77}, + {0x28, 0x11, 0x62, 0x7b, 0x14, 0x4d, 0x7e, 0x77}, + {0x28, 0x11, 0x62, 0x5b, 0x14, 0x4d, 0x7e, 0x67}, + {0x28, 0x11, 0x62, 0x5b, 0x14, 0x4d, 0x7e, 0x67}, + {0x68, 0x11, 0x62, 0x5b, 0x14, 0x4d, 0x5e, 0x67}, + {0x68, 0x11, 0x62, 0x5b, 0x14, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x14, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x14, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47}, + {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47}, + {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47} + }, + { + {0x60, 0x59, 0x02, 0x4b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x20, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x20, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x20, 0x19, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x20, 0x19, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x20, 0x19, 0x72, 0x6b, 0x1c, 0x45, 0x6e, 0x57}, + {0x20, 0x19, 0x72, 0x6b, 0x1c, 0x45, 0x6e, 0x57}, + {0x20, 0x19, 0x72, 0x7b, 0x1c, 0x45, 0x6e, 0x77}, + {0x20, 0x19, 0x72, 0x7b, 0x1c, 0x45, 0x6e, 0x77}, + {0x28, 0x19, 0x72, 0x7b, 0x1c, 0x45, 0x7e, 0x77}, + {0x28, 0x19, 0x72, 0x7b, 0x1c, 0x45, 0x7e, 0x77}, + {0x28, 0x11, 0x72, 0x7b, 0x1c, 0x4d, 0x7e, 0x77}, + {0x28, 0x11, 0x72, 0x7b, 0x1c, 0x4d, 0x7e, 0x77}, + {0x28, 0x11, 0x62, 0x7b, 0x14, 0x4d, 0x7e, 0x77}, + {0x28, 0x11, 0x62, 0x7b, 0x14, 0x4d, 0x7e, 0x77}, + {0x28, 0x11, 0x62, 0x5b, 0x14, 0x4d, 0x7e, 0x67}, + {0x28, 0x11, 0x62, 0x5b, 0x14, 0x4d, 0x7e, 0x67}, + {0x68, 0x11, 0x62, 0x5b, 0x14, 0x4d, 0x5e, 0x67}, + {0x68, 0x11, 0x62, 0x5b, 0x14, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x14, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x14, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47}, + {0x68, 0x51, 0x42, 0x0b, 0x54, 0x6d, 0x0e, 0x47} + }, + { + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x19, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x19, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x19, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x19, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x19, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77}, + {0x40, 0x19, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77}, + {0x48, 0x19, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77}, + {0x48, 0x19, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77}, + {0x48, 0x11, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77}, + {0x48, 0x11, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77}, + {0x48, 0x11, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77}, + {0x48, 0x11, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77}, + {0x48, 0x11, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67}, + {0x48, 0x11, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67}, + {0x68, 0x11, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x11, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47} + }, + { + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x19, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x19, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x19, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x19, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x19, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77}, + {0x40, 0x19, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77}, + {0x48, 0x19, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77}, + {0x48, 0x19, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77}, + {0x48, 0x11, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77}, + {0x48, 0x11, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77}, + {0x48, 0x11, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77}, + {0x48, 0x11, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77}, + {0x48, 0x11, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67}, + {0x48, 0x11, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67}, + {0x48, 0x11, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x11, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47} + }, + { + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77}, + {0x40, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77}, + {0x48, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77}, + {0x48, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77}, + {0x48, 0x01, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77}, + {0x48, 0x01, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77}, + {0x48, 0x01, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77}, + {0x48, 0x01, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47} + }, + { + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x4e, 0x07}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77}, + {0x40, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77}, + {0x48, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77}, + {0x48, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77}, + {0x48, 0x01, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77}, + {0x48, 0x01, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77}, + {0x48, 0x01, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77}, + {0x48, 0x01, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x42, 0x5b, 0x54, 0x6d, 0x5e, 0x47} + }, + { + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77}, + {0x40, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77}, + {0x48, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77}, + {0x48, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77}, + {0x48, 0x01, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77}, + {0x48, 0x01, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77}, + {0x48, 0x01, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77}, + {0x48, 0x01, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67} + }, + { + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x60, 0x59, 0x52, 0x6b, 0x5c, 0x65, 0x6e, 0x57}, + {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x59, 0x52, 0x6b, 0x5c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x52, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x72, 0x6b, 0x0c, 0x45, 0x6e, 0x57}, + {0x40, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77}, + {0x40, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x6e, 0x77}, + {0x48, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77}, + {0x48, 0x09, 0x72, 0x7b, 0x0c, 0x45, 0x7e, 0x77}, + {0x48, 0x01, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77}, + {0x48, 0x01, 0x72, 0x7b, 0x0c, 0x4d, 0x7e, 0x77}, + {0x48, 0x01, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77}, + {0x48, 0x01, 0x62, 0x7b, 0x04, 0x4d, 0x7e, 0x77}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x7e, 0x67}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x48, 0x01, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x04, 0x4d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67}, + {0x68, 0x51, 0x62, 0x5b, 0x54, 0x6d, 0x5e, 0x67} + } + }, + { /* 12,000bps map */ + { + {0x38, 0x21, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27} + }, + { + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27} + }, + { + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27} + }, + { + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27} + }, + { + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27} + }, + { + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x0b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x0b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x0e, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x0e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x1e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x35, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x0c, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07} + }, + { + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x0b, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x0b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x0b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x0b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x0e, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x0e, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x0e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x0e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x1e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x35, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x0c, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x0c, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07} + }, + { + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x13, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x0b, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x0b, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x0b, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x0b, 0x04, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x22, 0x0b, 0x04, 0x3d, 0x0e, 0x37}, + {0x38, 0x01, 0x22, 0x0b, 0x04, 0x3d, 0x0e, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x0e, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x3d, 0x0e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x0e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x0e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x1b, 0x0c, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x0c, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x0c, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x14, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07} + }, + { + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x0b, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x0b, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x0b, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x0b, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x3d, 0x0e, 0x37}, + {0x38, 0x01, 0x22, 0x0b, 0x04, 0x3d, 0x0e, 0x37}, + {0x38, 0x01, 0x22, 0x0b, 0x04, 0x3d, 0x0e, 0x37}, + {0x38, 0x01, 0x22, 0x0b, 0x04, 0x3d, 0x0e, 0x37}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x0e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x0e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x0e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x0e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x0c, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x0c, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x0c, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x0c, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07} + }, + { + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x0b, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x32, 0x0b, 0x24, 0x3d, 0x16, 0x37}, + {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x3d, 0x0e, 0x37}, + {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x3d, 0x0e, 0x37}, + {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x3d, 0x0e, 0x37}, + {0x38, 0x01, 0x22, 0x0b, 0x04, 0x3d, 0x0e, 0x37}, + {0x38, 0x01, 0x22, 0x0b, 0x04, 0x2d, 0x0e, 0x2f}, + {0x38, 0x01, 0x22, 0x0b, 0x04, 0x2d, 0x0e, 0x2f}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x0e, 0x27}, + {0x38, 0x01, 0x22, 0x1b, 0x04, 0x2d, 0x0e, 0x27}, + {0x28, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x0e, 0x27}, + {0x28, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x0e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x1e, 0x27}, + {0x30, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x1e, 0x27}, + {0x30, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x1e, 0x27}, + {0x30, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x0c, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x22, 0x3b, 0x0c, 0x35, 0x1e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07} + }, + { + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x3d, 0x0e, 0x37}, + {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x3d, 0x0e, 0x37}, + {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x3d, 0x0e, 0x37}, + {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x3d, 0x0e, 0x37}, + {0x38, 0x01, 0x22, 0x0b, 0x04, 0x2d, 0x0e, 0x2f}, + {0x38, 0x01, 0x22, 0x0b, 0x04, 0x2d, 0x0e, 0x2f}, + {0x38, 0x01, 0x22, 0x0b, 0x04, 0x2d, 0x0e, 0x2f}, + {0x38, 0x01, 0x22, 0x0b, 0x04, 0x2d, 0x0e, 0x2f}, + {0x28, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x0e, 0x27}, + {0x28, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x0e, 0x27}, + {0x28, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x0e, 0x27}, + {0x28, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x0e, 0x27}, + {0x30, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x1e, 0x27}, + {0x30, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x1e, 0x27}, + {0x30, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x1e, 0x27}, + {0x30, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x1e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07} + }, + { + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x18, 0x21, 0x32, 0x13, 0x24, 0x1d, 0x16, 0x37}, + {0x18, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x16, 0x37}, + {0x18, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x16, 0x37}, + {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x0e, 0x37}, + {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x0e, 0x37}, + {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x3d, 0x0e, 0x37}, + {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x3d, 0x0e, 0x37}, + {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x2d, 0x0e, 0x2f}, + {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x2d, 0x0e, 0x2f}, + {0x38, 0x01, 0x22, 0x0b, 0x04, 0x2d, 0x0e, 0x2f}, + {0x38, 0x01, 0x22, 0x0b, 0x04, 0x2d, 0x0e, 0x2f}, + {0x28, 0x01, 0x22, 0x0b, 0x0c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x01, 0x22, 0x0b, 0x0c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x0e, 0x27}, + {0x28, 0x01, 0x22, 0x1b, 0x0c, 0x2d, 0x0e, 0x27}, + {0x28, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x0e, 0x27}, + {0x28, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x0e, 0x27}, + {0x30, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x1e, 0x27}, + {0x30, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x1e, 0x27}, + {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x3e, 0x27}, + {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x35, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x35, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x35, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x14, 0x35, 0x3e, 0x07} + }, + { + {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x06, 0x37}, + {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x0e, 0x37}, + {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x0e, 0x37}, + {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x0e, 0x37}, + {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x0e, 0x37}, + {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x2d, 0x0e, 0x2f}, + {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x2d, 0x0e, 0x2f}, + {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x2d, 0x0e, 0x2f}, + {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x2d, 0x0e, 0x2f}, + {0x28, 0x01, 0x22, 0x0b, 0x0c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x01, 0x22, 0x0b, 0x0c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x01, 0x22, 0x0b, 0x0c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x01, 0x22, 0x0b, 0x0c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x0e, 0x27}, + {0x28, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x0e, 0x27}, + {0x28, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x0e, 0x27}, + {0x28, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x0e, 0x27}, + {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x3e, 0x27}, + {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x3e, 0x27}, + {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x3e, 0x27}, + {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x3e, 0x27}, + {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07} + }, + { + {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x32, 0x0b, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x06, 0x37}, + {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x0e, 0x37}, + {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x0e, 0x37}, + {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x0e, 0x2f}, + {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x0e, 0x2f}, + {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x2d, 0x0e, 0x2f}, + {0x38, 0x01, 0x2a, 0x0b, 0x24, 0x2d, 0x0e, 0x2f}, + {0x28, 0x01, 0x2a, 0x0b, 0x2c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x01, 0x2a, 0x0b, 0x2c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x01, 0x22, 0x0b, 0x0c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x01, 0x22, 0x0b, 0x0c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x09, 0x22, 0x2b, 0x0c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x09, 0x22, 0x2b, 0x0c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x0e, 0x27}, + {0x28, 0x09, 0x22, 0x3b, 0x0c, 0x2d, 0x0e, 0x27}, + {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x2e, 0x27}, + {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x2e, 0x27}, + {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x3e, 0x27}, + {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x3e, 0x27}, + {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07}, + {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07} + }, + { + {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x2a, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x06, 0x2f}, + {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x0e, 0x2f}, + {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x0e, 0x2f}, + {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x0e, 0x2f}, + {0x28, 0x21, 0x2a, 0x0b, 0x2c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x01, 0x2a, 0x0b, 0x2c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x01, 0x2a, 0x0b, 0x2c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x01, 0x2a, 0x0b, 0x2c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x09, 0x2a, 0x2b, 0x2c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x09, 0x22, 0x2b, 0x0c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x09, 0x22, 0x2b, 0x0c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x09, 0x22, 0x2b, 0x0c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x2d, 0x2e, 0x2f}, + {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x2e, 0x27}, + {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x2e, 0x27}, + {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x2e, 0x27}, + {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x2e, 0x07}, + {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07}, + {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07}, + {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07}, + {0x30, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07} + }, + { + {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x32, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x2a, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x2a, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x2a, 0x03, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x1d, 0x06, 0x37}, + {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x06, 0x2f}, + {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x06, 0x2f}, + {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x06, 0x2f}, + {0x38, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x0e, 0x2f}, + {0x28, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x0e, 0x2f}, + {0x28, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x0e, 0x2f}, + {0x28, 0x21, 0x2a, 0x0b, 0x2c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x01, 0x2a, 0x0b, 0x2c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x09, 0x2a, 0x2b, 0x2c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x09, 0x2a, 0x2b, 0x2c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x09, 0x2a, 0x2b, 0x2c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x09, 0x22, 0x2b, 0x0c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x2d, 0x2e, 0x2f}, + {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x2d, 0x2e, 0x2f}, + {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x2d, 0x2e, 0x2f}, + {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x2d, 0x2e, 0x27}, + {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x2e, 0x07}, + {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x2e, 0x07}, + {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x2e, 0x07}, + {0x30, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x3e, 0x07}, + {0x30, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x30, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x30, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x30, 0x11, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07} + }, + { + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x2a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x2a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x2a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x2a, 0x03, 0x24, 0x0d, 0x06, 0x3f}, + {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x06, 0x2f}, + {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x06, 0x2f}, + {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x06, 0x2f}, + {0x08, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x06, 0x2f}, + {0x28, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x0e, 0x2f}, + {0x28, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x0e, 0x2f}, + {0x28, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x0e, 0x2f}, + {0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x09, 0x2a, 0x2b, 0x2c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x09, 0x2a, 0x2b, 0x2c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x09, 0x2a, 0x2b, 0x2c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f}, + {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x2d, 0x2e, 0x2f}, + {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x2d, 0x2e, 0x2f}, + {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x2d, 0x2e, 0x2f}, + {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x25, 0x2e, 0x0f}, + {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x2e, 0x07}, + {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x2e, 0x07}, + {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x2e, 0x07}, + {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07}, + {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07} + }, + { + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x2a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x2a, 0x03, 0x24, 0x0d, 0x06, 0x3f}, + {0x18, 0x21, 0x2a, 0x03, 0x24, 0x0d, 0x06, 0x3f}, + {0x18, 0x21, 0x2a, 0x03, 0x24, 0x0d, 0x06, 0x3f}, + {0x18, 0x21, 0x2a, 0x0b, 0x24, 0x0d, 0x06, 0x2f}, + {0x08, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x06, 0x2f}, + {0x08, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x06, 0x2f}, + {0x08, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x06, 0x2f}, + {0x28, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x0e, 0x2f}, + {0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x0e, 0x2f}, + {0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x0e, 0x2f}, + {0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x09, 0x2a, 0x2b, 0x2c, 0x2d, 0x0e, 0x2f}, + {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f}, + {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f}, + {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f}, + {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x2d, 0x2e, 0x2f}, + {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x25, 0x2e, 0x0f}, + {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x25, 0x2e, 0x0f}, + {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x25, 0x2e, 0x0f}, + {0x28, 0x09, 0x02, 0x3b, 0x0c, 0x25, 0x2e, 0x07}, + {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07}, + {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07}, + {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07}, + {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07} + }, + { + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x0d, 0x06, 0x3f}, + {0x18, 0x21, 0x2a, 0x03, 0x24, 0x0d, 0x06, 0x3f}, + {0x18, 0x21, 0x2a, 0x03, 0x24, 0x0d, 0x06, 0x3f}, + {0x18, 0x21, 0x2a, 0x03, 0x24, 0x0d, 0x06, 0x3f}, + {0x08, 0x21, 0x2a, 0x03, 0x2c, 0x0d, 0x06, 0x3f}, + {0x08, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x06, 0x2f}, + {0x08, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x06, 0x2f}, + {0x08, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x06, 0x2f}, + {0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x0e, 0x2f}, + {0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x0e, 0x2f}, + {0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x0e, 0x2f}, + {0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x0e, 0x2f}, + {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f}, + {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f}, + {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f}, + {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f}, + {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x25, 0x2e, 0x0f}, + {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x25, 0x2e, 0x0f}, + {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x25, 0x2e, 0x0f}, + {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x25, 0x2e, 0x0f}, + {0x20, 0x09, 0x02, 0x2b, 0x1c, 0x25, 0x2e, 0x0f}, + {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07}, + {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07}, + {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07}, + {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07}, + {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07} + }, + { + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x1d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x0d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x0d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x24, 0x0d, 0x06, 0x3f}, + {0x18, 0x21, 0x2a, 0x03, 0x24, 0x0d, 0x06, 0x3f}, + {0x08, 0x21, 0x2a, 0x03, 0x2c, 0x0d, 0x06, 0x3f}, + {0x08, 0x21, 0x2a, 0x03, 0x2c, 0x0d, 0x06, 0x3f}, + {0x08, 0x21, 0x2a, 0x03, 0x2c, 0x0d, 0x06, 0x3f}, + {0x08, 0x21, 0x2a, 0x0b, 0x2c, 0x0d, 0x06, 0x2f}, + {0x08, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x06, 0x2f}, + {0x08, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x06, 0x2f}, + {0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x0e, 0x2f}, + {0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x0e, 0x2f}, + {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x2e, 0x2f}, + {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x2e, 0x2f}, + {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f}, + {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f}, + {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x25, 0x2e, 0x0f}, + {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x25, 0x2e, 0x0f}, + {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x25, 0x2e, 0x0f}, + {0x28, 0x09, 0x02, 0x2b, 0x0c, 0x25, 0x2e, 0x0f}, + {0x20, 0x09, 0x02, 0x2b, 0x1c, 0x25, 0x2e, 0x0f}, + {0x20, 0x09, 0x02, 0x2b, 0x1c, 0x25, 0x2e, 0x0f}, + {0x20, 0x09, 0x02, 0x2b, 0x1c, 0x25, 0x2e, 0x0f}, + {0x20, 0x09, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07}, + {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07}, + {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07}, + {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x2e, 0x07}, + {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07}, + {0x20, 0x19, 0x02, 0x3b, 0x1c, 0x25, 0x3e, 0x07} + }, + { + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f}, + {0x08, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f}, + {0x08, 0x21, 0x2a, 0x03, 0x2c, 0x0d, 0x06, 0x3f}, + {0x08, 0x21, 0x2a, 0x03, 0x2c, 0x0d, 0x06, 0x3f}, + {0x08, 0x21, 0x2a, 0x03, 0x2c, 0x0d, 0x06, 0x3f}, + {0x08, 0x29, 0x2a, 0x23, 0x2c, 0x0d, 0x06, 0x3f}, + {0x08, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x06, 0x2f}, + {0x08, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x06, 0x2f}, + {0x08, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x06, 0x2f}, + {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x2e, 0x2f}, + {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x2e, 0x2f}, + {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x2e, 0x2f}, + {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x2e, 0x2f}, + {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x25, 0x2e, 0x0f}, + {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x25, 0x2e, 0x0f}, + {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x25, 0x2e, 0x0f}, + {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x25, 0x2e, 0x0f}, + {0x20, 0x09, 0x0a, 0x2b, 0x3c, 0x25, 0x2e, 0x0f}, + {0x20, 0x09, 0x02, 0x2b, 0x1c, 0x25, 0x2e, 0x0f}, + {0x20, 0x09, 0x02, 0x2b, 0x1c, 0x25, 0x2e, 0x0f}, + {0x20, 0x09, 0x02, 0x2b, 0x1c, 0x25, 0x2e, 0x0f}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x0f}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x07}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x07}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x07}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07} + }, + { + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f}, + {0x08, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f}, + {0x08, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f}, + {0x08, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f}, + {0x08, 0x21, 0x2a, 0x03, 0x2c, 0x0d, 0x06, 0x3f}, + {0x08, 0x29, 0x2a, 0x23, 0x2c, 0x0d, 0x06, 0x3f}, + {0x08, 0x29, 0x2a, 0x23, 0x2c, 0x0d, 0x06, 0x3f}, + {0x08, 0x29, 0x2a, 0x23, 0x2c, 0x0d, 0x06, 0x3f}, + {0x08, 0x29, 0x2a, 0x2b, 0x2c, 0x0d, 0x06, 0x2f}, + {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x26, 0x2f}, + {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x26, 0x2f}, + {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x2e, 0x2f}, + {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x2e, 0x2f}, + {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x2e, 0x0f}, + {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x2e, 0x0f}, + {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x25, 0x2e, 0x0f}, + {0x28, 0x09, 0x0a, 0x2b, 0x2c, 0x25, 0x2e, 0x0f}, + {0x20, 0x09, 0x0a, 0x2b, 0x3c, 0x25, 0x2e, 0x0f}, + {0x20, 0x09, 0x0a, 0x2b, 0x3c, 0x25, 0x2e, 0x0f}, + {0x20, 0x09, 0x0a, 0x2b, 0x3c, 0x25, 0x2e, 0x0f}, + {0x20, 0x09, 0x02, 0x2b, 0x1c, 0x25, 0x2e, 0x0f}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x0f}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x0f}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x0f}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x07}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07} + }, + { + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x08, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x08, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f}, + {0x08, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f}, + {0x08, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f}, + {0x08, 0x29, 0x3a, 0x23, 0x34, 0x0d, 0x06, 0x3f}, + {0x08, 0x29, 0x2a, 0x23, 0x2c, 0x0d, 0x06, 0x3f}, + {0x08, 0x29, 0x2a, 0x23, 0x2c, 0x0d, 0x06, 0x3f}, + {0x08, 0x29, 0x2a, 0x23, 0x2c, 0x0d, 0x06, 0x3f}, + {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x26, 0x2f}, + {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x26, 0x2f}, + {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x26, 0x2f}, + {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x26, 0x2f}, + {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x2e, 0x0f}, + {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x2e, 0x0f}, + {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x2e, 0x0f}, + {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x2e, 0x0f}, + {0x20, 0x29, 0x0a, 0x2b, 0x3c, 0x25, 0x2e, 0x0f}, + {0x20, 0x09, 0x0a, 0x2b, 0x3c, 0x25, 0x2e, 0x0f}, + {0x20, 0x09, 0x0a, 0x2b, 0x3c, 0x25, 0x2e, 0x0f}, + {0x20, 0x09, 0x0a, 0x2b, 0x3c, 0x25, 0x2e, 0x0f}, + {0x20, 0x19, 0x0a, 0x33, 0x3c, 0x25, 0x2e, 0x0f}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x0f}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x0f}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x0f}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x0f}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07} + }, + { + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x18, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x08, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x08, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x08, 0x21, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x08, 0x21, 0x3a, 0x03, 0x34, 0x0d, 0x06, 0x3f}, + {0x08, 0x29, 0x3a, 0x23, 0x34, 0x0d, 0x06, 0x3f}, + {0x08, 0x29, 0x3a, 0x23, 0x34, 0x0d, 0x06, 0x3f}, + {0x08, 0x29, 0x3a, 0x23, 0x34, 0x0d, 0x06, 0x3f}, + {0x08, 0x29, 0x2a, 0x23, 0x2c, 0x0d, 0x06, 0x3f}, + {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x0d, 0x26, 0x3f}, + {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x0d, 0x26, 0x3f}, + {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x26, 0x2f}, + {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x0d, 0x26, 0x2f}, + {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x26, 0x0f}, + {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x26, 0x0f}, + {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x2e, 0x0f}, + {0x28, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x2e, 0x0f}, + {0x20, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x2e, 0x0f}, + {0x20, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x2e, 0x0f}, + {0x20, 0x29, 0x0a, 0x2b, 0x3c, 0x25, 0x2e, 0x0f}, + {0x20, 0x09, 0x0a, 0x2b, 0x3c, 0x25, 0x2e, 0x0f}, + {0x20, 0x19, 0x0a, 0x33, 0x3c, 0x25, 0x2e, 0x0f}, + {0x20, 0x19, 0x0a, 0x33, 0x3c, 0x25, 0x2e, 0x0f}, + {0x20, 0x19, 0x0a, 0x33, 0x3c, 0x25, 0x2e, 0x0f}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x2e, 0x0f}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x0f}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x0f}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x0f}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07}, + {0x20, 0x19, 0x02, 0x33, 0x1c, 0x25, 0x36, 0x07} + }, + { + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x08, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x08, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x08, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x08, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x08, 0x29, 0x3a, 0x23, 0x34, 0x0d, 0x06, 0x3f}, + {0x08, 0x29, 0x3a, 0x23, 0x34, 0x0d, 0x06, 0x3f}, + {0x08, 0x29, 0x3a, 0x23, 0x34, 0x0d, 0x06, 0x3f}, + {0x08, 0x29, 0x1a, 0x23, 0x34, 0x0d, 0x26, 0x3f}, + {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x0d, 0x26, 0x3f}, + {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x0d, 0x26, 0x3f}, + {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x0d, 0x26, 0x3f}, + {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x26, 0x0f}, + {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x26, 0x0f}, + {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x26, 0x0f}, + {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x26, 0x0f}, + {0x20, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x2e, 0x0f}, + {0x20, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x2e, 0x0f}, + {0x20, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x2e, 0x0f}, + {0x20, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x2e, 0x0f}, + {0x20, 0x39, 0x0a, 0x33, 0x3c, 0x25, 0x2e, 0x0f}, + {0x20, 0x19, 0x0a, 0x33, 0x3c, 0x25, 0x2e, 0x0f}, + {0x20, 0x19, 0x0a, 0x33, 0x3c, 0x25, 0x2e, 0x0f}, + {0x20, 0x19, 0x0a, 0x33, 0x3c, 0x25, 0x2e, 0x0f}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x0f}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x0f}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x0f}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x0f}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17} + }, + { + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x08, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x08, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x08, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x08, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x08, 0x29, 0x3a, 0x23, 0x34, 0x0d, 0x06, 0x3f}, + {0x08, 0x29, 0x1a, 0x23, 0x34, 0x0d, 0x26, 0x3f}, + {0x08, 0x29, 0x1a, 0x23, 0x34, 0x0d, 0x26, 0x3f}, + {0x08, 0x29, 0x1a, 0x23, 0x34, 0x0d, 0x26, 0x3f}, + {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x0d, 0x26, 0x3f}, + {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x05, 0x26, 0x1f}, + {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x05, 0x26, 0x1f}, + {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x26, 0x0f}, + {0x08, 0x29, 0x0a, 0x2b, 0x2c, 0x05, 0x26, 0x0f}, + {0x00, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x26, 0x0f}, + {0x00, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x26, 0x0f}, + {0x20, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x2e, 0x0f}, + {0x20, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x2e, 0x0f}, + {0x20, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x2e, 0x0f}, + {0x20, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x2e, 0x0f}, + {0x20, 0x39, 0x0a, 0x33, 0x3c, 0x25, 0x2e, 0x0f}, + {0x20, 0x19, 0x0a, 0x33, 0x3c, 0x25, 0x2e, 0x0f}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x0f}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x0f}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x0f}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x0f}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17} + }, + { + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x08, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x08, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x08, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x08, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x08, 0x29, 0x1a, 0x23, 0x34, 0x0d, 0x26, 0x3f}, + {0x08, 0x29, 0x1a, 0x23, 0x34, 0x0d, 0x26, 0x3f}, + {0x08, 0x29, 0x1a, 0x23, 0x34, 0x0d, 0x26, 0x3f}, + {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x05, 0x26, 0x1f}, + {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x05, 0x26, 0x1f}, + {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x05, 0x26, 0x1f}, + {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x05, 0x26, 0x1f}, + {0x00, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x26, 0x0f}, + {0x00, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x26, 0x0f}, + {0x00, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x26, 0x0f}, + {0x00, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x26, 0x0f}, + {0x20, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x2e, 0x0f}, + {0x20, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x2e, 0x0f}, + {0x20, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x2e, 0x0f}, + {0x20, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x2e, 0x0f}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x0f}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x0f}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x0f}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x0f}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17} + }, + { + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x08, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x08, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x08, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x08, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x08, 0x29, 0x1a, 0x23, 0x34, 0x0d, 0x26, 0x3f}, + {0x08, 0x29, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x08, 0x29, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x05, 0x26, 0x1f}, + {0x08, 0x29, 0x0a, 0x23, 0x2c, 0x05, 0x26, 0x1f}, + {0x00, 0x29, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x29, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x26, 0x0f}, + {0x00, 0x29, 0x0a, 0x2b, 0x3c, 0x05, 0x26, 0x0f}, + {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x0f}, + {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x0f}, + {0x20, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x2e, 0x0f}, + {0x20, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x2e, 0x0f}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x0f}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x0f}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17} + }, + { + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x08, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x08, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x08, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x08, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x08, 0x29, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x08, 0x29, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x08, 0x29, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x29, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x29, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x29, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x29, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x0f}, + {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x0f}, + {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x0f}, + {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x0f}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17} + }, + { + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x08, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x08, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x08, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x08, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x08, 0x29, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x29, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x29, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x29, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x29, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x0f}, + {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x0f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x0f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17} + }, + { + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x08, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x08, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x08, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x29, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x29, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x29, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x29, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x0f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17} + }, + { + {0x10, 0x31, 0x3a, 0x03, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x08, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x29, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x29, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x0a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x0a, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x0f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x1c, 0x25, 0x36, 0x17} + }, + { + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17} + }, + { + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17} + }, + { + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17}, + {0x20, 0x19, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17} + }, + { + {0x10, 0x31, 0x3a, 0x23, 0x34, 0x15, 0x06, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x3f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x10, 0x31, 0x1a, 0x23, 0x34, 0x15, 0x26, 0x1f}, + {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x31, 0x1a, 0x23, 0x34, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x1a, 0x23, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x26, 0x1f}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x00, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x05, 0x36, 0x17}, + {0x20, 0x39, 0x12, 0x33, 0x3c, 0x25, 0x36, 0x17} + } + }, + { /* 9,600bps map */ + { + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f} + }, + { + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f} + }, + { + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f} + }, + { + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f} + }, + { + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f} + }, + { + {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f} + }, + { + {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f} + }, + { + {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f} + }, + { + {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f} + }, + { + {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x0e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x01, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x12, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x1c, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x00, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f} + }, + { + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f} + }, + { + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f} + }, + { + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f} + }, + { + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x01, 0x12, 0x13, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x12, 0x13, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x09, 0x02, 0x13, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x09, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f} + }, + { + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f} + }, + { + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f} + }, + { + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f} + }, + { + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x1b, 0x0c, 0x1d, 0x0e, 0x07}, + {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x10, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x0e, 0x0f}, + {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x11, 0x12, 0x0b, 0x0c, 0x1d, 0x1e, 0x0f}, + {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x12, 0x0b, 0x0c, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x02, 0x0b, 0x14, 0x15, 0x1e, 0x0f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f}, + {0x08, 0x19, 0x02, 0x03, 0x14, 0x15, 0x1e, 0x1f} + }, + { + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f} + }, + { + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f} + }, + { + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f} + }, + { + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x1d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x06, 0x0f}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x1d, 0x16, 0x0f}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x15, 0x16, 0x0f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x15, 0x16, 0x1f} + }, + { + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f} + }, + { + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f} + }, + { + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f} + }, + { + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x0c, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x06, 0x17}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17}, + {0x08, 0x11, 0x1a, 0x0b, 0x0c, 0x0d, 0x16, 0x17}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x1a, 0x0b, 0x0c, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x08, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f} + }, + { + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f} + }, + { + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f} + }, + { + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f} + }, + { + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f} + }, + { + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f} + }, + { + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x07}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x1f} + }, + { + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17} + }, + { + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17} + }, + { + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17} + }, + { + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x10, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x1b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x06, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x11, 0x1a, 0x0b, 0x04, 0x0d, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x1a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x0b, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x04, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17}, + {0x18, 0x19, 0x0a, 0x03, 0x14, 0x05, 0x16, 0x17} + } + }, + { /* 7,200bps map */ + { + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f} + }, + { + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f} + }, + { + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f} + }, + { + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f} + }, + { + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f} + }, + { + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f} + }, + { + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f} + }, + { + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f} + }, + { + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f} + }, + { + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x03, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x04, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x0a, 0x0b, 0x0c, 0x0d, 0x06, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x03, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x04, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07}, + {0x08, 0x01, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07} + }, + { + {0x00, 0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x0f}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x00, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x05, 0x0e, 0x07}, + {0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x07} + } + } +}; + +static const uint8_t constel_map_4800[36][36] = +{ /* 4,800bps map - No trellis. V.32/V.32bis only */ + { + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01 + }, + { + 0x02, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01 + }, + { + 0x02, + 0x02, + 0x02, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01 + }, + { + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01 + }, + { + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01 + }, + { + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01 + }, + { + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01 + }, + { + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01 + }, + { + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x00, + 0x00, + 0x00, + 0x00, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01 + }, + { + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x00, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01 + }, + { + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x03, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01 + }, + { + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x03, + 0x03, + 0x03, + 0x03, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01 + }, + { + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01 + }, + { + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01 + }, + { + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01 + }, + { + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01 + }, + { + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01 + }, + { + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x01, + 0x01, + 0x01 + }, + { + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x01 + }, + { + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 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, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 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, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 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, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 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, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 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, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03 + }, + { + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03 + }, + { + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03 + }, + { + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x02, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03 + } +}; + +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/v17_v32bis_tx_constellation_maps.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/v17_v32bis_tx_constellation_maps.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,328 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v17_v32bis_tx_constellation_maps.h - ITU V.17 and V.32bis modems + * transmit part. + * Constellation mapping. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v17_v32bis_tx_constellation_maps.h,v 1.1.4.1 2009/12/24 16:52:30 steveu Exp $ + */ + +#if defined(SPANDSP_USE_FIXED_POINTx) +static const complexi16_t v17_v32bis_14400_constellation[128] = +#else +static const complexf_t v17_v32bis_14400_constellation[128] = +#endif +{ + {-8, -3}, /* 0x00 */ + { 9, 2}, /* 0x01 */ + { 2, -9}, /* 0x02 */ + {-3, 8}, /* 0x03 */ + { 8, 3}, /* 0x04 */ + {-9, -2}, /* 0x05 */ + {-2, 9}, /* 0x06 */ + { 3, -8}, /* 0x07 */ + {-8, 1}, /* 0x08 */ + { 9, -2}, /* 0x09 */ + {-2, -9}, /* 0x0A */ + { 1, 8}, /* 0x0B */ + { 8, -1}, /* 0x0C */ + {-9, 2}, /* 0x0D */ + { 2, 9}, /* 0x0E */ + {-1, -8}, /* 0x0F */ + {-4, -3}, /* 0x10 */ + { 5, 2}, /* 0x11 */ + { 2, -5}, /* 0x12 */ + {-3, 4}, /* 0x13 */ + { 4, 3}, /* 0x14 */ + {-5, -2}, /* 0x15 */ + {-2, 5}, /* 0x16 */ + { 3, -4}, /* 0x17 */ + {-4, 1}, /* 0x18 */ + { 5, -2}, /* 0x19 */ + {-2, -5}, /* 0x1A */ + { 1, 4}, /* 0x1B */ + { 4, -1}, /* 0x1C */ + {-5, 2}, /* 0x1D */ + { 2, 5}, /* 0x1E */ + {-1, -4}, /* 0x1F */ + { 4, -3}, /* 0x20 */ + {-3, 2}, /* 0x21 */ + { 2, 3}, /* 0x22 */ + {-3, -4}, /* 0x23 */ + {-4, 3}, /* 0x24 */ + { 3, -2}, /* 0x25 */ + {-2, -3}, /* 0x26 */ + { 3, 4}, /* 0x27 */ + { 4, 1}, /* 0x28 */ + {-3, -2}, /* 0x29 */ + {-2, 3}, /* 0x2A */ + { 1, -4}, /* 0x2B */ + {-4, -1}, /* 0x2C */ + { 3, 2}, /* 0x2D */ + { 2, -3}, /* 0x2E */ + {-1, 4}, /* 0x2F */ + { 0, -3}, /* 0x30 */ + { 1, 2}, /* 0x31 */ + { 2, -1}, /* 0x32 */ + {-3, 0}, /* 0x33 */ + { 0, 3}, /* 0x34 */ + {-1, -2}, /* 0x35 */ + {-2, 1}, /* 0x36 */ + { 3, 0}, /* 0x37 */ + { 0, 1}, /* 0x38 */ + { 1, -2}, /* 0x39 */ + {-2, -1}, /* 0x3A */ + { 1, 0}, /* 0x3B */ + { 0, -1}, /* 0x3C */ + {-1, 2}, /* 0x3D */ + { 2, 1}, /* 0x3E */ + {-1, 0}, /* 0x3F */ + { 8, -3}, /* 0x40 */ + {-7, 2}, /* 0x41 */ + { 2, 7}, /* 0x42 */ + {-3, -8}, /* 0x43 */ + {-8, 3}, /* 0x44 */ + { 7, -2}, /* 0x45 */ + {-2, -7}, /* 0x46 */ + { 3, 8}, /* 0x47 */ + { 8, 1}, /* 0x48 */ + {-7, -2}, /* 0x49 */ + {-2, 7}, /* 0x4A */ + { 1, -8}, /* 0x4B */ + {-8, -1}, /* 0x4C */ + { 7, 2}, /* 0x4D */ + { 2, -7}, /* 0x4E */ + {-1, 8}, /* 0x4F */ + {-4, -7}, /* 0x50 */ + { 5, 6}, /* 0x51 */ + { 6, -5}, /* 0x52 */ + {-7, 4}, /* 0x53 */ + { 4, 7}, /* 0x54 */ + {-5, -6}, /* 0x55 */ + {-6, 5}, /* 0x56 */ + { 7, -4}, /* 0x57 */ + {-4, 5}, /* 0x58 */ + { 5, -6}, /* 0x59 */ + {-6, -5}, /* 0x5A */ + { 5, 4}, /* 0x5B */ + { 4, -5}, /* 0x5C */ + {-5, 6}, /* 0x5D */ + { 6, 5}, /* 0x5E */ + {-5, -4}, /* 0x5F */ + { 4, -7}, /* 0x60 */ + {-3, 6}, /* 0x61 */ + { 6, 3}, /* 0x62 */ + {-7, -4}, /* 0x63 */ + {-4, 7}, /* 0x64 */ + { 3, -6}, /* 0x65 */ + {-6, -3}, /* 0x66 */ + { 7, 4}, /* 0x67 */ + { 4, 5}, /* 0x68 */ + {-3, -6}, /* 0x69 */ + {-6, 3}, /* 0x6A */ + { 5, -4}, /* 0x6B */ + {-4, -5}, /* 0x6C */ + { 3, 6}, /* 0x6D */ + { 6, -3}, /* 0x6E */ + {-5, 4}, /* 0x6F */ + { 0, -7}, /* 0x70 */ + { 1, 6}, /* 0x71 */ + { 6, -1}, /* 0x72 */ + {-7, 0}, /* 0x73 */ + { 0, 7}, /* 0x74 */ + {-1, -6}, /* 0x75 */ + {-6, 1}, /* 0x76 */ + { 7, 0}, /* 0x77 */ + { 0, 5}, /* 0x78 */ + { 1, -6}, /* 0x79 */ + {-6, -1}, /* 0x7A */ + { 5, 0}, /* 0x7B */ + { 0, -5}, /* 0x7C */ + {-1, 6}, /* 0x7D */ + { 6, 1}, /* 0x7E */ + {-5, 0} /* 0x7F */ +}; + +#if defined(SPANDSP_USE_FIXED_POINTx) +static const complexi16_t v17_v32bis_12000_constellation[64] = +#else +static const complexf_t v17_v32bis_12000_constellation[64] = +#endif +{ + { 7, 1}, /* 0x00 */ + {-5, -1}, /* 0x01 */ + {-1, 5}, /* 0x02 */ + { 1, -7}, /* 0x03 */ + {-7, -1}, /* 0x04 */ + { 5, 1}, /* 0x05 */ + { 1, -5}, /* 0x06 */ + {-1, 7}, /* 0x07 */ + { 3, -3}, /* 0x08 */ + {-1, 3}, /* 0x09 */ + { 3, 1}, /* 0x0A */ + {-3, -3}, /* 0x0B */ + {-3, 3}, /* 0x0C */ + { 1, -3}, /* 0x0D */ + {-3, -1}, /* 0x0E */ + { 3, 3}, /* 0x0F */ + { 7, -7}, /* 0x10 */ + {-5, 7}, /* 0x11 */ + { 7, 5}, /* 0x12 */ + {-7, -7}, /* 0x13 */ + {-7, 7}, /* 0x14 */ + { 5, -7}, /* 0x15 */ + {-7, -5}, /* 0x16 */ + { 7, 7}, /* 0x17 */ + {-1, -7}, /* 0x18 */ + { 3, 7}, /* 0x19 */ + { 7, -3}, /* 0x1A */ + {-7, 1}, /* 0x1B */ + { 1, 7}, /* 0x1C */ + {-3, -7}, /* 0x1D */ + {-7, 3}, /* 0x1E */ + { 7, -1}, /* 0x1F */ + { 3, 5}, /* 0x20 */ + {-1, -5}, /* 0x21 */ + {-5, 1}, /* 0x22 */ + { 5, -3}, /* 0x23 */ + {-3, -5}, /* 0x24 */ + { 1, 5}, /* 0x25 */ + { 5, -1}, /* 0x26 */ + {-5, 3}, /* 0x27 */ + {-1, 1}, /* 0x28 */ + { 3, -1}, /* 0x29 */ + {-1, -3}, /* 0x2A */ + { 1, 1}, /* 0x2B */ + { 1, -1}, /* 0x2C */ + {-3, 1}, /* 0x2D */ + { 1, 3}, /* 0x2E */ + {-1, -1}, /* 0x2F */ + {-5, 5}, /* 0x30 */ + { 7, -5}, /* 0x31 */ + {-5, -7}, /* 0x32 */ + { 5, 5}, /* 0x33 */ + { 5, -5}, /* 0x34 */ + {-7, 5}, /* 0x35 */ + { 5, 7}, /* 0x36 */ + {-5, -5}, /* 0x37 */ + {-5, -3}, /* 0x38 */ + { 7, 3}, /* 0x39 */ + { 3, -7}, /* 0x3A */ + {-3, 5}, /* 0x3B */ + { 5, 3}, /* 0x3C */ + {-7, -3}, /* 0x3D */ + {-3, 7}, /* 0x3E */ + { 3, -5} /* 0x3F */ +}; + +#if defined(SPANDSP_USE_FIXED_POINTx) +static const complexi16_t v17_v32bis_9600_constellation[32] = +#else +static const complexf_t v17_v32bis_9600_constellation[32] = +#endif +{ + {-8, 2}, /* 0x00 */ + {-6, -4}, /* 0x01 */ + {-4, 6}, /* 0x02 */ + { 2, 8}, /* 0x03 */ + { 8, -2}, /* 0x04 */ + { 6, 4}, /* 0x05 */ + { 4, -6}, /* 0x06 */ + {-2, -8}, /* 0x07 */ + { 0, 2}, /* 0x08 */ + {-6, 4}, /* 0x09 */ + { 4, 6}, /* 0x0A */ + { 2, 0}, /* 0x0B */ + { 0, -2}, /* 0x0C */ + { 6, -4}, /* 0x0D */ + {-4, -6}, /* 0x0E */ + {-2, 0}, /* 0x0F */ + { 0, -6}, /* 0x10 */ + { 2, -4}, /* 0x11 */ + {-4, -2}, /* 0x12 */ + {-6, 0}, /* 0x13 */ + { 0, 6}, /* 0x14 */ + {-2, 4}, /* 0x15 */ + { 4, 2}, /* 0x16 */ + { 6, 0}, /* 0x17 */ + { 8, 2}, /* 0x18 */ + { 2, 4}, /* 0x19 */ + { 4, -2}, /* 0x1A */ + { 2, -8}, /* 0x1B */ + {-8, -2}, /* 0x1C */ + {-2, -4}, /* 0x1D */ + {-4, 2}, /* 0x1E */ + {-2, 8} /* 0x1F */ +}; + +#if defined(SPANDSP_USE_FIXED_POINTx) +static const complexi16_t v17_v32bis_7200_constellation[16] = +#else +static const complexf_t v17_v32bis_7200_constellation[16] = +#endif +{ + { 6, -6}, /* 0x00 */ + {-2, 6}, /* 0x01 */ + { 6, 2}, /* 0x02 */ + {-6, -6}, /* 0x03 */ + {-6, 6}, /* 0x04 */ + { 2, -6}, /* 0x05 */ + {-6, -2}, /* 0x06 */ + { 6, 6}, /* 0x07 */ + {-2, 2}, /* 0x08 */ + { 6, -2}, /* 0x09 */ + {-2, -6}, /* 0x0A */ + { 2, 2}, /* 0x0B */ + { 2, -2}, /* 0x0C */ + {-6, 2}, /* 0x0D */ + { 2, 6}, /* 0x0E */ + {-2, -2} /* 0x0F */ +}; + +/* This one does not exist in V.17 as a data constellation. It is only + the equaliser training constellation. In V.32/V.32bis it is a data mode. */ +#if defined(SPANDSP_USE_FIXED_POINTx) +static const complexi16_t v17_v32bis_4800_constellation[4] = +#else +static const complexf_t v17_v32bis_4800_constellation[4] = +#endif +{ + {-6, -2}, /* 0x00 */ + {-2, 6}, /* 0x01 */ + { 2, -6}, /* 0x02 */ + { 6, 2} /* 0x03 */ +}; + +#if defined(SPANDSP_USE_FIXED_POINTx) +static const complexi16_t v17_v32bis_abcd_constellation[4] = +#else +static const complexf_t v17_v32bis_abcd_constellation[4] = +#endif +{ + {-6, -2}, /* A */ + { 2, -6}, /* B */ + { 6, 2}, /* C */ + {-2, 6} /* D */ +}; + +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/v17rx.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/v17rx.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1462 @@ +#define IAXMODEM_STUFF +/* + * SpanDSP - a series of DSP components for telephony + * + * v17rx.c - ITU V.17 modem receive part + * + * Written by Steve Underwood + * + * Copyright (C) 2004, 2005, 2006, 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v17rx.c,v 1.153.4.6 2009/12/28 12:20:46 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/complex.h" +#include "spandsp/vector_float.h" +#include "spandsp/complex_vector_float.h" +#include "spandsp/vector_int.h" +#include "spandsp/complex_vector_int.h" +#include "spandsp/async.h" +#include "spandsp/power_meter.h" +#include "spandsp/arctan2.h" +#include "spandsp/dds.h" +#include "spandsp/complex_filters.h" + +#include "spandsp/v29rx.h" +#include "spandsp/v17tx.h" +#include "spandsp/v17rx.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/v17rx.h" + +#include "v17_v32bis_tx_constellation_maps.h" +#include "v17_v32bis_rx_constellation_maps.h" +#if defined(SPANDSP_USE_FIXED_POINT) +#include "v17_v32bis_rx_fixed_rrc.h" +#else +#include "v17_v32bis_rx_floating_rrc.h" +#endif + +/*! The nominal frequency of the carrier, in Hertz */ +#define CARRIER_NOMINAL_FREQ 1800.0f +/*! The nominal baud or symbol rate */ +#define BAUD_RATE 2400 +/*! The adaption rate coefficient for the equalizer during initial training */ +#define EQUALIZER_DELTA 0.21f +/*! The adaption rate coefficient for the equalizer during continuous fine tuning */ +#define EQUALIZER_SLOW_ADAPT_RATIO 0.1f + +/* Segments of the training sequence */ +/*! The length of training segment 1, in symbols */ +#define V17_TRAINING_SEG_1_LEN 256 +/*! The length of training segment 2 in long training mode, in symbols */ +#define V17_TRAINING_SEG_2_LEN 2976 +/*! The length of training segment 2 in short training mode, in symbols */ +#define V17_TRAINING_SHORT_SEG_2_LEN 38 +/*! The length of training segment 3, in symbols */ +#define V17_TRAINING_SEG_3_LEN 64 +/*! The length of training segment 4A, in symbols */ +#define V17_TRAINING_SEG_4A_LEN 15 +/*! The length of training segment 4, in symbols */ +#define V17_TRAINING_SEG_4_LEN 48 + +/*! The 16 bit pattern used in the bridge section of the training sequence */ +#define V17_BRIDGE_WORD 0x8880 + +/*! The length of the equalizer buffer */ +#define V17_EQUALIZER_LEN (V17_EQUALIZER_PRE_LEN + 1 + V17_EQUALIZER_POST_LEN) + +enum +{ + TRAINING_STAGE_NORMAL_OPERATION = 0, + TRAINING_STAGE_SYMBOL_ACQUISITION, + TRAINING_STAGE_LOG_PHASE, + TRAINING_STAGE_SHORT_WAIT_FOR_CDBA, + TRAINING_STAGE_WAIT_FOR_CDBA, + TRAINING_STAGE_COARSE_TRAIN_ON_CDBA, + TRAINING_STAGE_FINE_TRAIN_ON_CDBA, + TRAINING_STAGE_SHORT_TRAIN_ON_CDBA_AND_TEST, + TRAINING_STAGE_TRAIN_ON_CDBA_AND_TEST, + TRAINING_STAGE_BRIDGE, + TRAINING_STAGE_TCM_WINDUP, + TRAINING_STAGE_TEST_ONES, + TRAINING_STAGE_PARKED +}; + +/* Coefficients for the band edge symbol timing synchroniser (alpha = 0.99) */ +/* low_edge = 2.0f*M_PI*(CARRIER_NOMINAL_FREQ - BAUD_RATE/2.0f)/SAMPLE_RATE; */ +/* high_edge = 2.0f*M_PI*(CARRIER_NOMINAL_FREQ + BAUD_RATE/2.0f)/SAMPLE_RATE; */ +#define SIN_LOW_BAND_EDGE 0.453990499f +#define COS_LOW_BAND_EDGE 0.891006542f +#define SIN_HIGH_BAND_EDGE 0.707106781f +#define COS_HIGH_BAND_EDGE -0.707106781f +#define ALPHA 0.99f + +#if defined(SPANDSP_USE_FIXED_POINTx) +#define SYNC_LOW_BAND_EDGE_COEFF_0 ((int)(FP_FACTOR*(2.0f*ALPHA*COS_LOW_BAND_EDGE))) +#define SYNC_LOW_BAND_EDGE_COEFF_1 ((int)(FP_FACTOR*(-ALPHA*ALPHA))) +#define SYNC_LOW_BAND_EDGE_COEFF_2 ((int)(FP_FACTOR*(-ALPHA*SIN_LOW_BAND_EDGE))) +#define SYNC_HIGH_BAND_EDGE_COEFF_0 ((int)(FP_FACTOR*(2.0f*ALPHA*COS_HIGH_BAND_EDGE))) +#define SYNC_HIGH_BAND_EDGE_COEFF_1 ((int)(FP_FACTOR*(-ALPHA*ALPHA))) +#define SYNC_HIGH_BAND_EDGE_COEFF_2 ((int)(FP_FACTOR*(-ALPHA*SIN_HIGH_BAND_EDGE))) +#define SYNC_MIXED_EDGES_COEFF_3 ((int)(FP_FACTOR*(-ALPHA*ALPHA*(SIN_HIGH_BAND_EDGE*COS_LOW_BAND_EDGE - SIN_LOW_BAND_EDGE*COS_HIGH_BAND_EDGE)))) +#else +#define SYNC_LOW_BAND_EDGE_COEFF_0 (2.0f*ALPHA*COS_LOW_BAND_EDGE) +#define SYNC_LOW_BAND_EDGE_COEFF_1 (-ALPHA*ALPHA) +#define SYNC_LOW_BAND_EDGE_COEFF_2 (-ALPHA*SIN_LOW_BAND_EDGE) +#define SYNC_HIGH_BAND_EDGE_COEFF_0 (2.0f*ALPHA*COS_HIGH_BAND_EDGE) +#define SYNC_HIGH_BAND_EDGE_COEFF_1 (-ALPHA*ALPHA) +#define SYNC_HIGH_BAND_EDGE_COEFF_2 (-ALPHA*SIN_HIGH_BAND_EDGE) +#define SYNC_MIXED_EDGES_COEFF_3 (-ALPHA*ALPHA*(SIN_HIGH_BAND_EDGE*COS_LOW_BAND_EDGE - SIN_LOW_BAND_EDGE*COS_HIGH_BAND_EDGE)) +#endif + +#if defined(SPANDSP_USE_FIXED_POINTx) +static const int constellation_spacing[4] = +{ + ((int)(FP_FACTOR*1.414f), + ((int)(FP_FACTOR*2.0f)}, + ((int)(FP_FACTOR*2.828f)}, + ((int)(FP_FACTOR*4.0f)}, +}; +#else +static const float constellation_spacing[4] = +{ + 1.414f, + 2.0f, + 2.828f, + 4.0f +}; +#endif + +SPAN_DECLARE(float) v17_rx_carrier_frequency(v17_rx_state_t *s) +{ + return dds_frequencyf(s->carrier_phase_rate); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) v17_rx_symbol_timing_correction(v17_rx_state_t *s) +{ + return (float) s->total_baud_timing_correction/((float) RX_PULSESHAPER_COEFF_SETS*10.0f/3.0f); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) v17_rx_signal_power(v17_rx_state_t *s) +{ + return power_meter_current_dbm0(&s->power) + 3.98f; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v17_rx_signal_cutoff(v17_rx_state_t *s, float cutoff) +{ + /* The 0.4 factor allows for the gain of the DC blocker */ + s->carrier_on_power = (int32_t) (power_meter_level_dbm0(cutoff + 2.5f)*0.4f); + s->carrier_off_power = (int32_t) (power_meter_level_dbm0(cutoff - 2.5f)*0.4f); +} +/*- End of function --------------------------------------------------------*/ + +static void report_status_change(v17_rx_state_t *s, int status) +{ + if (s->status_handler) + s->status_handler(s->status_user_data, status); + else if (s->put_bit) + s->put_bit(s->put_bit_user_data, status); +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINTx) +SPAN_DECLARE(int) v17_rx_equalizer_state(v17_rx_state_t *s, complexi16_t **coeffs) +#else +SPAN_DECLARE(int) v17_rx_equalizer_state(v17_rx_state_t *s, complexf_t **coeffs) +#endif +{ + *coeffs = s->eq_coeff; + return V17_EQUALIZER_LEN; +} +/*- End of function --------------------------------------------------------*/ + +static void equalizer_save(v17_rx_state_t *s) +{ +#if defined(SPANDSP_USE_FIXED_POINTx) + cvec_copyi16(s->eq_coeff_save, s->eq_coeff, V17_EQUALIZER_LEN); +#else + cvec_copyf(s->eq_coeff_save, s->eq_coeff, V17_EQUALIZER_LEN); +#endif +} +/*- End of function --------------------------------------------------------*/ + +static void equalizer_restore(v17_rx_state_t *s) +{ +#if defined(SPANDSP_USE_FIXED_POINTx) + cvec_copyi16(s->eq_coeff, s->eq_coeff_save, V17_EQUALIZER_LEN); + cvec_zeroi16(s->eq_buf, V17_EQUALIZER_LEN); + s->eq_delta = 32768.0f*EQUALIZER_SLOW_ADAPT_RATIO*EQUALIZER_DELTA/V17_EQUALIZER_LEN; +#else + cvec_copyf(s->eq_coeff, s->eq_coeff_save, V17_EQUALIZER_LEN); + cvec_zerof(s->eq_buf, V17_EQUALIZER_LEN); + s->eq_delta = EQUALIZER_SLOW_ADAPT_RATIO*EQUALIZER_DELTA/V17_EQUALIZER_LEN; +#endif + + s->eq_put_step = RX_PULSESHAPER_COEFF_SETS*10/(3*2) - 1; + s->eq_step = 0; +} +/*- End of function --------------------------------------------------------*/ + +static void equalizer_reset(v17_rx_state_t *s) +{ + /* Start with an equalizer based on everything being perfect */ +#if defined(SPANDSP_USE_FIXED_POINTx) + cvec_zeroi16(s->eq_coeff, V17_EQUALIZER_LEN); + s->eq_coeff[V17_EQUALIZER_PRE_LEN] = complex_seti16(3*FP_FACTOR, 0); + cvec_zeroi16(s->eq_buf, V17_EQUALIZER_LEN); + s->eq_delta = 32768.0f*EQUALIZER_DELTA/V17_EQUALIZER_LEN; +#else + cvec_zerof(s->eq_coeff, V17_EQUALIZER_LEN); + s->eq_coeff[V17_EQUALIZER_PRE_LEN] = complex_setf(3.0f, 0.0f); + cvec_zerof(s->eq_buf, V17_EQUALIZER_LEN); + s->eq_delta = EQUALIZER_DELTA/V17_EQUALIZER_LEN; +#endif + + s->eq_put_step = RX_PULSESHAPER_COEFF_SETS*10/(3*2) - 1; + s->eq_step = 0; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINTx) +static __inline__ complexi16_t equalizer_get(v17_rx_state_t *s) +#else +static __inline__ complexf_t equalizer_get(v17_rx_state_t *s) +#endif +{ + return cvec_circular_dot_prodf(s->eq_buf, s->eq_coeff, V17_EQUALIZER_LEN, s->eq_step); +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINTx) +static void tune_equalizer(v17_rx_state_t *s, const complexi16_t *z, const complexi16_t *target) +{ + complexi16_t err; + + /* Find the x and y mismatch from the exact constellation position. */ + err.re = target->re*FP_FACTOR - z->re; + err.im = target->im*FP_FACTOR - z->im; + //span_log(&s->logging, SPAN_LOG_FLOW, "Equalizer error %f\n", sqrt(err.re*err.re + err.im*err.im)); + err.re = ((int32_t) err.re*(int32_t) s->eq_delta) >> 15; + err.im = ((int32_t) err.im*(int32_t) s->eq_delta) >> 15; + cvec_circular_lmsi16(s->eq_buf, s->eq_coeff, V17_EQUALIZER_LEN, s->eq_step, &err); +} +#else +static void tune_equalizer(v17_rx_state_t *s, const complexf_t *z, const complexf_t *target) +{ + complexf_t err; + + /* Find the x and y mismatch from the exact constellation position. */ + err = complex_subf(target, z); + //span_log(&s->logging, SPAN_LOG_FLOW, "Equalizer error %f\n", sqrt(err.re*err.re + err.im*err.im)); + err.re *= s->eq_delta; + err.im *= s->eq_delta; + cvec_circular_lmsf(s->eq_buf, s->eq_coeff, V17_EQUALIZER_LEN, s->eq_step, &err); +} +#endif + +static int descramble(v17_rx_state_t *s, int in_bit) +{ + int out_bit; + + //out_bit = (in_bit ^ (s->scramble_reg >> s->scrambler_tap) ^ (s->scramble_reg >> (23 - 1))) & 1; + out_bit = (in_bit ^ (s->scramble_reg >> (18 - 1)) ^ (s->scramble_reg >> (23 - 1))) & 1; + s->scramble_reg <<= 1; + if (s->training_stage > TRAINING_STAGE_NORMAL_OPERATION && s->training_stage < TRAINING_STAGE_TCM_WINDUP) + s->scramble_reg |= out_bit; + else + s->scramble_reg |= (in_bit & 1); + return out_bit; +} +/*- End of function --------------------------------------------------------*/ + +static void track_carrier(v17_rx_state_t *s, const complexf_t *z, const complexf_t *target) +{ + float error; + + /* For small errors the imaginary part of the difference between the actual and the target + positions is proportional to the phase error, for any particular target. However, the + different amplitudes of the various target positions scale things. */ + error = z->im*target->re - z->re*target->im; + + s->carrier_phase_rate += (int32_t) (s->carrier_track_i*error); + s->carrier_phase += (int32_t) (s->carrier_track_p*error); + //span_log(&s->logging, SPAN_LOG_FLOW, "Im = %15.5f f = %15.5f\n", error, dds_frequencyf(s->carrier_phase_rate)); + //printf("XXX Im = %15.5f f = %15.5f %f %f %f %f (%f %f)\n", error, dds_frequencyf(s->carrier_phase_rate), target->re, target->im, z->re, z->im, s->carrier_track_i, s->carrier_track_p); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void put_bit(v17_rx_state_t *s, int bit) +{ + int out_bit; + + /* We need to strip the last part of the training - the test period of all 1s - + before we let data go to the application. */ + if (s->training_stage == TRAINING_STAGE_NORMAL_OPERATION) + { + out_bit = descramble(s, bit); + s->put_bit(s->put_bit_user_data, out_bit); + } + else if (s->training_stage == TRAINING_STAGE_TEST_ONES) + { + /* The bits during the final stage of training should be all ones. However, + buggy modems mean you cannot rely on this. Therefore we don't bother + testing for ones, but just rely on a constellation mismatch measurement. */ + out_bit = descramble(s, bit); + //span_log(&s->logging, SPAN_LOG_FLOW, "A 1 is really %d\n", out_bit); + } +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINTx) +static __inline__ uint32_t dist_sq(const complexi_t *x, const complexi_t *y) +{ + return (x->re - y->re)*(x->re - y->re) + (x->im - y->im)*(x->im - y->im); +} +/*- End of function --------------------------------------------------------*/ +#else +static __inline__ float dist_sq(const complexf_t *x, const complexf_t *y) +{ + return (x->re - y->re)*(x->re - y->re) + (x->im - y->im)*(x->im - y->im); +} +/*- End of function --------------------------------------------------------*/ +#endif + +static int decode_baud(v17_rx_state_t *s, complexf_t *z) +{ + static const uint8_t v32bis_4800_differential_decoder[4][4] = + { + {2, 3, 0, 1}, + {0, 2, 1, 3}, + {3, 1, 2, 0}, + {1, 0, 3, 2} + }; + static const uint8_t v17_differential_decoder[4][4] = + { + {0, 1, 2, 3}, + {3, 0, 1, 2}, + {2, 3, 0, 1}, + {1, 2, 3, 0} + }; + static const uint8_t tcm_paths[8][4] = + { + {0, 6, 2, 4}, + {6, 0, 4, 2}, + {2, 4, 0, 6}, + {4, 2, 6, 0}, + {1, 3, 7, 5}, + {5, 7, 3, 1}, + {7, 5, 1, 3}, + {3, 1, 5, 7} + }; + int nearest; + int i; + int j; + int k; + int re; + int im; + int raw; + int constellation_state; +#if defined(SPANDSP_USE_FIXED_POINTx) +#define DIST_FACTOR 2048 /* Something less than sqrt(0xFFFFFFFF/10)/10 */ + complexi_t zi; + uint32_t distances[8]; + uint32_t new_distances[8]; + uint32_t min; + complexi_t ci; +#else + float distances[8]; + float new_distances[8]; + float min; +#endif + + re = (int) ((z->re + 9.0f)*2.0f); + if (re > 35) + re = 35; + else if (re < 0) + re = 0; + im = (int) ((z->im + 9.0f)*2.0f); + if (im > 35) + im = 35; + else if (im < 0) + im = 0; + + if (s->bits_per_symbol == 2) + { + /* 4800bps V.32bis mode, without trellis coding */ + nearest = constel_map_4800[re][im]; + raw = v32bis_4800_differential_decoder[s->diff][nearest]; + s->diff = nearest; + put_bit(s, raw); + put_bit(s, raw >> 1); + return nearest; + } + + /* Find a set of 8 candidate constellation positions, that are the closest + to the target, with different patterns in the last 3 bits. */ +#if defined(SPANDSP_USE_FIXED_POINTx) + min = 0xFFFFFFFF; + zi = complex_seti(z->re*DIST_FACTOR, z->im*DIST_FACTOR); +#else + min = 9999999.0f; +#endif + j = 0; + for (i = 0; i < 8; i++) + { + nearest = constel_maps[s->space_map][re][im][i]; +#if defined(SPANDSP_USE_FIXED_POINTx) + ci = complex_seti(s->constellation[nearest].re*DIST_FACTOR, + s->constellation[nearest].im*DIST_FACTOR); + distances[i] = dist_sq(&ci, &zi); +#else + distances[i] = dist_sq(&s->constellation[nearest], z); +#endif + if (min > distances[i]) + { + min = distances[i]; + j = i; + } + } + /* Use the nearest of these soft-decisions as the basis for DFE */ + constellation_state = constel_maps[s->space_map][re][im][j]; + /* Control the equalizer, carrier tracking, etc. based on the non-trellis + corrected information. The trellis correct stuff comes out a bit late. */ + track_carrier(s, z, &s->constellation[constellation_state]); + //tune_equalizer(s, z, &s->constellation[constellation_state]); + + /* Now do the trellis decoding */ + + /* TODO: change to processing blocks of stored symbols here, instead of processing + one symbol at a time, to speed up the processing. */ + + /* Update the minimum accumulated distance to each of the 8 states */ + if (++s->trellis_ptr >= V17_TRELLIS_STORAGE_DEPTH) + s->trellis_ptr = 0; + for (i = 0; i < 4; i++) + { + min = distances[tcm_paths[i][0]] + s->distances[0]; + k = 0; + for (j = 1; j < 4; j++) + { + if (min > distances[tcm_paths[i][j]] + s->distances[j << 1]) + { + min = distances[tcm_paths[i][j]] + s->distances[j << 1]; + k = j; + } + } + /* Use an elementary IIR filter to track the distance to date. */ +#if defined(SPANDSP_USE_FIXED_POINTx) + new_distances[i] = s->distances[k << 1]*9/10 + distances[tcm_paths[i][k]]*1/10; +#else + new_distances[i] = s->distances[k << 1]*0.9f + distances[tcm_paths[i][k]]*0.1f; +#endif + s->full_path_to_past_state_locations[s->trellis_ptr][i] = constel_maps[s->space_map][re][im][tcm_paths[i][k]]; + s->past_state_locations[s->trellis_ptr][i] = k << 1; + } + for (i = 4; i < 8; i++) + { + min = distances[tcm_paths[i][0]] + s->distances[1]; + k = 0; + for (j = 1; j < 4; j++) + { + if (min > distances[tcm_paths[i][j]] + s->distances[(j << 1) + 1]) + { + min = distances[tcm_paths[i][j]] + s->distances[(j << 1) + 1]; + k = j; + } + } +#if defined(SPANDSP_USE_FIXED_POINTx) + new_distances[i] = s->distances[(k << 1) + 1]*9/10 + distances[tcm_paths[i][k]]*1/10; +#else + new_distances[i] = s->distances[(k << 1) + 1]*0.9f + distances[tcm_paths[i][k]]*0.1f; +#endif + s->full_path_to_past_state_locations[s->trellis_ptr][i] = constel_maps[s->space_map][re][im][tcm_paths[i][k]]; + s->past_state_locations[s->trellis_ptr][i] = (k << 1) + 1; + } + memcpy(s->distances, new_distances, sizeof(s->distances)); + + /* Find the minimum distance to date. This is the start of the path back to the result. */ + min = s->distances[0]; + k = 0; + for (i = 1; i < 8; i++) + { + if (min > s->distances[i]) + { + min = s->distances[i]; + k = i; + } + } + /* Trace back through every time step, starting with the current one, and find the + state from which the path came one step before. At the end of this search, the + last state found also points to the constellation point at that state. This is the + output of the trellis. */ + for (i = 0, j = s->trellis_ptr; i < V17_TRELLIS_LOOKBACK_DEPTH - 1; i++) + { + k = s->past_state_locations[j][k]; + if (--j < 0) + j = V17_TRELLIS_STORAGE_DEPTH - 1; + } + nearest = s->full_path_to_past_state_locations[j][k] >> 1; + + /* Differentially decode */ + raw = (nearest & 0x3C) | v17_differential_decoder[s->diff][nearest & 0x03]; + s->diff = nearest & 0x03; + for (i = 0; i < s->bits_per_symbol; i++) + { + put_bit(s, raw); + raw >>= 1; + } + return constellation_state; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void symbol_sync(v17_rx_state_t *s) +{ + int i; +#if defined(SPANDSP_USE_FIXED_POINTx) + int32_t v; + int32_t p; +#else + float v; + float p; +#endif + + /* This routine adapts the position of the half baud samples entering the equalizer. */ + + /* This symbol sync scheme is based on the technique first described by Dominique Godard in + Passband Timing Recovery in an All-Digital Modem Receiver + IEEE TRANSACTIONS ON COMMUNICATIONS, VOL. COM-26, NO. 5, MAY 1978 */ + + /* This is slightly rearranged for figure 3b of the Godard paper, as this saves a couple of + maths operations */ +#if defined(SPANDSP_USE_FIXED_POINTx) + /* TODO: The scalings used here need more thorough evaluation, to see if overflows are possible. */ + /* Cross correlate */ + v = (((s->symbol_sync_low[1] >> 5)*(s->symbol_sync_high[0] >> 4)) >> 15)*SYNC_LOW_BAND_EDGE_COEFF_2 + - (((s->symbol_sync_low[0] >> 5)*(s->symbol_sync_high[1] >> 4)) >> 15)*SYNC_HIGH_BAND_EDGE_COEFF_2 + + (((s->symbol_sync_low[1] >> 5)*(s->symbol_sync_high[1] >> 4)) >> 15)*SYNC_MIXED_EDGES_COEFF_3; + /* Filter away any DC component */ + p = v - s->symbol_sync_dc_filter[1]; + s->symbol_sync_dc_filter[1] = s->symbol_sync_dc_filter[0]; + s->symbol_sync_dc_filter[0] = v; + /* A little integration will now filter away much of the HF noise */ + s->baud_phase -= p; + if (abs(s->baud_phase) > 100*FP_FACTOR) + { + if (s->baud_phase > 0) + i = (s->baud_phase > 1000*FP_FACTOR) ? 15 : 1; + else + i = (s->baud_phase < -1000*FP_FACTOR) ? -15 : -1; + //printf("v = %10.5f %5d - %f %f %d %d\n", v, i, p, s->baud_phase, s->total_baud_timing_correction); + s->eq_put_step += i; + s->total_baud_timing_correction += i; + } +#else + /* Cross correlate */ + v = s->symbol_sync_low[1]*s->symbol_sync_high[0]*SYNC_LOW_BAND_EDGE_COEFF_2 + - s->symbol_sync_low[0]*s->symbol_sync_high[1]*SYNC_HIGH_BAND_EDGE_COEFF_2 + + s->symbol_sync_low[1]*s->symbol_sync_high[1]*SYNC_MIXED_EDGES_COEFF_3; + /* Filter away any DC component */ + p = v - s->symbol_sync_dc_filter[1]; + s->symbol_sync_dc_filter[1] = s->symbol_sync_dc_filter[0]; + s->symbol_sync_dc_filter[0] = v; + /* A little integration will now filter away much of the HF noise */ + s->baud_phase -= p; + if (fabsf(s->baud_phase) > 100.0f) + { + if (s->baud_phase > 0.0f) + i = (s->baud_phase > 1000.0f) ? 15 : 1; + else + i = (s->baud_phase < -1000.0f) ? -15 : -1; + //printf("v = %10.5f %5d - %f %f %d\n", v, i, p, s->baud_phase, s->total_baud_timing_correction); + s->eq_put_step += i; + s->total_baud_timing_correction += i; + } +#endif +} +/*- End of function --------------------------------------------------------*/ + +static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample) +{ + static const complexf_t cdba[4] = + { + { 6.0f, 2.0f}, + {-2.0f, 6.0f}, + { 2.0f, -6.0f}, + {-6.0f, -2.0f} + }; + complexf_t z; + complexf_t zz; +#if defined(SPANDSP_USE_FIXED_POINTx) + const complexi_t *target; + static const complexi16_t zero = {0, 0}; +#else + const complexf_t *target; + static const complexf_t zero = {0, 0}; +#endif + float p; + int bit; + int i; + int j; + int32_t angle; + int32_t ang; + int constellation_state; + + /* This routine processes every half a baud, as we put things into the equalizer at the T/2 rate. */ + + /* Add a sample to the equalizer's circular buffer, but don't calculate anything at this time. */ + s->eq_buf[s->eq_step] = *sample; + if (++s->eq_step >= V17_EQUALIZER_LEN) + s->eq_step = 0; + + /* On alternate insertions we have a whole baud and must process it. */ + if ((s->baud_half ^= 1)) + return; + + /* Symbol timing synchronisation */ + symbol_sync(s); + + z = equalizer_get(s); + + constellation_state = 0; + switch (s->training_stage) + { + case TRAINING_STAGE_NORMAL_OPERATION: + /* Normal operation. */ + constellation_state = decode_baud(s, &z); + target = &s->constellation[constellation_state]; + break; + case TRAINING_STAGE_SYMBOL_ACQUISITION: + /* Allow time for the symbol synchronisation to settle the symbol timing. */ + target = &zero; + if (++s->training_count >= 100) + { + /* Record the current phase angle */ + s->angles[0] = + s->start_angles[0] = arctan2(z.im, z.re); + s->training_stage = TRAINING_STAGE_LOG_PHASE; + if (s->agc_scaling_save == 0.0f) + s->agc_scaling_save = s->agc_scaling; + } + break; + case TRAINING_STAGE_LOG_PHASE: + /* Record the current alternate phase angle */ + target = &zero; + angle = arctan2(z.im, z.re); + s->training_count = 1; + if (s->short_train) + { + /* We should already know the accurate carrier frequency. All we need to sort + out is the phase. */ + /* Check if we just saw A or B */ + if ((uint32_t) (angle - s->start_angles[0]) < 0x80000000U) + { + angle = s->start_angles[0]; + s->angles[0] = 0xC0000000 + 219937506; + s->angles[1] = 0x80000000 + 219937506; + } + else + { + s->angles[0] = 0x80000000 + 219937506; + s->angles[1] = 0xC0000000 + 219937506; + } + /* Make a step shift in the phase, to pull it into line. We need to rotate the equalizer + buffer, as well as the carrier phase, for this to play out nicely. */ + /* angle is now the difference between where A is, and where it should be */ + p = 3.14159f + angle*2.0f*3.14159f/(65536.0f*65536.0f) - 0.321751f; + span_log(&s->logging, SPAN_LOG_FLOW, "Spin (short) by %.5f rads\n", p); + zz = complex_setf(cosf(p), -sinf(p)); + for (i = 0; i < V17_EQUALIZER_LEN; i++) + s->eq_buf[i] = complex_mulf(&s->eq_buf[i], &zz); + s->carrier_phase += (0x80000000 + angle - 219937506); + + s->carrier_track_p = 500000.0f; + + s->training_stage = TRAINING_STAGE_SHORT_WAIT_FOR_CDBA; + } + else + { + s->angles[1] = + s->start_angles[1] = angle; + s->training_stage = TRAINING_STAGE_WAIT_FOR_CDBA; + } + break; + case TRAINING_STAGE_WAIT_FOR_CDBA: + target = &zero; + angle = arctan2(z.im, z.re); + /* Look for the initial ABAB sequence to display a phase reversal, which will + signal the start of the scrambled CDBA segment */ + ang = angle - s->angles[(s->training_count - 1) & 0xF]; + s->angles[(s->training_count + 1) & 0xF] = angle; + + /* Do a coarse frequency adjustment about half way through the reversals, as if we wait until + the end, we might have rotated too far to correct properly. */ + if (s->training_count == 100) + { + i = s->training_count; + /* Avoid the possibility of a divide by zero */ + if (i) + { + j = i & 0xF; + ang = (s->angles[j] - s->start_angles[0])/i + + (s->angles[j | 0x1] - s->start_angles[1])/i; + s->carrier_phase_rate += 3*(ang/20); + //span_log(&s->logging, SPAN_LOG_FLOW, "Angles %x, %x, %x, %x, dist %d\n", s->angles[j], s->start_angles[0], s->angles[j | 0x1], s->start_angles[1], i); + + s->start_angles[0] = s->angles[j]; + s->start_angles[1] = s->angles[j | 0x1]; + } + //span_log(&s->logging, SPAN_LOG_FLOW, "%d %d %d %d %d\n", s->angles[s->training_count & 0xF], s->start_angles[0], s->angles[(s->training_count | 0x1) & 0xF], s->start_angles[1], s->training_count); + span_log(&s->logging, SPAN_LOG_FLOW, "First coarse carrier frequency %7.2f (%d)\n", dds_frequencyf(s->carrier_phase_rate), s->training_count); + + } + if ((ang > 0x40000000 || ang < -0x40000000) && s->training_count >= 13) + { + span_log(&s->logging, SPAN_LOG_FLOW, "We seem to have a reversal at symbol %d\n", s->training_count); + /* We seem to have a phase reversal */ + /* Slam the carrier frequency into line, based on the total phase drift over the last + section. Use the shift from the odd bits and the shift from the even bits to get + better jitter suppression. */ + /* TODO: We are supposed to deal with frequancy errors up to +-8Hz. Over 200+ + symbols that is more than half a cycle. We get confused an do crazy things. + We can only cope with errors up to 5Hz right now. We need to implement + greater tolerance to be compliant, although it doesn't really matter much + these days. */ + /* Step back a few symbols so we don't get ISI distorting things. */ + i = (s->training_count - 8) & ~1; + /* Avoid the possibility of a divide by zero */ + if (i - 100 + 8) + { + j = i & 0xF; + ang = (s->angles[j] - s->start_angles[0])/(i - 100 + 8) + + (s->angles[j | 0x1] - s->start_angles[1])/(i - 100 + 8); + s->carrier_phase_rate += 3*(ang/20); + span_log(&s->logging, SPAN_LOG_FLOW, "Angles %x, %x, %x, %x, dist %d\n", s->angles[j], s->start_angles[0], s->angles[j | 0x1], s->start_angles[1], i); + } + //span_log(&s->logging, SPAN_LOG_FLOW, "%d %d %d %d %d\n", s->angles[s->training_count & 0xF], s->start_angles[0], s->angles[(s->training_count | 0x1) & 0xF], s->start_angles[1], s->training_count); + span_log(&s->logging, SPAN_LOG_FLOW, "Second coarse carrier frequency %7.2f (%d)\n", dds_frequencyf(s->carrier_phase_rate), s->training_count); + /* Check if the carrier frequency is plausible */ + if (s->carrier_phase_rate < dds_phase_ratef(CARRIER_NOMINAL_FREQ - 20.0f) + || + s->carrier_phase_rate > dds_phase_ratef(CARRIER_NOMINAL_FREQ + 20.0f)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (sequence failed)\n"); + /* Park this modem */ + s->agc_scaling_save = 0.0f; + s->training_stage = TRAINING_STAGE_PARKED; + report_status_change(s, SIG_STATUS_TRAINING_FAILED); + break; + } + + /* Make a step shift in the phase, to pull it into line. We need to rotate the equalizer buffer, + as well as the carrier phase, for this to play out nicely. */ + /* angle is now the difference between where C is, and where it should be */ + p = angle*2.0f*3.14159f/(65536.0f*65536.0f) - 0.321751f; + span_log(&s->logging, SPAN_LOG_FLOW, "Spin (long) by %.5f rads\n", p); + zz = complex_setf(cosf(p), -sinf(p)); + for (i = 0; i < V17_EQUALIZER_LEN; i++) + s->eq_buf[i] = complex_mulf(&s->eq_buf[i], &zz); + s->carrier_phase += (angle - 219937506); + + /* We have just seen the first symbol of the scrambled sequence, so skip it. */ + bit = descramble(s, 1); + bit = (bit << 1) | descramble(s, 1); + target = &cdba[bit]; + s->training_count = 1; + s->training_stage = TRAINING_STAGE_COARSE_TRAIN_ON_CDBA; + report_status_change(s, SIG_STATUS_TRAINING_IN_PROGRESS); + break; + } + if (++s->training_count > V17_TRAINING_SEG_1_LEN) + { + /* This is bogus. There are not this many bits in this section + of a real training sequence. Note that this might be TEP. */ + span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (sequence failed)\n"); + /* Park this modem */ + s->agc_scaling_save = 0.0f; + s->training_stage = TRAINING_STAGE_PARKED; + report_status_change(s, SIG_STATUS_TRAINING_FAILED); + } + break; + case TRAINING_STAGE_COARSE_TRAIN_ON_CDBA: + /* Train on the scrambled CDBA section. */ + bit = descramble(s, 1); + bit = (bit << 1) | descramble(s, 1); + target = &cdba[bit]; + track_carrier(s, &z, target); + tune_equalizer(s, &z, target); +#if defined(IAXMODEM_STUFF) + zz = complex_subf(&z, target); + s->training_error = powerf(&zz); + if (++s->training_count == V17_TRAINING_SEG_2_LEN - 2000 || s->training_error < 1.0f || s->training_error > 200.0f) +#else + if (++s->training_count == V17_TRAINING_SEG_2_LEN - 2000) +#endif + { + /* Now the equaliser adaption should be getting somewhere, slow it down, or it will never + tune very well on a noisy signal. */ + s->eq_delta *= EQUALIZER_SLOW_ADAPT_RATIO; + s->carrier_track_i = 1000.0f; + s->training_stage = TRAINING_STAGE_FINE_TRAIN_ON_CDBA; + } + break; + case TRAINING_STAGE_FINE_TRAIN_ON_CDBA: + /* Train on the scrambled CDBA section. */ + bit = descramble(s, 1); + bit = (bit << 1) | descramble(s, 1); + target = &cdba[bit]; + /* By this point the training should be comming into focus. */ + track_carrier(s, &z, target); + tune_equalizer(s, &z, target); + if (++s->training_count >= V17_TRAINING_SEG_2_LEN - 48) + { + s->training_error = 0.0f; + s->carrier_track_i = 100.0f; + s->carrier_track_p = 500000.0f; + s->training_stage = TRAINING_STAGE_TRAIN_ON_CDBA_AND_TEST; + } + break; + case TRAINING_STAGE_TRAIN_ON_CDBA_AND_TEST: + /* Continue training on the scrambled CDBA section, but measure the quality of training too. */ + bit = descramble(s, 1); + bit = (bit << 1) | descramble(s, 1); + target = &cdba[bit]; + //span_log(&s->logging, SPAN_LOG_FLOW, "%5d [%15.5f, %15.5f] [%15.5f, %15.5f]\n", s->training_count, z.re, z.im, cdba[bit].re, cdba[bit].im); + /* We ignore the last few symbols because it seems some modems do not end this + part properly, and it throws things off. */ + if (++s->training_count < V17_TRAINING_SEG_2_LEN - 20) + { + track_carrier(s, &z, target); + tune_equalizer(s, &z, target); + /* Measure the training error */ + zz = complex_subf(&z, &cdba[bit]); + s->training_error += powerf(&zz); + } + else if (s->training_count >= V17_TRAINING_SEG_2_LEN) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Long training error %f\n", s->training_error); + if (s->training_error < 20.0f*1.414f*constellation_spacing[s->space_map]) + { + s->training_count = 0; + s->training_error = 0.0f; + s->training_stage = TRAINING_STAGE_BRIDGE; + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (convergence failed)\n"); + /* Park this modem */ + s->agc_scaling_save = 0.0f; + s->training_stage = TRAINING_STAGE_PARKED; + report_status_change(s, SIG_STATUS_TRAINING_FAILED); + } + } + break; + case TRAINING_STAGE_BRIDGE: + descramble(s, V17_BRIDGE_WORD >> ((s->training_count & 0x7) << 1)); + descramble(s, V17_BRIDGE_WORD >> (((s->training_count & 0x7) << 1) + 1)); + target = &z; + if (++s->training_count >= V17_TRAINING_SEG_3_LEN) + { + s->training_count = 0; + s->training_error = 0.0f; + if (s->bits_per_symbol == 2) + { + /* Restart the differential decoder */ + /* There is no trellis, so go straight to processing decoded data */ + s->diff = (s->short_train) ? 0 : 1; + s->training_stage = TRAINING_STAGE_TEST_ONES; + } + else + { + /* Wait for the trellis to wind up */ + s->training_stage = TRAINING_STAGE_TCM_WINDUP; + } + } + break; + case TRAINING_STAGE_SHORT_WAIT_FOR_CDBA: + /* Look for the initial ABAB sequence to display a phase reversal, which will + signal the start of the scrambled CDBA segment */ + angle = arctan2(z.im, z.re); + ang = angle - s->angles[s->training_count & 1]; + if (ang > 0x40000000 || ang < -0x40000000) + { + /* We seem to have a phase reversal */ + /* We have just seen the first symbol of the scrambled sequence, so skip it. */ + bit = descramble(s, 1); + bit = (bit << 1) | descramble(s, 1); + target = &cdba[bit]; + s->training_count = 1; + s->training_error = 0.0f; + s->training_stage = TRAINING_STAGE_SHORT_TRAIN_ON_CDBA_AND_TEST; + break; + } + target = &cdba[(s->training_count & 1) + 2]; + track_carrier(s, &z, target); + if (++s->training_count > V17_TRAINING_SEG_1_LEN) + { + /* This is bogus. There are not this many bits in this section + of a real training sequence. Note that this might be TEP. */ + span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (sequence failed)\n"); + /* Park this modem */ + s->training_stage = TRAINING_STAGE_PARKED; + report_status_change(s, SIG_STATUS_TRAINING_FAILED); + } + break; + case TRAINING_STAGE_SHORT_TRAIN_ON_CDBA_AND_TEST: + /* Short retrain on the scrambled CDBA section, but measure the quality of training too. */ + bit = descramble(s, 1); + bit = (bit << 1) | descramble(s, 1); + //span_log(&s->logging, SPAN_LOG_FLOW, "%5d [%15.5f, %15.5f] [%15.5f, %15.5f] %d\n", s->training_count, z.re, z.im, cdba[bit].re, cdba[bit].im, arctan2(z.im, z.re)); + target = &cdba[bit]; + track_carrier(s, &z, target); + //tune_equalizer(s, &z, target); + /* Measure the training error */ + if (s->training_count > 8) + { + zz = complex_subf(&z, &cdba[bit]); + s->training_error += powerf(&zz); + } + if (++s->training_count >= V17_TRAINING_SHORT_SEG_2_LEN) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Short training error %f\n", s->training_error); + s->carrier_track_i = 100.0f; + s->carrier_track_p = 500000.0f; + /* TODO: This was increased by a factor of 10 after studying real world failures. + However, it is not clear why this is an improvement, If something gives + a huge training error, surely it shouldn't decode too well? */ + if (s->training_error < (V17_TRAINING_SHORT_SEG_2_LEN - 8)*4.0f*constellation_spacing[s->space_map]) + { + s->training_count = 0; + if (s->bits_per_symbol == 2) + { + /* There is no trellis, so go straight to processing decoded data */ + /* Restart the differential decoder */ + s->diff = (s->short_train) ? 0 : 1; + s->training_error = 0.0f; + s->training_stage = TRAINING_STAGE_TEST_ONES; + } + else + { + /* Wait for the trellis to wind up */ + s->training_stage = TRAINING_STAGE_TCM_WINDUP; + } + report_status_change(s, SIG_STATUS_TRAINING_IN_PROGRESS); + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Short training failed (convergence failed)\n"); + /* Park this modem */ + s->training_stage = TRAINING_STAGE_PARKED; + report_status_change(s, SIG_STATUS_TRAINING_FAILED); + } + } + break; + case TRAINING_STAGE_TCM_WINDUP: + /* We need to wait 15 bauds while the trellis fills up. */ + //span_log(&s->logging, SPAN_LOG_FLOW, "%5d %15.5f, %15.5f\n", s->training_count, z.re, z.im); + constellation_state = decode_baud(s, &z); + target = &s->constellation[constellation_state]; + /* Measure the training error */ + zz = complex_subf(&z, target); + s->training_error += powerf(&zz); + if (++s->training_count >= V17_TRAINING_SEG_4A_LEN) + { + s->training_count = 0; + s->training_error = 0.0f; + /* Restart the differential decoder */ + s->diff = (s->short_train) ? 0 : 1; + s->training_stage = TRAINING_STAGE_TEST_ONES; + } + break; + case TRAINING_STAGE_TEST_ONES: + /* We are in the test phase, where we check that we can receive reliably. + We should get a run of 1's, 48 symbols long. */ + //span_log(&s->logging, SPAN_LOG_FLOW, "%5d %15.5f, %15.5f\n", s->training_count, z.re, z.im); + constellation_state = decode_baud(s, &z); + target = &s->constellation[constellation_state]; + /* Measure the training error */ + zz = complex_subf(&z, target); + s->training_error += powerf(&zz); + if (++s->training_count >= V17_TRAINING_SEG_4_LEN) + { + if (s->training_error < V17_TRAINING_SEG_4_LEN*constellation_spacing[s->space_map]) + { + /* We are up and running */ + span_log(&s->logging, SPAN_LOG_FLOW, "Training succeeded at %dbps (constellation mismatch %f)\n", s->bit_rate, s->training_error); + report_status_change(s, SIG_STATUS_TRAINING_SUCCEEDED); + /* Apply some lag to the carrier off condition, to ensure the last few bits get pushed through + the processing. */ + s->signal_present = 60; + equalizer_save(s); + s->carrier_phase_rate_save = s->carrier_phase_rate; + s->short_train = TRUE; + s->training_stage = TRAINING_STAGE_NORMAL_OPERATION; + } + else + { + /* Training has failed */ + span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (constellation mismatch %f)\n", s->training_error); + /* Park this modem */ + if (!s->short_train) + s->agc_scaling_save = 0.0f; + s->training_stage = TRAINING_STAGE_PARKED; + report_status_change(s, SIG_STATUS_TRAINING_FAILED); + } + } + break; + case TRAINING_STAGE_PARKED: + default: + /* We failed to train! */ + /* Park here until the carrier drops. */ + target = &zero; + break; + } + if (s->qam_report) + s->qam_report(s->qam_user_data, &z, target, constellation_state); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int signal_detect(v17_rx_state_t *s, int16_t amp) +{ + int16_t diff; + int16_t x; + int32_t power; + + /* There should be no DC in the signal, but sometimes there is. + We need to measure the power with the DC blocked, but not using + a slow to respond DC blocker. Use the most elementary HPF. */ + x = amp >> 1; + /* There could be overflow here, but it isn't a problem in practice */ + diff = x - s->last_sample; + s->last_sample = x; + power = power_meter_update(&(s->power), diff); +#if defined(IAXMODEM_STUFF) + /* Quick power drop fudge */ + diff = abs(diff); + if (10*diff < s->high_sample) + { + if (++s->low_samples > 120) + { + power_meter_init(&(s->power), 4); + s->high_sample = 0; + s->low_samples = 0; + } + } + else + { + s->low_samples = 0; + if (diff > s->high_sample) + s->high_sample = diff; + } +#endif + if (s->signal_present > 0) + { + /* Look for power below turn-off threshold to turn the carrier off */ +#if defined(IAXMODEM_STUFF) + if (s->carrier_drop_pending || power < s->carrier_off_power) +#else + if (power < s->carrier_off_power) +#endif + { + if (--s->signal_present <= 0) + { + /* Count down a short delay, to ensure we push the last + few bits through the filters before stopping. */ + v17_rx_restart(s, s->bit_rate, s->short_train); + report_status_change(s, SIG_STATUS_CARRIER_DOWN); + return 0; + } +#if defined(IAXMODEM_STUFF) + /* Carrier has dropped, but the put_bit is pending the signal_present delay. */ + s->carrier_drop_pending = TRUE; +#endif + } + } + else + { + /* Look for power exceeding turn-on threshold to turn the carrier on */ + if (power < s->carrier_on_power) + return 0; + s->signal_present = 1; +#if defined(IAXMODEM_STUFF) + s->carrier_drop_pending = FALSE; +#endif + report_status_change(s, SIG_STATUS_CARRIER_UP); + } + return power; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) v17_rx(v17_rx_state_t *s, const int16_t amp[], int len) +{ + int i; + int step; + complexf_t z; + complexf_t zz; + complexf_t sample; +#if defined(SPANDSP_USE_FIXED_POINT) + int32_t vi; +#endif +#if defined(SPANDSP_USE_FIXED_POINTx) + int32_t v; +#else + float v; +#endif + int32_t power; + + for (i = 0; i < len; i++) + { + s->rrc_filter[s->rrc_filter_step] = amp[i]; + if (++s->rrc_filter_step >= V17_RX_FILTER_STEPS) + s->rrc_filter_step = 0; + + if ((power = signal_detect(s, amp[i])) == 0) + continue; + if (s->training_stage == TRAINING_STAGE_PARKED) + continue; + /* Only spend effort processing this data if the modem is not + parked, after training failure. */ + s->eq_put_step -= RX_PULSESHAPER_COEFF_SETS; + step = -s->eq_put_step; + if (step > RX_PULSESHAPER_COEFF_SETS - 1) + step = RX_PULSESHAPER_COEFF_SETS - 1; + if (step < 0) + step += RX_PULSESHAPER_COEFF_SETS; +#if defined(SPANDSP_USE_FIXED_POINT) + vi = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_re[step], V17_RX_FILTER_STEPS, s->rrc_filter_step); + //sample.re = (vi*(int32_t) s->agc_scaling) >> 15; + sample.re = vi*s->agc_scaling; +#else + v = vec_circular_dot_prodf(s->rrc_filter, rx_pulseshaper_re[step], V17_RX_FILTER_STEPS, s->rrc_filter_step); + sample.re = v*s->agc_scaling; +#endif + /* Symbol timing synchronisation band edge filters */ + /* Low Nyquist band edge filter */ + v = s->symbol_sync_low[0]*SYNC_LOW_BAND_EDGE_COEFF_0 + s->symbol_sync_low[1]*SYNC_LOW_BAND_EDGE_COEFF_1 + sample.re; + s->symbol_sync_low[1] = s->symbol_sync_low[0]; + s->symbol_sync_low[0] = v; + /* High Nyquist band edge filter */ + v = s->symbol_sync_high[0]*SYNC_HIGH_BAND_EDGE_COEFF_0 + s->symbol_sync_high[1]*SYNC_HIGH_BAND_EDGE_COEFF_1 + sample.re; + s->symbol_sync_high[1] = s->symbol_sync_high[0]; + s->symbol_sync_high[0] = v; + + /* Put things into the equalization buffer at T/2 rate. The symbol sync. + will fiddle the step to align this with the symbols. */ + if (s->eq_put_step <= 0) + { + /* Only AGC until we have locked down the setting. */ + if (s->agc_scaling_save == 0.0f) + s->agc_scaling = (1.0f/RX_PULSESHAPER_GAIN)*2.17f/sqrtf(power); + /* Pulse shape while still at the carrier frequency, using a quadrature + pair of filters. This results in a properly bandpass filtered complex + signal, which can be brought directly to baseband by complex mixing. + No further filtering, to remove mixer harmonics, is needed. */ + step = -s->eq_put_step; + if (step > RX_PULSESHAPER_COEFF_SETS - 1) + step = RX_PULSESHAPER_COEFF_SETS - 1; + s->eq_put_step += RX_PULSESHAPER_COEFF_SETS*10/(3*2); +#if defined(SPANDSP_USE_FIXED_POINT) + vi = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_im[step], V17_RX_FILTER_STEPS, s->rrc_filter_step); + //sample.im = (vi*(int32_t) s->agc_scaling) >> 15; + sample.im = vi*s->agc_scaling; + z = dds_lookup_complexf(s->carrier_phase); + zz.re = sample.re*z.re - sample.im*z.im; + zz.im = -sample.re*z.im - sample.im*z.re; +#else + v = vec_circular_dot_prodf(s->rrc_filter, rx_pulseshaper_im[step], V17_RX_FILTER_STEPS, s->rrc_filter_step); + sample.im = v*s->agc_scaling; + z = dds_lookup_complexf(s->carrier_phase); + zz.re = sample.re*z.re - sample.im*z.im; + zz.im = -sample.re*z.im - sample.im*z.re; +#endif + process_half_baud(s, &zz); + } +#if defined(SPANDSP_USE_FIXED_POINT) + dds_advance(&s->carrier_phase, s->carrier_phase_rate); +#else + dds_advancef(&s->carrier_phase, s->carrier_phase_rate); +#endif + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v17_rx_fillin(v17_rx_state_t *s, int len) +{ + int i; + + /* We want to sustain the current state (i.e carrier on<->carrier off), and + try to sustain the carrier phase. We should probably push the filters, as well */ + span_log(&s->logging, SPAN_LOG_FLOW, "Fill-in %d samples\n", len); + if (s->signal_present <= 0) + return 0; + if (s->training_stage == TRAINING_STAGE_PARKED) + return 0; + for (i = 0; i < len; i++) + { +#if defined(SPANDSP_USE_FIXED_POINT) + dds_advance(&s->carrier_phase, s->carrier_phase_rate); +#else + dds_advancef(&s->carrier_phase, s->carrier_phase_rate); +#endif + /* Advance the symbol phase the appropriate amount */ + s->eq_put_step -= RX_PULSESHAPER_COEFF_SETS; + if (s->eq_put_step <= 0) + s->eq_put_step += RX_PULSESHAPER_COEFF_SETS*10/(3*2); + /* TODO: Should we rotate any buffers */ + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v17_rx_set_put_bit(v17_rx_state_t *s, put_bit_func_t put_bit, void *user_data) +{ + s->put_bit = put_bit; + s->put_bit_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v17_rx_set_modem_status_handler(v17_rx_state_t *s, modem_tx_status_func_t handler, void *user_data) +{ + s->status_handler = handler; + s->status_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(logging_state_t *) v17_rx_get_logging_state(v17_rx_state_t *s) +{ + return &s->logging; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v17_rx_restart(v17_rx_state_t *s, int bit_rate, int short_train) +{ + int i; + + span_log(&s->logging, SPAN_LOG_FLOW, "Restarting V.17, %dbps, %s training\n", bit_rate, (short_train) ? "short" : "long"); + switch (bit_rate) + { + case 14400: + s->constellation = v17_v32bis_14400_constellation; + s->space_map = 0; + s->bits_per_symbol = 6; + break; + case 12000: + s->constellation = v17_v32bis_12000_constellation; + s->space_map = 1; + s->bits_per_symbol = 5; + break; + case 9600: + s->constellation = v17_v32bis_9600_constellation; + s->space_map = 2; + s->bits_per_symbol = 4; + break; + case 7200: + s->constellation = v17_v32bis_7200_constellation; + s->space_map = 3; + s->bits_per_symbol = 3; + break; + case 4800: + /* This does not exist in the V.17 spec as a valid mode of operation. + However, it does exist in V.32bis, so it is here for completeness. */ + s->constellation = v17_v32bis_4800_constellation; + s->space_map = 0; + s->bits_per_symbol = 2; + break; + default: + return -1; + } + s->bit_rate = bit_rate; +#if defined(SPANDSP_USE_FIXED_POINT) + vec_zeroi16(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); +#else + vec_zerof(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); +#endif + s->rrc_filter_step = 0; + + s->diff = 1; + s->scramble_reg = 0x2ECDD5; + s->training_stage = TRAINING_STAGE_SYMBOL_ACQUISITION; + s->training_count = 0; + s->training_error = 0.0f; + s->signal_present = 0; +#if defined(IAXMODEM_STUFF) + s->high_sample = 0; + s->low_samples = 0; + s->carrier_drop_pending = FALSE; +#endif + if (short_train != 2) + s->short_train = short_train; + memset(s->start_angles, 0, sizeof(s->start_angles)); + memset(s->angles, 0, sizeof(s->angles)); + + /* Initialise the TCM decoder parameters. */ + /* The accumulated distance vectors are set so state zero starts + at a value of zero, and all others start larger. This forces the + initial paths to merge at the zero states. */ + for (i = 0; i < 8; i++) +#if defined(SPANDSP_USE_FIXED_POINTx) + s->distances[i] = 99*DIST_FACTOR*DIST_FACTOR; +#else + s->distances[i] = 99.0f; +#endif + memset(s->full_path_to_past_state_locations, 0, sizeof(s->full_path_to_past_state_locations)); + memset(s->past_state_locations, 0, sizeof(s->past_state_locations)); + s->distances[0] = 0; + s->trellis_ptr = 14; + + span_log(&s->logging, SPAN_LOG_FLOW, "Phase rates %f %f\n", dds_frequencyf(s->carrier_phase_rate), dds_frequencyf(s->carrier_phase_rate_save)); + s->carrier_phase = 0; + power_meter_init(&(s->power), 4); + + if (s->short_train) + { + s->carrier_phase_rate = s->carrier_phase_rate_save; + s->agc_scaling = s->agc_scaling_save; + equalizer_restore(s); + /* Don't allow any frequency correction at all, until we start to pull the phase in. */ +#if defined(SPANDSP_USE_FIXED_POINTx) + s->carrier_track_i = 0; + s->carrier_track_p = 40000; +#else + s->carrier_track_i = 0.0f; + s->carrier_track_p = 40000.0f; +#endif + } + else + { + s->carrier_phase_rate = dds_phase_ratef(CARRIER_NOMINAL_FREQ); + equalizer_reset(s); +#if defined(SPANDSP_USE_FIXED_POINTx) + s->agc_scaling_save = 0; + s->agc_scaling = (float) FP_FACTOR*32768.0f*0.0017f/RX_PULSESHAPER_GAIN; + s->carrier_track_i = 5000; + s->carrier_track_p = 40000; +#else + s->agc_scaling_save = 0.0f; + s->agc_scaling = 0.0017f/RX_PULSESHAPER_GAIN; + s->carrier_track_i = 5000.0f; + s->carrier_track_p = 40000.0f; +#endif + } + s->last_sample = 0; + + /* Initialise the working data for symbol timing synchronisation */ +#if defined(SPANDSP_USE_FIXED_POINTx) + for (i = 0; i < 2; i++) + { + s->symbol_sync_low[i] = 0; + s->symbol_sync_high[i] = 0; + s->symbol_sync_dc_filter[i] = 0; + } + s->baud_phase = 0; +#else + for (i = 0; i < 2; i++) + { + s->symbol_sync_low[i] = 0.0f; + s->symbol_sync_high[i] = 0.0f; + s->symbol_sync_dc_filter[i] = 0.0f; + } + s->baud_phase = 0.0f; +#endif + s->baud_half = 0; + + s->total_baud_timing_correction = 0; + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(v17_rx_state_t *) v17_rx_init(v17_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data) +{ + switch (bit_rate) + { + case 14400: + case 12000: + case 9600: + case 7200: + case 4800: + /* 4800 is an extension of V.17, to provide full converage of the V.32bis modes */ + break; + default: + return NULL; + } + if (s == NULL) + { + if ((s = (v17_rx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "V.17 RX"); + s->put_bit = put_bit; + s->put_bit_user_data = user_data; + s->short_train = FALSE; + //s->scrambler_tap = 18 - 1; + v17_rx_signal_cutoff(s, -45.5f); + s->agc_scaling = 0.0017f/RX_PULSESHAPER_GAIN; + s->agc_scaling_save = 0.0f; + s->carrier_phase_rate_save = dds_phase_ratef(CARRIER_NOMINAL_FREQ); + v17_rx_restart(s, bit_rate, s->short_train); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v17_rx_release(v17_rx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v17_rx_free(v17_rx_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v17_rx_set_qam_report_handler(v17_rx_state_t *s, qam_report_handler_t handler, void *user_data) +{ + s->qam_report = handler; + s->qam_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/v17tx.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/v17tx.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,475 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v17tx.c - ITU V.17 modem transmit part + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v17tx.c,v 1.75.4.1 2009/12/24 16:52:30 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/logging.h" +#include "spandsp/complex.h" +#include "spandsp/vector_float.h" +#include "spandsp/complex_vector_float.h" +#include "spandsp/async.h" +#include "spandsp/dds.h" +#include "spandsp/power_meter.h" + +#include "spandsp/v17tx.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/v17tx.h" + +#if defined(SPANDSP_USE_FIXED_POINT) +#define SPANDSP_USE_FIXED_POINTx +#endif + +#include "v17_v32bis_tx_constellation_maps.h" +#if defined(SPANDSP_USE_FIXED_POINT) +#include "v17_v32bis_tx_fixed_rrc.h" +#else +#include "v17_v32bis_tx_floating_rrc.h" +#endif + +/*! The nominal frequency of the carrier, in Hertz */ +#define CARRIER_NOMINAL_FREQ 1800.0f + +/* Segments of the training sequence */ +/*! The start of the optional TEP, that may preceed the actual training, in symbols */ +#define V17_TRAINING_SEG_TEP_A 0 +/*! The mid point of the optional TEP, that may preceed the actual training, in symbols */ +#define V17_TRAINING_SEG_TEP_B (V17_TRAINING_SEG_TEP_A + 480) +/*! The start of training segment 1, in symbols */ +#define V17_TRAINING_SEG_1 (V17_TRAINING_SEG_TEP_B + 48) +/*! The start of training segment 2, in symbols */ +#define V17_TRAINING_SEG_2 (V17_TRAINING_SEG_1 + 256) +/*! The start of training segment 3, in symbols */ +#define V17_TRAINING_SEG_3 (V17_TRAINING_SEG_2 + 2976) +/*! The start of training segment 4, in symbols */ +#define V17_TRAINING_SEG_4 (V17_TRAINING_SEG_3 + 64) +/*! The start of training segment 4 in short training mode, in symbols */ +#define V17_TRAINING_SHORT_SEG_4 (V17_TRAINING_SEG_2 + 38) +/*! The end of the training, in symbols */ +#define V17_TRAINING_END (V17_TRAINING_SEG_4 + 48) +#define V17_TRAINING_SHUTDOWN_A (V17_TRAINING_END + 32) +/*! The end of the shutdown sequence, in symbols */ +#define V17_TRAINING_SHUTDOWN_END (V17_TRAINING_SHUTDOWN_A + 48) + +/*! The 16 bit pattern used in the bridge section of the training sequence */ +#define V17_BRIDGE_WORD 0x8880 + +static __inline__ int scramble(v17_tx_state_t *s, int in_bit) +{ + int out_bit; + + //out_bit = (in_bit ^ (s->scramble_reg >> s->scrambler_tap) ^ (s->scramble_reg >> (23 - 1))) & 1; + out_bit = (in_bit ^ (s->scramble_reg >> (18 - 1)) ^ (s->scramble_reg >> (23 - 1))) & 1; + s->scramble_reg = (s->scramble_reg << 1) | out_bit; + return out_bit; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINT) +static __inline__ complexi16_t training_get(v17_tx_state_t *s) +#else +static __inline__ complexf_t training_get(v17_tx_state_t *s) +#endif +{ + static const int cdba_to_abcd[4] = + { + 2, 3, 1, 0 + }; + static const int dibit_to_step[4] = + { + 1, 0, 2, 3 + }; +#if defined(SPANDSP_USE_FIXED_POINT) + static const complexi16_t zero = {0, 0}; +#else + static const complexf_t zero = {0.0f, 0.0f}; +#endif + int bits; + int shift; + + if (++s->training_step <= V17_TRAINING_SEG_3) + { + if (s->training_step <= V17_TRAINING_SEG_2) + { + if (s->training_step <= V17_TRAINING_SEG_TEP_B) + { + /* Optional segment: Unmodulated carrier (talker echo protection) */ + return v17_v32bis_abcd_constellation[0]; + } + if (s->training_step <= V17_TRAINING_SEG_1) + { + /* Optional segment: silence (talker echo protection) */ + return zero; + } + /* Segment 1: ABAB... */ + return v17_v32bis_abcd_constellation[(s->training_step & 1) ^ 1]; + } + /* Segment 2: CDBA... */ + /* Apply the scrambler */ + bits = scramble(s, 1); + bits = (bits << 1) | scramble(s, 1); + s->constellation_state = cdba_to_abcd[bits]; + if (s->short_train && s->training_step == V17_TRAINING_SHORT_SEG_4) + { + /* Go straight to the ones test. */ + s->training_step = V17_TRAINING_SEG_4; + } + return v17_v32bis_abcd_constellation[s->constellation_state]; + } + /* Segment 3: Bridge... */ + shift = ((s->training_step - V17_TRAINING_SEG_3 - 1) & 0x7) << 1; + //span_log(&s->logging, SPAN_LOG_FLOW, "Seg 3 shift %d\n", shift); + bits = scramble(s, V17_BRIDGE_WORD >> shift); + bits = (bits << 1) | scramble(s, V17_BRIDGE_WORD >> (shift + 1)); + s->constellation_state = (s->constellation_state + dibit_to_step[bits]) & 3; + return v17_v32bis_abcd_constellation[s->constellation_state]; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int diff_and_convolutional_encode(v17_tx_state_t *s, int q) +{ + static const uint8_t v32bis_4800_differential_encoder[4][4] = + { + {2, 3, 0, 1}, + {0, 2, 1, 3}, + {3, 1, 2, 0}, + {1, 0, 3, 2} + }; + static const uint8_t v17_differential_encoder[4][4] = + { + {0, 1, 2, 3}, + {1, 2, 3, 0}, + {2, 3, 0, 1}, + {3, 0, 1, 2} + }; + static const uint8_t v17_convolutional_coder[8][4] = + { + {0, 2, 3, 1}, + {4, 7, 5, 6}, + {1, 3, 2, 0}, + {7, 4, 6, 5}, + {2, 0, 1, 3}, + {6, 5, 7, 4}, + {3, 1, 0, 2}, + {5, 6, 4, 7} + }; + + if (s->bits_per_symbol == 2) + { + /* 4800bps mode for V.32bis */ + /* There is no trellis. We just differentially encode. */ + s->diff = v32bis_4800_differential_encoder[s->diff][q & 0x03]; + return s->diff; + } + /* Differentially encode */ + s->diff = v17_differential_encoder[s->diff][q & 0x03]; + + /* Convolutionally encode the redundant bit */ + s->convolution = v17_convolutional_coder[s->convolution][s->diff]; + + /* The final result is the combination of some uncoded bits, 2 differentially + encoded bits, and the convolutionally encoded redundant bit. */ + return ((q << 1) & 0x78) | (s->diff << 1) | ((s->convolution >> 2) & 1); +} +/*- End of function --------------------------------------------------------*/ + +static int fake_get_bit(void *user_data) +{ + return 1; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINT) +static __inline__ complexi16_t getbaud(v17_tx_state_t *s) +#else +static __inline__ complexf_t getbaud(v17_tx_state_t *s) +#endif +{ + int i; + int bit; + int bits; + + if (s->in_training) + { + if (s->training_step <= V17_TRAINING_END) + { + /* Send the training sequence */ + if (s->training_step < V17_TRAINING_SEG_4) + return training_get(s); + /* The last step in training is to send some 1's */ + if (++s->training_step > V17_TRAINING_END) + { + /* Training finished - commence normal operation. */ + s->current_get_bit = s->get_bit; + s->in_training = FALSE; + } + } + else + { + if (++s->training_step > V17_TRAINING_SHUTDOWN_A) + { + /* The shutdown sequence is 32 bauds of all 1's, then 48 bauds + of silence */ +#if defined(SPANDSP_USE_FIXED_POINT) + return complex_seti16(0, 0); +#else + return complex_setf(0.0f, 0.0f); +#endif + } + if (s->training_step == V17_TRAINING_SHUTDOWN_END) + { + if (s->status_handler) + s->status_handler(s->status_user_data, SIG_STATUS_SHUTDOWN_COMPLETE); + } + } + } + bits = 0; + for (i = 0; i < s->bits_per_symbol; i++) + { + if ((bit = s->current_get_bit(s->get_bit_user_data)) == SIG_STATUS_END_OF_DATA) + { + /* End of real data. Switch to the fake get_bit routine, until we + have shut down completely. */ + if (s->status_handler) + s->status_handler(s->status_user_data, SIG_STATUS_END_OF_DATA); + s->current_get_bit = fake_get_bit; + s->in_training = TRUE; + bit = 1; + } + bits |= (scramble(s, bit) << i); + } + return s->constellation[diff_and_convolutional_encode(s, bits)]; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) v17_tx(v17_tx_state_t *s, int16_t amp[], int len) +{ +#if defined(SPANDSP_USE_FIXED_POINT) + complexi_t x; + complexi_t z; +#else + complexf_t x; + complexf_t z; +#endif + int i; + int sample; + + if (s->training_step >= V17_TRAINING_SHUTDOWN_END) + { + /* Once we have sent the shutdown sequence, we stop sending completely. */ + return 0; + } + for (sample = 0; sample < len; sample++) + { + if ((s->baud_phase += 3) >= 10) + { + s->baud_phase -= 10; + s->rrc_filter[s->rrc_filter_step] = + s->rrc_filter[s->rrc_filter_step + V17_TX_FILTER_STEPS] = getbaud(s); + if (++s->rrc_filter_step >= V17_TX_FILTER_STEPS) + s->rrc_filter_step = 0; + } + /* Root raised cosine pulse shaping at baseband */ +#if defined(SPANDSP_USE_FIXED_POINT) + x = complex_seti(0, 0); + for (i = 0; i < V17_TX_FILTER_STEPS; i++) + { + x.re += (int32_t) tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase][i]*(int32_t) s->rrc_filter[i + s->rrc_filter_step].re; + x.im += (int32_t) tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase][i]*(int32_t) s->rrc_filter[i + s->rrc_filter_step].im; + } + /* Now create and modulate the carrier */ + x.re >>= 4; + x.im >>= 4; + z = dds_complexi(&(s->carrier_phase), s->carrier_phase_rate); + /* Don't bother saturating. We should never clip. */ + i = (x.re*z.re - x.im*z.im) >> 15; + amp[sample] = (int16_t) ((i*s->gain) >> 15); +#else + x = complex_setf(0.0f, 0.0f); + for (i = 0; i < V17_TX_FILTER_STEPS; i++) + { + x.re += tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase][i]*s->rrc_filter[i + s->rrc_filter_step].re; + x.im += tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase][i]*s->rrc_filter[i + s->rrc_filter_step].im; + } + /* Now create and modulate the carrier */ + z = dds_complexf(&(s->carrier_phase), s->carrier_phase_rate); + /* Don't bother saturating. We should never clip. */ + amp[sample] = (int16_t) lfastrintf((x.re*z.re - x.im*z.im)*s->gain); +#endif + } + return sample; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v17_tx_power(v17_tx_state_t *s, float power) +{ + /* The constellation design seems to keep the average power the same, regardless + of which bit rate is in use. */ +#if defined(SPANDSP_USE_FIXED_POINT) + s->gain = 0.223f*powf(10.0f, (power - DBM0_MAX_POWER)/20.0f)*16.0f*(32767.0f/30672.52f)*32768.0f/TX_PULSESHAPER_GAIN; +#else + s->gain = 0.223f*powf(10.0f, (power - DBM0_MAX_POWER)/20.0f)*32768.0f/TX_PULSESHAPER_GAIN; +#endif +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v17_tx_set_get_bit(v17_tx_state_t *s, get_bit_func_t get_bit, void *user_data) +{ + if (s->get_bit == s->current_get_bit) + s->current_get_bit = get_bit; + s->get_bit = get_bit; + s->get_bit_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v17_tx_set_modem_status_handler(v17_tx_state_t *s, modem_tx_status_func_t handler, void *user_data) +{ + s->status_handler = handler; + s->status_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(logging_state_t *) v17_tx_get_logging_state(v17_tx_state_t *s) +{ + return &s->logging; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v17_tx_restart(v17_tx_state_t *s, int bit_rate, int tep, int short_train) +{ + switch (bit_rate) + { + case 14400: + s->bits_per_symbol = 6; + s->constellation = v17_v32bis_14400_constellation; + break; + case 12000: + s->bits_per_symbol = 5; + s->constellation = v17_v32bis_12000_constellation; + break; + case 9600: + s->bits_per_symbol = 4; + s->constellation = v17_v32bis_9600_constellation; + break; + case 7200: + s->bits_per_symbol = 3; + s->constellation = v17_v32bis_7200_constellation; + break; + case 4800: + /* This does not exist in the V.17 spec as a valid mode of operation. + However, it does exist in V.32bis, so it is here for completeness. */ + s->bits_per_symbol = 2; + s->constellation = v17_v32bis_4800_constellation; + break; + default: + return -1; + } + s->bit_rate = bit_rate; + /* NB: some modems seem to use 3 instead of 1 for long training */ + s->diff = (short_train) ? 0 : 1; +#if defined(SPANDSP_USE_FIXED_POINT) + memset(s->rrc_filter, 0, sizeof(s->rrc_filter)); +#else + cvec_zerof(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); +#endif + s->rrc_filter_step = 0; + s->convolution = 0; + s->scramble_reg = 0x2ECDD5; + s->in_training = TRUE; + s->short_train = short_train; + s->training_step = (tep) ? V17_TRAINING_SEG_TEP_A : V17_TRAINING_SEG_1; + s->carrier_phase = 0; + s->baud_phase = 0; + s->constellation_state = 0; + s->current_get_bit = fake_get_bit; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(v17_tx_state_t *) v17_tx_init(v17_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data) +{ + switch (bit_rate) + { + case 14400: + case 12000: + case 9600: + case 7200: + case 4800: + /* 4800 is an extension of V.17, to provide full converage of the V.32bis modes */ + break; + default: + return NULL; + } + if (s == NULL) + { + if ((s = (v17_tx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "V.17 TX"); + s->get_bit = get_bit; + s->get_bit_user_data = user_data; + //s->scrambler_tap = 18 - 1; + s->carrier_phase_rate = dds_phase_ratef(CARRIER_NOMINAL_FREQ); + v17_tx_power(s, -14.0f); + v17_tx_restart(s, bit_rate, tep, FALSE); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v17_tx_release(v17_tx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v17_tx_free(v17_tx_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/v18.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/v18.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,838 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v18.c - V.18 text telephony for the deaf. + * + * Written by Steve Underwood + * + * Copyright (C) 2004-2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v18.c,v 1.12 2009/11/04 15:52:06 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/queue.h" +#include "spandsp/async.h" +#include "spandsp/complex.h" +#include "spandsp/dds.h" +#include "spandsp/tone_detect.h" +#include "spandsp/tone_generate.h" +#include "spandsp/super_tone_rx.h" +#include "spandsp/power_meter.h" +#include "spandsp/fsk.h" +#include "spandsp/dtmf.h" +#include "spandsp/modem_connect_tones.h" +#include "spandsp/v8.h" +#include "spandsp/v18.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/queue.h" +#include "spandsp/private/tone_generate.h" +#include "spandsp/private/async.h" +#include "spandsp/private/fsk.h" +#include "spandsp/private/dtmf.h" +#include "spandsp/private/modem_connect_tones.h" +#include "spandsp/private/v18.h" + +#include + +/*! The baudot code to shift from alpha to digits and symbols */ +#define BAUDOT_FIGURE_SHIFT 0x1B +/*! The baudot code to shift from digits and symbols to alpha */ +#define BAUDOT_LETTER_SHIFT 0x1F + +struct dtmf_to_ascii_s +{ + const char *dtmf; + char ascii; +}; + +static const struct dtmf_to_ascii_s dtmf_to_ascii[] = +{ + {"###1", 'C'}, + {"###2", 'F'}, + {"###3", 'I'}, + {"###4", 'L'}, + {"###5", 'O'}, + {"###6", 'R'}, + {"###7", 'U'}, + {"###8", 'X'}, + {"###9", ';'}, + {"###0", '!'}, + {"##*1", 'A'}, + {"##*2", 'D'}, + {"##*3", 'G'}, + {"##*4", 'J'}, + {"##*5", 'M'}, + {"##*6", 'P'}, + {"##*7", 'S'}, + {"##*8", 'V'}, + {"##*9", 'Y'}, + {"##1", 'B'}, + {"##2", 'E'}, + {"##3", 'H'}, + {"##4", 'K'}, + {"##5", 'N'}, + {"##6", 'Q'}, + {"##7", 'T'}, + {"##8", 'W'}, + {"##9", 'Z'}, + {"##0", ' '}, +#if defined(WIN32) + {"#*1", 'X'}, // (Note 1) 111 1011 + {"#*2", 'X'}, // (Note 1) 111 1100 + {"#*3", 'X'}, // (Note 1) 111 1101 + {"#*4", 'X'}, // (Note 1) 101 1011 + {"#*5", 'X'}, // (Note 1) 101 1100 + {"#*6", 'X'}, // (Note 1) 101 1101 +#else + {"#*1", 'æ'}, // (Note 1) 111 1011 + {"#*2", 'ø'}, // (Note 1) 111 1100 + {"#*3", 'å'}, // (Note 1) 111 1101 + {"#*4", 'Æ'}, // (Note 1) 101 1011 + {"#*5", 'Ø'}, // (Note 1) 101 1100 + {"#*6", 'Å'}, // (Note 1) 101 1101 +#endif + {"#0", '?'}, + {"#1", 'c'}, + {"#2", 'f'}, + {"#3", 'i'}, + {"#4", 'l'}, + {"#5", 'o'}, + {"#6", 'r'}, + {"#7", 'u'}, + {"#8", 'x'}, + {"#9", '.'}, + {"*#0", '0'}, + {"*#1", '1'}, + {"*#2", '2'}, + {"*#3", '3'}, + {"*#4", '4'}, + {"*#5", '5'}, + {"*#6", '6'}, + {"*#7", '7'}, + {"*#8", '8'}, + {"*#9", '9'}, + {"**1", '+'}, + {"**2", '-'}, + {"**3", '='}, + {"**4", ':'}, + {"**5", '%'}, + {"**6", '('}, + {"**7", ')'}, + {"**8", ','}, + {"**9", '\n'}, + {"*0", '\b'}, + {"*1", 'a'}, + {"*2", 'd'}, + {"*3", 'g'}, + {"*4", 'j'}, + {"*5", 'm'}, + {"*6", 'p'}, + {"*7", 's'}, + {"*8", 'v'}, + {"*9", 'y'}, + {"0", ' '}, + {"1", 'b'}, + {"2", 'e'}, + {"3", 'h'}, + {"4", 'k'}, + {"5", 'n'}, + {"6", 'q'}, + {"7", 't'}, + {"8", 'w'}, + {"9", 'z'}, + {"", '\0'} +}; + +static const char *ascii_to_dtmf[128] = +{ + "", /* NULL */ + "", /* SOH */ + "", /* STX */ + "", /* ETX */ + "", /* EOT */ + "", /* ENQ */ + "", /* ACK */ + "", /* BEL */ + "*0", /* BACK SPACE */ + "0", /* HT >> SPACE */ + "**9", /* LF */ + "**9", /* VT >> LF */ + "**9", /* FF >> LF */ + "", /* CR */ + "", /* SO */ + "", /* SI */ + "", /* DLE */ + "", /* DC1 */ + "", /* DC2 */ + "", /* DC3 */ + "", /* DC4 */ + "", /* NAK */ + "", /* SYN */ + "", /* ETB */ + "", /* CAN */ + "", /* EM */ + "#0", /* SUB >> ? */ + "", /* ESC */ + "**9", /* IS4 >> LF */ + "**9", /* IS3 >> LF */ + "**9", /* IS2 >> LF */ + "0", /* IS1 >> SPACE */ + "0", /* SPACE */ + "###0", /* ! */ + "", /* " */ + "", /* # */ + "", /* $ */ + "**5", /* % */ + "**1", /* & >> + */ + "", /* ’ */ + "**6", /* ( */ + "**7", /* ) */ + "#9", /* _ >> . */ + "**1", /* + */ + "**8", /* , */ + "**2", /* - */ + "#9", /* . */ + "", /* / */ + "*#0", /* 0 */ + "*#1", /* 1 */ + "*#2", /* 2 */ + "*#3", /* 3 */ + "*#4", /* 4 */ + "*#5", /* 5 */ + "*#6", /* 6 */ + "*#7", /* 7 */ + "*#8", /* 8 */ + "*#9", /* 9 */ + "**4", /* : */ + "###9", /* ; */ + "**6", /* < >> ( */ + "**3", /* = */ + "**7", /* > >> ) */ + "#0", /* ? */ + "###8", /* @ >> X */ + "##*1", /* A */ + "##1", /* B */ + "###1", /* C */ + "##*2", /* D */ + "##2", /* E */ + "###2", /* F */ + "##*3", /* G */ + "##3", /* H */ + "###3", /* I */ + "##*4", /* J */ + "##4", /* K */ + "###4", /* L */ + "##*5", /* M */ + "##5", /* N */ + "###5", /* O */ + "##*6", /* P */ + "##6", /* Q */ + "###6", /* R */ + "##*7", /* S */ + "##7", /* T */ + "###7", /* U */ + "##*8", /* V */ + "##8", /* W */ + "###8", /* X */ + "##*9", /* Y */ + "##9", /* Z */ + "#*4", /* Æ (National code) */ + "#*5", /* Ø (National code) */ + "#*6", /* Å (National code) */ + "", /* ^ */ + "0", /* _ >> SPACE */ + "", /* ’ */ + "*1", /* a */ + "1", /* b */ + "#1", /* c */ + "*2", /* d */ + "2", /* e */ + "#2", /* f */ + "*3", /* g */ + "3", /* h */ + "#3", /* i */ + "*4", /* j */ + "4", /* k */ + "#4", /* l */ + "*5", /* m */ + "5", /* n */ + "#5", /* o */ + "*6", /* p */ + "6", /* q */ + "#6", /* r */ + "*7", /* s */ + "7", /* t */ + "#7", /* u */ + "*8", /* v */ + "8", /* w */ + "#8", /* x */ + "*9", /* y */ + "9", /* z */ + "#*1", /* æ (National code) */ + "#*2", /* ø (National code) */ + "#*3", /* å (National code) */ + "0", /* ~ >> SPACE */ + "*0" /* DEL >> BACK SPACE */ +}; + +static int cmp(const void *s, const void *t) +{ + const char *ss; + struct dtmf_to_ascii_s *tt; + + ss = (const char *) s; + tt = (struct dtmf_to_ascii_s *) t; + return strncmp(ss, tt->dtmf, strlen(tt->dtmf)); +} + +SPAN_DECLARE(int) v18_encode_dtmf(v18_state_t *s, char dtmf[], const char msg[]) +{ + const char *t; + char *u; + const char *v; + + t = msg; + u = dtmf; + while (*t) + { + v = ascii_to_dtmf[*t & 0x7F]; + while (*v) + *u++ = *v++; + t++; + } + *u = '\0'; + + return u - dtmf; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v18_decode_dtmf(v18_state_t *s, char msg[], const char dtmf[]) +{ + int entries; + const char *t; + char *u; + struct dtmf_to_ascii_s *ss; + + entries = sizeof(dtmf_to_ascii)/sizeof(dtmf_to_ascii[0]) - 1; + t = dtmf; + u = msg; + while (*t) + { + ss = bsearch(t, dtmf_to_ascii, entries, sizeof(dtmf_to_ascii[0]), cmp); + if (ss) + { + t += strlen(ss->dtmf); + *u++ = ss->ascii; + } + else + { + /* Can't match the code. Let's assume this is a code we just don't know, and skip over it */ + while (*t == '#' || *t == '*') + t++; + if (*t) + t++; + } + } + *u = '\0'; + return u - msg; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(uint16_t) v18_encode_baudot(v18_state_t *s, uint8_t ch) +{ + static const uint8_t conv[128] = + { + 0xFF, /* NUL */ + 0xFF, /* SOH */ + 0xFF, /* STX */ + 0xFF, /* ETX */ + 0xFF, /* EOT */ + 0xFF, /* ENQ */ + 0xFF, /* ACK */ + 0xFF, /* BEL */ + 0x00, /* BS */ + 0x44, /* HT >> SPACE */ + 0x42, /* LF */ + 0x42, /* VT >> LF */ + 0x42, /* FF >> LF */ + 0x48, /* CR */ + 0xFF, /* SO */ + 0xFF, /* SI */ + 0xFF, /* DLE */ + 0xFF, /* DC1 */ + 0xFF, /* DC2 */ + 0xFF, /* DC3 */ + 0xFF, /* DC4 */ + 0xFF, /* NAK */ + 0xFF, /* SYN */ + 0xFF, /* ETB */ + 0xFF, /* CAN */ + 0xFF, /* EM */ + 0x99, /* SUB >> ? */ + 0xFF, /* ESC */ + 0x42, /* IS4 >> LF */ + 0x42, /* IS3 >> LF */ + 0x42, /* IS2 >> LF */ + 0x44, /* IS1 >> SPACE */ + 0x44, /* */ + 0x8D, /* ! */ + 0x91, /* " */ + 0x89, /* # >> $ */ + 0x89, /* $ */ + 0x9D, /* % >> / */ + 0x9A, /* & >> + */ + 0x8B, /* ' */ + 0x8F, /* ( */ + 0x92, /* ) */ + 0x9C, /* * >> . */ + 0x9A, /* + */ + 0x8C, /* , */ + 0x83, /* - */ + 0x9C, /* . */ + 0x9D, /* / */ + 0x96, /* 0 */ + 0x97, /* 1 */ + 0x93, /* 2 */ + 0x81, /* 3 */ + 0x8A, /* 4 */ + 0x90, /* 5 */ + 0x95, /* 6 */ + 0x87, /* 7 */ + 0x86, /* 8 */ + 0x98, /* 9 */ + 0x8E, /* : */ + 0x9E, /* ; */ + 0x8F, /* < >> )*/ + 0x94, /* = */ + 0x92, /* > >> ( */ + 0x99, /* ? */ + 0x1D, /* @ >> X */ + 0x03, /* A */ + 0x19, /* B */ + 0x0E, /* C */ + 0x09, /* D */ + 0x01, /* E */ + 0x0D, /* F */ + 0x1A, /* G */ + 0x14, /* H */ + 0x06, /* I */ + 0x0B, /* J */ + 0x0F, /* K */ + 0x12, /* L */ + 0x1C, /* M */ + 0x0C, /* N */ + 0x18, /* O */ + 0x16, /* P */ + 0x17, /* Q */ + 0x0A, /* R */ + 0x05, /* S */ + 0x10, /* T */ + 0x07, /* U */ + 0x1E, /* V */ + 0x13, /* W */ + 0x1D, /* X */ + 0x15, /* Y */ + 0x11, /* Z */ + 0x8F, /* [ >> (*/ + 0x9D, /* \ >> / */ + 0x92, /* ] >> ) */ + 0x8B, /* ^ >> ' */ + 0x44, /* _ >> Space */ + 0x8B, /* ` >> ' */ + 0x03, /* a */ + 0x19, /* b */ + 0x0E, /* c */ + 0x09, /* d */ + 0x01, /* e */ + 0x0D, /* f */ + 0x1A, /* g */ + 0x14, /* h */ + 0x06, /* i */ + 0x0B, /* j */ + 0x0F, /* k */ + 0x12, /* l */ + 0x1C, /* m */ + 0x0C, /* n */ + 0x18, /* o */ + 0x16, /* p */ + 0x17, /* q */ + 0x0A, /* r */ + 0x05, /* s */ + 0x10, /* t */ + 0x07, /* u */ + 0x1E, /* v */ + 0x13, /* w */ + 0x1D, /* x */ + 0x15, /* y */ + 0x11, /* z */ + 0x8F, /* { >> ( */ + 0x8D, /* | >> ! */ + 0x92, /* } >> ) */ + 0x44, /* ~ >> Space */ + 0xFF, /* DEL */ + }; + uint16_t shift; + + if (ch == 0x7F) + { + /* DLE is a special character meaning "force a + change to the letter character set */ + shift = BAUDOT_LETTER_SHIFT; + return 0; + } + ch = conv[ch]; + /* Is it a non-existant code? */ + if (ch == 0xFF) + return 0; + /* Is it a code present in both character sets? */ + if ((ch & 0x40)) + return 0x8000 | (ch & 0x1F); + /* Need to allow for a possible character set change. */ + if ((ch & 0x80)) + { + if (s->baudot_tx_shift == 1) + return ch & 0x1F; + s->baudot_tx_shift = 1; + shift = BAUDOT_FIGURE_SHIFT; + } + else + { + if (s->baudot_tx_shift == 0) + return ch & 0x1F; + s->baudot_tx_shift = 0; + shift = BAUDOT_LETTER_SHIFT; + } + return 0x8000 | (shift << 5) | (ch & 0x1F); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(uint8_t) v18_decode_baudot(v18_state_t *s, uint8_t ch) +{ + static const uint8_t conv[2][32] = + { + {"\bE\nA SIU\rDRJNFCKTZLWHYPQOBG^MXV^"}, + {"\b3\n- -87\r$4',!:(5\")2=6019?+^./;^"} + }; + + switch (ch) + { + case BAUDOT_FIGURE_SHIFT: + s->baudot_rx_shift = 1; + break; + case BAUDOT_LETTER_SHIFT: + s->baudot_rx_shift = 0; + break; + default: + return conv[s->baudot_rx_shift][ch]; + } + /* return 0 if we did not produce a character */ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void v18_rx_dtmf(void *user_data, const char digits[], int len) +{ + v18_state_t *s; + + s = (v18_state_t *) user_data; +} +/*- End of function --------------------------------------------------------*/ + +static int v18_tdd_get_async_byte(void *user_data) +{ + v18_state_t *s; + int ch; + + s = (v18_state_t *) user_data; + if ((ch = queue_read_byte(&s->queue.queue)) >= 0) + { + int space; + int cont; + space = queue_free_space(&s->queue.queue); + cont = queue_contents(&s->queue.queue); + return ch; + } + if (s->tx_signal_on) + { + /* The FSK should now be switched off. */ + s->tx_signal_on = FALSE; + } + return 0x1F; +} +/*- End of function --------------------------------------------------------*/ + +static void v18_tdd_put_async_byte(void *user_data, int byte) +{ + v18_state_t *s; + uint8_t octet; + + s = (v18_state_t *) user_data; + //printf("Rx byte %x\n", byte); + if (byte < 0) + { + /* Special conditions */ + span_log(&s->logging, SPAN_LOG_FLOW, "V.18 signal status is %s (%d)\n", signal_status_to_str(byte), byte); + switch (byte) + { + case SIG_STATUS_CARRIER_UP: + s->consecutive_ones = 0; + s->bit_pos = 0; + s->in_progress = 0; + s->rx_msg_len = 0; + break; + case SIG_STATUS_CARRIER_DOWN: + if (s->rx_msg_len > 0) + { + /* Whatever we have to date constitutes the message */ + s->rx_msg[s->rx_msg_len] = '\0'; + s->put_msg(s->user_data, s->rx_msg, s->rx_msg_len); + s->rx_msg_len = 0; + } + break; + default: + span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected special put byte value - %d!\n", byte); + break; + } + return; + } + if ((octet = v18_decode_baudot(s, (uint8_t) (byte & 0x1F)))) + s->rx_msg[s->rx_msg_len++] = octet; + if (s->rx_msg_len >= 256) + { + s->rx_msg[s->rx_msg_len] = '\0'; + s->put_msg(s->user_data, s->rx_msg, s->rx_msg_len); + s->rx_msg_len = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) v18_tx(v18_state_t *s, int16_t *amp, int max_len) +{ + int len; + int lenx; + + len = tone_gen(&(s->alert_tone_gen), amp, max_len); + if (s->tx_signal_on) + { + switch (s->mode) + { + case V18_MODE_DTMF: + if (len < max_len) + len += dtmf_tx(&(s->dtmftx), amp, max_len - len); + break; + default: + if (len < max_len) + { + if ((lenx = fsk_tx(&(s->fsktx), amp + len, max_len - len)) <= 0) + s->tx_signal_on = FALSE; + len += lenx; + } + break; + } + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) v18_rx(v18_state_t *s, const int16_t amp[], int len) +{ + switch (s->mode) + { + case V18_MODE_DTMF: + /* Apply a message timeout. */ + s->in_progress -= len; + if (s->in_progress <= 0) + s->rx_msg_len = 0; + dtmf_rx(&(s->dtmfrx), amp, len); + break; + default: + fsk_rx(&(s->fskrx), amp, len); + break; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v18_put(v18_state_t *s, const char msg[], int len) +{ + char buf[256 + 1]; + int x; + int n; + int i; + + /* This returns the number of characters that would not fit in the buffer. + The buffer will only be loaded if the whole string of digits will fit, + in which case zero is returned. */ + if (len < 0) + { + if ((len = strlen(msg)) == 0) + return 0; + } + switch (s->mode) + { + case V18_MODE_5BIT_45: + case V18_MODE_5BIT_50: + for (i = 0; i < len; i++) + { + n = 0; + if ((x = v18_encode_baudot(s, msg[i]))) + { + if ((x & 0x3E0)) + buf[n++] = (uint8_t) ((x >> 5) & 0x1F); + buf[n++] = (uint8_t) (x & 0x1F); + /* TODO: Deal with out of space condition */ + if (queue_write(&s->queue.queue, (const uint8_t *) buf, n) < 0) + return i; + s->tx_signal_on = TRUE; + } + } + return len; + case V18_MODE_DTMF: + break; + } + return -1; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(logging_state_t *) v18_get_logging_state(v18_state_t *s) +{ + return &s->logging; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s, + int calling_party, + int mode, + put_msg_func_t put_msg, + void *user_data) +{ + if (s == NULL) + { + if ((s = (v18_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + s->calling_party = calling_party; + s->mode = mode; + s->put_msg = put_msg; + s->user_data = user_data; + + switch (s->mode) + { + case V18_MODE_5BIT_45: + fsk_tx_init(&(s->fsktx), &preset_fsk_specs[FSK_WEITBRECHT], async_tx_get_bit, &(s->asynctx)); + async_tx_init(&(s->asynctx), 5, ASYNC_PARITY_NONE, 2, FALSE, v18_tdd_get_async_byte, s); + /* Schedule an explicit shift at the start of baudot transmission */ + s->baudot_tx_shift = 2; + /* TDD uses 5 bit data, no parity and 1.5 stop bits. We scan for the first stop bit, and + ride over the fraction. */ + fsk_rx_init(&(s->fskrx), &preset_fsk_specs[FSK_WEITBRECHT], FSK_FRAME_MODE_5N1_FRAMES, v18_tdd_put_async_byte, s); + s->baudot_rx_shift = 0; + break; + case V18_MODE_5BIT_50: + fsk_tx_init(&(s->fsktx), &preset_fsk_specs[FSK_WEITBRECHT50], async_tx_get_bit, &(s->asynctx)); + async_tx_init(&(s->asynctx), 5, ASYNC_PARITY_NONE, 2, FALSE, v18_tdd_get_async_byte, s); + /* Schedule an explicit shift at the start of baudot transmission */ + s->baudot_tx_shift = 2; + /* TDD uses 5 bit data, no parity and 1.5 stop bits. We scan for the first stop bit, and + ride over the fraction. */ + fsk_rx_init(&(s->fskrx), &preset_fsk_specs[FSK_WEITBRECHT50], FSK_FRAME_MODE_5N1_FRAMES, v18_tdd_put_async_byte, s); + s->baudot_rx_shift = 0; + break; + case V18_MODE_DTMF: + dtmf_tx_init(&(s->dtmftx)); + dtmf_rx_init(&(s->dtmfrx), v18_rx_dtmf, s); + break; + case V18_MODE_EDT: + break; + case V18_MODE_BELL103: + break; + case V18_MODE_V23VIDEOTEX: + break; + case V18_MODE_V21TEXTPHONE: + break; + case V18_MODE_V18TEXTPHONE: + break; + } + queue_init(&s->queue.queue, 128, QUEUE_READ_ATOMIC | QUEUE_WRITE_ATOMIC); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v18_release(v18_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v18_free(v18_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) v18_mode_to_str(int mode) +{ + switch (mode) + { + case V18_MODE_NONE: + return "None"; + case V18_MODE_5BIT_45: + return "Weitbrecht TDD (45.45bps)"; + case V18_MODE_5BIT_50: + return "Weitbrecht TDD (50bps)"; + case V18_MODE_DTMF: + return "DTMF"; + case V18_MODE_EDT: + return "EDT"; + case V18_MODE_BELL103: + return "Bell 103"; + case V18_MODE_V23VIDEOTEX: + return "Videotex"; + case V18_MODE_V21TEXTPHONE: + return "V.21"; + case V18_MODE_V18TEXTPHONE: + return "V.18 text telephone"; + } + return "???"; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/v22bis_rx.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/v22bis_rx.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,873 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v22bis_rx.c - ITU V.22bis modem receive part + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v22bis_rx.c,v 1.69 2009/11/04 15:52:06 steveu Exp $ + */ + +/*! \file */ + +/* THIS IS A WORK IN PROGRESS - It is basically functional, but it is not feature + complete, and doesn't reliably sync over the signal and noise level ranges it + should. There are some nasty inefficiencies too! + TODO: + Better noise performance + Retrain is incomplete + Rate change is not implemented + Remote loopback is not implemented */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/complex.h" +#include "spandsp/vector_float.h" +#include "spandsp/complex_vector_float.h" +#include "spandsp/async.h" +#include "spandsp/power_meter.h" +#include "spandsp/arctan2.h" +#include "spandsp/dds.h" +#include "spandsp/complex_filters.h" + +#include "spandsp/v29rx.h" +#include "spandsp/v22bis.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/v22bis.h" + +#if defined(SPANDSP_USE_FIXED_POINTx) +#include "v22bis_rx_1200_floating_rrc.h" +#include "v22bis_rx_2400_floating_rrc.h" +#else +#include "v22bis_rx_1200_floating_rrc.h" +#include "v22bis_rx_2400_floating_rrc.h" +#endif + +#define ms_to_symbols(t) (((t)*600)/1000) + +/*! The adaption rate coefficient for the equalizer */ +#define EQUALIZER_DELTA 0.25f +/*! The number of phase shifted coefficient set for the pulse shaping/bandpass filter */ +#define PULSESHAPER_COEFF_SETS 12 + +/* +The basic method used by the V.22bis receiver is: + + Put each sample into the pulse-shaping and phase shift filter buffer + + At T/2 rate: + Filter and demodulate the contents of the input filter buffer, producing a sample + in the equalizer filter buffer. + + Tune the symbol timing based on the latest 3 samples in the equalizer buffer. This + updates the decision points for taking the T/2 samples. + + Equalize the contents of the equalizer buffer, producing a demodulated constellation + point. + + Find the nearest constellation point to the received position. This is our received + symbol. + + Tune the local carrier, based on the angular mismatch between the actual signal and + the decision. + + Tune the equalizer, based on the mismatch between the actual signal and the decision. + + Descramble and output the bits represented by the decision. +*/ + +static const uint8_t space_map_v22bis[6][6] = +{ + {11, 9, 9, 6, 6, 7}, + {10, 8, 8, 4, 4, 5}, + {10, 8, 8, 4, 4, 5}, + {13, 12, 12, 0, 0, 2}, + {13, 12, 12, 0, 0, 2}, + {15, 14, 14, 1, 1, 3} +}; + +static const uint8_t phase_steps[4] = +{ + 1, 0, 2, 3 +}; + +static const uint8_t ones[] = +{ + 0, 1, 1, 2, + 1, 2, 2, 3, + 1, 2, 2, 3, + 2, 3, 3, 4 +}; + +SPAN_DECLARE(float) v22bis_rx_carrier_frequency(v22bis_state_t *s) +{ + return dds_frequencyf(s->rx.carrier_phase_rate); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) v22bis_rx_symbol_timing_correction(v22bis_state_t *s) +{ + return (float) s->rx.total_baud_timing_correction/((float) PULSESHAPER_COEFF_SETS*40.0f/(3.0f*2.0f)); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) v22bis_rx_signal_power(v22bis_state_t *s) +{ + return power_meter_current_dbm0(&s->rx.rx_power) + 6.34f; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v22bis_rx_signal_cutoff(v22bis_state_t *s, float cutoff) +{ + s->rx.carrier_on_power = (int32_t) (power_meter_level_dbm0(cutoff + 2.5f)*0.232f); + s->rx.carrier_off_power = (int32_t) (power_meter_level_dbm0(cutoff - 2.5f)*0.232f); +} +/*- End of function --------------------------------------------------------*/ + +void v22bis_report_status_change(v22bis_state_t *s, int status) +{ + if (s->status_handler) + s->status_handler(s->status_user_data, status); + else if (s->put_bit) + s->put_bit(s->put_bit_user_data, status); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v22bis_rx_equalizer_state(v22bis_state_t *s, complexf_t **coeffs) +{ + *coeffs = s->rx.eq_coeff; + return 2*V22BIS_EQUALIZER_LEN + 1; +} +/*- End of function --------------------------------------------------------*/ + +void v22bis_equalizer_coefficient_reset(v22bis_state_t *s) +{ + /* Start with an equalizer based on everything being perfect */ +#if defined(SPANDSP_USE_FIXED_POINTx) + cvec_zeroi16(s->rx.eq_coeff, 2*V22BIS_EQUALIZER_LEN + 1); + s->rx.eq_coeff[V22BIS_EQUALIZER_LEN] = complex_seti16(3*FP_FACTOR, 0*FP_FACTOR); + s->rx.eq_delta = 32768.0f*EQUALIZER_DELTA/(2*V22BIS_EQUALIZER_LEN + 1); +#else + cvec_zerof(s->rx.eq_coeff, 2*V22BIS_EQUALIZER_LEN + 1); + s->rx.eq_coeff[V22BIS_EQUALIZER_LEN] = complex_setf(3.0f, 0.0f); + s->rx.eq_delta = EQUALIZER_DELTA/(2*V22BIS_EQUALIZER_LEN + 1); +#endif +} +/*- End of function --------------------------------------------------------*/ + +static void equalizer_reset(v22bis_state_t *s) +{ + v22bis_equalizer_coefficient_reset(s); +#if defined(SPANDSP_USE_FIXED_POINTx) + cvec_zeroi16(s->rx.eq_buf, V22BIS_EQUALIZER_MASK + 1); +#else + cvec_zerof(s->rx.eq_buf, V22BIS_EQUALIZER_MASK + 1); +#endif + s->rx.eq_put_step = 20 - 1; + s->rx.eq_step = 0; +} +/*- End of function --------------------------------------------------------*/ + +static complexf_t equalizer_get(v22bis_state_t *s) +{ + int i; + int p; + complexf_t z; + complexf_t z1; + + /* Get the next equalized value. */ + z = complex_setf(0.0f, 0.0f); + p = s->rx.eq_step - 1; + for (i = 0; i < 2*V22BIS_EQUALIZER_LEN + 1; i++) + { + p = (p - 1) & V22BIS_EQUALIZER_MASK; + z1 = complex_mulf(&s->rx.eq_coeff[i], &s->rx.eq_buf[p]); + z = complex_addf(&z, &z1); + } + return z; +} +/*- End of function --------------------------------------------------------*/ + +static void tune_equalizer(v22bis_state_t *s, const complexf_t *z, const complexf_t *target) +{ + int i; + int p; + complexf_t ez; + complexf_t z1; + + /* Find the x and y mismatch from the exact constellation position. */ + ez = complex_subf(target, z); + ez.re *= s->rx.eq_delta; + ez.im *= s->rx.eq_delta; + + p = s->rx.eq_step - 1; + for (i = 0; i < 2*V22BIS_EQUALIZER_LEN + 1; i++) + { + p = (p - 1) & V22BIS_EQUALIZER_MASK; + z1 = complex_conjf(&s->rx.eq_buf[p]); + z1 = complex_mulf(&ez, &z1); + s->rx.eq_coeff[i] = complex_addf(&s->rx.eq_coeff[i], &z1); + /* If we don't leak a little bit we seem to get some wandering adaption */ + s->rx.eq_coeff[i].re *= 0.9999f; + s->rx.eq_coeff[i].im *= 0.9999f; + } +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void track_carrier(v22bis_state_t *s, const complexf_t *z, const complexf_t *target) +{ + float error; + + /* For small errors the imaginary part of the difference between the actual and the target + positions is proportional to the phase error, for any particular target. However, the + different amplitudes of the various target positions scale things. */ + error = z->im*target->re - z->re*target->im; + + s->rx.carrier_phase_rate += (int32_t) (s->rx.carrier_track_i*error); + s->rx.carrier_phase += (int32_t) (s->rx.carrier_track_p*error); + //span_log(&s->logging, SPAN_LOG_FLOW, "Im = %15.5f f = %15.5f\n", error, dds_frequencyf(s->rx.carrier_phase_rate)); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int descramble(v22bis_state_t *s, int bit) +{ + int out_bit; + + bit &= 1; + + /* Descramble the bit */ + out_bit = (bit ^ (s->rx.scramble_reg >> 13) ^ (s->rx.scramble_reg >> 16)) & 1; + s->rx.scramble_reg = (s->rx.scramble_reg << 1) | bit; + + if (s->rx.scrambler_pattern_count >= 64) + { + out_bit ^= 1; + s->rx.scrambler_pattern_count = 0; + } + if (bit) + s->rx.scrambler_pattern_count++; + else + s->rx.scrambler_pattern_count = 0; + return out_bit; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void put_bit(v22bis_state_t *s, int bit) +{ + int out_bit; + + /* Descramble the bit */ + out_bit = descramble(s, bit); + s->put_bit(s->put_bit_user_data, out_bit); +} +/*- End of function --------------------------------------------------------*/ + +static void decode_baud(v22bis_state_t *s, int nearest) +{ + int raw_bits; + + raw_bits = phase_steps[((nearest >> 2) - (s->rx.constellation_state >> 2)) & 3]; + s->rx.constellation_state = nearest; + /* The first two bits are the quadrant */ + put_bit(s, raw_bits >> 1); + put_bit(s, raw_bits); + if (s->rx.sixteen_way_decisions) + { + /* The other two bits are the position within the quadrant */ + put_bit(s, nearest >> 1); + put_bit(s, nearest); + } +} +/*- End of function --------------------------------------------------------*/ + +static int decode_baudx(v22bis_state_t *s, int nearest) +{ + int raw_bits; + int out_bits; + + raw_bits = phase_steps[((nearest >> 2) - (s->rx.constellation_state >> 2)) & 3]; + s->rx.constellation_state = nearest; + /* The first two bits are the quadrant */ + out_bits = descramble(s, raw_bits >> 1); + out_bits = (out_bits << 1) | descramble(s, raw_bits); + if (s->rx.sixteen_way_decisions) + { + /* The other two bits are the position within the quadrant */ + out_bits = (out_bits << 1) | descramble(s, nearest >> 1); + out_bits = (out_bits << 1) | descramble(s, nearest); + } + return out_bits; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void symbol_sync(v22bis_state_t *s) +{ + float p; + float q; + complexf_t zz; + complexf_t a; + complexf_t b; + complexf_t c; + + /* This routine adapts the position of the half baud samples entering the equalizer. */ + + /* Perform a Gardner test for baud alignment on the three most recent samples. */ + if (s->rx.sixteen_way_decisions) + { + p = s->rx.eq_buf[(s->rx.eq_step - 3) & V22BIS_EQUALIZER_MASK].re + - s->rx.eq_buf[(s->rx.eq_step - 1) & V22BIS_EQUALIZER_MASK].re; + p *= s->rx.eq_buf[(s->rx.eq_step - 2) & V22BIS_EQUALIZER_MASK].re; + + q = s->rx.eq_buf[(s->rx.eq_step - 3) & V22BIS_EQUALIZER_MASK].im + - s->rx.eq_buf[(s->rx.eq_step - 1) & V22BIS_EQUALIZER_MASK].im; + q *= s->rx.eq_buf[(s->rx.eq_step - 2) & V22BIS_EQUALIZER_MASK].im; + } + else + { + /* Rotate the points to the 45 degree positions, to maximise the effectiveness of + the Gardner algorithm. This is particularly significant at the start of operation + to pull things in quickly. */ + zz = complex_setf(0.894427, 0.44721f); + a = complex_mulf(&s->rx.eq_buf[(s->rx.eq_step - 3) & V22BIS_EQUALIZER_MASK], &zz); + b = complex_mulf(&s->rx.eq_buf[(s->rx.eq_step - 2) & V22BIS_EQUALIZER_MASK], &zz); + c = complex_mulf(&s->rx.eq_buf[(s->rx.eq_step - 1) & V22BIS_EQUALIZER_MASK], &zz); + p = (a.re - c.re)*b.re; + q = (a.im - c.im)*b.im; + } + + s->rx.gardner_integrate += (p + q > 0.0f) ? s->rx.gardner_step : -s->rx.gardner_step; + + if (abs(s->rx.gardner_integrate) >= 16) + { + /* This integrate and dump approach avoids rapid changes of the equalizer put step. + Rapid changes, without hysteresis, are bad. They degrade the equalizer performance + when the true symbol boundary is close to a sample boundary. */ + s->rx.eq_put_step += (s->rx.gardner_integrate/16); + s->rx.total_baud_timing_correction += (s->rx.gardner_integrate/16); + //span_log(&s->logging, SPAN_LOG_FLOW, "Gardner kick %d [total %d]\n", s->rx.gardner_integrate, s->rx.total_baud_timing_correction); + if (s->rx.qam_report) + s->rx.qam_report(s->rx.qam_user_data, NULL, NULL, s->rx.gardner_integrate); + s->rx.gardner_integrate = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +static void process_half_baud(v22bis_state_t *s, const complexf_t *sample) +{ + complexf_t z; + complexf_t zz; + const complexf_t *target; + int re; + int im; + int nearest; + int bitstream; + int raw_bits; + + z.re = sample->re; + z.im = sample->im; + + /* Add a sample to the equalizer's circular buffer, but don't calculate anything + at this time. */ + s->rx.eq_buf[s->rx.eq_step] = z; + s->rx.eq_step = (s->rx.eq_step + 1) & V22BIS_EQUALIZER_MASK; + + /* On alternate insertions we have a whole baud and must process it. */ + if ((s->rx.baud_phase ^= 1)) + return; + + symbol_sync(s); + + z = equalizer_get(s); + + /* Find the constellation point */ + if (s->rx.sixteen_way_decisions) + { + re = (int) (z.re + 3.0f); + if (re > 5) + re = 5; + else if (re < 0) + re = 0; + im = (int) (z.im + 3.0f); + if (im > 5) + im = 5; + else if (im < 0) + im = 0; + nearest = space_map_v22bis[re][im]; + } + else + { + /* Rotate to 45 degrees, to make the slicing trivial */ + zz = complex_setf(0.894427, 0.44721f); + zz = complex_mulf(&z, &zz); + nearest = 0x01; + if (zz.re < 0.0f) + nearest |= 0x04; + if (zz.im < 0.0f) + { + nearest ^= 0x04; + nearest |= 0x08; + } + } + raw_bits = 0; + + switch (s->rx.training) + { + case V22BIS_RX_TRAINING_STAGE_NORMAL_OPERATION: + /* Normal operation. */ + target = &v22bis_constellation[nearest]; + track_carrier(s, &z, target); + tune_equalizer(s, &z, target); + raw_bits = phase_steps[((nearest >> 2) - (s->rx.constellation_state >> 2)) & 3]; + /* TODO: detect unscrambled ones indicating a loopback request */ + + /* Search for the S1 signal that might be requesting a retrain */ + if ((s->rx.last_raw_bits ^ raw_bits) == 0x3) + { + s->rx.pattern_repeats++; + } + else + { + if (s->rx.pattern_repeats >= 50 && (s->rx.last_raw_bits == 0x3 || s->rx.last_raw_bits == 0x0)) + { + /* We should get a full run of 00 11 (about 60 bauds) at either modem. */ + span_log(&s->logging, SPAN_LOG_FLOW, "+++ S1 detected (%d long)\n", s->rx.pattern_repeats); + span_log(&s->logging, SPAN_LOG_FLOW, "+++ Accepting a retrain request\n"); + s->rx.pattern_repeats = 0; + s->rx.training_count = 0; + s->rx.training = V22BIS_RX_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200; + s->tx.training_count = 0; + s->tx.training = V22BIS_TX_TRAINING_STAGE_U0011; + v22bis_equalizer_coefficient_reset(s); + v22bis_report_status_change(s, SIG_STATUS_MODEM_RETRAIN_OCCURRED); + } + s->rx.pattern_repeats = 0; + } + decode_baud(s, nearest); + break; + case V22BIS_RX_TRAINING_STAGE_SYMBOL_ACQUISITION: + /* Allow time for the Gardner algorithm to settle the symbol timing. */ + target = &z; + if (++s->rx.training_count >= 40) + { + /* QAM and Gardner only play nicely with heavy damping, so we need to change to + a slow rate of symbol timing adaption. However, it must not be so slow that it + cannot track the worst case timing error specified in V.22bis. This should be 0.01%, + but since we might be off in the opposite direction from the source, the total + error could be higher. */ + s->rx.gardner_step = 4; + s->rx.pattern_repeats = 0; + if (s->calling_party) + s->rx.training = V22BIS_RX_TRAINING_STAGE_UNSCRAMBLED_ONES; + else + s->rx.training = V22BIS_RX_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200; + /* Be pessimistic and see what the handshake brings */ + s->negotiated_bit_rate = 1200; + break; + } + /* Once we have pulled in the symbol timing in a coarse way, use finer + steps to fine tune the timing. */ + if (s->rx.training_count == 30) + s->rx.gardner_step = 32; + break; + case V22BIS_RX_TRAINING_STAGE_UNSCRAMBLED_ONES: + /* Calling modem only */ + /* The calling modem should initially receive unscrambled ones at 1200bps */ + target = &v22bis_constellation[nearest]; + track_carrier(s, &z, target); + raw_bits = phase_steps[((nearest >> 2) - (s->rx.constellation_state >> 2)) & 3]; + s->rx.constellation_state = nearest; + if (raw_bits != s->rx.last_raw_bits) + s->rx.pattern_repeats = 0; + else + s->rx.pattern_repeats++; + if (++s->rx.training_count == ms_to_symbols(155 + 456)) + { + /* After the first 155ms things should have been steady, so check if the last 456ms was + steady at 11 or 00. */ + if (raw_bits == s->rx.last_raw_bits + && + (raw_bits == 0x3 || raw_bits == 0x0) + && + s->rx.pattern_repeats >= ms_to_symbols(456)) + { + /* It looks like the answering machine is sending us a clean unscrambled 11 or 00 */ + if (s->bit_rate == 2400) + { + /* Try to establish at 2400bps */ + span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting U0011 (S1) (Caller)\n"); + s->tx.training = V22BIS_TX_TRAINING_STAGE_U0011; + s->tx.training_count = 0; + } + else + { + /* Only try to establish at 1200bps */ + span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting S11 (1200) (Caller)\n"); + s->tx.training = V22BIS_TX_TRAINING_STAGE_S11; + s->tx.training_count = 0; + } + } + s->rx.pattern_repeats = 0; + s->rx.training_count = 0; + s->rx.training = V22BIS_RX_TRAINING_STAGE_UNSCRAMBLED_ONES_SUSTAINING; + } + break; + case V22BIS_RX_TRAINING_STAGE_UNSCRAMBLED_ONES_SUSTAINING: + /* Calling modem only */ + /* Wait for the end of the unscrambled ones at 1200bps */ + target = &v22bis_constellation[nearest]; + track_carrier(s, &z, target); + raw_bits = phase_steps[((nearest >> 2) - (s->rx.constellation_state >> 2)) & 3]; + s->rx.constellation_state = nearest; + if (raw_bits != s->rx.last_raw_bits) + { + /* This looks like the end of the sustained initial unscrambled 11 or 00 */ + s->tx.training_count = 0; + s->tx.training = V22BIS_TX_TRAINING_STAGE_TIMED_S11; + s->rx.training_count = 0; + s->rx.training = V22BIS_RX_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200; + s->rx.pattern_repeats = 0; + } + break; + case V22BIS_RX_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200: + target = &v22bis_constellation[nearest]; + track_carrier(s, &z, target); + tune_equalizer(s, &z, target); + raw_bits = phase_steps[((nearest >> 2) - (s->rx.constellation_state >> 2)) & 3]; + bitstream = decode_baudx(s, nearest); + s->rx.training_count++; +//span_log(&s->logging, SPAN_LOG_FLOW, "S11 0x%02x 0x%02x 0x%X %d %d %d %d %d\n", raw_bits, nearest, bitstream, s->rx.scrambled_ones_to_date, 0, 0, 0, s->rx.training_count); + if (s->negotiated_bit_rate == 1200) + { + /* Search for the S1 signal */ + if ((s->rx.last_raw_bits ^ raw_bits) == 0x3) + { + s->rx.pattern_repeats++; + } + else + { + if (s->rx.pattern_repeats >= 15 && (s->rx.last_raw_bits == 0x3 || s->rx.last_raw_bits == 0x0)) + { + /* We should get a full run of 00 11 (about 60 bauds) at the calling modem, but only about 20 + at the answering modem, as the first 40 are TED settling time. */ + span_log(&s->logging, SPAN_LOG_FLOW, "+++ S1 detected (%d long)\n", s->rx.pattern_repeats); + if (s->bit_rate == 2400) + { + if (!s->calling_party) + { + /* Accept establishment at 2400bps */ + span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting U0011 (S1) (Answerer)\n"); + s->tx.training = V22BIS_TX_TRAINING_STAGE_U0011; + s->tx.training_count = 0; + } + s->negotiated_bit_rate = 2400; + } + } + s->rx.pattern_repeats = 0; + } + if (s->rx.training_count >= ms_to_symbols(270)) + { + /* If we haven't seen the S1 signal by now, we are committed to be in 1200bps mode */ + if (s->calling_party) + { + span_log(&s->logging, SPAN_LOG_FLOW, "+++ Rx normal operation (1200)\n"); + /* The transmit side needs to sustain the scrambled ones for a timed period */ + s->tx.training_count = 0; + s->tx.training = V22BIS_TX_TRAINING_STAGE_TIMED_S11; + /* Normal reception starts immediately */ + s->rx.training = V22BIS_RX_TRAINING_STAGE_NORMAL_OPERATION; + s->rx.carrier_track_i = 8000.0f; + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting S11 (1200) (Answerer)\n"); + /* The transmit side needs to sustain the scrambled ones for a timed period */ + s->tx.training_count = 0; + s->tx.training = V22BIS_TX_TRAINING_STAGE_TIMED_S11; + /* The receive side needs to wait a timed period, receiving scrambled ones, + before entering normal operation. */ + s->rx.training = V22BIS_RX_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200_SUSTAINING; + } + } + } + else + { + if (s->calling_party) + { + if (s->rx.training_count >= ms_to_symbols(100 + 450)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting 16 way decisions (caller)\n"); + s->rx.sixteen_way_decisions = TRUE; + s->rx.training = V22BIS_RX_TRAINING_STAGE_WAIT_FOR_SCRAMBLED_ONES_AT_2400; + s->rx.pattern_repeats = 0; + s->rx.carrier_track_i = 8000.0f; + } + } + else + { + if (s->rx.training_count >= ms_to_symbols(450)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting 16 way decisions (answerer)\n"); + s->rx.sixteen_way_decisions = TRUE; + s->rx.training = V22BIS_RX_TRAINING_STAGE_WAIT_FOR_SCRAMBLED_ONES_AT_2400; + s->rx.pattern_repeats = 0; + } + } + } + break; + case V22BIS_RX_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200_SUSTAINING: + target = &v22bis_constellation[nearest]; + track_carrier(s, &z, target); + tune_equalizer(s, &z, target); + bitstream = decode_baudx(s, nearest); + if (++s->rx.training_count > ms_to_symbols(270 + 765)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "+++ Rx normal operation (1200)\n"); + s->rx.training = V22BIS_RX_TRAINING_STAGE_NORMAL_OPERATION; + } + break; + case V22BIS_RX_TRAINING_STAGE_WAIT_FOR_SCRAMBLED_ONES_AT_2400: + target = &v22bis_constellation[nearest]; + track_carrier(s, &z, target); + tune_equalizer(s, &z, target); + bitstream = decode_baudx(s, nearest); + /* We need 32 sustained 1's to switch into normal operation. */ + if (bitstream == 0xF) + { + if (++s->rx.pattern_repeats >= 9) + { + span_log(&s->logging, SPAN_LOG_FLOW, "+++ Rx normal operation (2400)\n"); + s->rx.training = V22BIS_RX_TRAINING_STAGE_NORMAL_OPERATION; + } + } + else + { + s->rx.pattern_repeats = 0; + } + break; + case V22BIS_RX_TRAINING_STAGE_PARKED: + default: + /* We failed to train! */ + /* Park here until the carrier drops. */ + target = &z; + break; + } + s->rx.last_raw_bits = raw_bits; + if (s->rx.qam_report) + s->rx.qam_report(s->rx.qam_user_data, &z, target, s->rx.constellation_state); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int len) +{ + int i; + int j; + int step; + complexf_t z; + complexf_t zz; + int32_t power; + complexf_t sample; + float ii; + float qq; + + for (i = 0; i < len; i++) + { + /* Complex bandpass filter the signal, using a pair of FIRs, and RRC coeffs shifted + to centre at 1200Hz or 2400Hz. The filters support 12 fractional phase shifts, to + permit signal extraction very close to the middle of a symbol. */ + s->rx.rrc_filter[s->rx.rrc_filter_step] = + s->rx.rrc_filter[s->rx.rrc_filter_step + V22BIS_RX_FILTER_STEPS] = amp[i]; + if (++s->rx.rrc_filter_step >= V22BIS_RX_FILTER_STEPS) + s->rx.rrc_filter_step = 0; + + /* Calculate the I filter, with an arbitrary phase step, just so we can calculate + the signal power of the required carrier, with any guard tone or spillback of our + own transmitted signal suppressed. */ + if (s->calling_party) + { + ii = rx_pulseshaper_2400_re[6][0]*s->rx.rrc_filter[s->rx.rrc_filter_step]; + for (j = 1; j < V22BIS_RX_FILTER_STEPS; j++) + ii += rx_pulseshaper_2400_re[6][j]*s->rx.rrc_filter[j + s->rx.rrc_filter_step]; + } + else + { + ii = rx_pulseshaper_1200_re[6][0]*s->rx.rrc_filter[s->rx.rrc_filter_step]; + for (j = 1; j < V22BIS_RX_FILTER_STEPS; j++) + ii += rx_pulseshaper_1200_re[6][j]*s->rx.rrc_filter[j + s->rx.rrc_filter_step]; + } + power = power_meter_update(&(s->rx.rx_power), (int16_t) ii); + if (s->rx.signal_present) + { + /* Look for power below the carrier off point */ + if (power < s->rx.carrier_off_power) + { + v22bis_restart(s, s->bit_rate); + v22bis_report_status_change(s, SIG_STATUS_CARRIER_DOWN); + continue; + } + } + else + { + /* Look for power exceeding the carrier on point */ + if (power < s->rx.carrier_on_power) + continue; + s->rx.signal_present = TRUE; + v22bis_report_status_change(s, SIG_STATUS_CARRIER_UP); + } + if (s->rx.training != V22BIS_RX_TRAINING_STAGE_PARKED) + { + /* Only spend effort processing this data if the modem is not + parked, after a training failure. */ + z = dds_complexf(&s->rx.carrier_phase, s->rx.carrier_phase_rate); + if (s->rx.training == V22BIS_RX_TRAINING_STAGE_SYMBOL_ACQUISITION) + { + /* Only AGC during the initial symbol acquisition, and then lock the gain. */ + s->rx.agc_scaling = 0.18f*3.60f/sqrtf(power); + } + /* Put things into the equalization buffer at T/2 rate. The Gardner algorithm + will fiddle the step to align this with the symbols. */ + if ((s->rx.eq_put_step -= PULSESHAPER_COEFF_SETS) <= 0) + { + /* Pulse shape while still at the carrier frequency, using a quadrature + pair of filters. This results in a properly bandpass filtered complex + signal, which can be brought directly to bandband by complex mixing. + No further filtering, to remove mixer harmonics, is needed. */ + step = -s->rx.eq_put_step; + if (step > PULSESHAPER_COEFF_SETS - 1) + step = PULSESHAPER_COEFF_SETS - 1; + s->rx.eq_put_step += PULSESHAPER_COEFF_SETS*40/(3*2); + if (s->calling_party) + { + ii = rx_pulseshaper_2400_re[step][0]*s->rx.rrc_filter[s->rx.rrc_filter_step]; + qq = rx_pulseshaper_2400_im[step][0]*s->rx.rrc_filter[s->rx.rrc_filter_step]; + for (j = 1; j < V22BIS_RX_FILTER_STEPS; j++) + { + ii += rx_pulseshaper_2400_re[step][j]*s->rx.rrc_filter[j + s->rx.rrc_filter_step]; + qq += rx_pulseshaper_2400_im[step][j]*s->rx.rrc_filter[j + s->rx.rrc_filter_step]; + } + } + else + { + ii = rx_pulseshaper_1200_re[step][0]*s->rx.rrc_filter[s->rx.rrc_filter_step]; + qq = rx_pulseshaper_1200_im[step][0]*s->rx.rrc_filter[s->rx.rrc_filter_step]; + for (j = 1; j < V22BIS_RX_FILTER_STEPS; j++) + { + ii += rx_pulseshaper_1200_re[step][j]*s->rx.rrc_filter[j + s->rx.rrc_filter_step]; + qq += rx_pulseshaper_1200_im[step][j]*s->rx.rrc_filter[j + s->rx.rrc_filter_step]; + } + } + sample.re = ii*s->rx.agc_scaling; + sample.im = qq*s->rx.agc_scaling; + /* Shift to baseband - since this is done in a full complex form, the + result is clean, and requires no further filtering apart from the + equalizer. */ + zz.re = sample.re*z.re - sample.im*z.im; + zz.im = -sample.re*z.im - sample.im*z.re; + process_half_baud(s, &zz); + } + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v22bis_rx_fillin(v22bis_state_t *s, int len) +{ + int i; + + /* We want to sustain the current state (i.e carrier on<->carrier off), and + try to sustain the carrier phase. We should probably push the filters, as well */ + span_log(&s->logging, SPAN_LOG_FLOW, "Fill-in %d samples\n", len); + if (!s->rx.signal_present) + return 0; + for (i = 0; i < len; i++) + { +#if defined(SPANDSP_USE_FIXED_POINTx) + dds_advance(&s->rx.carrier_phase, s->rx.carrier_phase_rate); +#else + dds_advancef(&s->rx.carrier_phase, s->rx.carrier_phase_rate); +#endif + } + /* TODO: Advance the symbol phase the appropriate amount */ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int v22bis_rx_restart(v22bis_state_t *s) +{ + vec_zerof(s->rx.rrc_filter, sizeof(s->rx.rrc_filter)/sizeof(s->rx.rrc_filter[0])); + s->rx.rrc_filter_step = 0; + s->rx.scramble_reg = 0; + s->rx.scrambler_pattern_count = 0; + s->rx.training = V22BIS_RX_TRAINING_STAGE_SYMBOL_ACQUISITION; + s->rx.training_count = 0; + s->rx.signal_present = FALSE; + + s->rx.carrier_phase_rate = dds_phase_ratef((s->calling_party) ? 2400.0f : 1200.0f); + s->rx.carrier_phase = 0; + power_meter_init(&(s->rx.rx_power), 5); + v22bis_rx_signal_cutoff(s, -45.5f); + s->rx.agc_scaling = 0.0005f*0.025f; + + s->rx.constellation_state = 0; + s->rx.sixteen_way_decisions = FALSE; + + equalizer_reset(s); + + s->rx.pattern_repeats = 0; + s->rx.last_raw_bits = 0; + s->rx.gardner_integrate = 0; + s->rx.gardner_step = 256; + s->rx.baud_phase = 0; + s->rx.training_error = 0.0f; + s->rx.total_baud_timing_correction = 0; + /* We want the carrier to pull in faster on the answerer side, as it has very little time to adapt. */ + s->rx.carrier_track_i = (s->calling_party) ? 8000.0f : 40000.0f; + s->rx.carrier_track_p = 8000000.0f; + + s->negotiated_bit_rate = 1200; + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v22bis_rx_set_qam_report_handler(v22bis_state_t *s, qam_report_handler_t handler, void *user_data) +{ + s->rx.qam_report = handler; + s->rx.qam_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/v22bis_tx.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/v22bis_tx.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,705 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v22bis_tx.c - ITU V.22bis modem transmit part + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v22bis_tx.c,v 1.64 2009/11/04 15:52:06 steveu Exp $ + */ + +/*! \file */ + +/* THIS IS A WORK IN PROGRESS - It is basically functional, but it is not feature + complete, and doesn't reliably sync over the signal and noise level ranges it should! */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/logging.h" +#include "spandsp/complex.h" +#include "spandsp/vector_float.h" +#include "spandsp/complex_vector_float.h" +#include "spandsp/async.h" +#include "spandsp/dds.h" +#include "spandsp/power_meter.h" + +#include "spandsp/v29rx.h" +#include "spandsp/v22bis.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/v22bis.h" + +#if defined(SPANDSP_USE_FIXED_POINTx) +#include "v22bis_tx_fixed_rrc.h" +#else +#include "v22bis_tx_floating_rrc.h" +#endif + +/* Quoting from the V.22bis spec. + +6.3.1.1 Interworking at 2400 bit/s + +6.3.1.1.1 Calling modem + +a) On connection to line the calling modem shall be conditioned to receive signals + in the high channel at 1200 bit/s and transmit signals in the low channel at 1200 bit/s + in accordance with section 2.5.2.2. It shall apply an ON condition to circuit 107 in accordance + with Recommendation V.25. The modem shall initially remain silent. + +b) After 155 +-10 ms of unscrambled binary 1 has been detected, the modem shall remain silent + for a further 456 +-10 ms then transmit an unscrambled repetitive double dibit pattern of 00 + and 11 at 1200 bit/s for 100 +-3 ms. Following this signal the modem shall transmit scrambled + binary 1 at 1200 bit/s. + +c) If the modem detects scrambled binary 1 in the high channel at 1200 bit/s for 270 +-40 ms, + the handshake shall continue in accordance with section 6.3.1.2.1 c) and d). However, if unscrambled + repetitive double dibit 00 and 11 at 1200 bit/s is detected in the high channel, then at the + end of receipt of this signal the modem shall apply an ON condition to circuit 112. + +d) 600 +-10 ms after circuit 112 has been turned ON the modem shall begin transmitting scrambled + binary 1 at 2400 bit/s, and 450 +-10 ms after circuit 112 has been turned ON the receiver may + begin making 16-way decisions. + +e) Following transmission of scrambled binary 1 at 2400 bit/s for 200 +-10 ms, circuit 106 shall + be conditioned to respond to circuit 105 and the modem shall be ready to transmit data at + 2400 bit/s. + +f) When 32 consecutive bits of scrambled binary 1 at 2400 bit/s have been detected in the high + channel the modem shall be ready to receive data at 2400 bit/s and shall apply an ON condition + to circuit 109. + +6.3.1.1.2 Answering modem + +a) On connection to line the answering modem shall be conditioned to transmit signals in the high + channel at 1200 bit/s in accordance with section 2.5.2.2 and receive signals in the low channel at + 1200 bit/s. Following transmission of the answer sequence in accordance with Recommendation + V.25, the modem shall apply an ON condition to circuit 107 and then transmit unscrambled + binary 1 at 1200 bit/s. + +b) If the modem detects scrambled binary 1 or 0 in the low channel at 1200 bit/s for 270 +-40 ms, + the handshake shall continue in accordance with section 6.3.1.2.2 b) and c). However, if unscrambled + repetitive double dibit 00 and 11 at 1200 bit/s is detected in the low channel, at the end of + receipt of this signal the modem shall apply an ON condition to circuit 112 and then transmit + an unscrambled repetitive double dibit pattern of 00 and 11 at 1200 bit/s for 100 +-3 ms. + Following these signals the modem shall transmit scrambled binary 1 at 1200 bit/s. + +c) 600 +-10 ms after circuit 112 has been turned ON the modem shall begin transmitting scrambled + binary 1 at 2400 bit/s, and 450 +-10 ms after circuit 112 has been turned ON the receiver may + begin making 16-way decisions. + +d) Following transmission of scrambled binary 1 at 2400 bit/s for 200 +-10 ms, circuit 106 shall + be conditioned to respond to circuit 105 and the modem shall be ready to transmit data at + 2400 bit/s. + +e) When 32 consecutive bits of scrambled binary 1 at 2400 bit/s have been detected in the low + channel the modem shall be ready to receive data at 2400 bit/s and shall apply an ON + condition to circuit 109. + +6.3.1.2 Interworking at 1200 bit/s + +The following handshake is identical to the Recommendation V.22 alternative A and B handshake. + +6.3.1.2.1 Calling modem + +a) On connection to line the calling modem shall be conditioned to receive signals in the high + channel at 1200 bit/s and transmit signals in the low channel at 1200 bit/s in accordance + with section 2.5.2.2. It shall apply an ON condition to circuit 107 in accordance with + Recommendation V.25. The modem shall initially remain silent. + +b) After 155 +-10 ms of unscrambled binary 1 has been detected, the modem shall remain silent + for a further 456 +-10 ms then transmit scrambled binary 1 at 1200 bit/s (a preceding V.22 bis + signal, as shown in Figure 7/V.22 bis, would not affect the operation of a V.22 answer modem). + +c) On detection of scrambled binary 1 in the high channel at 1200 bit/s for 270 +-40 ms the modem + shall be ready to receive data at 1200 bit/s and shall apply an ON condition to circuit 109 and + an OFF condition to circuit 112. + +d) 765 +-10 ms after circuit 109 has been turned ON, circuit 106 shall be conditioned to respond + to circuit 105 and the modem shall be ready to transmit data at 1200 bit/s. + +6.3.1.2.2 Answering modem + +a) On connection to line the answering modem shall be conditioned to transmit signals in the high + channel at 1200 bit/s in accordance with section 2.5.2.2 and receive signals in the low channel at + 1200 bit/s. + + Following transmission of the answer sequence in accordance with V.25 the modem shall apply + an ON condition to circuit 107 and then transmit unscrambled binary 1 at 1200 bit/s. + +b) On detection of scrambled binary 1 or 0 in the low channel at 1200 bit/s for 270 +-40 ms the + modem shall apply an OFF condition to circuit 112 and shall then transmit scrambled binary 1 + at 1200 bit/s. + +c) After scrambled binary 1 has been transmitted at 1200 bit/s for 765 +-10 ms the modem shall be + ready to transmit and receive data at 1200 bit/s, shall condition circuit 106 to respond to + circuit 105 and shall apply an ON condition to circuit 109. + +Note - Manufacturers may wish to note that in certain countries, for national purposes, modems are + in service which emit an answering tone of 2225 Hz instead of unscrambled binary 1. + + +V.22bis to V.22bis +------------------ +Calling party + S1 scrambled 1's scrambled 1's data + at 1200bps at 2400bps +|---------------------------------------------------------|XXXXXXXX|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX|XXXXXXXXXXXXXX|XXXXXXXXXXXXX + |<155+-10>|<456+-10>|<100+-3>| |<------600+-10------>|<---200+-10-->| + ^ | ^<----450+-100---->|[16 way decisions begin] + | | | + | v | + | |<------450+-100----->|[16 way decisions begin] + | |<----------600+-10-------->| + |<2150+-350>|<--3300+-700->|<75+-20>| |<100+-3>| |<---200+-10--> + |-----------|XXXXXXXXXXXXXX|--------|XXXXXXXXXXXXXXXXXXXXXXXXXXXX|XXXXXXXX|XXXXXXXXXXXXXXXXXX|XXXXXXXXXXXXXX|XXXXXXXXXXXXX + silence 2100Hz unscrambled 1's S1 scrambled 1's scrambled 1's data + at 1200bps at 1200bps at 2400bps +Answering party + +S1 = Unscrambled double dibit 00 and 11 at 1200bps +When the 2400bps section starts, both sides should look for 32 bits of continuous ones, as a test of integrity. + + + + +V.22 to V.22bis +--------------- +Calling party + scrambled 1's data + at 1200bps +|---------------------------------------------------------|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX|XXXXXXXXXXXXX + |<155+-10>|<456+-10>| |<270+-40>|<--------765+-10-------->| + ^ | ^ + | | | + | | | + | | | + | v | + |<2150+-350>|<--3300+-700->|<75+-20>| |<270+-40>|<---------765+-10-------->| + |-----------|XXXXXXXXXXXXXX|--------|XXXXXXXXXXXXXXXXXXXXXXXXXXXXX|XXXXXXXXXXXXXXXXXXXXXXXXXX|XXXXXXXXXXXXX + silence 2100Hz unscrambled 1's scrambled 1's data + at 1200bps at 1200bps +Answering party + +Both ends should accept unscrambled binary 1 or binary 0 as the preamble. + + + + +V.22bis to V.22 +--------------- +Calling party + S1 scrambled 1's data + at 1200bps +|---------------------------------------------------------|XXXXXXXX|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX|XXXXXXXXXXXXX + |<155+-10>|<456+-10>|<100+-3>| |<-270+-40-><------765+-10------>| + ^ | ^ + | | | + | v | + | | + | | + |<2150+-350>|<--3300+-700->|<75+-20>| |<-270+-40->|<------765+-10----->| + |-----------|XXXXXXXXXXXXXX|--------|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX|XXXXXXXXXXXXXXXXXXXX|XXXXXXXXXXXXX + silence 2100Hz unscrambled 1's scrambled 1's data + at 1200bps at 1200bps +Answering party + +Both ends should accept unscrambled binary 1 or binary 0 as the preamble. +*/ + +#define ms_to_symbols(t) (((t)*600)/1000) + +static const int phase_steps[4] = +{ + 1, 0, 2, 3 +}; + +const complexf_t v22bis_constellation[16] = +{ + { 1.0f, 1.0f}, + { 3.0f, 1.0f}, /* 1200bps 00 */ + { 1.0f, 3.0f}, + { 3.0f, 3.0f}, + {-1.0f, 1.0f}, + {-1.0f, 3.0f}, /* 1200bps 01 */ + {-3.0f, 1.0f}, + {-3.0f, 3.0f}, + {-1.0f, -1.0f}, + {-3.0f, -1.0f}, /* 1200bps 10 */ + {-1.0f, -3.0f}, + {-3.0f, -3.0f}, + { 1.0f, -1.0f}, + { 1.0f, -3.0f}, /* 1200bps 11 */ + { 3.0f, -1.0f}, + { 3.0f, -3.0f} +}; + +static int fake_get_bit(void *user_data) +{ + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int scramble(v22bis_state_t *s, int bit) +{ + int out_bit; + + if (s->tx.scrambler_pattern_count >= 64) + { + bit ^= 1; + s->tx.scrambler_pattern_count = 0; + } + out_bit = (bit ^ (s->tx.scramble_reg >> 13) ^ (s->tx.scramble_reg >> 16)) & 1; + s->tx.scramble_reg = (s->tx.scramble_reg << 1) | out_bit; + + if (out_bit == 1) + s->tx.scrambler_pattern_count++; + else + s->tx.scrambler_pattern_count = 0; + return out_bit; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int get_scrambled_bit(v22bis_state_t *s) +{ + int bit; + + if ((bit = s->tx.current_get_bit(s->get_bit_user_data)) == SIG_STATUS_END_OF_DATA) + { + /* Fill out this symbol with ones, and prepare to send + the rest of the shutdown sequence. */ + s->tx.current_get_bit = fake_get_bit; + s->tx.shutdown = 1; + bit = 1; + } + return scramble(s, bit); +} +/*- End of function --------------------------------------------------------*/ + +static complexf_t training_get(v22bis_state_t *s) +{ + complexf_t z; + int bits; + + /* V.22bis training sequence */ + switch (s->tx.training) + { + case V22BIS_TX_TRAINING_STAGE_INITIAL_TIMED_SILENCE: + /* The answerer waits 75ms, then sends unscrambled ones */ + if (++s->tx.training_count >= ms_to_symbols(75)) + { + /* Initial 75ms of silence is over */ + span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting U11 1200\n"); + s->tx.training_count = 0; + s->tx.training = V22BIS_TX_TRAINING_STAGE_U11; + } + /* Fall through */ + case V22BIS_TX_TRAINING_STAGE_INITIAL_SILENCE: + /* Silence */ + s->tx.constellation_state = 0; + z = complex_setf(0.0f, 0.0f); + break; + case V22BIS_TX_TRAINING_STAGE_U11: + /* Send continuous unscrambled ones at 1200bps (i.e. 270 degree phase steps). */ + /* Only the answering modem sends unscrambled ones. It is the first thing exchanged between the modems. */ + s->tx.constellation_state = (s->tx.constellation_state + phase_steps[3]) & 3; + z = v22bis_constellation[(s->tx.constellation_state << 2) | 0x01]; + break; + case V22BIS_TX_TRAINING_STAGE_U0011: + /* Continuous unscrambled double dibit 00 11 at 1200bps. This is termed the S1 segment in + the V.22bis spec. It is only sent to request or accept 2400bps mode, and lasts 100+-3ms. After this + timed burst, we unconditionally change to sending scrambled ones at 1200bps. */ + s->tx.constellation_state = (s->tx.constellation_state + phase_steps[3*(s->tx.training_count & 1)]) & 3; + z = v22bis_constellation[(s->tx.constellation_state << 2) | 0x01]; + if (++s->tx.training_count >= ms_to_symbols(100)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting S11 after U0011\n"); + if (s->calling_party) + { + s->tx.training_count = 0; + s->tx.training = V22BIS_TX_TRAINING_STAGE_S11; + } + else + { + s->tx.training_count = ms_to_symbols(756 - (600 - 100)); + s->tx.training = V22BIS_TX_TRAINING_STAGE_TIMED_S11; + } + } + break; + case V22BIS_TX_TRAINING_STAGE_TIMED_S11: + /* A timed period of scrambled ones at 1200bps. */ + if (++s->tx.training_count >= ms_to_symbols(756)) + { + if (s->negotiated_bit_rate == 2400) + { + span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting S1111 (C)\n"); + s->tx.training_count = 0; + s->tx.training = V22BIS_TX_TRAINING_STAGE_S1111; + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "+++ Tx normal operation (1200)\n"); + s->tx.training_count = 0; + s->tx.training = V22BIS_TX_TRAINING_STAGE_NORMAL_OPERATION; + v22bis_report_status_change(s, SIG_STATUS_TRAINING_SUCCEEDED); + s->tx.current_get_bit = s->get_bit; + } + } + /* Fall through */ + case V22BIS_TX_TRAINING_STAGE_S11: + /* Scrambled ones at 1200bps. */ + bits = scramble(s, 1); + bits = (bits << 1) | scramble(s, 1); + s->tx.constellation_state = (s->tx.constellation_state + phase_steps[bits]) & 3; + z = v22bis_constellation[(s->tx.constellation_state << 2) | 0x01]; + break; + case V22BIS_TX_TRAINING_STAGE_S1111: + /* Scrambled ones at 2400bps. We send a timed 200ms burst, and switch to normal operation at 2400bps */ + bits = scramble(s, 1); + bits = (bits << 1) | scramble(s, 1); + s->tx.constellation_state = (s->tx.constellation_state + phase_steps[bits]) & 3; + bits = scramble(s, 1); + bits = (bits << 1) | scramble(s, 1); + z = v22bis_constellation[(s->tx.constellation_state << 2) | bits]; + if (++s->tx.training_count >= ms_to_symbols(200)) + { + /* We have completed training. Now handle some real work. */ + span_log(&s->logging, SPAN_LOG_FLOW, "+++ Tx normal operation (2400)\n"); + s->tx.training_count = 0; + s->tx.training = V22BIS_TX_TRAINING_STAGE_NORMAL_OPERATION; + v22bis_report_status_change(s, SIG_STATUS_TRAINING_SUCCEEDED); + s->tx.current_get_bit = s->get_bit; + } + break; + case V22BIS_TX_TRAINING_STAGE_PARKED: + default: + z = complex_setf(0.0f, 0.0f); + break; + } + return z; +} +/*- End of function --------------------------------------------------------*/ + +static complexf_t getbaud(v22bis_state_t *s) +{ + int bits; + + if (s->tx.training) + { + /* Send the training sequence */ + return training_get(s); + } + + /* There is no graceful shutdown procedure defined for V.22bis. Just + send some ones, to ensure we get the real data bits through, even + with bad ISI. */ + if (s->tx.shutdown) + { + if (++s->tx.shutdown > 10) + return complex_setf(0.0f, 0.0f); + } + /* The first two bits define the quadrant */ + bits = get_scrambled_bit(s); + bits = (bits << 1) | get_scrambled_bit(s); + s->tx.constellation_state = (s->tx.constellation_state + phase_steps[bits]) & 3; + if (s->negotiated_bit_rate == 1200) + { + bits = 0x01; + } + else + { + /* The other two bits define the position within the quadrant */ + bits = get_scrambled_bit(s); + bits = (bits << 1) | get_scrambled_bit(s); + } + return v22bis_constellation[(s->tx.constellation_state << 2) | bits]; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) v22bis_tx(v22bis_state_t *s, int16_t amp[], int len) +{ + complexf_t x; + complexf_t z; + int i; + int sample; + float famp; + + if (s->tx.shutdown > 10) + return 0; + for (sample = 0; sample < len; sample++) + { + if ((s->tx.baud_phase += 3) >= 40) + { + s->tx.baud_phase -= 40; + s->tx.rrc_filter[s->tx.rrc_filter_step] = + s->tx.rrc_filter[s->tx.rrc_filter_step + V22BIS_TX_FILTER_STEPS] = getbaud(s); + if (++s->tx.rrc_filter_step >= V22BIS_TX_FILTER_STEPS) + s->tx.rrc_filter_step = 0; + } + /* Root raised cosine pulse shaping at baseband */ + x = complex_setf(0.0f, 0.0f); + for (i = 0; i < V22BIS_TX_FILTER_STEPS; i++) + { + x.re += tx_pulseshaper[39 - s->tx.baud_phase][i]*s->tx.rrc_filter[i + s->tx.rrc_filter_step].re; + x.im += tx_pulseshaper[39 - s->tx.baud_phase][i]*s->tx.rrc_filter[i + s->tx.rrc_filter_step].im; + } + /* Now create and modulate the carrier */ + z = dds_complexf(&(s->tx.carrier_phase), s->tx.carrier_phase_rate); + famp = (x.re*z.re - x.im*z.im)*s->tx.gain; + if (s->tx.guard_phase_rate && (s->tx.rrc_filter[s->tx.rrc_filter_step].re != 0.0f || s->tx.rrc_filter[i + s->tx.rrc_filter_step].im != 0.0f)) + { + /* Add the guard tone */ + famp += dds_modf(&(s->tx.guard_phase), s->tx.guard_phase_rate, s->tx.guard_level, 0); + } + /* Don't bother saturating. We should never clip. */ + amp[sample] = (int16_t) lfastrintf(famp); + } + return sample; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v22bis_tx_power(v22bis_state_t *s, float power) +{ + float l; + + if (s->tx.guard_phase_rate == dds_phase_ratef(550.0f)) + { + l = 1.6f*powf(10.0f, (power - 1.0f - DBM0_MAX_POWER)/20.0f); + s->tx.gain = l*32768.0f/(TX_PULSESHAPER_GAIN*3.0f); + l = powf(10.0f, (power - 1.0f - 3.0f - DBM0_MAX_POWER)/20.0f); + s->tx.guard_level = l*32768.0f; + } + else if(s->tx.guard_phase_rate == dds_phase_ratef(1800.0f)) + { + l = 1.6f*powf(10.0f, (power - 1.0f - 1.0f - DBM0_MAX_POWER)/20.0f); + s->tx.gain = l*32768.0f/(TX_PULSESHAPER_GAIN*3.0f); + l = powf(10.0f, (power - 1.0f - 6.0f - DBM0_MAX_POWER)/20.0f); + s->tx.guard_level = l*32768.0f; + } + else + { + l = 1.6f*powf(10.0f, (power - DBM0_MAX_POWER)/20.0f); + s->tx.gain = l*32768.0f/(TX_PULSESHAPER_GAIN*3.0f); + s->tx.guard_level = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +static int v22bis_tx_restart(v22bis_state_t *s) +{ + cvec_zerof(s->tx.rrc_filter, sizeof(s->tx.rrc_filter)/sizeof(s->tx.rrc_filter[0])); + s->tx.rrc_filter_step = 0; + s->tx.scramble_reg = 0; + s->tx.scrambler_pattern_count = 0; + if (s->calling_party) + s->tx.training = V22BIS_TX_TRAINING_STAGE_INITIAL_SILENCE; + else + s->tx.training = V22BIS_TX_TRAINING_STAGE_INITIAL_TIMED_SILENCE; + s->tx.training_count = 0; + s->tx.carrier_phase = 0; + s->tx.guard_phase = 0; + s->tx.baud_phase = 0; + s->tx.constellation_state = 0; + s->tx.current_get_bit = fake_get_bit; + s->tx.shutdown = 0; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v22bis_set_get_bit(v22bis_state_t *s, get_bit_func_t get_bit, void *user_data) +{ + s->get_bit = get_bit; + s->get_bit_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v22bis_set_put_bit(v22bis_state_t *s, put_bit_func_t put_bit, void *user_data) +{ + s->put_bit = put_bit; + s->put_bit_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v22bis_set_modem_status_handler(v22bis_state_t *s, modem_tx_status_func_t handler, void *user_data) +{ + s->status_handler = handler; + s->status_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(logging_state_t *) v22bis_get_logging_state(v22bis_state_t *s) +{ + return &s->logging; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v22bis_restart(v22bis_state_t *s, int bit_rate) +{ + switch (bit_rate) + { + case 2400: + case 1200: + break; + default: + return -1; + } + s->bit_rate = bit_rate; + s->negotiated_bit_rate = 1200; + if (v22bis_tx_restart(s)) + return -1; + return v22bis_rx_restart(s); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v22bis_request_retrain(v22bis_state_t *s, int bit_rate) +{ + /* TODO: support bit rate switching */ + switch (bit_rate) + { + case 2400: + case 1200: + break; + default: + return -1; + } + /* TODO: support bit rate changes */ + /* Retrain is only valid when we are normal operation at 2400bps */ + if (s->rx.training != V22BIS_RX_TRAINING_STAGE_NORMAL_OPERATION + || + s->tx.training != V22BIS_TX_TRAINING_STAGE_NORMAL_OPERATION + || + s->negotiated_bit_rate != 2400) + { + return -1; + } + /* Send things back into the training process at the appropriate point. + The far end should detect the S1 signal, and reciprocate. */ + span_log(&s->logging, SPAN_LOG_FLOW, "+++ Initiating a retrain\n"); + s->rx.pattern_repeats = 0; + s->rx.training_count = 0; + s->rx.training = V22BIS_RX_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200; + s->tx.training_count = 0; + s->tx.training = V22BIS_TX_TRAINING_STAGE_U0011; + v22bis_equalizer_coefficient_reset(s); + v22bis_report_status_change(s, SIG_STATUS_MODEM_RETRAIN_OCCURRED); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v22bis_remote_loopback(v22bis_state_t *s, int enable) +{ + /* TODO: */ + return -1; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v22bis_current_bit_rate(v22bis_state_t *s) +{ + return s->negotiated_bit_rate; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(v22bis_state_t *) v22bis_init(v22bis_state_t *s, + int bit_rate, + int guard, + int calling_party, + get_bit_func_t get_bit, + void *get_bit_user_data, + put_bit_func_t put_bit, + void *put_bit_user_data) +{ + switch (bit_rate) + { + case 2400: + case 1200: + break; + default: + return NULL; + } + if (s == NULL) + { + if ((s = (v22bis_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "V.22bis"); + s->bit_rate = bit_rate; + s->calling_party = calling_party; + + s->get_bit = get_bit; + s->get_bit_user_data = get_bit_user_data; + s->put_bit = put_bit; + s->put_bit_user_data = put_bit_user_data; + + if (s->calling_party) + { + s->tx.carrier_phase_rate = dds_phase_ratef(1200.0f); + } + else + { + s->tx.carrier_phase_rate = dds_phase_ratef(2400.0f); + switch (guard) + { + case V22BIS_GUARD_TONE_550HZ: + s->tx.guard_phase_rate = dds_phase_ratef(550.0f); + break; + case V22BIS_GUARD_TONE_1800HZ: + s->tx.guard_phase_rate = dds_phase_ratef(1800.0f); + break; + default: + s->tx.guard_phase_rate = 0; + break; + } + } + v22bis_tx_power(s, -14.0f); + v22bis_restart(s, s->bit_rate); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v22bis_release(v22bis_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v22bis_free(v22bis_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/v27ter_rx.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/v27ter_rx.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1152 @@ +#define IAXMODEM_STUFF +/* + * SpanDSP - a series of DSP components for telephony + * + * v27ter_rx.c - ITU V.27ter modem receive part + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v27ter_rx.c,v 1.131 2009/07/08 15:11:09 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/complex.h" +#include "spandsp/vector_float.h" +#include "spandsp/complex_vector_float.h" +#include "spandsp/vector_int.h" +#include "spandsp/complex_vector_int.h" +#include "spandsp/async.h" +#include "spandsp/power_meter.h" +#include "spandsp/arctan2.h" +#include "spandsp/dds.h" +#include "spandsp/complex_filters.h" + +#include "spandsp/v29rx.h" +#include "spandsp/v27ter_rx.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/v27ter_rx.h" + +#if defined(SPANDSP_USE_FIXED_POINT) +#include "v27ter_rx_4800_fixed_rrc.h" +#include "v27ter_rx_2400_fixed_rrc.h" +#else +#include "v27ter_rx_4800_floating_rrc.h" +#include "v27ter_rx_2400_floating_rrc.h" +#endif + +/* V.27ter is a DPSK modem, but this code treats it like QAM. It nails down the + signal to a static constellation, even though dealing with differences is all + that is necessary. */ + +/*! The nominal frequency of the carrier, in Hertz */ +#define CARRIER_NOMINAL_FREQ 1800.0f +/*! The nominal baud or symbol rate in 2400bps mode */ +#define BAUD_RATE_2400 1200 +/*! The nominal baud or symbol rate in 4800bps mode */ +#define BAUD_RATE_4800 1600 +/*! The adaption rate coefficient for the equalizer */ +#define EQUALIZER_DELTA 0.25f + +#if defined(SPANDSP_USE_FIXED_POINT) +#define FP_FACTOR 4096 +#define FP_SHIFT_FACTOR 12 +#endif + +/* Segments of the training sequence */ +/* V.27ter defines a long and a short sequence. FAX doesn't use the + short sequence, so it is not implemented here. */ +/*! The length of training segment 3, in symbols */ +#define V27TER_TRAINING_SEG_3_LEN 50 +/*! The length of training segment 5, in symbols */ +#define V27TER_TRAINING_SEG_5_LEN 1074 +/*! The length of training segment 6, in symbols */ +#define V27TER_TRAINING_SEG_6_LEN 8 + +/*! The length of the equalizer buffer */ +#define V27TER_EQUALIZER_LEN (V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN) + +enum +{ + TRAINING_STAGE_NORMAL_OPERATION = 0, + TRAINING_STAGE_SYMBOL_ACQUISITION, + TRAINING_STAGE_LOG_PHASE, + TRAINING_STAGE_WAIT_FOR_HOP, + TRAINING_STAGE_TRAIN_ON_ABAB, + TRAINING_STAGE_TEST_ONES, + TRAINING_STAGE_PARKED +}; + +#if defined(SPANDSP_USE_FIXED_POINTx) +static const complexi16_t v27ter_constellation[8] = +{ + {((int)(FP_FACTOR* 1.414f), ((int)(FP_FACTOR* 0.0f)}, /* 0deg */ + {((int)(FP_FACTOR* 1.0f), ((int)(FP_FACTOR* 1.0f)}, /* 45deg */ + {((int)(FP_FACTOR* 0.0f), ((int)(FP_FACTOR* 1.414f)}, /* 90deg */ + {((int)(FP_FACTOR*-1.0f), ((int)(FP_FACTOR* 1.0f)}, /* 135deg */ + {((int)(FP_FACTOR*-1.414f), ((int)(FP_FACTOR* 0.0f)}, /* 180deg */ + {((int)(FP_FACTOR*-1.0f), ((int)(FP_FACTOR*-1.0f)}, /* 225deg */ + {((int)(FP_FACTOR* 0.0f), ((int)(FP_FACTOR*-1.414f)}, /* 270deg */ + {((int)(FP_FACTOR* 1.0f), ((int)(FP_FACTOR*-1.0f)} /* 315deg */ +}; +#else +static const complexf_t v27ter_constellation[8] = +{ + { 1.414f, 0.0f}, /* 0deg */ + { 1.0f, 1.0f}, /* 45deg */ + { 0.0f, 1.414f}, /* 90deg */ + {-1.0f, 1.0f}, /* 135deg */ + {-1.414f, 0.0f}, /* 180deg */ + {-1.0f, -1.0f}, /* 225deg */ + { 0.0f, -1.414f}, /* 270deg */ + { 1.0f, -1.0f} /* 315deg */ +}; +#endif + +SPAN_DECLARE(float) v27ter_rx_carrier_frequency(v27ter_rx_state_t *s) +{ + return dds_frequencyf(s->carrier_phase_rate); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) v27ter_rx_symbol_timing_correction(v27ter_rx_state_t *s) +{ + int steps_per_symbol; + + steps_per_symbol = (s->bit_rate == 4800) ? RX_PULSESHAPER_4800_COEFF_SETS*5 : RX_PULSESHAPER_2400_COEFF_SETS*20/3; + return (float) s->total_baud_timing_correction/(float) steps_per_symbol; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) v27ter_rx_signal_power(v27ter_rx_state_t *s) +{ + return power_meter_current_dbm0(&s->power) + 3.98f; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v27ter_rx_signal_cutoff(v27ter_rx_state_t *s, float cutoff) +{ + /* The 0.4 factor allows for the gain of the DC blocker */ + s->carrier_on_power = (int32_t) (power_meter_level_dbm0(cutoff + 2.5f)*0.4f); + s->carrier_off_power = (int32_t) (power_meter_level_dbm0(cutoff - 2.5f)*0.4f); +} +/*- End of function --------------------------------------------------------*/ + +static void report_status_change(v27ter_rx_state_t *s, int status) +{ + if (s->status_handler) + s->status_handler(s->status_user_data, status); + else if (s->put_bit) + s->put_bit(s->put_bit_user_data, status); +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINTx) +SPAN_DECLARE(int) v27ter_rx_equalizer_state(v27ter_rx_state_t *s, complexi16_t **coeffs) +#else +SPAN_DECLARE(int) v27ter_rx_equalizer_state(v27ter_rx_state_t *s, complexf_t **coeffs) +#endif +{ + *coeffs = s->eq_coeff; + return V27TER_EQUALIZER_LEN; +} +/*- End of function --------------------------------------------------------*/ + +static void equalizer_save(v27ter_rx_state_t *s) +{ +#if defined(SPANDSP_USE_FIXED_POINTx) + cvec_copyi16(s->eq_coeff_save, s->eq_coeff, V27TER_EQUALIZER_LEN); +#else + cvec_copyf(s->eq_coeff_save, s->eq_coeff, V27TER_EQUALIZER_LEN); +#endif +} +/*- End of function --------------------------------------------------------*/ + +static void equalizer_restore(v27ter_rx_state_t *s) +{ +#if defined(SPANDSP_USE_FIXED_POINTx) + cvec_copyi16(s->eq_coeff, s->eq_coeff_save, V27TER_EQUALIZER_LEN); + cvec_zeroi16(s->eq_buf, V27TER_EQUALIZER_LEN); + s->eq_delta = 32768.0f*EQUALIZER_DELTA/V27TER_EQUALIZER_LEN); +#else + cvec_copyf(s->eq_coeff, s->eq_coeff_save, V27TER_EQUALIZER_LEN); + cvec_zerof(s->eq_buf, V27TER_EQUALIZER_LEN); + s->eq_delta = EQUALIZER_DELTA/V27TER_EQUALIZER_LEN; +#endif + + s->eq_put_step = (s->bit_rate == 4800) ? RX_PULSESHAPER_4800_COEFF_SETS*5/2 : RX_PULSESHAPER_2400_COEFF_SETS*20/(3*2); + s->eq_step = 0; +} +/*- End of function --------------------------------------------------------*/ + +static void equalizer_reset(v27ter_rx_state_t *s) +{ + /* Start with an equalizer based on everything being perfect. */ +#if defined(SPANDSP_USE_FIXED_POINTx) + cvec_zeroi16(s->eq_coeff, V27TER_EQUALIZER_LEN); + s->eq_coeff[V27TER_EQUALIZER_PRE_LEN] = complex_seti16(1.414f*FP_FACTOR, 0); + cvec_zeroi16(s->eq_buf, V27TER_EQUALIZER_LEN); + s->eq_delta = 32768.0f*EQUALIZER_DELTA/V27TER_EQUALIZER_LEN); +#else + cvec_zerof(s->eq_coeff, V27TER_EQUALIZER_LEN); + s->eq_coeff[V27TER_EQUALIZER_PRE_LEN] = complex_setf(1.414f, 0.0f); + cvec_zerof(s->eq_buf, V27TER_EQUALIZER_LEN); + s->eq_delta = EQUALIZER_DELTA/V27TER_EQUALIZER_LEN; +#endif + + s->eq_put_step = (s->bit_rate == 4800) ? RX_PULSESHAPER_4800_COEFF_SETS*5/2 : RX_PULSESHAPER_2400_COEFF_SETS*20/(3*2); + s->eq_step = 0; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINTx) +static __inline__ complexi16_t complex_mul_q4_12(const complexi16_t *x, const complexi16_t *y) +{ + complexi16_t z; + + z.re = ((int32_t) x->re*(int32_t) y->re - (int32_t) x->im*(int32_t) y->im) >> 12; + z.im = ((int32_t) x->re*(int32_t) y->im + (int32_t) x->im*(int32_t) y->re) >> 12; + return z; +} +/*- End of function --------------------------------------------------------*/ +#endif + +#if defined(SPANDSP_USE_FIXED_POINTx) +static __inline__ complexi16_t equalizer_get(v27ter_rx_state_t *s) +#else +static __inline__ complexf_t equalizer_get(v27ter_rx_state_t *s) +#endif +{ +#if defined(SPANDSP_USE_FIXED_POINTx) + complexi32_t zz; + complexi16_t z; + + /* Get the next equalized value. */ + zz = cvec_circular_dot_prodi16(s->eq_buf, s->eq_coeff, V27TER_EQUALIZER_LEN, s->eq_step); + z.re = zz.re >> FP_SHIFT_FACTOR; + z.im = zz.im >> FP_SHIFT_FACTOR; + return z; +#else + /* Get the next equalized value. */ + return cvec_circular_dot_prodf(s->eq_buf, s->eq_coeff, V27TER_EQUALIZER_LEN, s->eq_step); +#endif +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINTx) +static void tune_equalizer(v27ter_rx_state_t *s, const complexi16_t *z, const complexi16_t *target) +{ + complexi16_t err; + + /* Find the x and y mismatch from the exact constellation position. */ + err.re = target->re*FP_FACTOR - z->re; + err.im = target->im*FP_FACTOR - z->im; + err.re = ((int32_t) err.re*(int32_t) s->eq_delta) >> 15; + err.im = ((int32_t) err.im*(int32_t) s->eq_delta) >> 15; + cvec_circular_lmsi16(s->eq_buf, s->eq_coeff, V27TER_EQUALIZER_LEN, s->eq_step, &err); +} +#else +static void tune_equalizer(v27ter_rx_state_t *s, const complexf_t *z, const complexf_t *target) +{ + complexf_t err; + + /* Find the x and y mismatch from the exact constellation position. */ + err = complex_subf(target, z); + err.re *= s->eq_delta; + err.im *= s->eq_delta; + cvec_circular_lmsf(s->eq_buf, s->eq_coeff, V27TER_EQUALIZER_LEN, s->eq_step, &err); +} +#endif +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINTx) +static __inline__ int find_quadrant(const complexi16_t *z) +#else +static __inline__ int find_quadrant(const complexf_t *z) +#endif +{ + int b1; + int b2; + + /* Split the space along the two diagonals. */ + b1 = (z->im > z->re); + b2 = (z->im < -z->re); + return (b2 << 1) | (b1 ^ b2); +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINTx) +static __inline__ int find_octant(complexi16_t *z) +#else +static __inline__ int find_octant(complexf_t *z) +#endif +{ + float abs_re; + float abs_im; + int b1; + int b2; + int bits; + + /* Are we near an axis or a diagonal? */ + abs_re = fabsf(z->re); + abs_im = fabsf(z->im); + if (abs_im > abs_re*0.4142136f && abs_im < abs_re*2.4142136f) + { + /* Split the space along the two axes. */ + b1 = (z->re < 0.0f); + b2 = (z->im < 0.0f); + bits = (b2 << 2) | ((b1 ^ b2) << 1) | 1; + } + else + { + /* Split the space along the two diagonals. */ + b1 = (z->im > z->re); + b2 = (z->im < -z->re); + bits = (b2 << 2) | ((b1 ^ b2) << 1); + } + return bits; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINTx) +static __inline__ void track_carrier(v27ter_rx_state_t *s, const complexi16_t *z, const complexi16_t *target) +#else +static __inline__ void track_carrier(v27ter_rx_state_t *s, const complexf_t *z, const complexf_t *target) +#endif +{ +#if defined(SPANDSP_USE_FIXED_POINTx) + int32_t error; +#else + float error; +#endif + + /* For small errors the imaginary part of the difference between the actual and the target + positions is proportional to the phase error, for any particular target. However, the + different amplitudes of the various target positions scale things. */ + error = z->im*target->re - z->re*target->im; + +#if defined(SPANDSP_USE_FIXED_POINTx) + error /= (float) FP_FACTOR; + s->carrier_phase_rate += (int32_t) (s->carrier_track_i*error); + s->carrier_phase += (int32_t) (s->carrier_track_p*error); +#else + s->carrier_phase_rate += (int32_t) (s->carrier_track_i*error); + s->carrier_phase += (int32_t) (s->carrier_track_p*error); + //span_log(&s->logging, SPAN_LOG_FLOW, "Im = %15.5f f = %15.5f\n", error, dds_frequencyf(s->carrier_phase_rate)); +#endif +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int descramble(v27ter_rx_state_t *s, int in_bit) +{ + int out_bit; + + out_bit = (in_bit ^ (s->scramble_reg >> 5) ^ (s->scramble_reg >> 6)) & 1; + if (s->scrambler_pattern_count >= 33) + { + out_bit ^= 1; + s->scrambler_pattern_count = 0; + } + else + { + if (s->training_stage > TRAINING_STAGE_NORMAL_OPERATION && s->training_stage < TRAINING_STAGE_TEST_ONES) + { + s->scrambler_pattern_count = 0; + } + else + { + if ((((s->scramble_reg >> 7) ^ in_bit) & ((s->scramble_reg >> 8) ^ in_bit) & ((s->scramble_reg >> 11) ^ in_bit) & 1)) + s->scrambler_pattern_count = 0; + else + s->scrambler_pattern_count++; + } + } + s->scramble_reg <<= 1; + if (s->training_stage > TRAINING_STAGE_NORMAL_OPERATION && s->training_stage < TRAINING_STAGE_TEST_ONES) + s->scramble_reg |= out_bit; + else + s->scramble_reg |= in_bit; + return out_bit; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void put_bit(v27ter_rx_state_t *s, int bit) +{ + int out_bit; + + bit &= 1; + + out_bit = descramble(s, bit); + + /* We need to strip the last part of the training before we let data + go to the application. */ + if (s->training_stage == TRAINING_STAGE_NORMAL_OPERATION) + { + s->put_bit(s->put_bit_user_data, out_bit); + } + else + { + //span_log(&s->logging, SPAN_LOG_FLOW, "Test bit %d\n", out_bit); + /* The bits during the final stage of training should be all ones. However, + buggy modems mean you cannot rely on this. Therefore we don't bother + testing for ones, but just rely on a constellation mismatch measurement. */ + } +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINTx) +static void decode_baud(v27ter_rx_state_t *s, complexi16_t *z) +#else +static void decode_baud(v27ter_rx_state_t *s, complexf_t *z) +#endif +{ + static const uint8_t phase_steps_4800[8] = + { + 4, 0, 2, 6, 7, 3, 1, 5 + }; + static const uint8_t phase_steps_2400[4] = + { + 0, 2, 3, 1 + }; + int nearest; + int raw_bits; + + if (s->bit_rate == 2400) + { + nearest = find_quadrant(z); + raw_bits = phase_steps_2400[(nearest - s->constellation_state) & 3]; + put_bit(s, raw_bits); + put_bit(s, raw_bits >> 1); + s->constellation_state = nearest; + nearest <<= 1; + } + else + { + nearest = find_octant(z); + raw_bits = phase_steps_4800[(nearest - s->constellation_state) & 7]; + put_bit(s, raw_bits); + put_bit(s, raw_bits >> 1); + put_bit(s, raw_bits >> 2); + s->constellation_state = nearest; + } + track_carrier(s, z, &v27ter_constellation[nearest]); + if (--s->eq_skip <= 0) + { + /* Once we are in the data the equalization should not need updating. + However, the line characteristics may slowly drift. We, therefore, + tune up on the occassional sample, keeping the compute down. */ + s->eq_skip = 100; + tune_equalizer(s, z, &v27ter_constellation[nearest]); + } +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void symbol_sync(v27ter_rx_state_t *s) +{ + float p; + float q; + + /* This routine adapts the position of the half baud samples entering the equalizer. */ + + /* Perform a Gardner test for baud alignment */ + p = s->eq_buf[(s->eq_step - 3) & V27TER_EQUALIZER_LEN].re + - s->eq_buf[(s->eq_step - 1) & V27TER_EQUALIZER_LEN].re; + p *= s->eq_buf[(s->eq_step - 2) & V27TER_EQUALIZER_LEN].re; + + q = s->eq_buf[(s->eq_step - 3) & V27TER_EQUALIZER_LEN].im + - s->eq_buf[(s->eq_step - 1) & V27TER_EQUALIZER_LEN].im; + q *= s->eq_buf[(s->eq_step - 2) & V27TER_EQUALIZER_LEN].im; + + s->gardner_integrate += (p + q > 0.0f) ? s->gardner_step : -s->gardner_step; + + if (abs(s->gardner_integrate) >= 256) + { + /* This integrate and dump approach avoids rapid changes of the equalizer put step. + Rapid changes, without hysteresis, are bad. They degrade the equalizer performance + when the true symbol boundary is close to a sample boundary. */ + //span_log(&s->logging, SPAN_LOG_FLOW, "Hop %d\n", s->gardner_integrate); + s->eq_put_step += (s->gardner_integrate/256); + s->total_baud_timing_correction += (s->gardner_integrate/256); + if (s->qam_report) + s->qam_report(s->qam_user_data, NULL, NULL, s->gardner_integrate); + s->gardner_integrate = 0; + } + //span_log(&s->logging, SPAN_LOG_FLOW, "Gardner=%10.5f 0x%X\n", p, s->eq_put_step); +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINT) +static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexi16_t *sample) +#else +static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t *sample) +#endif +{ + static const int abab_pos[2] = + { + 0, 4 + }; + complexf_t zz; +#if defined(SPANDSP_USE_FIXED_POINTx) + complexf_t z1; + complexi16_t z; + const complexi16_t *target; + static const complexi16_t zero = {0, 0}; +#else + complexf_t z; + const complexf_t *target; + static const complexf_t zero = {0.0f, 0.0f}; +#endif + float p; + int i; + int j; + int32_t angle; + int32_t ang; + int constellation_state; + + /* Add a sample to the equalizer's circular buffer, but don't calculate anything + at this time. */ +#if defined(SPANDSP_USE_FIXED_POINT) + s->eq_buf[s->eq_step].re = sample->re/(float) FP_FACTOR; + s->eq_buf[s->eq_step].im = sample->im/(float) FP_FACTOR; +#else + s->eq_buf[s->eq_step] = *sample; +#endif + if (++s->eq_step >= V27TER_EQUALIZER_LEN) + s->eq_step = 0; + + /* On alternate insertions we have a whole baud, and must process it. */ + if ((s->baud_half ^= 1)) + return; + + symbol_sync(s); + + z = equalizer_get(s); + + //span_log(&s->logging, SPAN_LOG_FLOW, "Equalized symbol - %15.5f %15.5f\n", z.re, z.im); + constellation_state = s->constellation_state; + switch (s->training_stage) + { + case TRAINING_STAGE_NORMAL_OPERATION: + decode_baud(s, &z); + constellation_state = (s->bit_rate == 4800) ? s->constellation_state : (s->constellation_state << 1); + target = &v27ter_constellation[constellation_state]; + break; + case TRAINING_STAGE_SYMBOL_ACQUISITION: + /* Allow time for the Gardner algorithm to settle the baud timing */ + /* Don't start narrowing the bandwidth of the Gardner algorithm too early. + Some modems are a bit wobbly when they start sending the signal. Also, we start + this analysis before our filter buffers have completely filled. */ + target = &zero; + if (++s->training_count >= 30) + { + s->gardner_step = 32; + s->training_stage = TRAINING_STAGE_LOG_PHASE; + s->angles[0] = + s->start_angles[0] = arctan2(z.im, z.re); + } + break; + case TRAINING_STAGE_LOG_PHASE: + /* Record the current alternate phase angle */ + target = &zero; + angle = arctan2(z.im, z.re); + s->angles[1] = + s->start_angles[1] = angle; + s->training_count = 1; + s->training_stage = TRAINING_STAGE_WAIT_FOR_HOP; + break; + case TRAINING_STAGE_WAIT_FOR_HOP: + target = &zero; + angle = arctan2(z.im, z.re); + /* Look for the initial ABAB sequence to display a phase reversal, which will + signal the start of the scrambled ABAB segment */ + ang = angle - s->angles[(s->training_count - 1) & 0xF]; + s->angles[(s->training_count + 1) & 0xF] = angle; + if ((ang > 0x20000000 || ang < -0x20000000) && s->training_count >= 3) + { + /* We seem to have a phase reversal */ + /* Slam the carrier frequency into line, based on the total phase drift over the last + section. Use the shift from the odd bits and the shift from the even bits to get + better jitter suppression. We need to scale here, or at the maximum specified + frequency deviation we could overflow, and get a silly answer. */ + /* Step back a few symbols so we don't get ISI distorting things. */ + i = (s->training_count - 8) & ~1; + /* Avoid the possibility of a divide by zero */ + if (i) + { + j = i & 0xF; + ang = (s->angles[j] - s->start_angles[0])/i + + (s->angles[j | 0x1] - s->start_angles[1])/i; + if (s->bit_rate == 4800) + s->carrier_phase_rate += ang/10; + else + s->carrier_phase_rate += 3*(ang/40); + } + span_log(&s->logging, SPAN_LOG_FLOW, "Coarse carrier frequency %7.2f (%d)\n", dds_frequencyf(s->carrier_phase_rate), s->training_count); + /* Check if the carrier frequency is plausible */ + if (s->carrier_phase_rate < dds_phase_ratef(CARRIER_NOMINAL_FREQ - 20.0f) + || + s->carrier_phase_rate > dds_phase_ratef(CARRIER_NOMINAL_FREQ + 20.0f)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (sequence failed)\n"); + /* Park this modem */ + s->training_stage = TRAINING_STAGE_PARKED; + report_status_change(s, SIG_STATUS_TRAINING_FAILED); + break; + } + + /* Make a step shift in the phase, to pull it into line. We need to rotate the equalizer + buffer, as well as the carrier phase, for this to play out nicely. */ + angle += 0x80000000; + p = angle*2.0f*3.14159f/(65536.0f*65536.0f); +#if defined(SPANDSP_USE_FIXED_POINTx) + zz = complex_setf(cosf(p), -sinf(p)); + for (i = 0; i < V27TER_EQUALIZER_LEN; i++) + { + z1 = complex_setf(s->eq_buf[i].re, s->eq_buf[i].im); + z1 = complex_mulf(&z1, &zz); + s->eq_buf[i].re = z1.re; + s->eq_buf[i].im = z1.im; + } +#else + zz = complex_setf(cosf(p), -sinf(p)); + for (i = 0; i < V27TER_EQUALIZER_LEN; i++) + s->eq_buf[i] = complex_mulf(&s->eq_buf[i], &zz); +#endif + s->carrier_phase += angle; + s->gardner_step = 2; + /* We have just seen the first element of the scrambled sequence so skip it. */ + s->training_bc = 1; + s->training_bc ^= descramble(s, 1); + descramble(s, 1); + descramble(s, 1); + constellation_state = + s->constellation_state = abab_pos[s->training_bc]; + target = &v27ter_constellation[constellation_state]; + s->training_count = 1; + s->training_stage = TRAINING_STAGE_TRAIN_ON_ABAB; + report_status_change(s, SIG_STATUS_TRAINING_IN_PROGRESS); + } + else if (++s->training_count > V27TER_TRAINING_SEG_3_LEN) + { + /* This is bogus. There are not this many bits in this section + of a real training sequence. */ + span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (sequence failed)\n"); + /* Park this modem */ + s->training_stage = TRAINING_STAGE_PARKED; + report_status_change(s, SIG_STATUS_TRAINING_FAILED); + } + break; + case TRAINING_STAGE_TRAIN_ON_ABAB: + /* Train on the scrambled ABAB section */ + s->training_bc ^= descramble(s, 1); + descramble(s, 1); + descramble(s, 1); + constellation_state = + s->constellation_state = abab_pos[s->training_bc]; + target = &v27ter_constellation[constellation_state]; + track_carrier(s, &z, target); + tune_equalizer(s, &z, target); + +#if defined(SPANDSP_USE_FIXED_POINTx) + s->carrier_track_i = 400 + (200000 - 400)*(float) (V27TER_TRAINING_SEG_5_LEN - s->training_count)/(float) V27TER_TRAINING_SEG_5_LEN; + s->carrier_track_p = 1000000 + (10000000 - 1000000)*(float) (V27TER_TRAINING_SEG_5_LEN - s->training_count)/(float) V27TER_TRAINING_SEG_5_LEN; +#else + s->carrier_track_i = 400.0f + (200000.0f - 400.0f)*(float) (V27TER_TRAINING_SEG_5_LEN - s->training_count)/(float) V27TER_TRAINING_SEG_5_LEN; + s->carrier_track_p = 1000000.0f + (10000000.0f - 1000000.0f)*(float) (V27TER_TRAINING_SEG_5_LEN - s->training_count)/(float) V27TER_TRAINING_SEG_5_LEN; +#endif + if (++s->training_count >= V27TER_TRAINING_SEG_5_LEN) + { + constellation_state = 4; + s->constellation_state = (s->bit_rate == 4800) ? 4 : 2; + s->training_count = 0; + s->training_stage = TRAINING_STAGE_TEST_ONES; + } + break; + case TRAINING_STAGE_TEST_ONES: + decode_baud(s, &z); + constellation_state = (s->bit_rate == 4800) ? s->constellation_state : (s->constellation_state << 1); + target = &v27ter_constellation[constellation_state]; + /* Measure the training error */ +#if defined(SPANDSP_USE_FIXED_POINTx) + z1.re = z.re/(float) FP_FACTOR; + z1.im = z.im/(float) FP_FACTOR; + zz = complex_subf(&z, target); + zz = complex_subf(&z1, &zz); + s->training_error += powerf(&zz); +#else + zz = complex_subf(&z, target); + s->training_error += powerf(&zz); +#endif + if (++s->training_count >= V27TER_TRAINING_SEG_6_LEN) + { + /* At 4800bps the symbols are 1.08238 (Euclidian) apart. + At 2400bps the symbols are 2.0 (Euclidian) apart. */ + if ((s->bit_rate == 4800 && s->training_error < V27TER_TRAINING_SEG_6_LEN*0.25f) + || + (s->bit_rate == 2400 && s->training_error < V27TER_TRAINING_SEG_6_LEN*0.5f)) + { + /* We are up and running */ + span_log(&s->logging, SPAN_LOG_FLOW, "Training succeeded at %dbps (constellation mismatch %f)\n", s->bit_rate, s->training_error); + report_status_change(s, SIG_STATUS_TRAINING_SUCCEEDED); + /* Apply some lag to the carrier off condition, to ensure the last few bits get pushed through + the processing. */ + s->signal_present = (s->bit_rate == 4800) ? 90 : 120; + s->training_stage = TRAINING_STAGE_NORMAL_OPERATION; + equalizer_save(s); + s->carrier_phase_rate_save = s->carrier_phase_rate; + s->agc_scaling_save = s->agc_scaling; + } + else + { + /* Training has failed */ + span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (constellation mismatch %f)\n", s->training_error); + /* Park this modem */ + s->training_stage = TRAINING_STAGE_PARKED; + report_status_change(s, SIG_STATUS_TRAINING_FAILED); + } + } + break; + case TRAINING_STAGE_PARKED: + default: + /* We failed to train! */ + /* Park here until the carrier drops. */ + target = &zero; + break; + } + if (s->qam_report) + { +#if defined(SPANDSP_USE_FIXED_POINTx) + z1.re = z.re/(float) FP_FACTOR; + z1.im = z.im/(float) FP_FACTOR; + zz.re = target->re; + zz.im = target->im; + s->qam_report(s->qam_user_data, &z1, &zz, s->constellation_state); +#else + s->qam_report(s->qam_user_data, &z, target, s->constellation_state); +#endif + } +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int signal_detect(v27ter_rx_state_t *s, int16_t amp) +{ + int16_t diff; + int16_t x; + int32_t power; + + /* There should be no DC in the signal, but sometimes there is. + We need to measure the power with the DC blocked, but not using + a slow to respond DC blocker. Use the most elementary HPF. */ + x = amp >> 1; + /* There could be overflow here, but it isn't a problem in practice */ + diff = x - s->last_sample; + s->last_sample = x; + power = power_meter_update(&(s->power), diff); +#if defined(IAXMODEM_STUFF) + /* Quick power drop fudge */ + diff = abs(diff); + if (10*diff < s->high_sample) + { + if (++s->low_samples > 120) + { + power_meter_init(&(s->power), 4); + s->high_sample = 0; + s->low_samples = 0; + } + } + else + { + s->low_samples = 0; + if (diff > s->high_sample) + s->high_sample = diff; + } +#endif + //span_log(&s->logging, SPAN_LOG_FLOW, "Power = %f\n", power_meter_current_dbm0(&(s->power))); + if (s->signal_present > 0) + { + /* Look for power below turn-off threshold to turn the carrier off */ +#if defined(IAXMODEM_STUFF) + if (s->carrier_drop_pending || power < s->carrier_off_power) +#else + if (power < s->carrier_off_power) +#endif + { + if (--s->signal_present <= 0) + { + /* Count down a short delay, to ensure we push the last + few bits through the filters before stopping. */ + v27ter_rx_restart(s, s->bit_rate, FALSE); + report_status_change(s, SIG_STATUS_CARRIER_DOWN); + return 0; + } +#if defined(IAXMODEM_STUFF) + /* Carrier has dropped, but the put_bit is pending the signal_present delay. */ + s->carrier_drop_pending = TRUE; +#endif + } + } + else + { + /* Look for power exceeding turn-on threshold to turn the carrier on */ + if (power < s->carrier_on_power) + return 0; + s->signal_present = 1; +#if defined(IAXMODEM_STUFF) + s->carrier_drop_pending = FALSE; +#endif + report_status_change(s, SIG_STATUS_CARRIER_UP); + } + return power; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) v27ter_rx(v27ter_rx_state_t *s, const int16_t amp[], int len) +{ + int i; + int step; +#if defined(SPANDSP_USE_FIXED_POINT) + complexi16_t z; + complexi16_t zz; + complexi16_t sample; + int32_t v; +#else + complexf_t z; + complexf_t zz; + complexf_t sample; + float v; +#endif + int32_t power; + + if (s->bit_rate == 4800) + { + for (i = 0; i < len; i++) + { + s->rrc_filter[s->rrc_filter_step] = amp[i]; + if (++s->rrc_filter_step >= V27TER_RX_4800_FILTER_STEPS) + s->rrc_filter_step = 0; + + if ((power = signal_detect(s, amp[i])) == 0) + continue; + /* Only spend effort processing this data if the modem is not + parked, after training failure. */ + if (s->training_stage == TRAINING_STAGE_PARKED) + continue; + + /* Put things into the equalization buffer at T/2 rate. The Gardner algorithm + will fiddle the step to align this with the symbols. */ + if ((s->eq_put_step -= RX_PULSESHAPER_4800_COEFF_SETS) <= 0) + { + if (s->training_stage == TRAINING_STAGE_SYMBOL_ACQUISITION) + { + /* Only AGC during the initial training */ +#if defined(SPANDSP_USE_FIXED_POINT) + s->agc_scaling = (float) FP_FACTOR*32768.0f*(1.0f/RX_PULSESHAPER_4800_GAIN)*1.414f/sqrtf(power); +#else + s->agc_scaling = (1.0f/RX_PULSESHAPER_4800_GAIN)*1.414f/sqrtf(power); +#endif + } + /* Pulse shape while still at the carrier frequency, using a quadrature + pair of filters. This results in a properly bandpass filtered complex + signal, which can be brought directly to baseband by complex mixing. + No further filtering, to remove mixer harmonics, is needed. */ + step = -s->eq_put_step; + if (step > RX_PULSESHAPER_4800_COEFF_SETS - 1) + step = RX_PULSESHAPER_4800_COEFF_SETS - 1; + s->eq_put_step += RX_PULSESHAPER_4800_COEFF_SETS*5/2; +#if defined(SPANDSP_USE_FIXED_POINT) + v = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_4800_re[step], V27TER_RX_FILTER_STEPS, s->rrc_filter_step); + sample.re = (v*(int32_t) s->agc_scaling) >> 15; + v = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_4800_im[step], V27TER_RX_FILTER_STEPS, s->rrc_filter_step); + sample.im = (v*(int32_t) s->agc_scaling) >> 15; + z = dds_lookup_complexi16(s->carrier_phase); + zz.re = ((int32_t) sample.re*(int32_t) z.re - (int32_t) sample.im*(int32_t) z.im) >> 15; + zz.im = ((int32_t) -sample.re*(int32_t) z.im - (int32_t) sample.im*(int32_t) z.re) >> 15; +#else + v = vec_circular_dot_prodf(s->rrc_filter, rx_pulseshaper_4800_re[step], V27TER_RX_FILTER_STEPS, s->rrc_filter_step); + sample.re = v*s->agc_scaling; + v = vec_circular_dot_prodf(s->rrc_filter, rx_pulseshaper_4800_im[step], V27TER_RX_FILTER_STEPS, s->rrc_filter_step); + sample.im = v*s->agc_scaling; + z = dds_lookup_complexf(s->carrier_phase); + zz.re = sample.re*z.re - sample.im*z.im; + zz.im = -sample.re*z.im - sample.im*z.re; +#endif + process_half_baud(s, &zz); + } +#if defined(SPANDSP_USE_FIXED_POINT) + dds_advance(&s->carrier_phase, s->carrier_phase_rate); +#else + dds_advancef(&s->carrier_phase, s->carrier_phase_rate); +#endif + } + } + else + { + for (i = 0; i < len; i++) + { + s->rrc_filter[s->rrc_filter_step] = amp[i]; + if (++s->rrc_filter_step >= V27TER_RX_2400_FILTER_STEPS) + s->rrc_filter_step = 0; + + if ((power = signal_detect(s, amp[i])) == 0) + continue; + /* Only spend effort processing this data if the modem is not + parked, after training failure. */ + if (s->training_stage == TRAINING_STAGE_PARKED) + continue; + + /* Put things into the equalization buffer at T/2 rate. The Gardner algorithm + will fiddle the step to align this with the symbols. */ + if ((s->eq_put_step -= RX_PULSESHAPER_2400_COEFF_SETS) <= 0) + { + if (s->training_stage == TRAINING_STAGE_SYMBOL_ACQUISITION) + { + /* Only AGC during the initial training */ +#if defined(SPANDSP_USE_FIXED_POINT) + s->agc_scaling = (float) FP_FACTOR*32768.0f*(1.0f/RX_PULSESHAPER_2400_GAIN)*1.414f/sqrtf(power); +#else + s->agc_scaling = (1.0f/RX_PULSESHAPER_2400_GAIN)*1.414f/sqrtf(power); +#endif + } + /* Pulse shape while still at the carrier frequency, using a quadrature + pair of filters. This results in a properly bandpass filtered complex + signal, which can be brought directly to bandband by complex mixing. + No further filtering, to remove mixer harmonics, is needed. */ + step = -s->eq_put_step; + if (step > RX_PULSESHAPER_2400_COEFF_SETS - 1) + step = RX_PULSESHAPER_2400_COEFF_SETS - 1; + s->eq_put_step += RX_PULSESHAPER_2400_COEFF_SETS*20/(3*2); +#if defined(SPANDSP_USE_FIXED_POINT) + v = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_2400_re[step], V27TER_RX_FILTER_STEPS, s->rrc_filter_step); + sample.re = (v*(int32_t) s->agc_scaling) >> 15; + v = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_2400_im[step], V27TER_RX_FILTER_STEPS, s->rrc_filter_step); + sample.im = (v*(int32_t) s->agc_scaling) >> 15; + z = dds_lookup_complexi16(s->carrier_phase); + zz.re = ((int32_t) sample.re*(int32_t) z.re - (int32_t) sample.im*(int32_t) z.im) >> 15; + zz.im = ((int32_t) -sample.re*(int32_t) z.im - (int32_t) sample.im*(int32_t) z.re) >> 15; +#else + v = vec_circular_dot_prodf(s->rrc_filter, rx_pulseshaper_2400_re[step], V27TER_RX_FILTER_STEPS, s->rrc_filter_step); + sample.re = v*s->agc_scaling; + v = vec_circular_dot_prodf(s->rrc_filter, rx_pulseshaper_2400_im[step], V27TER_RX_FILTER_STEPS, s->rrc_filter_step); + sample.im = v*s->agc_scaling; + z = dds_lookup_complexf(s->carrier_phase); + zz.re = sample.re*z.re - sample.im*z.im; + zz.im = -sample.re*z.im - sample.im*z.re; +#endif + process_half_baud(s, &zz); + } +#if defined(SPANDSP_USE_FIXED_POINT) + dds_advance(&s->carrier_phase, s->carrier_phase_rate); +#else + dds_advancef(&s->carrier_phase, s->carrier_phase_rate); +#endif + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v27ter_rx_fillin(v27ter_rx_state_t *s, int len) +{ + int i; + + /* We want to sustain the current state (i.e carrier on<->carrier off), and + try to sustain the carrier phase. We should probably push the filters, as well */ + span_log(&s->logging, SPAN_LOG_FLOW, "Fill-in %d samples\n", len); + if (s->signal_present <= 0) + return 0; + if (s->training_stage == TRAINING_STAGE_PARKED) + return 0; + for (i = 0; i < len; i++) + { +#if defined(SPANDSP_USE_FIXED_POINT) + dds_advance(&s->carrier_phase, s->carrier_phase_rate); +#else + dds_advancef(&s->carrier_phase, s->carrier_phase_rate); +#endif + /* Advance the symbol phase the appropriate amount */ + if (s->bit_rate == 4800) + { + if ((s->eq_put_step -= RX_PULSESHAPER_4800_COEFF_SETS) <= 0) + s->eq_put_step += RX_PULSESHAPER_4800_COEFF_SETS*5/2; + } + else + { + if ((s->eq_put_step -= RX_PULSESHAPER_2400_COEFF_SETS) <= 0) + s->eq_put_step += RX_PULSESHAPER_2400_COEFF_SETS*20/(3*2); + } + /* TODO: Should we rotate any buffers */ + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v27ter_rx_set_put_bit(v27ter_rx_state_t *s, put_bit_func_t put_bit, void *user_data) +{ + s->put_bit = put_bit; + s->put_bit_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v27ter_rx_set_modem_status_handler(v27ter_rx_state_t *s, modem_tx_status_func_t handler, void *user_data) +{ + s->status_handler = handler; + s->status_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(logging_state_t *) v27ter_rx_get_logging_state(v27ter_rx_state_t *s) +{ + return &s->logging; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v27ter_rx_restart(v27ter_rx_state_t *s, int bit_rate, int old_train) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "Restarting V.27ter\n"); + if (bit_rate != 4800 && bit_rate != 2400) + return -1; + s->bit_rate = bit_rate; + +#if defined(SPANDSP_USE_FIXED_POINT) + vec_zeroi16(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); +#else + vec_zerof(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); +#endif + s->rrc_filter_step = 0; + + s->scramble_reg = 0x3C; + s->scrambler_pattern_count = 0; + s->training_stage = TRAINING_STAGE_SYMBOL_ACQUISITION; + s->training_bc = 0; + s->training_count = 0; + s->training_error = 0.0f; + s->signal_present = 0; +#if defined(IAXMODEM_STUFF) + s->high_sample = 0; + s->low_samples = 0; + s->carrier_drop_pending = FALSE; +#endif + + s->carrier_phase = 0; +#if defined(SPANDSP_USE_FIXED_POINTx) + s->carrier_track_i = 200000; + s->carrier_track_p = 10000000; +#else + s->carrier_track_i = 200000.0f; + s->carrier_track_p = 10000000.0f; +#endif + power_meter_init(&(s->power), 4); + + s->constellation_state = 0; + + if (s->old_train) + { + s->carrier_phase_rate = s->carrier_phase_rate_save; + s->agc_scaling = s->agc_scaling_save; + equalizer_restore(s); + } + else + { + s->carrier_phase_rate = dds_phase_ratef(CARRIER_NOMINAL_FREQ); +#if defined(SPANDSP_USE_FIXED_POINTx) + s->agc_scaling = (float) FP_FACTOR*32768.0f*0.005f/RX_PULSESHAPER_4800_GAIN; +#else + s->agc_scaling = 0.005f/RX_PULSESHAPER_4800_GAIN; +#endif + equalizer_reset(s); + } + s->eq_skip = 0; + s->last_sample = 0; + + s->gardner_integrate = 0; + s->total_baud_timing_correction = 0; + s->gardner_step = 512; + s->baud_half = 0; + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(v27ter_rx_state_t *) v27ter_rx_init(v27ter_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data) +{ + switch (bit_rate) + { + case 4800: + case 2400: + break; + default: + return NULL; + } + if (s == NULL) + { + if ((s = (v27ter_rx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "V.27ter RX"); + v27ter_rx_signal_cutoff(s, -45.5f); + s->put_bit = put_bit; + s->put_bit_user_data = user_data; + + v27ter_rx_restart(s, bit_rate, FALSE); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v27ter_rx_release(v27ter_rx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v27ter_rx_free(v27ter_rx_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v27ter_rx_set_qam_report_handler(v27ter_rx_state_t *s, qam_report_handler_t handler, void *user_data) +{ + s->qam_report = handler; + s->qam_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/v27ter_tx.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/v27ter_tx.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,452 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v27ter_tx.c - ITU V.27ter modem transmit part + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v27ter_tx.c,v 1.76 2009/06/02 16:03:56 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/logging.h" +#include "spandsp/complex.h" +#include "spandsp/vector_float.h" +#include "spandsp/complex_vector_float.h" +#include "spandsp/async.h" +#include "spandsp/dds.h" +#include "spandsp/power_meter.h" + +#include "spandsp/v27ter_tx.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/v27ter_tx.h" + +#if defined(SPANDSP_USE_FIXED_POINT) +#include "v27ter_tx_4800_fixed_rrc.h" +#include "v27ter_tx_2400_fixed_rrc.h" +#else +#include "v27ter_tx_4800_floating_rrc.h" +#include "v27ter_tx_2400_floating_rrc.h" +#endif + +/*! The nominal frequency of the carrier, in Hertz */ +#define CARRIER_NOMINAL_FREQ 1800.0f + +/* Segments of the training sequence */ +/* V.27ter defines a long and a short sequence. FAX doesn't use the + short sequence, so it is not implemented here. */ +/*! The start of training segment 1, in symbols */ +#define V27TER_TRAINING_SEG_1 0 +/*! The start of training segment 2, in symbols */ +#define V27TER_TRAINING_SEG_2 (V27TER_TRAINING_SEG_1 + 320) +/*! The start of training segment 3, in symbols */ +#define V27TER_TRAINING_SEG_3 (V27TER_TRAINING_SEG_2 + 32) +/*! The start of training segment 4, in symbols */ +#define V27TER_TRAINING_SEG_4 (V27TER_TRAINING_SEG_3 + 50) +/*! The start of training segment 5, in symbols */ +#define V27TER_TRAINING_SEG_5 (V27TER_TRAINING_SEG_4 + 1074) +/*! The end of the training, in symbols */ +#define V27TER_TRAINING_END (V27TER_TRAINING_SEG_5 + 8) +/*! The end of the shutdown sequence, in symbols */ +#define V27TER_TRAINING_SHUTDOWN_END (V27TER_TRAINING_END + 32) + +static int fake_get_bit(void *user_data) +{ + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int scramble(v27ter_tx_state_t *s, int in_bit) +{ + int out_bit; + + /* This scrambler is really quite messy to implement. There seems to be no efficient shortcut */ + out_bit = (in_bit ^ (s->scramble_reg >> 5) ^ (s->scramble_reg >> 6)) & 1; + if (s->scrambler_pattern_count >= 33) + { + out_bit ^= 1; + s->scrambler_pattern_count = 0; + } + else + { + if ((((s->scramble_reg >> 7) ^ out_bit) & ((s->scramble_reg >> 8) ^ out_bit) & ((s->scramble_reg >> 11) ^ out_bit) & 1)) + s->scrambler_pattern_count = 0; + else + s->scrambler_pattern_count++; + } + s->scramble_reg = (s->scramble_reg << 1) | out_bit; + return out_bit; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int get_scrambled_bit(v27ter_tx_state_t *s) +{ + int bit; + + if ((bit = s->current_get_bit(s->get_bit_user_data)) == SIG_STATUS_END_OF_DATA) + { + /* End of real data. Switch to the fake get_bit routine, until we + have shut down completely. */ + if (s->status_handler) + s->status_handler(s->status_user_data, SIG_STATUS_END_OF_DATA); + s->current_get_bit = fake_get_bit; + s->in_training = TRUE; + bit = 1; + } + return scramble(s, bit); +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINT) +static complexi16_t getbaud(v27ter_tx_state_t *s) +#else +static complexf_t getbaud(v27ter_tx_state_t *s) +#endif +{ + static const int phase_steps_4800[8] = + { + 1, 0, 2, 3, 6, 7, 5, 4 + }; + static const int phase_steps_2400[4] = + { + 0, 2, 6, 4 + }; +#if defined(SPANDSP_USE_FIXED_POINT) + static const complexi16_t constellation[8] = + { + { 1414, 0000}, /* 0deg */ + { 1000, 1000}, /* 45deg */ + { 0000, 1414}, /* 90deg */ + {-1000, 1000}, /* 135deg */ + {-1414, 0000}, /* 180deg */ + {-1000, -1000}, /* 225deg */ + { 0000, -1414}, /* 270deg */ + { 1000, -1000} /* 315deg */ + }; + static const complexi16_t zero = {0, 0}; +#else + static const complexf_t constellation[8] = + { + { 1.414f, 0.0f}, /* 0deg */ + { 1.0f, 1.0f}, /* 45deg */ + { 0.0f, 1.414f}, /* 90deg */ + {-1.0f, 1.0f}, /* 135deg */ + {-1.414f, 0.0f}, /* 180deg */ + {-1.0f, -1.0f}, /* 225deg */ + { 0.0f, -1.414f}, /* 270deg */ + { 1.0f, -1.0f} /* 315deg */ + }; + static const complexf_t zero = {0.0f, 0.0f}; +#endif + int bits; + + if (s->in_training) + { + /* Send the training sequence */ + if (++s->training_step <= V27TER_TRAINING_SEG_5) + { + if (s->training_step <= V27TER_TRAINING_SEG_4) + { + if (s->training_step <= V27TER_TRAINING_SEG_2) + { + /* Segment 1: Unmodulated carrier (talker echo protection) */ + return constellation[0]; + } + if (s->training_step <= V27TER_TRAINING_SEG_3) + { + /* Segment 2: Silence */ + return zero; + } + /* Segment 3: Regular reversals... */ + s->constellation_state = (s->constellation_state + 4) & 7; + return constellation[s->constellation_state]; + } + /* Segment 4: Scrambled reversals... */ + /* Apply the 1 + x^-6 + x^-7 scrambler. We want every third + bit from the scrambler. */ + bits = get_scrambled_bit(s) << 2; + get_scrambled_bit(s); + get_scrambled_bit(s); + s->constellation_state = (s->constellation_state + bits) & 7; + return constellation[s->constellation_state]; + } + /* We should be in the block of test ones, or shutdown ones, if we get here. */ + /* There is no graceful shutdown procedure defined for V.27ter. Just + send some ones, to ensure we get the real data bits through, even + with bad ISI. */ + if (s->training_step == V27TER_TRAINING_END + 1) + { + /* End of the last segment - segment 5: All ones */ + /* Switch from the fake get_bit routine, to the user supplied real + one, and we are up and running. */ + s->current_get_bit = s->get_bit; + s->in_training = FALSE; + } + if (s->training_step == V27TER_TRAINING_SHUTDOWN_END) + { + if (s->status_handler) + s->status_handler(s->status_user_data, SIG_STATUS_SHUTDOWN_COMPLETE); + } + } + /* 4800bps uses 8 phases. 2400bps uses 4 phases. */ + if (s->bit_rate == 4800) + { + bits = get_scrambled_bit(s); + bits = (bits << 1) | get_scrambled_bit(s); + bits = (bits << 1) | get_scrambled_bit(s); + bits = phase_steps_4800[bits]; + } + else + { + bits = get_scrambled_bit(s); + bits = (bits << 1) | get_scrambled_bit(s); + bits = phase_steps_2400[bits]; + } + s->constellation_state = (s->constellation_state + bits) & 7; + return constellation[s->constellation_state]; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) v27ter_tx(v27ter_tx_state_t *s, int16_t amp[], int len) +{ +#if defined(SPANDSP_USE_FIXED_POINT) + complexi_t x; + complexi_t z; +#else + complexf_t x; + complexf_t z; +#endif + int i; + int sample; + + if (s->training_step >= V27TER_TRAINING_SHUTDOWN_END) + { + /* Once we have sent the shutdown symbols, we stop sending completely. */ + return 0; + } + /* The symbol rates for the two bit rates are different. This makes it difficult to + merge both generation procedures into a single efficient loop. We do not bother + trying. We use two independent loops, filter coefficients, etc. */ + if (s->bit_rate == 4800) + { + for (sample = 0; sample < len; sample++) + { + if (++s->baud_phase >= 5) + { + s->baud_phase -= 5; + s->rrc_filter[s->rrc_filter_step] = + s->rrc_filter[s->rrc_filter_step + V27TER_TX_FILTER_STEPS] = getbaud(s); + if (++s->rrc_filter_step >= V27TER_TX_FILTER_STEPS) + s->rrc_filter_step = 0; + } + /* Root raised cosine pulse shaping at baseband */ +#if defined(SPANDSP_USE_FIXED_POINT) + x = complex_seti(0, 0); + for (i = 0; i < V27TER_TX_FILTER_STEPS; i++) + { + x.re += (int32_t) tx_pulseshaper_4800[TX_PULSESHAPER_4800_COEFF_SETS - 1 - s->baud_phase][i]*(int32_t) s->rrc_filter[i + s->rrc_filter_step].re; + x.im += (int32_t) tx_pulseshaper_4800[TX_PULSESHAPER_4800_COEFF_SETS - 1 - s->baud_phase][i]*(int32_t) s->rrc_filter[i + s->rrc_filter_step].im; + } + /* Now create and modulate the carrier */ + x.re >>= 14; + x.im >>= 14; + z = dds_complexi(&(s->carrier_phase), s->carrier_phase_rate); + /* Don't bother saturating. We should never clip. */ + i = (x.re*z.re - x.im*z.im) >> 15; + amp[sample] = (int16_t) ((i*s->gain_4800) >> 15); +#else + x = complex_setf(0.0f, 0.0f); + for (i = 0; i < V27TER_TX_FILTER_STEPS; i++) + { + x.re += tx_pulseshaper_4800[TX_PULSESHAPER_4800_COEFF_SETS - 1 - s->baud_phase][i]*s->rrc_filter[i + s->rrc_filter_step].re; + x.im += tx_pulseshaper_4800[TX_PULSESHAPER_4800_COEFF_SETS - 1 - s->baud_phase][i]*s->rrc_filter[i + s->rrc_filter_step].im; + } + /* Now create and modulate the carrier */ + z = dds_complexf(&(s->carrier_phase), s->carrier_phase_rate); + /* Don't bother saturating. We should never clip. */ + amp[sample] = (int16_t) lfastrintf((x.re*z.re - x.im*z.im)*s->gain_4800); +#endif + } + } + else + { + for (sample = 0; sample < len; sample++) + { + if ((s->baud_phase += 3) >= 20) + { + s->baud_phase -= 20; + s->rrc_filter[s->rrc_filter_step] = + s->rrc_filter[s->rrc_filter_step + V27TER_TX_FILTER_STEPS] = getbaud(s); + if (++s->rrc_filter_step >= V27TER_TX_FILTER_STEPS) + s->rrc_filter_step = 0; + } + /* Root raised cosine pulse shaping at baseband */ +#if defined(SPANDSP_USE_FIXED_POINT) + x = complex_seti(0, 0); + for (i = 0; i < V27TER_TX_FILTER_STEPS; i++) + { + x.re += (int32_t) tx_pulseshaper_2400[TX_PULSESHAPER_2400_COEFF_SETS - 1 - s->baud_phase][i]*(int32_t) s->rrc_filter[i + s->rrc_filter_step].re; + x.im += (int32_t) tx_pulseshaper_2400[TX_PULSESHAPER_2400_COEFF_SETS - 1 - s->baud_phase][i]*(int32_t) s->rrc_filter[i + s->rrc_filter_step].im; + } + /* Now create and modulate the carrier */ + x.re >>= 14; + x.im >>= 14; + z = dds_complexi(&(s->carrier_phase), s->carrier_phase_rate); + /* Don't bother saturating. We should never clip. */ + i = (x.re*z.re - x.im*z.im) >> 15; + amp[sample] = (int16_t) ((i*s->gain_2400) >> 15); +#else + x = complex_setf(0.0f, 0.0f); + for (i = 0; i < V27TER_TX_FILTER_STEPS; i++) + { + x.re += tx_pulseshaper_2400[TX_PULSESHAPER_2400_COEFF_SETS - 1 - s->baud_phase][i]*s->rrc_filter[i + s->rrc_filter_step].re; + x.im += tx_pulseshaper_2400[TX_PULSESHAPER_2400_COEFF_SETS - 1 - s->baud_phase][i]*s->rrc_filter[i + s->rrc_filter_step].im; + } + /* Now create and modulate the carrier */ + z = dds_complexf(&(s->carrier_phase), s->carrier_phase_rate); + /* Don't bother saturating. We should never clip. */ + amp[sample] = (int16_t) lfastrintf((x.re*z.re - x.im*z.im)*s->gain_2400); +#endif + } + } + return sample; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v27ter_tx_power(v27ter_tx_state_t *s, float power) +{ + float l; + + l = powf(10.0f, (power - DBM0_MAX_POWER)/20.0f)*32768.0f; +#if defined(SPANDSP_USE_FIXED_POINT) + s->gain_2400 = 16.0f*1.024f*(32767.0f/28828.51f)*l/TX_PULSESHAPER_2400_GAIN; + s->gain_4800 = 16.0f*1.024f*(32767.0f/28828.46f)*l/TX_PULSESHAPER_4800_GAIN; +#else + s->gain_2400 = l/TX_PULSESHAPER_2400_GAIN; + s->gain_4800 = l/TX_PULSESHAPER_4800_GAIN; +#endif +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v27ter_tx_set_get_bit(v27ter_tx_state_t *s, get_bit_func_t get_bit, void *user_data) +{ + if (s->get_bit == s->current_get_bit) + s->current_get_bit = get_bit; + s->get_bit = get_bit; + s->get_bit_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v27ter_tx_set_modem_status_handler(v27ter_tx_state_t *s, modem_tx_status_func_t handler, void *user_data) +{ + s->status_handler = handler; + s->status_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(logging_state_t *) v27ter_tx_get_logging_state(v27ter_tx_state_t *s) +{ + return &s->logging; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v27ter_tx_restart(v27ter_tx_state_t *s, int bit_rate, int tep) +{ + if (bit_rate != 4800 && bit_rate != 2400) + return -1; + s->bit_rate = bit_rate; +#if defined(SPANDSP_USE_FIXED_POINT) + memset(s->rrc_filter, 0, sizeof(s->rrc_filter)); +#else + cvec_zerof(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); +#endif + s->rrc_filter_step = 0; + s->scramble_reg = 0x3C; + s->scrambler_pattern_count = 0; + s->in_training = TRUE; + s->training_step = (tep) ? V27TER_TRAINING_SEG_1 : V27TER_TRAINING_SEG_2; + s->carrier_phase = 0; + s->baud_phase = 0; + s->constellation_state = 0; + s->current_get_bit = fake_get_bit; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(v27ter_tx_state_t *) v27ter_tx_init(v27ter_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data) +{ + switch (bit_rate) + { + case 4800: + case 2400: + break; + default: + return NULL; + } + if (s == NULL) + { + if ((s = (v27ter_tx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "V.27ter TX"); + s->get_bit = get_bit; + s->get_bit_user_data = user_data; + s->carrier_phase_rate = dds_phase_ratef(CARRIER_NOMINAL_FREQ); + v27ter_tx_power(s, -14.0f); + v27ter_tx_restart(s, bit_rate, tep); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v27ter_tx_release(v27ter_tx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v27ter_tx_free(v27ter_tx_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/v29rx.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/v29rx.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1227 @@ +#define IAXMODEM_STUFF +/* + * SpanDSP - a series of DSP components for telephony + * + * v29rx.c - ITU V.29 modem receive part + * + * Written by Steve Underwood + * + * Copyright (C) 2003, 2004, 2005, 2006, 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v29rx.c,v 1.167.4.5 2009/12/28 12:20:47 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/complex.h" +#include "spandsp/vector_float.h" +#include "spandsp/complex_vector_float.h" +#include "spandsp/vector_int.h" +#include "spandsp/complex_vector_int.h" +#include "spandsp/async.h" +#include "spandsp/power_meter.h" +#include "spandsp/arctan2.h" +#include "spandsp/dds.h" +#include "spandsp/complex_filters.h" + +#include "spandsp/v29rx.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/v29rx.h" + +#include "v29tx_constellation_maps.h" +#if defined(SPANDSP_USE_FIXED_POINT) +#include "v29rx_fixed_rrc.h" +#else +#include "v29rx_floating_rrc.h" +#endif + +/*! The nominal frequency of the carrier, in Hertz */ +#define CARRIER_NOMINAL_FREQ 1700.0f +/*! The nominal baud or symbol rate */ +#define BAUD_RATE 2400 +/*! The adaption rate coefficient for the equalizer */ +#define EQUALIZER_DELTA 0.21f + +#if defined(SPANDSP_USE_FIXED_POINT) +#define FP_FACTOR 4096 +#define FP_SHIFT_FACTOR 12 +#endif + +/* Segments of the training sequence */ +/*! The length of training segment 2, in symbols */ +#define V29_TRAINING_SEG_2_LEN 128 +/*! The length of training segment 3, in symbols */ +#define V29_TRAINING_SEG_3_LEN 384 +/*! The length of training segment 4, in symbols */ +#define V29_TRAINING_SEG_4_LEN 48 + +/*! The length of the equalizer buffer */ +#define V29_EQUALIZER_LEN (V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN) + +enum +{ + TRAINING_STAGE_NORMAL_OPERATION = 0, + TRAINING_STAGE_SYMBOL_ACQUISITION, + TRAINING_STAGE_LOG_PHASE, + TRAINING_STAGE_WAIT_FOR_CDCD, + TRAINING_STAGE_TRAIN_ON_CDCD, + TRAINING_STAGE_TRAIN_ON_CDCD_AND_TEST, + TRAINING_STAGE_TEST_ONES, + TRAINING_STAGE_PARKED +}; + +static const uint8_t space_map_9600[20][20] = +{ + {13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11}, + {13, 13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 11}, + {13, 13, 13, 13, 13, 13, 13, 4, 4, 4, 4, 4, 4, 11, 11, 11, 11, 11, 11, 11}, + {13, 13, 13, 13, 13, 13, 13, 4, 4, 4, 4, 4, 4, 11, 11, 11, 11, 11, 11, 11}, + {13, 13, 13, 13, 13, 13, 13, 4, 4, 4, 4, 4, 4, 11, 11, 11, 11, 11, 11, 11}, + {13, 13, 13, 13, 13, 13, 13, 5, 4, 4, 4, 4, 3, 11, 11, 11, 11, 11, 11, 11}, + {14, 13, 13, 13, 13, 13, 5, 5, 5, 5, 3, 3, 3, 3, 11, 11, 11, 11, 11, 10}, + {14, 14, 6, 6, 6, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 2, 2, 2, 10, 10}, + {14, 14, 6, 6, 6, 6, 5, 5, 5, 5, 3, 3, 3, 3, 2, 2, 2, 2, 10, 10}, + {14, 14, 6, 6, 6, 6, 5, 5, 5, 5, 3, 3, 3, 3, 2, 2, 2, 2, 10, 10}, + {14, 14, 6, 6, 6, 6, 7, 7, 7, 7, 1, 1, 1, 1, 2, 2, 2, 2, 10, 10}, + {14, 14, 6, 6, 6, 6, 7, 7, 7, 7, 1, 1, 1, 1, 2, 2, 2, 2, 10, 10}, + {14, 14, 6, 6, 6, 7, 7, 7, 7, 7, 1, 1, 1, 1, 1, 2, 2, 2, 10, 10}, + {14, 15, 15, 15, 15, 15, 7, 7, 7, 7, 1, 1, 1, 1, 9, 9, 9, 9, 9, 10}, + {15, 15, 15, 15, 15, 15, 15, 7, 0, 0, 0, 0, 1, 9, 9, 9, 9, 9, 9, 9}, + {15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9}, + {15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9}, + {15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9}, + {15, 15, 15, 15, 15, 15, 15, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9}, + {15, 15, 15, 15, 15, 15, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9} +}; + +/* Coefficients for the band edge symbol timing synchroniser (alpha = 0.99) */ +/* low_edge = 2.0f*M_PI*(CARRIER_NOMINAL_FREQ - BAUD_RATE/2.0f)/SAMPLE_RATE; */ +/* high_edge = 2.0f*M_PI*(CARRIER_NOMINAL_FREQ + BAUD_RATE/2.0f)/SAMPLE_RATE; */ +#define SIN_LOW_BAND_EDGE 0.382683432f +#define COS_LOW_BAND_EDGE 0.923879533f +#define SIN_HIGH_BAND_EDGE 0.760405966f +#define COS_HIGH_BAND_EDGE -0.649448048f +#define ALPHA 0.99f + +#if defined(SPANDSP_USE_FIXED_POINT) +#define SYNC_LOW_BAND_EDGE_COEFF_0 ((int)(FP_FACTOR*(2.0f*ALPHA*COS_LOW_BAND_EDGE))) +#define SYNC_LOW_BAND_EDGE_COEFF_1 ((int)(FP_FACTOR*(-ALPHA*ALPHA))) +#define SYNC_LOW_BAND_EDGE_COEFF_2 ((int)(FP_FACTOR*(-ALPHA*SIN_LOW_BAND_EDGE))) +#define SYNC_HIGH_BAND_EDGE_COEFF_0 ((int)(FP_FACTOR*(2.0f*ALPHA*COS_HIGH_BAND_EDGE))) +#define SYNC_HIGH_BAND_EDGE_COEFF_1 ((int)(FP_FACTOR*(-ALPHA*ALPHA))) +#define SYNC_HIGH_BAND_EDGE_COEFF_2 ((int)(FP_FACTOR*(-ALPHA*SIN_HIGH_BAND_EDGE))) +#define SYNC_MIXED_EDGES_COEFF_3 ((int)(FP_FACTOR*(-ALPHA*ALPHA*(SIN_HIGH_BAND_EDGE*COS_LOW_BAND_EDGE - SIN_LOW_BAND_EDGE*COS_HIGH_BAND_EDGE)))) +#else +#define SYNC_LOW_BAND_EDGE_COEFF_0 (2.0f*ALPHA*COS_LOW_BAND_EDGE) +#define SYNC_LOW_BAND_EDGE_COEFF_1 (-ALPHA*ALPHA) +#define SYNC_LOW_BAND_EDGE_COEFF_2 (-ALPHA*SIN_LOW_BAND_EDGE) +#define SYNC_HIGH_BAND_EDGE_COEFF_0 (2.0f*ALPHA*COS_HIGH_BAND_EDGE) +#define SYNC_HIGH_BAND_EDGE_COEFF_1 (-ALPHA*ALPHA) +#define SYNC_HIGH_BAND_EDGE_COEFF_2 (-ALPHA*SIN_HIGH_BAND_EDGE) +#define SYNC_MIXED_EDGES_COEFF_3 (-ALPHA*ALPHA*(SIN_HIGH_BAND_EDGE*COS_LOW_BAND_EDGE - SIN_LOW_BAND_EDGE*COS_HIGH_BAND_EDGE)) +#endif + +SPAN_DECLARE(float) v29_rx_carrier_frequency(v29_rx_state_t *s) +{ + return dds_frequencyf(s->carrier_phase_rate); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) v29_rx_symbol_timing_correction(v29_rx_state_t *s) +{ + return (float) s->total_baud_timing_correction/((float) RX_PULSESHAPER_COEFF_SETS*10.0f/3.0f); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(float) v29_rx_signal_power(v29_rx_state_t *s) +{ + return power_meter_current_dbm0(&s->power) + 3.98f; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v29_rx_signal_cutoff(v29_rx_state_t *s, float cutoff) +{ + /* The 0.4 factor allows for the gain of the DC blocker */ + s->carrier_on_power = (int32_t) (power_meter_level_dbm0(cutoff + 2.5f)*0.4f); + s->carrier_off_power = (int32_t) (power_meter_level_dbm0(cutoff - 2.5f)*0.4f); +} +/*- End of function --------------------------------------------------------*/ + +static void report_status_change(v29_rx_state_t *s, int status) +{ + if (s->status_handler) + s->status_handler(s->status_user_data, status); + else if (s->put_bit) + s->put_bit(s->put_bit_user_data, status); +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINT) +SPAN_DECLARE(int) v29_rx_equalizer_state(v29_rx_state_t *s, complexi16_t **coeffs) +#else +SPAN_DECLARE(int) v29_rx_equalizer_state(v29_rx_state_t *s, complexf_t **coeffs) +#endif +{ + *coeffs = s->eq_coeff; + return V29_EQUALIZER_LEN; +} +/*- End of function --------------------------------------------------------*/ + +static void equalizer_save(v29_rx_state_t *s) +{ +#if defined(SPANDSP_USE_FIXED_POINT) + cvec_copyi16(s->eq_coeff_save, s->eq_coeff, V29_EQUALIZER_LEN); +#else + cvec_copyf(s->eq_coeff_save, s->eq_coeff, V29_EQUALIZER_LEN); +#endif +} +/*- End of function --------------------------------------------------------*/ + +static void equalizer_restore(v29_rx_state_t *s) +{ +#if defined(SPANDSP_USE_FIXED_POINT) + cvec_copyi16(s->eq_coeff, s->eq_coeff_save, V29_EQUALIZER_LEN); + cvec_zeroi16(s->eq_buf, V29_EQUALIZER_LEN); + s->eq_delta = 32768.0f*EQUALIZER_DELTA/V29_EQUALIZER_LEN; +#else + cvec_copyf(s->eq_coeff, s->eq_coeff_save, V29_EQUALIZER_LEN); + cvec_zerof(s->eq_buf, V29_EQUALIZER_LEN); + s->eq_delta = EQUALIZER_DELTA/V29_EQUALIZER_LEN; +#endif + + s->eq_put_step = RX_PULSESHAPER_COEFF_SETS*10/(3*2) - 1; + s->eq_step = 0; +} +/*- End of function --------------------------------------------------------*/ + +static void equalizer_reset(v29_rx_state_t *s) +{ + /* Start with an equalizer based on everything being perfect */ +#if defined(SPANDSP_USE_FIXED_POINT) + cvec_zeroi16(s->eq_coeff, V29_EQUALIZER_LEN); + s->eq_coeff[V29_EQUALIZER_POST_LEN] = complex_seti16(3*FP_FACTOR, 0*FP_FACTOR); + cvec_zeroi16(s->eq_buf, V29_EQUALIZER_LEN); + s->eq_delta = 32768.0f*EQUALIZER_DELTA/V29_EQUALIZER_LEN; +#else + cvec_zerof(s->eq_coeff, V29_EQUALIZER_LEN); + s->eq_coeff[V29_EQUALIZER_POST_LEN] = complex_setf(3.0f, 0.0f); + cvec_zerof(s->eq_buf, V29_EQUALIZER_LEN); + s->eq_delta = EQUALIZER_DELTA/V29_EQUALIZER_LEN; +#endif + + s->eq_put_step = RX_PULSESHAPER_COEFF_SETS*10/(3*2) - 1; + s->eq_step = 0; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINT) +static __inline__ complexi16_t complex_mul_q4_12(const complexi16_t *x, const complexi16_t *y) +{ + complexi16_t z; + + z.re = ((int32_t) x->re*(int32_t) y->re - (int32_t) x->im*(int32_t) y->im) >> FP_SHIFT_FACTOR; + z.im = ((int32_t) x->re*(int32_t) y->im + (int32_t) x->im*(int32_t) y->re) >> FP_SHIFT_FACTOR; + return z; +} +/*- End of function --------------------------------------------------------*/ +#endif + +#if defined(SPANDSP_USE_FIXED_POINT) +static __inline__ complexi16_t equalizer_get(v29_rx_state_t *s) +#else +static __inline__ complexf_t equalizer_get(v29_rx_state_t *s) +#endif +{ +#if defined(SPANDSP_USE_FIXED_POINT) + complexi32_t zz; + complexi16_t z; + + /* Get the next equalized value. */ + zz = cvec_circular_dot_prodi16(s->eq_buf, s->eq_coeff, V29_EQUALIZER_LEN, s->eq_step); + z.re = zz.re >> FP_SHIFT_FACTOR; + z.im = zz.im >> FP_SHIFT_FACTOR; + return z; +#else + /* Get the next equalized value. */ + return cvec_circular_dot_prodf(s->eq_buf, s->eq_coeff, V29_EQUALIZER_LEN, s->eq_step); +#endif +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINT) +static void tune_equalizer(v29_rx_state_t *s, const complexi16_t *z, const complexi16_t *target) +{ + complexi16_t err; + + /* Find the x and y mismatch from the exact constellation position. */ + err.re = target->re*FP_FACTOR - z->re; + err.im = target->im*FP_FACTOR - z->im; + err.re = ((int32_t) err.re*(int32_t) s->eq_delta) >> 15; + err.im = ((int32_t) err.im*(int32_t) s->eq_delta) >> 15; + cvec_circular_lmsi16(s->eq_buf, s->eq_coeff, V29_EQUALIZER_LEN, s->eq_step, &err); +} +#else +static void tune_equalizer(v29_rx_state_t *s, const complexf_t *z, const complexf_t *target) +{ + complexf_t err; + + /* Find the x and y mismatch from the exact constellation position. */ + err = complex_subf(target, z); + err.re *= s->eq_delta; + err.im *= s->eq_delta; + cvec_circular_lmsf(s->eq_buf, s->eq_coeff, V29_EQUALIZER_LEN, s->eq_step, &err); +} +#endif +/*- End of function --------------------------------------------------------*/ + +static int scrambled_training_bit(v29_rx_state_t *s) +{ + int bit; + + /* Segment 3 of the training sequence - the scrambled CDCD part. */ + /* Apply the 1 + x^-6 + x^-7 scrambler */ + bit = s->training_scramble_reg & 1; + s->training_scramble_reg >>= 1; + if (bit ^ (s->training_scramble_reg & 1)) + s->training_scramble_reg |= 0x40; + return bit; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINT) +static __inline__ int find_quadrant(const complexi16_t *z) +#else +static __inline__ int find_quadrant(const complexf_t *z) +#endif +{ + int b1; + int b2; + + /* Split the space along the two diagonals. */ + b1 = (z->im > z->re); + b2 = (z->im < -z->re); + return (b2 << 1) | (b1 ^ b2); +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINT) +static __inline__ void track_carrier(v29_rx_state_t *s, const complexi16_t *z, const complexi16_t *target) +#else +static __inline__ void track_carrier(v29_rx_state_t *s, const complexf_t *z, const complexf_t *target) +#endif +{ +#if defined(SPANDSP_USE_FIXED_POINT) + int32_t error; +#else + float error; +#endif + + /* The initial coarse carrier frequency and phase estimation should have + got us in the right ballpark. Now we need to fine tune fairly quickly, + to get the receovered carrier more precisely on target. Then we need to + fine tune in a more damped way to keep us on target. The goal is to have + things running really well by the time the training is complete. + We assume the frequency of the oscillators at the two ends drift only + very slowly. The PSTN has rather limited doppler problems. :-) Any + remaining FDM in the network should also drift slowly. */ + /* For small errors the imaginary part of the difference between the actual and the target + positions is proportional to the phase error, for any particular target. However, the + different amplitudes of the various target positions scale things. This isn't all bad, + as the angular error for the larger amplitude constellation points is probably + a more reliable indicator, and we are weighting it as such. */ + error = z->im*target->re - z->re*target->im; + + /* Use a proportional-integral approach to tracking the carrier. The PI + parameters are coarser at first, until we get precisely on target. Then, + the filter will be damped more to keep us on target. */ +#if defined(SPANDSP_USE_FIXED_POINT) + s->carrier_phase_rate += ((s->carrier_track_i*error) >> FP_SHIFT_FACTOR); + s->carrier_phase += ((s->carrier_track_p*error) >> FP_SHIFT_FACTOR); +#else + s->carrier_phase_rate += (int32_t) (s->carrier_track_i*error); + s->carrier_phase += (int32_t) (s->carrier_track_p*error); + //span_log(&s->logging, SPAN_LOG_FLOW, "Im = %15.5f f = %15.5f\n", error, dds_frequencyf(s->carrier_phase_rate)); +#endif +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void put_bit(v29_rx_state_t *s, int bit) +{ + int out_bit; + + bit &= 1; + + /* Descramble the bit */ + out_bit = (bit ^ (s->scramble_reg >> 17) ^ (s->scramble_reg >> 22)) & 1; + s->scramble_reg = (s->scramble_reg << 1) | bit; + + /* We need to strip the last part of the training - the test period of all 1s - + before we let data go to the application. */ + if (s->training_stage == TRAINING_STAGE_NORMAL_OPERATION) + { + s->put_bit(s->put_bit_user_data, out_bit); + } + else + { + /* The bits during the final stage of training should be all ones. However, + buggy modems mean you cannot rely on this. Therefore we don't bother + testing for ones, but just rely on a constellation mismatch measurement. */ + } +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINT) +static void decode_baud(v29_rx_state_t *s, complexi16_t *z) +#else +static void decode_baud(v29_rx_state_t *s, complexf_t *z) +#endif +{ + static const uint8_t phase_steps_9600[8] = + { + 4, 0, 2, 6, 7, 3, 1, 5 + }; + static const uint8_t phase_steps_4800[4] = + { + 0, 2, 3, 1 + }; + int nearest; + int raw_bits; + int i; + int re; + int im; + + if (s->bit_rate == 4800) + { + /* 4800 is a special case. */ + nearest = find_quadrant(z) << 1; + raw_bits = phase_steps_4800[((nearest - s->constellation_state) >> 1) & 3]; + put_bit(s, raw_bits); + put_bit(s, raw_bits >> 1); + } + else + { + /* 9600 and 7200 are quite similar. */ +#if defined(SPANDSP_USE_FIXED_POINT) + re = (z->re + 5*FP_FACTOR) >> (FP_SHIFT_FACTOR - 1); + im = (z->im + 5*FP_FACTOR) >> (FP_SHIFT_FACTOR - 1); +#else + re = (int) ((z->re + 5.0f)*2.0f); + im = (int) ((z->im + 5.0f)*2.0f); +#endif + if (re > 19) + re = 19; + else if (re < 0) + re = 0; + if (im > 19) + im = 19; + else if (im < 0) + im = 0; + nearest = space_map_9600[re][im]; + if (s->bit_rate == 9600) + { + /* Send out the top (amplitude) bit. */ + put_bit(s, nearest >> 3); + } + else + { + /* We can reuse the space map for 9600, but drop the top bit. */ + nearest &= 7; + } + raw_bits = phase_steps_9600[(nearest - s->constellation_state) & 7]; + for (i = 0; i < 3; i++) + { + put_bit(s, raw_bits); + raw_bits >>= 1; + } + } + + track_carrier(s, z, &v29_9600_constellation[nearest]); + if (--s->eq_skip <= 0) + { + /* Once we are in the data the equalization should not need updating. + However, the line characteristics may slowly drift. We, therefore, + tune up on the occassional sample, keeping the compute down. */ + s->eq_skip = 10; + tune_equalizer(s, z, &v29_9600_constellation[nearest]); + } + s->constellation_state = nearest; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void symbol_sync(v29_rx_state_t *s) +{ + int i; +#if defined(SPANDSP_USE_FIXED_POINT) + int32_t v; + int32_t p; +#else + float v; + float p; +#endif + + /* This routine adapts the position of the half baud samples entering the equalizer. */ + + /* This symbol sync scheme is based on the technique first described by Dominique Godard in + Passband Timing Recovery in an All-Digital Modem Receiver + IEEE TRANSACTIONS ON COMMUNICATIONS, VOL. COM-26, NO. 5, MAY 1978 */ + + /* This is slightly rearranged for figure 3b of the Godard paper, as this saves a couple of + maths operations */ +#if defined(SPANDSP_USE_FIXED_POINT) + /* TODO: The scalings used here need more thorough evaluation, to see if overflows are possible. */ + /* Cross correlate */ + v = (((s->symbol_sync_low[1] >> 5)*(s->symbol_sync_high[0] >> 4)) >> 15)*SYNC_LOW_BAND_EDGE_COEFF_2 + - (((s->symbol_sync_low[0] >> 5)*(s->symbol_sync_high[1] >> 4)) >> 15)*SYNC_HIGH_BAND_EDGE_COEFF_2 + + (((s->symbol_sync_low[1] >> 5)*(s->symbol_sync_high[1] >> 4)) >> 15)*SYNC_MIXED_EDGES_COEFF_3; + /* Filter away any DC component */ + p = v - s->symbol_sync_dc_filter[1]; + s->symbol_sync_dc_filter[1] = s->symbol_sync_dc_filter[0]; + s->symbol_sync_dc_filter[0] = v; + /* A little integration will now filter away much of the HF noise */ + s->baud_phase -= p; + if (abs(s->baud_phase) > 30*FP_FACTOR) + { + if (s->baud_phase > 0) + i = (s->baud_phase > 1000*FP_FACTOR) ? 5 : 1; + else + i = (s->baud_phase < -1000*FP_FACTOR) ? -5 : -1; + //printf("v = %10.5f %5d - %f %f %d %d\n", v, i, p, s->baud_phase, s->total_baud_timing_correction); + s->eq_put_step += i; + s->total_baud_timing_correction += i; + } +#else + /* Cross correlate */ + v = s->symbol_sync_low[1]*s->symbol_sync_high[0]*SYNC_LOW_BAND_EDGE_COEFF_2 + - s->symbol_sync_low[0]*s->symbol_sync_high[1]*SYNC_HIGH_BAND_EDGE_COEFF_2 + + s->symbol_sync_low[1]*s->symbol_sync_high[1]*SYNC_MIXED_EDGES_COEFF_3; + /* Filter away any DC component */ + p = v - s->symbol_sync_dc_filter[1]; + s->symbol_sync_dc_filter[1] = s->symbol_sync_dc_filter[0]; + s->symbol_sync_dc_filter[0] = v; + /* A little integration will now filter away much of the HF noise */ + s->baud_phase -= p; + if (fabsf(s->baud_phase) > 30.0f) + { + if (s->baud_phase > 0.0f) + i = (s->baud_phase > 1000.0f) ? 5 : 1; + else + i = (s->baud_phase < -1000.0f) ? -5 : -1; + //printf("v = %10.5f %5d - %f %f %d %d\n", v, i, p, s->baud_phase, s->total_baud_timing_correction); + s->eq_put_step += i; + s->total_baud_timing_correction += i; + } +#endif +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINT) +static void process_half_baud(v29_rx_state_t *s, complexi16_t *sample) +#else +static void process_half_baud(v29_rx_state_t *s, complexf_t *sample) +#endif +{ + static const int cdcd_pos[6] = + { + 0, 11, + 0, 3, + 0, 2 + }; + complexf_t zz; +#if defined(SPANDSP_USE_FIXED_POINT) + complexf_t z1; + complexi16_t z; + const complexi16_t *target; + static const complexi16_t zero = {0, 0}; +#else + complexf_t z; + const complexf_t *target; + static const complexf_t zero = {0.0f, 0.0f}; +#endif + float p; + int bit; + int i; + int j; + int32_t angle; + int32_t ang; + + /* This routine processes every half a baud, as we put things into the equalizer at the T/2 rate. */ + + /* Add a sample to the equalizer's circular buffer, but don't calculate anything at this time. */ + s->eq_buf[s->eq_step] = *sample; + if (++s->eq_step >= V29_EQUALIZER_LEN) + s->eq_step = 0; + + /* On alternate insertions we have a whole baud, and must process it. */ + if ((s->baud_half ^= 1)) + return; + + /* Symbol timing synchronisation */ + symbol_sync(s); + + z = equalizer_get(s); + + switch (s->training_stage) + { + case TRAINING_STAGE_NORMAL_OPERATION: + /* Normal operation. */ + decode_baud(s, &z); + target = &v29_9600_constellation[s->constellation_state]; + break; + case TRAINING_STAGE_SYMBOL_ACQUISITION: + /* Allow time for symbol synchronisation to settle the symbol timing. */ + target = &zero; + if (++s->training_count >= 60) + { + /* Record the current phase angle */ + s->training_stage = TRAINING_STAGE_LOG_PHASE; + s->angles[0] = + s->start_angles[0] = arctan2(z.im, z.re); +#if defined(SPANDSP_USE_FIXED_POINT) + if (s->agc_scaling_save == 0) + s->agc_scaling_save = s->agc_scaling; +#else + if (s->agc_scaling_save == 0.0f) + s->agc_scaling_save = s->agc_scaling; +#endif + } + break; + case TRAINING_STAGE_LOG_PHASE: + /* Record the current alternate phase angle */ + target = &zero; + s->angles[1] = + s->start_angles[1] = arctan2(z.im, z.re); + s->training_count = 1; + s->training_stage = TRAINING_STAGE_WAIT_FOR_CDCD; + break; + case TRAINING_STAGE_WAIT_FOR_CDCD: + target = &zero; + angle = arctan2(z.im, z.re); + /* Look for the initial ABAB sequence to display a phase reversal, which will + signal the start of the scrambled CDCD segment */ + ang = angle - s->angles[(s->training_count - 1) & 0xF]; + s->angles[(s->training_count + 1) & 0xF] = angle; + if ((ang > 0x20000000 || ang < -0x20000000) && s->training_count >= 13) + { + /* We seem to have a phase reversal */ + /* Slam the carrier frequency into line, based on the total phase drift over the last + section. Use the shift from the odd bits and the shift from the even bits to get + better jitter suppression. We need to scale here, or at the maximum specified + frequency deviation we could overflow, and get a silly answer. */ + /* Step back a few symbols so we don't get ISI distorting things. */ + i = (s->training_count - 8) & ~1; + /* Avoid the possibility of a divide by zero */ + if (i) + { + j = i & 0xF; + ang = (s->angles[j] - s->start_angles[0])/i + + (s->angles[j | 0x1] - s->start_angles[1])/i; + s->carrier_phase_rate += 3*(ang/20); + } + span_log(&s->logging, SPAN_LOG_FLOW, "Coarse carrier frequency %7.2f\n", dds_frequencyf(s->carrier_phase_rate)); + /* Check if the carrier frequency is plausible */ + if (s->carrier_phase_rate < dds_phase_ratef(CARRIER_NOMINAL_FREQ - 20.0f) + || + s->carrier_phase_rate > dds_phase_ratef(CARRIER_NOMINAL_FREQ + 20.0f)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (sequence failed)\n"); + /* Park this modem */ +#if defined(SPANDSP_USE_FIXED_POINT) + s->agc_scaling_save = 0; +#else + s->agc_scaling_save = 0.0f; +#endif + s->training_stage = TRAINING_STAGE_PARKED; + report_status_change(s, SIG_STATUS_TRAINING_FAILED); + break; + } + /* Make a step shift in the phase, to pull it into line. We need to rotate the equalizer + buffer, as well as the carrier phase, for this to play out nicely. */ + p = angle*2.0f*3.14159f/(65536.0f*65536.0f); +#if defined(SPANDSP_USE_FIXED_POINT) + zz = complex_setf(cosf(p), -sinf(p)); + for (i = 0; i < V29_EQUALIZER_LEN; i++) + { + z1 = complex_setf(s->eq_buf[i].re, s->eq_buf[i].im); + z1 = complex_mulf(&z1, &zz); + s->eq_buf[i].re = z1.re; + s->eq_buf[i].im = z1.im; + } +#else + zz = complex_setf(cosf(p), -sinf(p)); + for (i = 0; i < V29_EQUALIZER_LEN; i++) + s->eq_buf[i] = complex_mulf(&s->eq_buf[i], &zz); +#endif + s->carrier_phase += angle; + /* We have just seen the first bit of the scrambled sequence, so skip it. */ + bit = scrambled_training_bit(s); + s->constellation_state = cdcd_pos[s->training_cd + bit]; + target = &v29_9600_constellation[s->constellation_state]; + s->training_count = 1; + s->training_stage = TRAINING_STAGE_TRAIN_ON_CDCD; + report_status_change(s, SIG_STATUS_TRAINING_IN_PROGRESS); + break; + } + if (++s->training_count > V29_TRAINING_SEG_2_LEN) + { + /* This is bogus. There are not this many bauds in this section + of a real training sequence. */ + span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (sequence failed)\n"); + /* Park this modem */ +#if defined(SPANDSP_USE_FIXED_POINT) + s->agc_scaling_save = 0; +#else + s->agc_scaling_save = 0.0f; +#endif + s->training_stage = TRAINING_STAGE_PARKED; + report_status_change(s, SIG_STATUS_TRAINING_FAILED); + } + break; + case TRAINING_STAGE_TRAIN_ON_CDCD: + /* Train on the scrambled CDCD section. */ + bit = scrambled_training_bit(s); + //span_log(&s->logging, SPAN_LOG_FLOW, "%5d %15.5f, %15.5f %15.5f, %15.5f\n", s->training_count, z.re, z.im, v29_9600_constellation[cdcd_pos[s->training_cd + bit]].re, v29_9600_constellation[cdcd_pos[s->training_cd + bit]].im); + s->constellation_state = cdcd_pos[s->training_cd + bit]; + target = &v29_9600_constellation[s->constellation_state]; + track_carrier(s, &z, target); + tune_equalizer(s, &z, target); + if (++s->training_count >= V29_TRAINING_SEG_3_LEN - 48) + { + s->training_stage = TRAINING_STAGE_TRAIN_ON_CDCD_AND_TEST; + s->training_error = 0.0f; +#if defined(SPANDSP_USE_FIXED_POINT) + s->carrier_track_i = 200; + s->carrier_track_p = 1000000; +#else + s->carrier_track_i = 200.0f; + s->carrier_track_p = 1000000.0f; +#endif + } + break; + case TRAINING_STAGE_TRAIN_ON_CDCD_AND_TEST: + /* Continue training on the scrambled CDCD section, but measure the quality of training too. */ + bit = scrambled_training_bit(s); + //span_log(&s->logging, SPAN_LOG_FLOW, "%5d %15.5f, %15.5f %15.5f, %15.5f\n", s->training_count, z.re, z.im, v29_9600_constellation[cdcd_pos[s->training_cd + bit]].re, v29_9600_constellation[cdcd_pos[s->training_cd + bit]].im); + s->constellation_state = cdcd_pos[s->training_cd + bit]; + target = &v29_9600_constellation[s->constellation_state]; + track_carrier(s, &z, target); + tune_equalizer(s, &z, target); + /* Measure the training error */ +#if defined(SPANDSP_USE_FIXED_POINT) + z1.re = z.re/(float) FP_FACTOR; + z1.im = z.im/(float) FP_FACTOR; + zz.re = target->re; + zz.im = target->im; + zz = complex_subf(&z1, &zz); + s->training_error += powerf(&zz); +#else + zz = complex_subf(&z, target); + s->training_error += powerf(&zz); +#endif + if (++s->training_count >= V29_TRAINING_SEG_3_LEN) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Constellation mismatch %f\n", s->training_error); + if (s->training_error < 48.0f*2.0f) + { + s->training_count = 0; + s->training_error = 0.0f; + s->constellation_state = 0; + s->training_stage = TRAINING_STAGE_TEST_ONES; + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (convergence failed)\n"); + /* Park this modem */ +#if defined(SPANDSP_USE_FIXED_POINT) + s->agc_scaling_save = 0; +#else + s->agc_scaling_save = 0.0f; +#endif + s->training_stage = TRAINING_STAGE_PARKED; + report_status_change(s, SIG_STATUS_TRAINING_FAILED); + } + } + break; + case TRAINING_STAGE_TEST_ONES: + /* We are in the test phase, where we check that we can receive reliably. + We should get a run of 1's, 48 symbols (192 bits at 9600bps) long. */ + //span_log(&s->logging, SPAN_LOG_FLOW, "%5d %15.5f, %15.5f\n", s->training_count, z.re, z.im); + decode_baud(s, &z); + target = &v29_9600_constellation[s->constellation_state]; + /* Measure the training error */ +#if defined(SPANDSP_USE_FIXED_POINT) + z1.re = z.re/(float) FP_FACTOR; + z1.im = z.im/(float) FP_FACTOR; + zz.re = target->re; + zz.im = target->im; + zz = complex_subf(&z1, &zz); + s->training_error += powerf(&zz); +#else + zz = complex_subf(&z, target); + s->training_error += powerf(&zz); +#endif + if (++s->training_count >= V29_TRAINING_SEG_4_LEN) + { + if (s->training_error < 48.0f) + { + /* We are up and running */ + span_log(&s->logging, SPAN_LOG_FLOW, "Training succeeded at %dbps (constellation mismatch %f)\n", s->bit_rate, s->training_error); + report_status_change(s, SIG_STATUS_TRAINING_SUCCEEDED); + /* Apply some lag to the carrier off condition, to ensure the last few bits get pushed through + the processing. */ + s->signal_present = 60; + s->training_stage = TRAINING_STAGE_NORMAL_OPERATION; + equalizer_save(s); + s->carrier_phase_rate_save = s->carrier_phase_rate; + s->agc_scaling_save = s->agc_scaling; + } + else + { + /* Training has failed */ + span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (constellation mismatch %f)\n", s->training_error); + /* Park this modem */ +#if defined(SPANDSP_USE_FIXED_POINT) + s->agc_scaling_save = 0; +#else + s->agc_scaling_save = 0.0f; +#endif + s->training_stage = TRAINING_STAGE_PARKED; + report_status_change(s, SIG_STATUS_TRAINING_FAILED); + } + } + break; + case TRAINING_STAGE_PARKED: + default: + /* We failed to train! */ + /* Park here until the carrier drops. */ + target = &zero; + break; + } + if (s->qam_report) + { +#if defined(SPANDSP_USE_FIXED_POINT) + z1.re = z.re/(float) FP_FACTOR; + z1.im = z.im/(float) FP_FACTOR; + zz.re = target->re; + zz.im = target->im; + s->qam_report(s->qam_user_data, &z1, &zz, s->constellation_state); +#else + s->qam_report(s->qam_user_data, &z, target, s->constellation_state); +#endif + } +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int signal_detect(v29_rx_state_t *s, int16_t amp) +{ + int16_t diff; + int16_t x; + int32_t power; + + /* There should be no DC in the signal, but sometimes there is. + We need to measure the power with the DC blocked, but not using + a slow to respond DC blocker. Use the most elementary HPF. */ + x = amp >> 1; + /* There could be overflow here, but it isn't a problem in practice */ + diff = x - s->last_sample; + s->last_sample = x; + power = power_meter_update(&(s->power), diff); +#if defined(IAXMODEM_STUFF) + /* Quick power drop fudge */ + diff = abs(diff); + if (10*diff < s->high_sample) + { + if (++s->low_samples > 120) + { + power_meter_init(&(s->power), 4); + s->high_sample = 0; + s->low_samples = 0; + } + } + else + { + s->low_samples = 0; + if (diff > s->high_sample) + s->high_sample = diff; + } +#endif + if (s->signal_present > 0) + { + /* Look for power below turn-off threshold to turn the carrier off */ +#if defined(IAXMODEM_STUFF) + if (s->carrier_drop_pending || power < s->carrier_off_power) +#else + if (power < s->carrier_off_power) +#endif + { + if (--s->signal_present <= 0) + { + /* Count down a short delay, to ensure we push the last + few bits through the filters before stopping. */ + v29_rx_restart(s, s->bit_rate, FALSE); + report_status_change(s, SIG_STATUS_CARRIER_DOWN); + return 0; + } +#if defined(IAXMODEM_STUFF) + /* Carrier has dropped, but the put_bit is + pending the signal_present delay. */ + s->carrier_drop_pending = TRUE; +#endif + } + } + else + { + /* Look for power exceeding turn-on threshold to turn the carrier on */ + if (power < s->carrier_on_power) + return 0; + s->signal_present = 1; +#if defined(IAXMODEM_STUFF) + s->carrier_drop_pending = FALSE; +#endif + report_status_change(s, SIG_STATUS_CARRIER_UP); + } + return power; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) v29_rx(v29_rx_state_t *s, const int16_t amp[], int len) +{ + int i; + int step; +#if defined(SPANDSP_USE_FIXED_POINT) + complexi16_t z; + complexi16_t zz; + complexi16_t sample; + int32_t v; +#else + complexf_t z; + complexf_t zz; + complexf_t sample; + float v; +#endif + int32_t power; + + for (i = 0; i < len; i++) + { + s->rrc_filter[s->rrc_filter_step] = amp[i]; + if (++s->rrc_filter_step >= V29_RX_FILTER_STEPS) + s->rrc_filter_step = 0; + + if ((power = signal_detect(s, amp[i])) == 0) + continue; + if (s->training_stage == TRAINING_STAGE_PARKED) + continue; + /* Only spend effort processing this data if the modem is not + parked, after training failure. */ + s->eq_put_step -= RX_PULSESHAPER_COEFF_SETS; + step = -s->eq_put_step; + if (step > RX_PULSESHAPER_COEFF_SETS - 1) + step = RX_PULSESHAPER_COEFF_SETS - 1; + if (step < 0) + step += RX_PULSESHAPER_COEFF_SETS; +#if defined(SPANDSP_USE_FIXED_POINT) + v = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_re[step], V29_RX_FILTER_STEPS, s->rrc_filter_step); + sample.re = (v*s->agc_scaling) >> 15; +#else + v = vec_circular_dot_prodf(s->rrc_filter, rx_pulseshaper_re[step], V29_RX_FILTER_STEPS, s->rrc_filter_step); + sample.re = v*s->agc_scaling; +#endif + + /* Symbol timing synchronisation band edge filters */ +#if defined(SPANDSP_USE_FIXED_POINT) + /* Low Nyquist band edge filter */ + v = ((s->symbol_sync_low[0]*SYNC_LOW_BAND_EDGE_COEFF_0) >> FP_SHIFT_FACTOR) + ((s->symbol_sync_low[1]*SYNC_LOW_BAND_EDGE_COEFF_1) >> FP_SHIFT_FACTOR) + sample.re; + s->symbol_sync_low[1] = s->symbol_sync_low[0]; + s->symbol_sync_low[0] = v; + /* High Nyquist band edge filter */ + v = ((s->symbol_sync_high[0]*SYNC_HIGH_BAND_EDGE_COEFF_0) >> FP_SHIFT_FACTOR) + ((s->symbol_sync_high[1]*SYNC_HIGH_BAND_EDGE_COEFF_1) >> FP_SHIFT_FACTOR) + sample.re; + s->symbol_sync_high[1] = s->symbol_sync_high[0]; + s->symbol_sync_high[0] = v; +#else + /* Low Nyquist band edge filter */ + v = s->symbol_sync_low[0]*SYNC_LOW_BAND_EDGE_COEFF_0 + s->symbol_sync_low[1]*SYNC_LOW_BAND_EDGE_COEFF_1 + sample.re; + s->symbol_sync_low[1] = s->symbol_sync_low[0]; + s->symbol_sync_low[0] = v; + /* High Nyquist band edge filter */ + v = s->symbol_sync_high[0]*SYNC_HIGH_BAND_EDGE_COEFF_0 + s->symbol_sync_high[1]*SYNC_HIGH_BAND_EDGE_COEFF_1 + sample.re; + s->symbol_sync_high[1] = s->symbol_sync_high[0]; + s->symbol_sync_high[0] = v; +#endif + /* Put things into the equalization buffer at T/2 rate. The symbol synchronisation + will fiddle the step to align this with the symbols. */ + if (s->eq_put_step <= 0) + { + /* Only AGC until we have locked down the setting. */ +#if defined(SPANDSP_USE_FIXED_POINT) + if (s->agc_scaling_save == 0) + s->agc_scaling = (float) FP_FACTOR*32768.0f*(1.0f/RX_PULSESHAPER_GAIN)*5.0f*0.25f/sqrtf(power); +#else + if (s->agc_scaling_save == 0.0f) + s->agc_scaling = (1.0f/RX_PULSESHAPER_GAIN)*5.0f*0.25f/sqrtf(power); +#endif + /* Pulse shape while still at the carrier frequency, using a quadrature + pair of filters. This results in a properly bandpass filtered complex + signal, which can be brought directly to baseband by complex mixing. + No further filtering, to remove mixer harmonics, is needed. */ + step = -s->eq_put_step; + if (step > RX_PULSESHAPER_COEFF_SETS - 1) + step = RX_PULSESHAPER_COEFF_SETS - 1; + s->eq_put_step += RX_PULSESHAPER_COEFF_SETS*10/(3*2); +#if defined(SPANDSP_USE_FIXED_POINT) + v = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_im[step], V29_RX_FILTER_STEPS, s->rrc_filter_step); + sample.im = (v*s->agc_scaling) >> 15; + z = dds_lookup_complexi16(s->carrier_phase); + zz.re = ((int32_t) sample.re*(int32_t) z.re - (int32_t) sample.im*(int32_t) z.im) >> 15; + zz.im = ((int32_t) -sample.re*(int32_t) z.im - (int32_t) sample.im*(int32_t) z.re) >> 15; +#else + v = vec_circular_dot_prodf(s->rrc_filter, rx_pulseshaper_im[step], V29_RX_FILTER_STEPS, s->rrc_filter_step); + sample.im = v*s->agc_scaling; + z = dds_lookup_complexf(s->carrier_phase); + zz.re = sample.re*z.re - sample.im*z.im; + zz.im = -sample.re*z.im - sample.im*z.re; +#endif + process_half_baud(s, &zz); + } +#if defined(SPANDSP_USE_FIXED_POINT) + dds_advance(&s->carrier_phase, s->carrier_phase_rate); +#else + dds_advancef(&s->carrier_phase, s->carrier_phase_rate); +#endif + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v29_rx_fillin(v29_rx_state_t *s, int len) +{ + int i; + + /* We want to sustain the current state (i.e carrier on<->carrier off), and + try to sustain the carrier phase. We should probably push the filters, as well */ + span_log(&s->logging, SPAN_LOG_FLOW, "Fill-in %d samples\n", len); + if (s->signal_present <= 0) + return 0; + if (s->training_stage == TRAINING_STAGE_PARKED) + return 0; + for (i = 0; i < len; i++) + { +#if defined(SPANDSP_USE_FIXED_POINT) + dds_advance(&s->carrier_phase, s->carrier_phase_rate); +#else + dds_advancef(&s->carrier_phase, s->carrier_phase_rate); +#endif + /* Advance the symbol phase the appropriate amount */ + s->eq_put_step -= RX_PULSESHAPER_COEFF_SETS; + if (s->eq_put_step <= 0) + s->eq_put_step += RX_PULSESHAPER_COEFF_SETS*10/(3*2); + /* TODO: Should we rotate any buffers */ + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v29_rx_set_put_bit(v29_rx_state_t *s, put_bit_func_t put_bit, void *user_data) +{ + s->put_bit = put_bit; + s->put_bit_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v29_rx_set_modem_status_handler(v29_rx_state_t *s, modem_tx_status_func_t handler, void *user_data) +{ + s->status_handler = handler; + s->status_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(logging_state_t *) v29_rx_get_logging_state(v29_rx_state_t *s) +{ + return &s->logging; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v29_rx_restart(v29_rx_state_t *s, int bit_rate, int old_train) +{ + int i; + + switch (bit_rate) + { + case 9600: + s->training_cd = 0; + break; + case 7200: + s->training_cd = 2; + break; + case 4800: + s->training_cd = 4; + break; + default: + return -1; + } + s->bit_rate = bit_rate; + +#if defined(SPANDSP_USE_FIXED_POINT) + vec_zeroi16(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); +#else + vec_zerof(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); +#endif + s->rrc_filter_step = 0; + + s->scramble_reg = 0; + s->training_scramble_reg = 0x2A; + s->training_stage = TRAINING_STAGE_SYMBOL_ACQUISITION; + s->training_count = 0; + s->signal_present = 0; +#if defined(IAXMODEM_STUFF) + s->high_sample = 0; + s->low_samples = 0; + s->carrier_drop_pending = FALSE; +#endif + s->old_train = old_train; + + s->carrier_phase = 0; + + power_meter_init(&(s->power), 4); + + s->constellation_state = 0; + + if (s->old_train) + { + s->carrier_phase_rate = s->carrier_phase_rate_save; + s->agc_scaling = s->agc_scaling_save; + equalizer_restore(s); + } + else + { + s->carrier_phase_rate = dds_phase_ratef(CARRIER_NOMINAL_FREQ); +#if defined(SPANDSP_USE_FIXED_POINT) + s->agc_scaling_save = 0; + s->agc_scaling = (float) FP_FACTOR*32768.0f*0.0017f/RX_PULSESHAPER_GAIN; +#else + s->agc_scaling_save = 0.0f; + s->agc_scaling = 0.0017f/RX_PULSESHAPER_GAIN; +#endif + equalizer_reset(s); + } +#if defined(SPANDSP_USE_FIXED_POINT) + s->carrier_track_i = 8000; + s->carrier_track_p = 8000000; +#else + s->carrier_track_i = 8000.0f; + s->carrier_track_p = 8000000.0f; +#endif + s->last_sample = 0; + s->eq_skip = 0; + + /* Initialise the working data for symbol timing synchronisation */ +#if defined(SPANDSP_USE_FIXED_POINT) + for (i = 0; i < 2; i++) + { + s->symbol_sync_low[i] = 0; + s->symbol_sync_high[i] = 0; + s->symbol_sync_dc_filter[i] = 0; + } + s->baud_phase = 0; +#else + for (i = 0; i < 2; i++) + { + s->symbol_sync_low[i] = 0.0f; + s->symbol_sync_high[i] = 0.0f; + s->symbol_sync_dc_filter[i] = 0.0f; + } + s->baud_phase = 0.0f; +#endif + s->baud_half = 0; + + s->total_baud_timing_correction = 0; + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(v29_rx_state_t *) v29_rx_init(v29_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data) +{ + switch (bit_rate) + { + case 9600: + case 7200: + case 4800: + break; + default: + return NULL; + } + if (s == NULL) + { + if ((s = (v29_rx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "V.29 RX"); + s->put_bit = put_bit; + s->put_bit_user_data = user_data; + /* The V.29 spec says the thresholds should be -31dBm and -26dBm, but that makes little + sense. V.17 uses -48dBm and -43dBm, and there seems no good reason to cut off at a + higher level (though at 9600bps and 7200bps, TCM should put V.17 sensitivity several + dB ahead of V.29). */ + /* The thresholds should be on at -26dBm0 and off at -31dBm0 */ + v29_rx_signal_cutoff(s, -28.5f); + + v29_rx_restart(s, bit_rate, FALSE); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v29_rx_release(v29_rx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v29_rx_free(v29_rx_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v29_rx_set_qam_report_handler(v29_rx_state_t *s, qam_report_handler_t handler, void *user_data) +{ + s->qam_report = handler; + s->qam_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/v29tx.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/v29tx.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,409 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v29tx.c - ITU V.29 modem transmit part + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v29tx.c,v 1.89 2009/06/02 16:03:56 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/logging.h" +#include "spandsp/complex.h" +#include "spandsp/vector_float.h" +#include "spandsp/complex_vector_float.h" +#include "spandsp/async.h" +#include "spandsp/dds.h" +#include "spandsp/power_meter.h" + +#include "spandsp/v29tx.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/v29tx.h" + +#include "v29tx_constellation_maps.h" +#if defined(SPANDSP_USE_FIXED_POINT) +#include "v29tx_fixed_rrc.h" +#else +#include "v29tx_floating_rrc.h" +#endif + +/*! The nominal frequency of the carrier, in Hertz */ +#define CARRIER_NOMINAL_FREQ 1700.0f + +/* Segments of the training sequence */ +/*! The start of the optional TEP, that may preceed the actual training, in symbols */ +#define V29_TRAINING_SEG_TEP 0 +/*! The start of training segment 1, in symbols */ +#define V29_TRAINING_SEG_1 (V29_TRAINING_SEG_TEP + 480) +/*! The start of training segment 2, in symbols */ +#define V29_TRAINING_SEG_2 (V29_TRAINING_SEG_1 + 48) +/*! The start of training segment 3, in symbols */ +#define V29_TRAINING_SEG_3 (V29_TRAINING_SEG_2 + 128) +/*! The start of training segment 4, in symbols */ +#define V29_TRAINING_SEG_4 (V29_TRAINING_SEG_3 + 384) +/*! The end of the training, in symbols */ +#define V29_TRAINING_END (V29_TRAINING_SEG_4 + 48) +/*! The end of the shutdown sequence, in symbols */ +#define V29_TRAINING_SHUTDOWN_END (V29_TRAINING_END + 32) + +static int fake_get_bit(void *user_data) +{ + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int get_scrambled_bit(v29_tx_state_t *s) +{ + int bit; + int out_bit; + + if ((bit = s->current_get_bit(s->get_bit_user_data)) == SIG_STATUS_END_OF_DATA) + { + /* End of real data. Switch to the fake get_bit routine, until we + have shut down completely. */ + if (s->status_handler) + s->status_handler(s->status_user_data, SIG_STATUS_END_OF_DATA); + s->current_get_bit = fake_get_bit; + s->in_training = TRUE; + bit = 1; + } + out_bit = (bit ^ (s->scramble_reg >> 17) ^ (s->scramble_reg >> 22)) & 1; + s->scramble_reg = (s->scramble_reg << 1) | out_bit; + return out_bit; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(SPANDSP_USE_FIXED_POINT) +static __inline__ complexi16_t getbaud(v29_tx_state_t *s) +#else +static __inline__ complexf_t getbaud(v29_tx_state_t *s) +#endif +{ + static const int phase_steps_9600[8] = + { + 1, 0, 2, 3, 6, 7, 5, 4 + }; + static const int phase_steps_4800[4] = + { + 0, 2, 6, 4 + }; +#if defined(SPANDSP_USE_FIXED_POINT) + static const complexi16_t zero = {0, 0}; +#else + static const complexf_t zero = {0.0f, 0.0f}; +#endif + int bits; + int amp; + int bit; + + if (s->in_training) + { + /* Send the training sequence */ + if (++s->training_step <= V29_TRAINING_SEG_4) + { + if (s->training_step <= V29_TRAINING_SEG_3) + { + if (s->training_step <= V29_TRAINING_SEG_1) + { + /* Optional segment: Unmodulated carrier (talker echo protection) */ + return v29_9600_constellation[0]; + } + if (s->training_step <= V29_TRAINING_SEG_2) + { + /* Segment 1: silence */ + return zero; + } + /* Segment 2: ABAB... */ + return v29_abab_constellation[(s->training_step & 1) + s->training_offset]; + } + /* Segment 3: CDCD... */ + /* Apply the 1 + x^-6 + x^-7 training scrambler */ + bit = s->training_scramble_reg & 1; + s->training_scramble_reg >>= 1; + s->training_scramble_reg |= (((bit ^ s->training_scramble_reg) & 1) << 6); + return v29_cdcd_constellation[bit + s->training_offset]; + } + /* We should be in the block of test ones, or shutdown ones, if we get here. */ + /* There is no graceful shutdown procedure defined for V.29. Just + send some ones, to ensure we get the real data bits through, even + with bad ISI. */ + if (s->training_step == V29_TRAINING_END + 1) + { + /* Switch from the fake get_bit routine, to the user supplied real + one, and we are up and running. */ + s->current_get_bit = s->get_bit; + s->in_training = FALSE; + } + if (s->training_step == V29_TRAINING_SHUTDOWN_END) + { + if (s->status_handler) + s->status_handler(s->status_user_data, SIG_STATUS_SHUTDOWN_COMPLETE); + } + } + /* 9600bps uses the full constellation. + 7200bps uses only the first half of the full constellation. + 4800bps uses the smaller constellation. */ + amp = 0; + /* We only use an amplitude bit at 9600bps */ + if (s->bit_rate == 9600 && get_scrambled_bit(s)) + amp = 8; + /*endif*/ + bits = get_scrambled_bit(s); + bits = (bits << 1) | get_scrambled_bit(s); + if (s->bit_rate == 4800) + { + bits = phase_steps_4800[bits]; + } + else + { + bits = (bits << 1) | get_scrambled_bit(s); + bits = phase_steps_9600[bits]; + } + s->constellation_state = (s->constellation_state + bits) & 7; + return v29_9600_constellation[amp | s->constellation_state]; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) v29_tx(v29_tx_state_t *s, int16_t amp[], int len) +{ +#if defined(SPANDSP_USE_FIXED_POINT) + complexi_t x; + complexi_t z; +#else + complexf_t x; + complexf_t z; +#endif + int i; + int sample; + + if (s->training_step >= V29_TRAINING_SHUTDOWN_END) + { + /* Once we have sent the shutdown symbols, we stop sending completely. */ + return 0; + } + for (sample = 0; sample < len; sample++) + { + if ((s->baud_phase += 3) >= 10) + { + s->baud_phase -= 10; + s->rrc_filter[s->rrc_filter_step] = + s->rrc_filter[s->rrc_filter_step + V29_TX_FILTER_STEPS] = getbaud(s); + if (++s->rrc_filter_step >= V29_TX_FILTER_STEPS) + s->rrc_filter_step = 0; + } + /* Root raised cosine pulse shaping at baseband */ +#if defined(SPANDSP_USE_FIXED_POINT) + x = complex_seti(0, 0); + for (i = 0; i < V29_TX_FILTER_STEPS; i++) + { + x.re += (int32_t) tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase][i]*(int32_t) s->rrc_filter[i + s->rrc_filter_step].re; + x.im += (int32_t) tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase][i]*(int32_t) s->rrc_filter[i + s->rrc_filter_step].im; + } + /* Now create and modulate the carrier */ + x.re >>= 4; + x.im >>= 4; + z = dds_complexi(&(s->carrier_phase), s->carrier_phase_rate); + /* Don't bother saturating. We should never clip. */ + i = (x.re*z.re - x.im*z.im) >> 15; + amp[sample] = (int16_t) ((i*s->gain) >> 15); +#else + x = complex_setf(0.0f, 0.0f); + for (i = 0; i < V29_TX_FILTER_STEPS; i++) + { + x.re += tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase][i]*s->rrc_filter[i + s->rrc_filter_step].re; + x.im += tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase][i]*s->rrc_filter[i + s->rrc_filter_step].im; + } + /* Now create and modulate the carrier */ + z = dds_complexf(&(s->carrier_phase), s->carrier_phase_rate); + /* Don't bother saturating. We should never clip. */ + amp[sample] = (int16_t) lfastrintf((x.re*z.re - x.im*z.im)*s->gain); +#endif + } + return sample; +} +/*- End of function --------------------------------------------------------*/ + +static void set_working_gain(v29_tx_state_t *s) +{ +#if defined(SPANDSP_USE_FIXED_POINT) + switch (s->bit_rate) + { + case 9600: + s->gain = 0.387f*s->base_gain*16.0f*32767.0f/30672.52f; + break; + case 7200: + s->gain = 0.605f*s->base_gain*16.0f*32767.0f/30672.52f; + break; + case 4800: + s->gain = 0.470f*s->base_gain*16.0f*32767.0f/30672.52f; + break; + default: + break; + } +#else + switch (s->bit_rate) + { + case 9600: + s->gain = 0.387f*s->base_gain; + break; + case 7200: + s->gain = 0.605f*s->base_gain; + break; + case 4800: + s->gain = 0.470f*s->base_gain; + break; + default: + break; + } +#endif +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v29_tx_power(v29_tx_state_t *s, float power) +{ + /* The constellation does not maintain constant average power as we change bit rates. + We need to scale the gain we get here by a bit rate specific scaling factor each + time we restart the modem. */ + s->base_gain = powf(10.0f, (power - DBM0_MAX_POWER)/20.0f)*32768.0f/TX_PULSESHAPER_GAIN; + set_working_gain(s); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v29_tx_set_get_bit(v29_tx_state_t *s, get_bit_func_t get_bit, void *user_data) +{ + if (s->get_bit == s->current_get_bit) + s->current_get_bit = get_bit; + s->get_bit = get_bit; + s->get_bit_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v29_tx_set_modem_status_handler(v29_tx_state_t *s, modem_tx_status_func_t handler, void *user_data) +{ + s->status_handler = handler; + s->status_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(logging_state_t *) v29_tx_get_logging_state(v29_tx_state_t *s) +{ + return &s->logging; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v29_tx_restart(v29_tx_state_t *s, int bit_rate, int tep) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "Restarting V.29\n"); + s->bit_rate = bit_rate; + set_working_gain(s); + switch (s->bit_rate) + { + case 9600: + s->training_offset = 0; + break; + case 7200: + s->training_offset = 2; + break; + case 4800: + s->training_offset = 4; + break; + default: + return -1; + } +#if defined(SPANDSP_USE_FIXED_POINT) + memset(s->rrc_filter, 0, sizeof(s->rrc_filter)); +#else + cvec_zerof(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); +#endif + s->rrc_filter_step = 0; + s->scramble_reg = 0; + s->training_scramble_reg = 0x2A; + s->in_training = TRUE; + s->training_step = (tep) ? V29_TRAINING_SEG_TEP : V29_TRAINING_SEG_1; + s->carrier_phase = 0; + s->baud_phase = 0; + s->constellation_state = 0; + s->current_get_bit = fake_get_bit; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(v29_tx_state_t *) v29_tx_init(v29_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data) +{ + switch (bit_rate) + { + case 9600: + case 7200: + case 4800: + break; + default: + return NULL; + } + if (s == NULL) + { + if ((s = (v29_tx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "V.29 TX"); + s->get_bit = get_bit; + s->get_bit_user_data = user_data; + s->carrier_phase_rate = dds_phase_ratef(CARRIER_NOMINAL_FREQ); + v29_tx_power(s, -14.0f); + v29_tx_restart(s, bit_rate, tep); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v29_tx_release(v29_tx_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v29_tx_free(v29_tx_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/v29tx_constellation_maps.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/v29tx_constellation_maps.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,81 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v29tx_constellation_maps.h - ITU V.29 modem transmit part. + * Constellation mapping. + * + * Written by Steve Underwood + * + * Copyright (C) 2008 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v29tx_constellation_maps.h,v 1.2 2008/09/04 14:40:05 steveu Exp $ + */ + +#if defined(SPANDSP_USE_FIXED_POINT) +static const complexi16_t v29_abab_constellation[6] = +#else +static const complexf_t v29_abab_constellation[6] = +#endif +{ + { 3, -3}, /* 315deg high 9600 */ + {-3, 0}, /* 180deg low */ + { 1, -1}, /* 315deg low 7200 */ + {-3, 0}, /* 180deg low */ + { 0, -3}, /* 270deg low 4800 */ + {-3, 0} /* 180deg low */ +}; + +#if defined(SPANDSP_USE_FIXED_POINT) +static const complexi16_t v29_cdcd_constellation[6] = +#else +static const complexf_t v29_cdcd_constellation[6] = +#endif +{ + { 3, 0}, /* 0deg low 9600 */ + {-3, 3}, /* 135deg high */ + { 3, 0}, /* 0deg low 7200 */ + {-1, 1}, /* 135deg low */ + { 3, 0}, /* 0deg low 4800 */ + { 0, 3} /* 90deg low */ +}; + +#if defined(SPANDSP_USE_FIXED_POINT) +static const complexi16_t v29_9600_constellation[16] = +#else +static const complexf_t v29_9600_constellation[16] = +#endif +{ + { 3, 0}, /* 0deg low */ + { 1, 1}, /* 45deg low */ + { 0, 3}, /* 90deg low */ + {-1, 1}, /* 135deg low */ + {-3, 0}, /* 180deg low */ + {-1, -1}, /* 225deg low */ + { 0, -3}, /* 270deg low */ + { 1, -1}, /* 315deg low */ + { 5, 0}, /* 0deg high */ + { 3, 3}, /* 45deg high */ + { 0, 5}, /* 90deg high */ + {-3, 3}, /* 135deg high */ + {-5, 0}, /* 180deg high */ + {-3, -3}, /* 225deg high */ + { 0, -5}, /* 270deg high */ + { 3, -3} /* 315deg high */ +}; + +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/v42.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/v42.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1432 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v42.c + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v42.c,v 1.51 2009/11/04 15:52:06 steveu Exp $ + */ + +/* THIS IS A WORK IN PROGRESS. IT IS NOT FINISHED. */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/async.h" +#include "spandsp/hdlc.h" +#include "spandsp/schedule.h" +#include "spandsp/queue.h" +#include "spandsp/v42.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/schedule.h" +#include "spandsp/private/hdlc.h" +#include "spandsp/private/v42.h" + +#if !defined(FALSE) +#define FALSE 0 +#endif +#if !defined(TRUE) +#define TRUE (!FALSE) +#endif + +#define LAPM_FRAMETYPE_MASK 0x03 + +#define LAPM_FRAMETYPE_I 0x00 +#define LAPM_FRAMETYPE_I_ALT 0x02 +#define LAPM_FRAMETYPE_S 0x01 +#define LAPM_FRAMETYPE_U 0x03 + +/* Timer values */ + +#define T_WAIT_MIN 2000 +#define T_WAIT_MAX 10000 +/* Detection phase timer */ +#define T_400 750000 +/* Acknowledgement timer - 1 second between SABME's */ +#define T_401 1000000 +/* Replay delay timer (optional) */ +#define T_402 1000000 +/* Inactivity timer (optional). No default - use 10 seconds with no packets */ +#define T_403 10000000 +/* Max retries */ +#define N_400 3 +/* Max octets in an information field */ +#define N_401 128 + +#define LAPM_DLCI_DTE_TO_DTE 0 +#define LAPM_DLCI_LAYER2_MANAGEMENT 63 + +static void t401_expired(span_sched_state_t *s, void *user_data); +static void t403_expired(span_sched_state_t *s, void *user_data); + +SPAN_DECLARE(void) lapm_reset(lapm_state_t *s); +SPAN_DECLARE(void) lapm_restart(lapm_state_t *s); + +static void lapm_link_down(lapm_state_t *s); + +static __inline__ void lapm_init_header(uint8_t *frame, int command) +{ + /* Data link connection identifier (0) */ + /* Command/response (0 if answerer, 1 if originator) */ + /* Extended address (1) */ + frame[0] = (LAPM_DLCI_DTE_TO_DTE << 2) | ((command) ? 0x02 : 0x00) | 0x01; +} +/*- End of function --------------------------------------------------------*/ + +static int lapm_tx_frame(lapm_state_t *s, uint8_t *frame, int len) +{ + if ((s->debug & LAPM_DEBUG_LAPM_DUMP)) + lapm_dump(s, frame, len, s->debug & LAPM_DEBUG_LAPM_RAW, TRUE); + /*endif*/ + hdlc_tx_frame(&s->hdlc_tx, frame, len); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void t400_expired(span_sched_state_t *ss, void *user_data) +{ + v42_state_t *s; + + /* Give up trying to detect a V.42 capable peer. */ + s = (v42_state_t *) user_data; + s->t400_timer = -1; + s->lapm.state = LAPM_UNSUPPORTED; + if (s->lapm.status_callback) + s->lapm.status_callback(s->lapm.status_callback_user_data, s->lapm.state); + /*endif*/ +} +/*- End of function --------------------------------------------------------*/ + +static void lapm_send_ua(lapm_state_t *s, int pfbit) +{ + uint8_t frame[3]; + + lapm_init_header(frame, !s->we_are_originator); + frame[1] = (uint8_t) (0x63 | (pfbit << 4)); + frame[2] = 0; + span_log(&s->logging, SPAN_LOG_FLOW, "Sending unnumbered acknowledgement\n"); + lapm_tx_frame(s, frame, 3); +} +/*- End of function --------------------------------------------------------*/ + +static void lapm_send_sabme(span_sched_state_t *ss, void *user_data) +{ + lapm_state_t *s; + uint8_t frame[3]; + + s = (lapm_state_t *) user_data; + if (s->t401_timer >= 0) + { +fprintf(stderr, "Deleting T401 q [%p] %d\n", (void *) s, s->t401_timer); + span_schedule_del(&s->sched, s->t401_timer); + s->t401_timer = -1; + } + /*endif*/ + if (++s->retransmissions > N_400) + { + /* 8.3.2.2 Too many retries */ + s->state = LAPM_RELEASE; + if (s->status_callback) + s->status_callback(s->status_callback_user_data, s->state); + /*endif*/ + return; + } + /*endif*/ +fprintf(stderr, "Setting T401 a1 [%p]\n", (void *) s); + s->t401_timer = span_schedule_event(&s->sched, T_401, lapm_send_sabme, s); + lapm_init_header(frame, s->we_are_originator); + frame[1] = 0x7F; + frame[2] = 0; + span_log(&s->logging, SPAN_LOG_FLOW, "Sending SABME (set asynchronous balanced mode extended)\n"); + lapm_tx_frame(s, frame, 3); +} +/*- End of function --------------------------------------------------------*/ + +static int lapm_ack_packet(lapm_state_t *s, int num) +{ + lapm_frame_queue_t *f; + lapm_frame_queue_t *prev; + + for (prev = NULL, f = s->txqueue; f; prev = f, f = f->next) + { + if ((f->frame[1] >> 1) == num) + { + /* Cancel each packet, as necessary */ + if (prev) + prev->next = f->next; + else + s->txqueue = f->next; + /*endif*/ + span_log(&s->logging, + SPAN_LOG_FLOW, + "-- ACKing packet %d. New txqueue is %d (-1 means empty)\n", + (f->frame[1] >> 1), + (s->txqueue) ? (s->txqueue->frame[1] >> 1) : -1); + s->last_frame_peer_acknowledged = num; + free(f); + /* Reset retransmission count if we actually acked something */ + s->retransmissions = 0; + return 1; + } + /*endif*/ + } + /*endfor*/ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void lapm_ack_rx(lapm_state_t *s, int ack) +{ + int i; + int cnt; + + /* This might not be acking anything new */ + if (s->last_frame_peer_acknowledged == ack) + return; + /*endif*/ + /* It should be acking something that is actually outstanding */ + if ((s->last_frame_peer_acknowledged < s->next_tx_frame && (ack < s->last_frame_peer_acknowledged || ack > s->next_tx_frame)) + || + (s->last_frame_peer_acknowledged > s->next_tx_frame && (ack > s->last_frame_peer_acknowledged || ack < s->next_tx_frame))) + { + /* ACK was outside our window --- ignore */ + span_log(&s->logging, SPAN_LOG_FLOW, "ACK received outside window, ignoring\n"); + return; + } + /*endif*/ + + /* Cancel each packet, as necessary */ + span_log(&s->logging, + SPAN_LOG_FLOW, + "-- ACKing all packets from %d to (but not including) %d\n", + s->last_frame_peer_acknowledged, + ack); + for (cnt = 0, i = s->last_frame_peer_acknowledged; i != ack; i = (i + 1) & 0x7F) + cnt += lapm_ack_packet(s, i); + /*endfor*/ + s->last_frame_peer_acknowledged = ack; + if (s->txqueue == NULL) + { + span_log(&s->logging, SPAN_LOG_FLOW, "-- Since there was nothing left, stopping timer T_401\n"); + /* Something was ACK'd. Stop timer T_401. */ +fprintf(stderr, "T401 a2 is %d [%p]\n", s->t401_timer, (void *) s); + if (s->t401_timer >= 0) + { +fprintf(stderr, "Deleting T401 a3 [%p] %d\n", (void *) s, s->t401_timer); + span_schedule_del(&s->sched, s->t401_timer); + s->t401_timer = -1; + } + /*endif*/ + } + /*endif*/ + if (s->t403_timer >= 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "-- Stopping timer T_403, since we got an ACK\n"); + if (s->t403_timer >= 0) + { +fprintf(stderr, "Deleting T403 b %d\n", s->t403_timer); + span_schedule_del(&s->sched, s->t403_timer); + s->t403_timer = -1; + } + /*endif*/ + } + /*endif*/ + if (s->txqueue) + { + /* Something left to transmit. Start timer T_401 again if it is stopped */ + span_log(&s->logging, + SPAN_LOG_FLOW, + "-- Something left to transmit (%d). Restarting timer T_401\n", + s->txqueue->frame[1] >> 1); + if (s->t401_timer < 0) + { +fprintf(stderr, "Setting T401 b [%p]\n", (void *) s); + s->t401_timer = span_schedule_event(&s->sched, T_401, t401_expired, s); + } + /*endif*/ + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "-- Nothing left, starting timer T_403\n"); + /* Nothing to transmit. Start timer T_403. */ +fprintf(stderr, "Setting T403 c\n"); + s->t403_timer = span_schedule_event(&s->sched, T_403, t403_expired, s); + } + /*endif*/ +} +/*- End of function --------------------------------------------------------*/ + +static void lapm_reject(lapm_state_t *s) +{ + uint8_t frame[4]; + + lapm_init_header(frame, !s->we_are_originator); + frame[1] = (uint8_t) (0x00 | 0x08 | LAPM_FRAMETYPE_S); + /* Where to start retransmission */ + frame[2] = (uint8_t) ((s->next_expected_frame << 1) | 0x01); + span_log(&s->logging, SPAN_LOG_FLOW, "Sending REJ (reject (%d)\n", s->next_expected_frame); + lapm_tx_frame(s, frame, 4); +} +/*- End of function --------------------------------------------------------*/ + +static void lapm_rr(lapm_state_t *s, int pfbit) +{ + uint8_t frame[4]; + + lapm_init_header(frame, !s->we_are_originator); + frame[1] = (uint8_t) (0x00 | 0x00 | LAPM_FRAMETYPE_S); + frame[2] = (uint8_t) ((s->next_expected_frame << 1) | pfbit); + /* Note that we have already ACKed this */ + s->last_frame_we_acknowledged = s->next_expected_frame; + span_log(&s->logging, SPAN_LOG_FLOW, "Sending RR (receiver ready) (%d)\n", s->next_expected_frame); + lapm_tx_frame(s, frame, 4); +} +/*- End of function --------------------------------------------------------*/ + +static void t401_expired(span_sched_state_t *ss, void *user_data) +{ + lapm_state_t *s; + + s = (lapm_state_t *) user_data; +fprintf(stderr, "Expiring T401 a4 [%p]\n", (void *) s); + s->t401_timer = -1; + if (s->txqueue) + { + /* Retransmit first packet in the queue, setting the poll bit */ + span_log(&s->logging, SPAN_LOG_FLOW, "-- Timer T_401 expired, What to do...\n"); + /* Update N(R), and set the poll bit */ + s->txqueue->frame[2] = (uint8_t)((s->next_expected_frame << 1) | 0x01); + s->last_frame_we_acknowledged = s->next_expected_frame; + s->solicit_f_bit = TRUE; + if (++s->retransmissions <= N_400) + { + /* Reschedule timer T401 */ + span_log(&s->logging, SPAN_LOG_FLOW, "-- Retransmitting %d bytes\n", s->txqueue->len); + lapm_tx_frame(s, s->txqueue->frame, s->txqueue->len); + span_log(&s->logging, SPAN_LOG_FLOW, "-- Scheduling retransmission (%d)\n", s->retransmissions); +fprintf(stderr, "Setting T401 d [%p]\n", (void *) s); + s->t401_timer = span_schedule_event(&s->sched, T_401, t401_expired, s); + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "-- Timeout occured\n"); + s->state = LAPM_RELEASE; + if (s->status_callback) + s->status_callback(s->status_callback_user_data, s->state); + lapm_link_down(s); + lapm_restart(s); + } + /*endif*/ + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Timer T_401 expired. Nothing to send...\n"); + } + /*endif*/ +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) lapm_status_to_str(int status) +{ + switch (status) + { + case LAPM_DETECT: + return "LAPM_DETECT"; + case LAPM_ESTABLISH: + return "LAPM_ESTABLISH"; + case LAPM_DATA: + return "LAPM_DATA"; + case LAPM_RELEASE: + return "LAPM_RELEASE"; + case LAPM_SIGNAL: + return "LAPM_SIGNAL"; + case LAPM_SETPARM: + return "LAPM_SETPARM"; + case LAPM_TEST: + return "LAPM_TEST"; + case LAPM_UNSUPPORTED: + return "LAPM_UNSUPPORTED"; + } + /*endswitch*/ + return "???"; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) lapm_tx(lapm_state_t *s, const void *buf, int len) +{ + return queue_write(s->tx_queue, buf, len); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) lapm_release(lapm_state_t *s) +{ + s->state = LAPM_RELEASE; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) lapm_loopback(lapm_state_t *s, int enable) +{ + s->state = LAPM_TEST; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) lapm_break(lapm_state_t *s, int enable) +{ + s->state = LAPM_SIGNAL; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) lapm_tx_iframe(lapm_state_t *s, const void *buf, int len, int cr) +{ + lapm_frame_queue_t *f; + + if ((f = malloc(sizeof(*f) + len + 4)) == NULL) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Out of memory\n"); + return -1; + } + /*endif*/ + + lapm_init_header(f->frame, (s->peer_is_originator) ? cr : !cr); + f->next = NULL; + f->len = len + 4; + f->frame[1] = (uint8_t) (s->next_tx_frame << 1); + f->frame[2] = (uint8_t) (s->next_expected_frame << 1); + memcpy(f->frame + 3, buf, len); + s->next_tx_frame = (s->next_tx_frame + 1) & 0x7F; + s->last_frame_we_acknowledged = s->next_expected_frame; + /* Clear poll bit */ + f->frame[2] &= ~0x01; + if (s->tx_last) + s->tx_last->next = f; + else + s->txqueue = f; + /*endif*/ + s->tx_last = f; + /* Immediately transmit unless we're in a recovery state */ + if (s->retransmissions == 0) + lapm_tx_frame(s, f->frame, f->len); + /*endif*/ + if (s->t403_timer >= 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Stopping T_403 timer\n"); +fprintf(stderr, "Deleting T403 c %d\n", s->t403_timer); + span_schedule_del(&s->sched, s->t403_timer); + s->t403_timer = -1; + } + /*endif*/ + if (s->t401_timer < 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Starting timer T_401\n"); + s->t401_timer = span_schedule_event(&s->sched, T_401, t401_expired, s); +fprintf(stderr, "Setting T401 e %d [%p]\n", s->t401_timer, (void *) s); + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Timer T_401 already running (%d)\n", s->t401_timer); + } + /*endif*/ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void t403_expired(span_sched_state_t *ss, void *user_data) +{ + lapm_state_t *s; + + s = (lapm_state_t *) user_data; + span_log(&s->logging, SPAN_LOG_FLOW, "Timer T_403 expired. Sending RR and scheduling T_403 again\n"); + s->t403_timer = -1; + s->retransmissions = 0; + /* Solicit an F-bit in the other end's RR */ + s->solicit_f_bit = TRUE; + lapm_rr(s, 1); + /* Restart ourselves */ +fprintf(stderr, "Setting T403 f\n"); + s->t401_timer = span_schedule_event(&s->sched, T_401, t401_expired, s); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) lapm_dump(lapm_state_t *s, const uint8_t *frame, int len, int showraw, int txrx) +{ + const char *type; + char direction_tag[2]; + + direction_tag[0] = txrx ? '>' : '<'; + direction_tag[1] = '\0'; + if (showraw) + span_log_buf(&s->logging, SPAN_LOG_FLOW, direction_tag, frame, len); + /*endif*/ + + switch ((frame[1] & LAPM_FRAMETYPE_MASK)) + { + case LAPM_FRAMETYPE_I: + case LAPM_FRAMETYPE_I_ALT: + span_log(&s->logging, SPAN_LOG_FLOW, "%c Information frame:\n", direction_tag[0]); + break; + case LAPM_FRAMETYPE_S: + span_log(&s->logging, SPAN_LOG_FLOW, "%c Supervisory frame:\n", direction_tag[0]); + break; + case LAPM_FRAMETYPE_U: + span_log(&s->logging, SPAN_LOG_FLOW, "%c Unnumbered frame:\n", direction_tag[0]); + break; + } + /*endswitch*/ + + span_log(&s->logging, + SPAN_LOG_FLOW, + "%c DLCI: %2d C/R: %d EA: %d\n", + direction_tag[0], + (frame[0] >> 2), + (frame[0] & 0x02) ? 1 : 0, + (frame[0] & 0x01), + direction_tag[0]); + switch ((frame[1] & LAPM_FRAMETYPE_MASK)) + { + case LAPM_FRAMETYPE_I: + case LAPM_FRAMETYPE_I_ALT: + /* Information frame */ + span_log(&s->logging, + SPAN_LOG_FLOW, + "%c N(S): %03d\n", + direction_tag[0], + (frame[1] >> 1)); + span_log(&s->logging, + SPAN_LOG_FLOW, + "%c N(R): %03d P: %d\n", + direction_tag[0], + (frame[2] >> 1), + (frame[2] & 0x01)); + span_log(&s->logging, + SPAN_LOG_FLOW, + "%c %d bytes of data\n", + direction_tag[0], + len - 4); + break; + case LAPM_FRAMETYPE_S: + /* Supervisory frame */ + switch (frame[1] & 0x0C) + { + case 0x00: + type = "RR (receive ready)"; + break; + case 0x04: + type = "RNR (receive not ready)"; + break; + case 0x08: + type = "REJ (reject)"; + break; + case 0x0C: + type = "SREJ (selective reject)"; + break; + default: + type = "???"; + break; + } + /*endswitch*/ + span_log(&s->logging, + SPAN_LOG_FLOW, + "%c S: %03d [ %s ]\n", + direction_tag[0], + frame[1], + type); + span_log(&s->logging, + SPAN_LOG_FLOW, + "%c N(R): %03d P/F: %d\n", + direction_tag[0], + frame[2] >> 1, + frame[2] & 0x01); + span_log(&s->logging, + SPAN_LOG_FLOW, + "%c %d bytes of data\n", + direction_tag[0], + len - 4); + break; + case LAPM_FRAMETYPE_U: + /* Unnumbered frame */ + switch (frame[1] & 0xEC) + { + case 0x00: + type = "UI (unnumbered information)"; + break; + case 0x0C: + type = "DM (disconnect mode)"; + break; + case 0x40: + type = "DISC (disconnect)"; + break; + case 0x60: + type = "UA (unnumbered acknowledgement)"; + break; + case 0x6C: + type = "SABME (set asynchronous balanced mode extended)"; + break; + case 0x84: + type = "FRMR (frame reject)"; + break; + case 0xAC: + type = "XID (exchange identification)"; + break; + case 0xE0: + type = "TEST (test)"; + break; + default: + type = "???"; + break; + } + /*endswitch*/ + span_log(&s->logging, + SPAN_LOG_FLOW, + "%c M: %03d [ %s ] P/F: %d\n", + direction_tag[0], + frame[1], + type, + (frame[1] >> 4) & 1); + span_log(&s->logging, + SPAN_LOG_FLOW, + "%c %d bytes of data\n", + direction_tag[0], + len - 3); + break; + } + /*endswitch*/ +} +/*- End of function --------------------------------------------------------*/ + +static void lapm_link_up(lapm_state_t *s) +{ + uint8_t buf[1024]; + int len; + + lapm_reset(s); + /* Go into connection established state */ + s->state = LAPM_DATA; + if (s->status_callback) + s->status_callback(s->status_callback_user_data, s->state); + /*endif*/ + if (!queue_empty(s->tx_queue)) + { + if ((len = queue_read(s->tx_queue, buf, s->n401)) > 0) + lapm_tx_iframe(s, buf, len, TRUE); + /*endif*/ + } + /*endif*/ + if (s->t401_timer >= 0) + { +fprintf(stderr, "Deleting T401 x [%p] %d\n", (void *) s, s->t401_timer); + span_schedule_del(&s->sched, s->t401_timer); + s->t401_timer = -1; + } + /*endif*/ + /* Start the T403 timer */ +fprintf(stderr, "Setting T403 g\n"); + s->t403_timer = span_schedule_event(&s->sched, T_403, t403_expired, s); +} +/*- End of function --------------------------------------------------------*/ + +static void lapm_link_down(lapm_state_t *s) +{ + lapm_reset(s); + + if (s->status_callback) + s->status_callback(s->status_callback_user_data, s->state); + /*endif*/ +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) lapm_reset(lapm_state_t *s) +{ + lapm_frame_queue_t *f; + lapm_frame_queue_t *p; + + /* Having received a SABME, we need to reset our entire state */ + s->next_tx_frame = 0; + s->last_frame_peer_acknowledged = 0; + s->next_expected_frame = 0; + s->last_frame_we_acknowledged = 0; + s->window_size_k = 15; + s->n401 = 128; + if (s->t401_timer >= 0) + { +fprintf(stderr, "Deleting T401 d [%p] %d\n", (void *) s, s->t401_timer); + span_schedule_del(&s->sched, s->t401_timer); + s->t401_timer = -1; + } + /*endif*/ + if (s->t403_timer >= 0) + { +fprintf(stderr, "Deleting T403 e %d\n", s->t403_timer); + span_schedule_del(&s->sched, s->t403_timer); + s->t403_timer = -1; + } + /*endif*/ + s->busy = FALSE; + s->solicit_f_bit = FALSE; + s->state = LAPM_RELEASE; + s->retransmissions = 0; + /* Discard anything waiting to go out */ + for (f = s->txqueue; f; ) + { + p = f; + f = f->next; + free(p); + } + /*endfor*/ + s->txqueue = NULL; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(void) lapm_receive(void *user_data, const uint8_t *frame, int len, int ok) +{ + lapm_state_t *s; + lapm_frame_queue_t *f; + int sendnow; + int octet; + int s_field; + int m_field; + +fprintf(stderr, "LAPM receive %d %d\n", ok, len); + if (!ok || len == 0) + return; + /*endif*/ + s = (lapm_state_t *) user_data; + if (len < 0) + { + /* Special conditions */ + span_log(&s->logging, SPAN_LOG_DEBUG, "V.42 rx status is %s (%d)\n", signal_status_to_str(len), len); + return; + } + /*endif*/ + + if ((s->debug & LAPM_DEBUG_LAPM_DUMP)) + lapm_dump(s, frame, len, s->debug & LAPM_DEBUG_LAPM_RAW, FALSE); + /*endif*/ + octet = 0; + /* We do not expect extended addresses */ + if ((frame[octet] & 0x01) == 0) + return; + /*endif*/ + /* Check for DLCIs we do not recognise */ + if ((frame[octet] >> 2) != LAPM_DLCI_DTE_TO_DTE) + return; + /*endif*/ + octet++; + switch (frame[octet] & LAPM_FRAMETYPE_MASK) + { + case LAPM_FRAMETYPE_I: + case LAPM_FRAMETYPE_I_ALT: + if (s->state != LAPM_DATA) + { + span_log(&s->logging, SPAN_LOG_FLOW, "!! Got an I-frame while link state is %d\n", s->state); + break; + } + /*endif*/ + /* Information frame */ + if (len < 4) + { + span_log(&s->logging, SPAN_LOG_FLOW, "!! Received short I-frame (expected 4, got %d)\n", len); + break; + } + /*endif*/ + /* Make sure this is a valid packet */ + if ((frame[1] >> 1) == s->next_expected_frame) + { + /* Increment next expected I-frame */ + s->next_expected_frame = (s->next_expected_frame + 1) & 0x7F; + /* Handle their ACK */ + lapm_ack_rx(s, frame[2] >> 1); + if ((frame[2] & 0x01)) + { + /* If the Poll/Final bit is set, send the RR immediately */ + lapm_rr(s, 1); + } + /*endif*/ + s->iframe_receive(s->iframe_receive_user_data, frame + 3, len - 4); + /* Send an RR if one wasn't sent already */ + if (s->last_frame_we_acknowledged != s->next_expected_frame) + lapm_rr(s, 0); + /*endif*/ + } + else + { + if (((s->next_expected_frame - (frame[1] >> 1)) & 127) < s->window_size_k) + { + /* It's within our window -- send back an RR */ + lapm_rr(s, 0); + } + else + { + lapm_reject(s); + } + /*endif*/ + } + /*endif*/ + break; + case LAPM_FRAMETYPE_S: + if (s->state != LAPM_DATA) + { + span_log(&s->logging, SPAN_LOG_FLOW, "!! Got S-frame while link down\n"); + break; + } + /*endif*/ + if (len < 4) + { + span_log(&s->logging, SPAN_LOG_FLOW, "!! Received short S-frame (expected 4, got %d)\n", len); + break; + } + /*endif*/ + s_field = frame[octet] & 0xEC; + switch (s_field) + { + case 0x00: + /* RR (receive ready) */ + s->busy = FALSE; + /* Acknowledge frames as necessary */ + lapm_ack_rx(s, frame[2] >> 1); + if ((frame[2] & 0x01)) + { + /* If P/F is one, respond with an RR with the P/F bit set */ + if (s->solicit_f_bit) + { + span_log(&s->logging, SPAN_LOG_FLOW, "-- Got RR response to our frame\n"); + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "-- Unsolicited RR with P/F bit, responding\n"); + lapm_rr(s, 1); + } + /*endif*/ + s->solicit_f_bit = FALSE; + } + /*endif*/ + break; + case 0x04: + /* RNR (receive not ready) */ + span_log(&s->logging, SPAN_LOG_FLOW, "-- Got receiver not ready\n"); + s->busy = TRUE; + break; + case 0x08: + /* REJ (reject) */ + /* Just retransmit */ + span_log(&s->logging, SPAN_LOG_FLOW, "-- Got reject requesting packet %d... Retransmitting.\n", frame[2] >> 1); + if ((frame[2] & 0x01)) + { + /* If it has the poll bit set, send an appropriate supervisory response */ + lapm_rr(s, 1); + } + /*endif*/ + sendnow = FALSE; + /* Resend the appropriate I-frame */ + for (f = s->txqueue; f; f = f->next) + { + if (sendnow || (f->frame[1] >> 1) == (frame[2] >> 1)) + { + /* Matches the request, or follows in our window */ + sendnow = TRUE; + span_log(&s->logging, + SPAN_LOG_FLOW, + "!! Got reject for frame %d, retransmitting frame %d now, updating n_r!\n", + frame[2] >> 1, + f->frame[1] >> 1); + f->frame[2] = (uint8_t) (s->next_expected_frame << 1); + lapm_tx_frame(s, f->frame, f->len); + } + /*endif*/ + } + /*endfor*/ + if (!sendnow) + { + if (s->txqueue) + { + /* This should never happen */ + if ((frame[2] & 0x01) == 0 || (frame[2] >> 1)) + { + span_log(&s->logging, + SPAN_LOG_FLOW, + "!! Got reject for frame %d, but we only have others!\n", + frame[2] >> 1); + } + /*endif*/ + } + else + { + /* Hrm, we have nothing to send, but have been REJ'd. Reset last_frame_peer_acknowledged, next_tx_frame, etc */ + span_log(&s->logging, SPAN_LOG_FLOW, "!! Got reject for frame %d, but we have nothing -- resetting!\n", frame[2] >> 1); + s->last_frame_peer_acknowledged = + s->next_tx_frame = frame[2] >> 1; + /* Reset t401 timer if it was somehow going */ + if (s->t401_timer >= 0) + { +fprintf(stderr, "Deleting T401 f [%p] %d\n", (void *) s, s->t401_timer); + span_schedule_del(&s->sched, s->t401_timer); + s->t401_timer = -1; + } + /*endif*/ + /* Reset and restart t403 timer */ + if (s->t403_timer >= 0) + { +fprintf(stderr, "Deleting T403 g %d\n", s->t403_timer); + span_schedule_del(&s->sched, s->t403_timer); + s->t403_timer = -1; + } + /*endif*/ +fprintf(stderr, "Setting T403 h\n"); + s->t403_timer = span_schedule_event(&s->sched, T_403, t403_expired, s); + } + /*endif*/ + } + /*endif*/ + break; + case 0x0C: + /* SREJ (selective reject) */ + break; + default: + span_log(&s->logging, + SPAN_LOG_FLOW, + "!! XXX Unknown Supervisory frame sd=0x%02x,pf=%02xnr=%02x vs=%02x, va=%02x XXX\n", + s_field, + frame[2] & 0x01, + frame[2] >> 1, + s->next_tx_frame, + s->last_frame_peer_acknowledged); + break; + } + /*endswitch*/ + break; + case LAPM_FRAMETYPE_U: + if (len < 3) + { + span_log(&s->logging, SPAN_LOG_FLOW, "!! Received too short unnumbered frame\n"); + break; + } + /*endif*/ + m_field = frame[octet] & 0xEC; + switch (m_field) + { + case 0x00: + /* UI (unnumbered information) */ + switch (frame[++octet] & 0x7F) + { + case 0x40: + /* BRK */ + span_log(&s->logging, SPAN_LOG_FLOW, "BRK - option %d, length %d\n", (frame[octet] >> 5), frame[octet + 1]); + octet += 2; + break; + case 0x60: + /* BRKACK */ + span_log(&s->logging, SPAN_LOG_FLOW, "BRKACK\n"); + break; + default: + /* Unknown */ + span_log(&s->logging, SPAN_LOG_FLOW, "Unknown UI type\n"); + break; + } + /*endswitch*/ + break; + case 0x0C: + /* DM (disconnect mode) */ + if ((frame[octet] & 0x10)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "-- Got Unconnected Mode from peer.\n"); + /* Disconnected mode, try again */ + lapm_link_down(s); + lapm_restart(s); + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "-- DM (disconnect mode) requesting SABME, starting.\n"); + /* Requesting that we start */ + lapm_restart(s); + } + /*endif*/ + break; + case 0x40: + /* DISC (disconnect) */ + span_log(&s->logging, SPAN_LOG_FLOW, "-- Got DISC (disconnect) from peer.\n"); + /* Acknowledge */ + lapm_send_ua(s, (frame[octet] & 0x10)); + lapm_link_down(s); + break; + case 0x60: + /* UA (unnumbered acknowledgement) */ + if (s->state == LAPM_ESTABLISH) + { + span_log(&s->logging, SPAN_LOG_FLOW, "-- Got UA (unnumbered acknowledgement) from %s peer. Link up.\n", (frame[0] & 0x02) ? "xxx" : "yyy"); + lapm_link_up(s); + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "!! Got a UA (unnumbered acknowledgement) in state %d\n", s->state); + } + /*endif*/ + break; + case 0x6C: + /* SABME (set asynchronous balanced mode extended) */ + span_log(&s->logging, SPAN_LOG_FLOW, "-- Got SABME (set asynchronous balanced mode extended) from %s peer.\n", (frame[0] & 0x02) ? "yyy" : "xxx"); + if ((frame[0] & 0x02)) + { + s->peer_is_originator = TRUE; + if (s->we_are_originator) + { + /* We can't both be originators */ + span_log(&s->logging, SPAN_LOG_FLOW, "We think we are the originator, but they think so too."); + break; + } + /*endif*/ + } + else + { + s->peer_is_originator = FALSE; + if (!s->we_are_originator) + { + /* We can't both be answerers */ + span_log(&s->logging, SPAN_LOG_FLOW, "We think we are the answerer, but they think so too.\n"); + break; + } + /*endif*/ + } + /*endif*/ + /* Send unnumbered acknowledgement */ + lapm_send_ua(s, (frame[octet] & 0x10)); + lapm_link_up(s); + break; + case 0x84: + /* FRMR (frame reject) */ + span_log(&s->logging, SPAN_LOG_FLOW, "!! FRMR (frame reject).\n"); + break; + case 0xAC: + /* XID (exchange identification) */ + span_log(&s->logging, SPAN_LOG_FLOW, "!! XID (exchange identification) frames not supported\n"); + break; + case 0xE0: + /* TEST (test) */ + span_log(&s->logging, SPAN_LOG_FLOW, "!! TEST (test) frames not supported\n"); + break; + default: + span_log(&s->logging, SPAN_LOG_FLOW, "!! Don't know what to do with M=%X u-frames\n", m_field); + break; + } + /*endswitch*/ + break; + } + /*endswitch*/ +} +/*- End of function --------------------------------------------------------*/ + +static void lapm_hdlc_underflow(void *user_data) +{ + lapm_state_t *s; + uint8_t buf[1024]; + int len; + + s = (lapm_state_t *) user_data; + span_log(&s->logging, SPAN_LOG_FLOW, "HDLC underflow\n"); + if (s->state == LAPM_DATA) + { + if (!queue_empty(s->tx_queue)) + { + if ((len = queue_read(s->tx_queue, buf, s->n401)) > 0) + lapm_tx_iframe(s, buf, len, TRUE); + /*endif*/ + } + /*endif*/ + } + /*endif*/ +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) lapm_restart(lapm_state_t *s) +{ +#if 0 + if (s->state != LAPM_RELEASE) + { + span_log(&s->logging, SPAN_LOG_FLOW, "!! lapm_restart: Not in 'Link Connection Released' state\n"); + return; + } + /*endif*/ +#endif + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "LAP.M"); + hdlc_tx_init(&s->hdlc_tx, FALSE, 1, TRUE, lapm_hdlc_underflow, s); + hdlc_rx_init(&s->hdlc_rx, FALSE, FALSE, 1, lapm_receive, s); + /* TODO: This is a bodge! */ + s->t401_timer = -1; + s->t402_timer = -1; + s->t403_timer = -1; + lapm_reset(s); + /* TODO: Maybe we should implement T_WAIT? */ + lapm_send_sabme(NULL, s); +} +/*- End of function --------------------------------------------------------*/ + +#if 0 +static void lapm_init(lapm_state_t *s) +{ + lapm_restart(s); +} +/*- End of function --------------------------------------------------------*/ +#endif + +static void negotiation_rx_bit(v42_state_t *s, int new_bit) +{ + /* DC1 with even parity, 8-16 ones, DC1 with odd parity, 8-16 ones */ + //uint8_t odp = "0100010001 11111111 0100010011 11111111"; + /* V.42 OK E , 8-16 ones, C, 8-16 ones */ + //uint8_t adp_v42 = "0101000101 11111111 0110000101 11111111"; + /* V.42 disabled E, 8-16 ones, NULL, 8-16 ones */ + //uint8_t adp_nov42 = "0101000101 11111111 0000000001 11111111"; + + /* There may be no negotiation, so we need to process this data through the + HDLC receiver as well */ + if (new_bit < 0) + { + /* Special conditions */ + span_log(&s->logging, SPAN_LOG_DEBUG, "V.42 rx status is %s (%d)\n", signal_status_to_str(new_bit), new_bit); + return; + } + /*endif*/ + new_bit &= 1; + s->rxstream = (s->rxstream << 1) | new_bit; + switch (s->rx_negotiation_step) + { + case 0: + /* Look for some ones */ + if (new_bit) + break; + /*endif*/ + s->rx_negotiation_step = 1; + s->rxbits = 0; + s->rxstream = ~1; + s->rxoks = 0; + break; + case 1: + /* Look for the first character */ + if (++s->rxbits < 9) + break; + /*endif*/ + s->rxstream &= 0x3FF; + if (s->calling_party && s->rxstream == 0x145) + { + s->rx_negotiation_step++; + } + else if (!s->calling_party && s->rxstream == 0x111) + { + s->rx_negotiation_step++; + } + else + { + s->rx_negotiation_step = 0; + } + /*endif*/ + s->rxbits = 0; + s->rxstream = ~0; + break; + case 2: + /* Look for 8 to 16 ones */ + s->rxbits++; + if (new_bit) + break; + /*endif*/ + if (s->rxbits >= 8 && s->rxbits <= 16) + s->rx_negotiation_step++; + else + s->rx_negotiation_step = 0; + /*endif*/ + s->rxbits = 0; + s->rxstream = ~1; + break; + case 3: + /* Look for the second character */ + if (++s->rxbits < 9) + break; + /*endif*/ + s->rxstream &= 0x3FF; + if (s->calling_party && s->rxstream == 0x185) + { + s->rx_negotiation_step++; + } + else if (s->calling_party && s->rxstream == 0x001) + { + s->rx_negotiation_step++; + } + else if (!s->calling_party && s->rxstream == 0x113) + { + s->rx_negotiation_step++; + } + else + { + s->rx_negotiation_step = 0; + } + /*endif*/ + s->rxbits = 0; + s->rxstream = ~0; + break; + case 4: + /* Look for 8 to 16 ones */ + s->rxbits++; + if (new_bit) + break; + /*endif*/ + if (s->rxbits >= 8 && s->rxbits <= 16) + { + if (++s->rxoks >= 2) + { + /* HIT */ + s->rx_negotiation_step++; + if (s->calling_party) + { + if (s->t400_timer >= 0) + { +fprintf(stderr, "Deleting T400 h %d\n", s->t400_timer); + span_schedule_del(&s->lapm.sched, s->t400_timer); + s->t400_timer = -1; + } + /*endif*/ + s->lapm.state = LAPM_ESTABLISH; + if (s->lapm.status_callback) + s->lapm.status_callback(s->lapm.status_callback_user_data, s->lapm.state); + /*endif*/ + } + else + { + s->odp_seen = TRUE; + } + /*endif*/ + break; + } + /*endif*/ + s->rx_negotiation_step = 1; + s->rxbits = 0; + s->rxstream = ~1; + } + else + { + s->rx_negotiation_step = 0; + s->rxbits = 0; + s->rxstream = ~0; + } + /*endif*/ + break; + case 5: + /* Parked */ + break; + } + /*endswitch*/ +} +/*- End of function --------------------------------------------------------*/ + +static int v42_support_negotiation_tx_bit(v42_state_t *s) +{ + int bit; + + if (s->calling_party) + { + if (s->txbits <= 0) + { + s->txstream = 0x3FE22; + s->txbits = 36; + } + else if (s->txbits == 18) + { + s->txstream = 0x3FF22; + } + /*endif*/ + bit = s->txstream & 1; + s->txstream >>= 1; + s->txbits--; + } + else + { + if (s->odp_seen && s->txadps < 10) + { + if (s->txbits <= 0) + { + if (++s->txadps >= 10) + { + if (s->t400_timer >= 0) + { +fprintf(stderr, "Deleting T400 i %d\n", s->t400_timer); + span_schedule_del(&s->lapm.sched, s->t400_timer); + s->t400_timer = -1; + } + /*endif*/ + s->lapm.state = LAPM_ESTABLISH; + if (s->lapm.status_callback) + s->lapm.status_callback(s->lapm.status_callback_user_data, s->lapm.state); + /*endif*/ + s->txstream = 1; + } + else + { + s->txstream = 0x3FE8A; + s->txbits = 36; + } + /*endif*/ + } + else if (s->txbits == 18) + { + s->txstream = 0x3FE86; + } + /*endif*/ + bit = s->txstream & 1; + s->txstream >>= 1; + s->txbits--; + } + else + { + bit = 1; + } + /*endif*/ + } + /*endif*/ + return bit; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v42_rx_bit(void *user_data, int bit) +{ + v42_state_t *s; + + s = (v42_state_t *) user_data; + if (s->lapm.state == LAPM_DETECT) + negotiation_rx_bit(s, bit); + else + hdlc_rx_put_bit(&s->lapm.hdlc_rx, bit); + /*endif*/ +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v42_tx_bit(void *user_data) +{ + v42_state_t *s; + int bit; + + s = (v42_state_t *) user_data; + if (s->lapm.state == LAPM_DETECT) + bit = v42_support_negotiation_tx_bit(s); + else + bit = hdlc_tx_get_bit(&s->lapm.hdlc_tx); + /*endif*/ + return bit; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v42_set_status_callback(v42_state_t *s, v42_status_func_t callback, void *user_data) +{ + s->lapm.status_callback = callback; + s->lapm.status_callback_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v42_restart(v42_state_t *s) +{ + span_schedule_init(&s->lapm.sched); + + s->lapm.we_are_originator = s->calling_party; + lapm_restart(&s->lapm); + if (s->detect) + { + s->txstream = ~0; + s->txbits = 0; + s->rxstream = ~0; + s->rxbits = 0; + s->rxoks = 0; + s->txadps = 0; + s->rx_negotiation_step = 0; + s->odp_seen = FALSE; +fprintf(stderr, "Setting T400 i\n"); + s->t400_timer = span_schedule_event(&s->lapm.sched, T_400, t400_expired, s); + s->lapm.state = LAPM_DETECT; + } + else + { + s->lapm.state = LAPM_ESTABLISH; + } + /*endif*/ +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(v42_state_t *) v42_init(v42_state_t *s, int calling_party, int detect, v42_frame_handler_t frame_handler, void *user_data) +{ + int alloced; + + if (frame_handler == NULL) + return NULL; + /*endif*/ + alloced = FALSE; + if (s == NULL) + { + if ((s = (v42_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + alloced = TRUE; + } + memset(s, 0, sizeof(*s)); + s->calling_party = calling_party; + s->detect = detect; + s->lapm.iframe_receive = frame_handler; + s->lapm.iframe_receive_user_data = user_data; + s->lapm.debug |= (LAPM_DEBUG_LAPM_RAW | LAPM_DEBUG_LAPM_DUMP | LAPM_DEBUG_LAPM_STATE); + s->lapm.t401_timer = + s->lapm.t402_timer = + s->lapm.t403_timer = -1; + + if ((s->lapm.tx_queue = queue_init(NULL, 16384, 0)) == NULL) + { + if (alloced) + free(s); + return NULL; + } + /*endif*/ + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "V.42"); + v42_restart(s); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v42_release(v42_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v42_free(v42_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/v42bis.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/v42bis.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,702 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v42bis.c + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v42bis.c,v 1.37 2009/02/10 13:06:47 steveu Exp $ + */ + +/* THIS IS A WORK IN PROGRESS. IT IS NOT FINISHED. + Currently it performs the core compression and decompression functions OK. + However, a number of the bells and whistles in V.42bis are incomplete. */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/bit_operations.h" +#include "spandsp/v42bis.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/v42bis.h" + +/* Fixed parameters from the spec. */ +#define V42BIS_N3 8 /* Character size (bits) */ +#define V42BIS_N4 256 /* Number of characters in the alphabet */ +#define V42BIS_N5 (V42BIS_N4 + V42BIS_N6) /* Index number of first dictionary entry used to store a string */ +#define V42BIS_N6 3 /* Number of control codewords */ + +/* Control code words in compressed mode */ +enum +{ + V42BIS_ETM = 0, /* Enter transparent mode */ + V42BIS_FLUSH = 1, /* Flush data */ + V42BIS_STEPUP = 2 /* Step up codeword size */ +}; + +/* Command codes in transparent mode */ +enum +{ + V42BIS_ECM = 0, /* Enter compression mode */ + V42BIS_EID = 1, /* Escape character in data */ + V42BIS_RESET = 2 /* Force reinitialisation */ +}; + +static __inline__ void push_compressed_raw_octet(v42bis_compress_state_t *ss, int octet) +{ + ss->output_buf[ss->output_octet_count++] = (uint8_t) octet; + if (ss->output_octet_count >= ss->max_len) + { + ss->handler(ss->user_data, ss->output_buf, ss->output_octet_count); + ss->output_octet_count = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void push_compressed_code(v42bis_compress_state_t *ss, int code) +{ + ss->output_bit_buffer |= code << (32 - ss->v42bis_parm_c2 - ss->output_bit_count); + ss->output_bit_count += ss->v42bis_parm_c2; + while (ss->output_bit_count >= 8) + { + push_compressed_raw_octet(ss, ss->output_bit_buffer >> 24); + ss->output_bit_buffer <<= 8; + ss->output_bit_count -= 8; + } +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void push_compressed_octet(v42bis_compress_state_t *ss, int code) +{ + ss->output_bit_buffer |= code << (32 - 8 - ss->output_bit_count); + ss->output_bit_count += 8; + while (ss->output_bit_count >= 8) + { + push_compressed_raw_octet(ss, ss->output_bit_buffer >> 24); + ss->output_bit_buffer <<= 8; + ss->output_bit_count -= 8; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v42bis_compress(v42bis_state_t *s, const uint8_t *buf, int len) +{ + int ptr; + int i; + uint32_t octet; + uint32_t code; + v42bis_compress_state_t *ss; + + ss = &s->compress; + if ((s->v42bis_parm_p0 & 2) == 0) + { + /* Compression is off - just push the incoming data out */ + for (i = 0; i < len - ss->max_len; i += ss->max_len) + ss->handler(ss->user_data, buf + i, ss->max_len); + if (i < len) + ss->handler(ss->user_data, buf + i, len - i); + return 0; + } + ptr = 0; + if (ss->first && len > 0) + { + octet = buf[ptr++]; + ss->string_code = octet + V42BIS_N6; + if (ss->transparent) + push_compressed_octet(ss, octet); + ss->first = FALSE; + } + while (ptr < len) + { + octet = buf[ptr++]; + if ((ss->dict[ss->string_code].children[octet >> 5] & (1 << (octet & 0x1F)))) + { + /* The leaf exists. Now find it in the table. */ + /* TODO: This is a brute force scan for a match. We need something better. */ + for (code = 0; code < ss->v42bis_parm_c3; code++) + { + if (ss->dict[code].parent_code == ss->string_code && ss->dict[code].node_octet == octet) + break; + } + } + else + { + /* The leaf does not exist. */ + code = s->v42bis_parm_n2; + } + /* 6.3(b) If the string matches a dictionary entry, and the entry is not that entry + created by the last invocation of the string matching procedure, then the + next character shall be read and appended to the string and this step + repeated. */ + if (code < ss->v42bis_parm_c3 && code != ss->latest_code) + { + /* The string was found */ + ss->string_code = code; + ss->string_length++; + } + else + { + /* The string is not in the table. */ + if (!ss->transparent) + { + /* 7.4 Encoding - we now have the longest matchable string, and will need to output the code for it. */ + while (ss->v42bis_parm_c1 >= ss->v42bis_parm_c3 && ss->v42bis_parm_c3 <= s->v42bis_parm_n2) + { + /* We need to increase the codeword size */ + /* 7.4(a) */ + push_compressed_code(ss, V42BIS_STEPUP); + /* 7.4(b) */ + ss->v42bis_parm_c2++; + /* 7.4(c) */ + ss->v42bis_parm_c3 <<= 1; + /* 7.4(d) this might need to be repeated, so we loop */ + } + /* 7.5 Transfer - output the last state of the string */ + push_compressed_code(ss, ss->string_code); + } + /* 7.6 Dictionary updating */ + /* 6.4 Add the string to the dictionary */ + /* 6.4(b) The string is not in the table. */ + if (code != ss->latest_code && ss->string_length < s->v42bis_parm_n7) + { + ss->latest_code = ss->v42bis_parm_c1; + /* 6.4(a) The length of the string is in range for adding to the dictionary */ + /* If the last code was a leaf, it no longer is */ + ss->dict[ss->string_code].leaves++; + ss->dict[ss->string_code].children[octet >> 5] |= (1 << (octet & 0x1F)); + /* The new one is definitely a leaf */ + ss->dict[ss->v42bis_parm_c1].parent_code = (uint16_t) ss->string_code; + ss->dict[ss->v42bis_parm_c1].leaves = 0; + ss->dict[ss->v42bis_parm_c1].node_octet = (uint8_t) octet; + /* 7.7 Node recovery */ + /* 6.5 Recovering a dictionary entry to use next */ + for (;;) + { + /* 6.5(a) and (b) */ + if ((int) (++ss->v42bis_parm_c1) >= s->v42bis_parm_n2) + ss->v42bis_parm_c1 = V42BIS_N5; + /* 6.5(c) We need to reuse a leaf node */ + if (ss->dict[ss->v42bis_parm_c1].leaves) + continue; + if (ss->dict[ss->v42bis_parm_c1].parent_code == 0xFFFF) + break; + /* 6.5(d) Detach the leaf node from its parent, and re-use it */ + /* Possibly make the parent a leaf node again */ + ss->dict[ss->dict[ss->v42bis_parm_c1].parent_code].leaves--; + ss->dict[ss->dict[ss->v42bis_parm_c1].parent_code].children[ss->dict[ss->v42bis_parm_c1].node_octet >> 5] &= ~(1 << (ss->dict[ss->v42bis_parm_c1].node_octet & 0x1F)); + ss->dict[ss->v42bis_parm_c1].parent_code = 0xFFFF; + break; + } + } + else + { + ss->latest_code = 0xFFFFFFFF; + } + /* 7.8 Data compressibility test */ + /* Filter on the balance of what went into the compressor, and what came out */ + ss->compressibility_filter += ((((8*ss->string_length - ss->v42bis_parm_c2) << 20) - ss->compressibility_filter) >> 10); + if (ss->compression_mode == V42BIS_COMPRESSION_MODE_DYNAMIC) + { + /* Work out if it is appropriate to change between transparent and + compressed mode. */ + if (ss->transparent) + { + if (ss->compressibility_filter > 0) + { + if (++ss->compressibility_persistence > 1000) + { + /* Schedule a switch to compressed mode */ + ss->change_transparency = -1; + ss->compressibility_persistence = 0; + } + } + else + { + ss->compressibility_persistence = 0; + } + } + else + { + if (ss->compressibility_filter < 0) + { + if (++ss->compressibility_persistence > 1000) + { + /* Schedule a switch to transparent mode */ + ss->change_transparency = 1; + ss->compressibility_persistence = 0; + } + } + else + { + ss->compressibility_persistence = 0; + } + } + } + if (ss->change_transparency) + { + if (ss->change_transparency < 0) + { + if (ss->transparent) + { + printf("Going compressed\n"); + /* 7.8.1 Transition to compressed mode */ + /* Switch out of transparent now, between codes. We need to send the octet which did not + match, just before switching. */ + if (octet == ss->escape_code) + { + push_compressed_octet(ss, ss->escape_code++); + push_compressed_octet(ss, V42BIS_EID); + } + else + { + push_compressed_octet(ss, octet); + } + push_compressed_octet(ss, ss->escape_code++); + push_compressed_octet(ss, V42BIS_ECM); + ss->transparent = FALSE; + } + } + else + { + if (!ss->transparent) + { + printf("Going transparent\n"); + /* 7.8.2 Transition to transparent mode */ + /* Switch into transparent now, between codes, and the unmatched octet should + go out in transparent mode, just below */ + push_compressed_code(ss, V42BIS_ETM); + ss->transparent = TRUE; + } + } + ss->change_transparency = 0; + } + /* 7.8.3 Reset function - TODO */ + ss->string_code = octet + V42BIS_N6; + ss->string_length = 1; + } + if (ss->transparent) + { + if (octet == ss->escape_code) + { + push_compressed_octet(ss, ss->escape_code++); + push_compressed_octet(ss, V42BIS_EID); + } + else + { + push_compressed_octet(ss, octet); + } + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v42bis_compress_flush(v42bis_state_t *s) +{ + v42bis_compress_state_t *ss; + + ss = &s->compress; + if (!ss->transparent) + { + /* Output the last state of the string */ + push_compressed_code(ss, ss->string_code); + /* TODO: We use a positive FLUSH at all times. It is really needed, if the + previous step resulted in no leftover bits. */ + push_compressed_code(ss, V42BIS_FLUSH); + } + while (ss->output_bit_count > 0) + { + push_compressed_raw_octet(ss, ss->output_bit_buffer >> 24); + ss->output_bit_buffer <<= 8; + ss->output_bit_count -= 8; + } + /* Now push out anything remaining. */ + if (ss->output_octet_count > 0) + { + ss->handler(ss->user_data, ss->output_buf, ss->output_octet_count); + ss->output_octet_count = 0; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +#if 0 +SPAN_DECLARE(int) v42bis_compress_dump(v42bis_state_t *s) +{ + int i; + + for (i = 0; i < V42BIS_MAX_CODEWORDS; i++) + { + if (s->compress.dict[i].parent_code != 0xFFFF) + { + printf("Entry %4x, prior %4x, leaves %d, octet %2x\n", i, s->compress.dict[i].parent_code, s->compress.dict[i].leaves, s->compress.dict[i].node_octet); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +#endif + +SPAN_DECLARE(int) v42bis_decompress(v42bis_state_t *s, const uint8_t *buf, int len) +{ + int ptr; + int i; + int this_length; + uint8_t *string; + uint32_t code; + uint32_t new_code; + int code_len; + v42bis_decompress_state_t *ss; + uint8_t decode_buf[V42BIS_MAX_STRING_SIZE]; + + ss = &s->decompress; + if ((s->v42bis_parm_p0 & 1) == 0) + { + /* Compression is off - just push the incoming data out */ + for (i = 0; i < len - ss->max_len; i += ss->max_len) + ss->handler(ss->user_data, buf + i, ss->max_len); + if (i < len) + ss->handler(ss->user_data, buf + i, len - i); + return 0; + } + ptr = 0; + code_len = (ss->transparent) ? 8 : ss->v42bis_parm_c2; + for (;;) + { + /* Fill up the bit buffer. */ + while (ss->input_bit_count < 32 - 8 && ptr < len) + { + ss->input_bit_count += 8; + ss->input_bit_buffer |= (uint32_t) buf[ptr++] << (32 - ss->input_bit_count); + } + if (ss->input_bit_count < code_len) + break; + new_code = ss->input_bit_buffer >> (32 - code_len); + ss->input_bit_count -= code_len; + ss->input_bit_buffer <<= code_len; + if (ss->transparent) + { + code = new_code; + if (ss->escaped) + { + ss->escaped = FALSE; + if (code == V42BIS_ECM) + { + printf("Hit V42BIS_ECM\n"); + ss->transparent = FALSE; + code_len = ss->v42bis_parm_c2; + } + else if (code == V42BIS_EID) + { + printf("Hit V42BIS_EID\n"); + ss->output_buf[ss->output_octet_count++] = ss->escape_code - 1; + if (ss->output_octet_count >= ss->max_len - s->v42bis_parm_n7) + { + ss->handler(ss->user_data, ss->output_buf, ss->output_octet_count); + ss->output_octet_count = 0; + } + } + else if (code == V42BIS_RESET) + { + printf("Hit V42BIS_RESET\n"); + } + else + { + printf("Hit V42BIS_???? - %" PRIu32 "\n", code); + } + } + else if (code == ss->escape_code) + { + ss->escape_code++; + ss->escaped = TRUE; + } + else + { + ss->output_buf[ss->output_octet_count++] = (uint8_t) code; + if (ss->output_octet_count >= ss->max_len - s->v42bis_parm_n7) + { + ss->handler(ss->user_data, ss->output_buf, ss->output_octet_count); + ss->output_octet_count = 0; + } + } + } + else + { + if (new_code < V42BIS_N6) + { + /* We have a control code. */ + switch (new_code) + { + case V42BIS_ETM: + printf("Hit V42BIS_ETM\n"); + ss->transparent = TRUE; + code_len = 8; + break; + case V42BIS_FLUSH: + printf("Hit V42BIS_FLUSH\n"); + v42bis_decompress_flush(s); + break; + case V42BIS_STEPUP: + /* We need to increase the codeword size */ + printf("Hit V42BIS_STEPUP\n"); + if (ss->v42bis_parm_c3 >= s->v42bis_parm_n2) + { + /* Invalid condition */ + return -1; + } + code_len = ++ss->v42bis_parm_c2; + ss->v42bis_parm_c3 <<= 1; + break; + } + continue; + } + if (ss->first) + { + ss->first = FALSE; + ss->octet = new_code - V42BIS_N6; + ss->output_buf[0] = (uint8_t) ss->octet; + ss->output_octet_count = 1; + if (ss->output_octet_count >= ss->max_len - s->v42bis_parm_n7) + { + ss->handler(ss->user_data, ss->output_buf, ss->output_octet_count); + ss->output_octet_count = 0; + } + ss->old_code = new_code; + continue; + } + /* Start at the end of the buffer, and decode backwards */ + string = &decode_buf[V42BIS_MAX_STRING_SIZE - 1]; + /* Check the received code is valid. It can't be too big, as we pulled only the expected number + of bits from the input stream. It could, however, be unknown. */ + if (ss->dict[new_code].parent_code == 0xFFFF) + return -1; + /* Otherwise we do a straight decode of the new code. */ + code = new_code; + /* Trace back through the octets which form the string, and output them. */ + while (code >= V42BIS_N5) + { +if (code > 4095) {printf("Code is 0x%" PRIu32 "\n", code); exit(2);} + *string-- = ss->dict[code].node_octet; + code = ss->dict[code].parent_code; + } + *string = (uint8_t) (code - V42BIS_N6); + ss->octet = code - V42BIS_N6; + /* Output the decoded string. */ + this_length = V42BIS_MAX_STRING_SIZE - (int) (string - decode_buf); + memcpy(ss->output_buf + ss->output_octet_count, string, this_length); + ss->output_octet_count += this_length; + if (ss->output_octet_count >= ss->max_len - s->v42bis_parm_n7) + { + ss->handler(ss->user_data, ss->output_buf, ss->output_octet_count); + ss->output_octet_count = 0; + } + /* 6.4 Add the string to the dictionary */ + if (ss->last_length < s->v42bis_parm_n7) + { + /* 6.4(a) The string does not exceed N7 in length */ + if (ss->last_old_code != ss->old_code + || + ss->last_extra_octet != *string) + { + /* 6.4(b) The string is not in the table. */ + ss->dict[ss->old_code].leaves++; + /* The new one is definitely a leaf */ + ss->dict[ss->v42bis_parm_c1].parent_code = (uint16_t) ss->old_code; + ss->dict[ss->v42bis_parm_c1].leaves = 0; + ss->dict[ss->v42bis_parm_c1].node_octet = (uint8_t) ss->octet; + /* 6.5 Recovering a dictionary entry to use next */ + for (;;) + { + /* 6.5(a) and (b) */ + if (++ss->v42bis_parm_c1 >= s->v42bis_parm_n2) + ss->v42bis_parm_c1 = V42BIS_N5; + /* 6.5(c) We need to reuse a leaf node */ + if (ss->dict[ss->v42bis_parm_c1].leaves) + continue; + /* 6.5(d) This is a leaf node, so re-use it */ + /* Possibly make the parent a leaf node again */ + if (ss->dict[ss->v42bis_parm_c1].parent_code != 0xFFFF) + ss->dict[ss->dict[ss->v42bis_parm_c1].parent_code].leaves--; + ss->dict[ss->v42bis_parm_c1].parent_code = 0xFFFF; + break; + } + } + } + /* Record the addition to the dictionary, so we can check for repeat attempts + at the next code - see II.4.3 */ + ss->last_old_code = ss->old_code; + ss->last_extra_octet = *string; + + ss->old_code = new_code; + ss->last_length = this_length; + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v42bis_decompress_flush(v42bis_state_t *s) +{ + v42bis_decompress_state_t *ss; + + ss = &s->decompress; + /* Push out anything remaining. */ + if (ss->output_octet_count > 0) + { + ss->handler(ss->user_data, ss->output_buf, ss->output_octet_count); + ss->output_octet_count = 0; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +#if 0 +SPAN_DECLARE(int) v42bis_decompress_dump(v42bis_state_t *s) +{ + int i; + + for (i = 0; i < V42BIS_MAX_CODEWORDS; i++) + { + if (s->decompress.dict[i].parent_code != 0xFFFF) + { + printf("Entry %4x, prior %4x, leaves %d, octet %2x\n", i, s->decompress.dict[i].parent_code, s->decompress.dict[i].leaves, s->decompress.dict[i].node_octet); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +#endif + +SPAN_DECLARE(void) v42bis_compression_control(v42bis_state_t *s, int mode) +{ + s->compress.compression_mode = mode; + switch (mode) + { + case V42BIS_COMPRESSION_MODE_ALWAYS: + s->compress.change_transparency = -1; + break; + case V42BIS_COMPRESSION_MODE_NEVER: + s->compress.change_transparency = 1; + break; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(v42bis_state_t *) v42bis_init(v42bis_state_t *s, + int negotiated_p0, + int negotiated_p1, + int negotiated_p2, + v42bis_frame_handler_t frame_handler, + void *frame_user_data, + int max_frame_len, + v42bis_data_handler_t data_handler, + void *data_user_data, + int max_data_len) +{ + int i; + + if (negotiated_p1 < 512 || negotiated_p1 > 65535) + return NULL; + if (negotiated_p2 < 6 || negotiated_p2 > V42BIS_MAX_STRING_SIZE) + return NULL; + if (s == NULL) + { + if ((s = (v42bis_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + + s->compress.handler = frame_handler; + s->compress.user_data = frame_user_data; + s->compress.max_len = (max_frame_len < 1024) ? max_frame_len : 1024; + + s->decompress.handler = data_handler; + s->decompress.user_data = data_user_data; + s->decompress.max_len = (max_data_len < 1024) ? max_data_len : 1024; + + s->v42bis_parm_p0 = negotiated_p0; /* default is both ways off */ + + s->v42bis_parm_n1 = top_bit(negotiated_p1 - 1) + 1; + s->v42bis_parm_n2 = negotiated_p1; + s->v42bis_parm_n7 = negotiated_p2; + + /* 6.5 */ + s->compress.v42bis_parm_c1 = + s->decompress.v42bis_parm_c1 = V42BIS_N5; + + s->compress.v42bis_parm_c2 = + s->decompress.v42bis_parm_c2 = V42BIS_N3 + 1; + + s->compress.v42bis_parm_c3 = + s->decompress.v42bis_parm_c3 = 2*V42BIS_N4; + + s->compress.first = + s->decompress.first = TRUE; + for (i = 0; i < V42BIS_MAX_CODEWORDS; i++) + { + s->compress.dict[i].parent_code = + s->decompress.dict[i].parent_code = 0xFFFF; + s->compress.dict[i].leaves = + s->decompress.dict[i].leaves = 0; + } + /* Point the root nodes for decompression to themselves. It doesn't matter much what + they are set to, as long as they are considered "known" codes. */ + for (i = 0; i < V42BIS_N5; i++) + s->decompress.dict[i].parent_code = (uint16_t) i; + s->compress.string_code = 0xFFFFFFFF; + s->compress.latest_code = 0xFFFFFFFF; + + s->decompress.last_old_code = 0xFFFFFFFF; + s->decompress.last_extra_octet = -1; + + s->compress.compression_mode = V42BIS_COMPRESSION_MODE_DYNAMIC; + + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v42bis_release(v42bis_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v42bis_free(v42bis_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/v8.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/v8.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1089 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v8.c - V.8 modem negotiation processing. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v8.c,v 1.42.4.3 2009/12/28 12:20:47 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/queue.h" +#include "spandsp/async.h" +#include "spandsp/vector_int.h" +#include "spandsp/complex.h" +#include "spandsp/dds.h" +#include "spandsp/tone_detect.h" +#include "spandsp/tone_generate.h" +#include "spandsp/super_tone_rx.h" +#include "spandsp/power_meter.h" +#include "spandsp/fsk.h" +#include "spandsp/modem_connect_tones.h" +#include "spandsp/v8.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/fsk.h" +#include "spandsp/private/modem_connect_tones.h" +#include "spandsp/private/v8.h" + +enum +{ + V8_WAIT_1S, + V8_CI_ON, + V8_CI_OFF, + V8_HEARD_ANSAM, + V8_CM_ON, + V8_CJ_ON, + V8_CM_WAIT, + + V8_SIGC, + V8_JM_ON, + V8_SIGA, + + V8_PARKED +} v8_states_e; + +enum +{ + V8_SYNC_UNKNOWN = 0, + V8_SYNC_CI, + V8_SYNC_CM_JM, + V8_SYNC_V92 +} v8_sync_types_e; + +enum +{ + V8_CALL_FUNCTION_TAG = 0x01, + V8_MODULATION_TAG = 0x05, + V8_PROTOCOLS_TAG = 0x0A, + V8_PSTN_ACCESS_TAG = 0x0D, + V8_NSF_TAG = 0x0F, + V8_PCM_MODEM_AVAILABILITY_TAG = 0x07, + V8_T66_TAG = 0x0E +}; + +enum +{ + V8_CI_SYNC_OCTET = 0x00, + V8_CM_JM_SYNC_OCTET = 0xE0 +}; + +SPAN_DECLARE(const char *) v8_call_function_to_str(int call_function) +{ + switch (call_function) + { + case V8_CALL_TBS: + return "TBS"; + case V8_CALL_H324: + return "H.324 PSTN multimedia terminal"; + case V8_CALL_V18: + return "V.18 textphone"; + case V8_CALL_T101: + return "T.101 videotext"; + case V8_CALL_T30_TX: + return "T.30 Tx FAX"; + case V8_CALL_T30_RX: + return "T.30 Rx FAX"; + case V8_CALL_V_SERIES: + return "V series modem data"; + case V8_CALL_FUNCTION_EXTENSION: + return "Call function is in extention octet"; + } + return "???"; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) v8_modulation_to_str(int modulation_scheme) +{ + switch (modulation_scheme) + { + case V8_MOD_V17: + return "V.17 half-duplex"; + case V8_MOD_V21: + return "V.21 duplex"; + case V8_MOD_V22: + return "V.22/V.22bis duplex"; + case V8_MOD_V23HALF: + return "V.23 half-duplex"; + case V8_MOD_V23: + return "V.23 duplex"; + case V8_MOD_V26BIS: + return "V.26bis duplex"; + case V8_MOD_V26TER: + return "V.26ter duplex"; + case V8_MOD_V27TER: + return "V.27ter duplex"; + case V8_MOD_V29: + return "V.29 half-duplex"; + case V8_MOD_V32: + return "V.32/V.32bis duplex"; + case V8_MOD_V34HALF: + return "V.34 half-duplex"; + case V8_MOD_V34: + return "V.34 duplex"; + case V8_MOD_V90: + return "V.90 duplex"; + case V8_MOD_V92: + return "V.92 duplex"; + case V8_MOD_FAILED: + return "negotiation failed"; + } + return "???"; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) v8_protocol_to_str(int protocol) +{ + switch (protocol) + { + case V8_PROTOCOL_NONE: + return "None"; + case V8_PROTOCOL_LAPM_V42: + return "LAPM"; + case V8_PROTOCOL_EXTENSION: + return "Extension"; + } + return "Undefined"; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) v8_pstn_access_to_str(int pstn_access) +{ + switch (pstn_access) + { + case V8_PSTN_ACCESS_CALL_DCE_CELLULAR: + return "Calling modem on cellular"; + case V8_PSTN_ACCESS_ANSWER_DCE_CELLULAR: + return "Answering modem on cellular"; + case V8_PSTN_ACCESS_ANSWER_DCE_CELLULAR | V8_PSTN_ACCESS_CALL_DCE_CELLULAR: + return "Answering and calling modems on cellular"; + case V8_PSTN_ACCESS_DCE_ON_DIGITAL: + return "DCE on digital"; + case V8_PSTN_ACCESS_DCE_ON_DIGITAL | V8_PSTN_ACCESS_CALL_DCE_CELLULAR: + return "DCE on digital, and calling modem on cellular"; + case V8_PSTN_ACCESS_DCE_ON_DIGITAL | V8_PSTN_ACCESS_ANSWER_DCE_CELLULAR: + return "DCE on digital, answering modem on cellular"; + case V8_PSTN_ACCESS_DCE_ON_DIGITAL | V8_PSTN_ACCESS_ANSWER_DCE_CELLULAR | V8_PSTN_ACCESS_CALL_DCE_CELLULAR: + return "DCE on digital, and answering and calling modems on cellular"; + } + return "???"; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) v8_nsf_to_str(int nsf) +{ + switch (nsf) + { + case 0: + return "???"; + } + return "???"; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) v8_pcm_modem_availability_to_str(int pcm_modem_availability) +{ + switch (pcm_modem_availability) + { + case 0: + return "PCM unavailable"; + case V8_PSTN_PCM_MODEM_V90_V92_ANALOGUE: + return "V.90/V.92 analogue available"; + case V8_PSTN_PCM_MODEM_V90_V92_DIGITAL: + return "V.90/V.92 digital available"; + case V8_PSTN_PCM_MODEM_V90_V92_DIGITAL | V8_PSTN_PCM_MODEM_V90_V92_ANALOGUE: + return "V.90/V.92 digital/analogue available"; + case V8_PSTN_PCM_MODEM_V91: + return "V.91 available"; + case V8_PSTN_PCM_MODEM_V91 | V8_PSTN_PCM_MODEM_V90_V92_ANALOGUE: + return "V.91 and V.90/V.92 analogue available"; + case V8_PSTN_PCM_MODEM_V91 | V8_PSTN_PCM_MODEM_V90_V92_DIGITAL: + return "V.91 and V.90/V.92 digital available"; + case V8_PSTN_PCM_MODEM_V91 | V8_PSTN_PCM_MODEM_V90_V92_DIGITAL | V8_PSTN_PCM_MODEM_V90_V92_ANALOGUE: + return "V.91 and V.90/V.92 digital/analogue available"; + } + return "???"; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) v8_t66_to_str(int t66) +{ + /* T.66 doesn't really define any V.8 values. The bits are all reserved. */ + switch (t66) + { + case 0: + return "???"; + case 1: + return "Reserved TIA"; + case 2: + return "Reserved"; + case 3: + return "Reserved TIA + others"; + case 4: + return "Reserved"; + case 5: + return "Reserved TIA + others"; + case 6: + return "Reserved"; + case 7: + return "Reserved TIA + others"; + } + return "???"; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) v8_log_supported_modulations(v8_state_t *s, int modulation_schemes) +{ + const char *comma; + int i; + + comma = ""; + span_log(&s->logging, SPAN_LOG_FLOW, ""); + for (i = 0; i < 32; i++) + { + if ((modulation_schemes & (1 << i))) + { + span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, "%s%s", comma, v8_modulation_to_str(modulation_schemes & (1 << i))); + comma = ", "; + } + } + span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, " supported\n"); +} +/*- End of function --------------------------------------------------------*/ + +static const uint8_t *process_call_function(v8_state_t *s, const uint8_t *p) +{ + s->result.call_function = (*p >> 5) & 0x07; + span_log(&s->logging, SPAN_LOG_FLOW, "%s\n", v8_call_function_to_str(s->result.call_function)); + return ++p; +} +/*- End of function --------------------------------------------------------*/ + +static const uint8_t *process_modulation_mode(v8_state_t *s, const uint8_t *p) +{ + unsigned int far_end_modulations; + + /* Modulation mode octet */ + far_end_modulations = 0; + if (*p & 0x80) + far_end_modulations |= V8_MOD_V34HALF; + if (*p & 0x40) + far_end_modulations |= V8_MOD_V34; + if (*p & 0x20) + far_end_modulations |= V8_MOD_V90; + + /* Check for an extension octet */ + if ((*++p & 0x38) == 0x10) + { + if (*p & 0x80) + far_end_modulations |= V8_MOD_V27TER; + if (*p & 0x40) + far_end_modulations |= V8_MOD_V29; + if (*p & 0x04) + far_end_modulations |= V8_MOD_V17; + if (*p & 0x02) + far_end_modulations |= V8_MOD_V22; + if (*p & 0x01) + far_end_modulations |= V8_MOD_V32; + + /* Check for an extension octet */ + if ((*++p & 0x38) == 0x10) + { + if (*p & 0x80) + far_end_modulations |= V8_MOD_V21; + if (*p & 0x40) + far_end_modulations |= V8_MOD_V23HALF; + if (*p & 0x04) + far_end_modulations |= V8_MOD_V23; + if (*p & 0x02) + far_end_modulations |= V8_MOD_V26BIS; + if (*p & 0x01) + far_end_modulations |= V8_MOD_V26TER; + } + } + s->far_end_modulations = + s->result.modulations = far_end_modulations; + v8_log_supported_modulations(s, far_end_modulations); + return ++p; +} +/*- End of function --------------------------------------------------------*/ + +static const uint8_t *process_protocols(v8_state_t *s, const uint8_t *p) +{ + s->result.protocol = (*p >> 5) & 0x07; + span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, "%s\n", v8_protocol_to_str(s->result.protocol)); + return ++p; +} +/*- End of function --------------------------------------------------------*/ + +static const uint8_t *process_pstn_access(v8_state_t *s, const uint8_t *p) +{ + s->result.pstn_access = (*p >> 5) & 0x07; + span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, "%s\n", v8_pstn_access_to_str(s->result.pstn_access)); + return ++p; +} +/*- End of function --------------------------------------------------------*/ + +static const uint8_t *process_non_standard_facilities(v8_state_t *s, const uint8_t *p) +{ + s->result.nsf = (*p >> 5) & 0x07; + span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, "%s\n", v8_nsf_to_str(s->result.nsf)); + return p; +} +/*- End of function --------------------------------------------------------*/ + +static const uint8_t *process_pcm_modem_availability(v8_state_t *s, const uint8_t *p) +{ + s->result.pcm_modem_availability = (*p >> 5) & 0x07; + span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, "%s\n", v8_pcm_modem_availability_to_str(s->result.pcm_modem_availability)); + return ++p; +} +/*- End of function --------------------------------------------------------*/ + +static const uint8_t *process_t66(v8_state_t *s, const uint8_t *p) +{ + s->result.t66 = (*p >> 5) & 0x07; + span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, "%s\n", v8_t66_to_str(s->result.t66)); + return ++p; +} +/*- End of function --------------------------------------------------------*/ + +static void ci_decode(v8_state_t *s) +{ + if ((s->rx_data[0] & 0x1F) == V8_CALL_FUNCTION_TAG) + process_call_function(s, &s->rx_data[0]); +} +/*- End of function --------------------------------------------------------*/ + +static void cm_jm_decode(v8_state_t *s) +{ + const uint8_t *p; + + if (s->got_cm_jm) + return; + + /* We must receive two consecutive identical CM or JM sequences to accept it. */ + if (s->cm_jm_len <= 0 + || + s->cm_jm_len != s->rx_data_ptr + || + memcmp(s->cm_jm_data, s->rx_data, s->rx_data_ptr)) + { + /* Save the current CM or JM sequence */ + s->cm_jm_len = s->rx_data_ptr; + memcpy(s->cm_jm_data, s->rx_data, s->rx_data_ptr); + return; + } + /* We have a matching pair of CMs or JMs, so we are happy this is correct. */ + s->got_cm_jm = TRUE; + + span_log(&s->logging, SPAN_LOG_FLOW, "Decoding\n"); + + /* Zero indicates the end */ + s->cm_jm_data[s->cm_jm_len] = 0; + + s->result.modulations = 0; + p = s->cm_jm_data; + + while (*p) + { + switch (*p & 0x1F) + { + case V8_CALL_FUNCTION_TAG: + p = process_call_function(s, p); + break; + case V8_MODULATION_TAG: + p = process_modulation_mode(s, p); + break; + case V8_PROTOCOLS_TAG: + p = process_protocols(s, p); + break; + case V8_PSTN_ACCESS_TAG: + p = process_pstn_access(s, p); + break; + case V8_NSF_TAG: + p = process_non_standard_facilities(s, p); + break; + case V8_PCM_MODEM_AVAILABILITY_TAG: + p = process_pcm_modem_availability(s, p); + break; + case V8_T66_TAG: + p = process_t66(s, p); + break; + default: + p++; + break; + } + /* Skip any future extensions we do not understand */ + while ((*p & 0x38) == 0x10) + p++; + } +} +/*- End of function --------------------------------------------------------*/ + +static void put_bit(void *user_data, int bit) +{ + v8_state_t *s; + int new_preamble_type; + const char *tag; + uint8_t data; + + s = user_data; + if (bit < 0) + { + /* Special conditions */ + switch (bit) + { + case SIG_STATUS_CARRIER_UP: + case SIG_STATUS_CARRIER_DOWN: + case SIG_STATUS_TRAINING_SUCCEEDED: + case SIG_STATUS_TRAINING_FAILED: + break; + default: + break; + } + return; + } + //span_log(&s->logging, SPAN_LOG_FLOW, "Bit %d\n", bit); + /* Wait until we sync. */ + s->bit_stream = (s->bit_stream >> 1) | (bit << 19); + /* CI preamble is 10 ones then a framed 0x00 + CM/JM preamble is 10 ones then a framed 0x07 + V.92 preamble is 10 ones then a framed 0x55 + Should we look at all 10 ones? The first couple might be + settling down. */ + /* The preamble + synchronisation bit sequence should be unique in + any bit stream, so we can rely on seeing this at any time as being + a real sync code. */ + switch (s->bit_stream) + { + case 0x803FF: + new_preamble_type = V8_SYNC_CI; + break; + case 0xF03FF: + new_preamble_type = V8_SYNC_CM_JM; + break; + case 0xAABFF: + new_preamble_type = V8_SYNC_V92; + break; + default: + new_preamble_type = V8_SYNC_UNKNOWN; + break; + } + if (new_preamble_type != V8_SYNC_UNKNOWN) + { + /* We have seen a fresh sync code */ + /* Debug */ + if (span_log_test(&s->logging, SPAN_LOG_FLOW)) + { + if (s->preamble_type != V8_SYNC_UNKNOWN) + { + switch (s->preamble_type) + { + case V8_SYNC_CI: + tag = "CI: "; + break; + case V8_SYNC_CM_JM: + tag = (s->calling_party) ? "JM: " : "CM: "; + break; + case V8_SYNC_V92: + tag = "V92: "; + break; + default: + tag = "??: "; + break; + } + span_log_buf(&s->logging, SPAN_LOG_FLOW, tag, s->rx_data, s->rx_data_ptr); + } + } + /* If we were handling a valid sync code then we should process what has been + received to date. */ + switch (s->preamble_type) + { + case V8_SYNC_CI: + ci_decode(s); + break; + case V8_SYNC_CM_JM: + cm_jm_decode(s); + break; + } + s->preamble_type = new_preamble_type; + s->bit_cnt = 0; + s->rx_data_ptr = 0; + } + + if (s->preamble_type != V8_SYNC_UNKNOWN) + { + /* Parse octets with 1 bit start, 1 bit stop */ + s->bit_cnt++; + /* Start, stop? */ + if ((s->bit_stream & 0x80400) == 0x80000 && s->bit_cnt >= 10) + { + /* Store the available data */ + data = (uint8_t) ((s->bit_stream >> 11) & 0xFF); + /* CJ (3 successive zero octets) detection */ + if (data == 0) + { + if (++s->zero_byte_count == 3) + s->got_cj = TRUE; + } + else + { + s->zero_byte_count = 0; + } + + if (s->rx_data_ptr < (int) (sizeof(s->rx_data) - 1)) + s->rx_data[s->rx_data_ptr++] = data; + s->bit_cnt = 0; + } + } +} +/*- End of function --------------------------------------------------------*/ + +static void v8_decode_init(v8_state_t *s) +{ + fsk_rx_init(&s->v21rx, + &preset_fsk_specs[(s->calling_party) ? FSK_V21CH2 : FSK_V21CH1], + FSK_FRAME_MODE_ASYNC, + put_bit, + s); + fsk_rx_signal_cutoff(&s->v21rx, -45.5f); + s->preamble_type = V8_SYNC_UNKNOWN; + s->bit_stream = 0; + s->cm_jm_len = 0; + s->got_cm_jm = FALSE; + s->got_cj = FALSE; + s->zero_byte_count = 0; + s->rx_data_ptr = 0; +} +/*- End of function --------------------------------------------------------*/ + +static int get_bit(void *user_data) +{ + v8_state_t *s; + uint8_t bit; + + s = user_data; + if (queue_read(s->tx_queue, &bit, 1) <= 0) + return SIG_STATUS_END_OF_DATA; + return bit; +} +/*- End of function --------------------------------------------------------*/ + +static void v8_put_preamble(v8_state_t *s) +{ + static const uint8_t preamble[10] = + { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; + + queue_write(s->tx_queue, preamble, 10); +} +/*- End of function --------------------------------------------------------*/ + +static void v8_put_byte(v8_state_t *s, int data) +{ + int i; + uint8_t bits[10]; + + /* Insert start & stop bits */ + bits[0] = 0; + for (i = 1; i < 9; i++) + { + bits[i] = (uint8_t) (data & 1); + data >>= 1; + } + bits[9] = 1; + queue_write(s->tx_queue, bits, 10); +} +/*- End of function --------------------------------------------------------*/ + +static void send_cm_jm(v8_state_t *s) +{ + int val; + unsigned int offered_modulations; + + offered_modulations = s->parms.modulations & s->far_end_modulations; + + /* Send a CM, or a JM as appropriate */ + v8_put_preamble(s); + v8_put_byte(s, V8_CM_JM_SYNC_OCTET); + /* Data call */ + v8_put_byte(s, (s->result.call_function << 5) | V8_CALL_FUNCTION_TAG); + + /* Supported modulations */ + val = 0x05; + if (offered_modulations & V8_MOD_V90) + val |= 0x20; + if (offered_modulations & V8_MOD_V34) + val |= 0x40; + v8_put_byte(s, val); + + val = 0x10; + if (offered_modulations & V8_MOD_V32) + val |= 0x01; + if (offered_modulations & V8_MOD_V22) + val |= 0x02; + if (offered_modulations & V8_MOD_V17) + val |= 0x04; + if (offered_modulations & V8_MOD_V29) + val |= 0x40; + if (offered_modulations & V8_MOD_V27TER) + val |= 0x80; + v8_put_byte(s, val); + + val = 0x10; + if (offered_modulations & V8_MOD_V26TER) + val |= 0x01; + if (offered_modulations & V8_MOD_V26BIS) + val |= 0x02; + if (offered_modulations & V8_MOD_V23) + val |= 0x04; + if (offered_modulations & V8_MOD_V23HALF) + val |= 0x40; + if (offered_modulations & V8_MOD_V21) + val |= 0x80; + v8_put_byte(s, val); + + if (s->parms.protocol) + v8_put_byte(s, (s->parms.protocol << 5) | V8_PROTOCOLS_TAG); + if (s->parms.pcm_modem_availability) + v8_put_byte(s, (s->parms.pcm_modem_availability << 5) | V8_PCM_MODEM_AVAILABILITY_TAG); + if (s->parms.pstn_access) + v8_put_byte(s, (s->parms.pstn_access << 5) | V8_PSTN_ACCESS_TAG); + if (s->parms.t66 >= 0) + v8_put_byte(s, (s->parms.t66 << 5) | V8_T66_TAG); + + /* No NSF */ + //v8_put_byte(s, (0 << 5) | V8_NSF_TAG); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) v8_tx(v8_state_t *s, int16_t *amp, int max_len) +{ + int len; + + //span_log(&s->logging, SPAN_LOG_FLOW, "v8_tx state %d\n", s->state); + len = 0; + if (s->modem_connect_tone_tx_on) + { + if (s->modem_connect_tone_tx_on > ms_to_samples(75)) + { + /* Send the ANSam tone */ + len = modem_connect_tones_tx(&s->ansam_tx, amp, max_len); + if (len < max_len) + { + span_log(&s->logging, SPAN_LOG_FLOW, "ANSam or ANSam/ ended\n"); + s->modem_connect_tone_tx_on = ms_to_samples(75); + } + } + else + { + /* Send the 75ms of silence after the ANSam tone */ + if (max_len > s->modem_connect_tone_tx_on) + len = s->modem_connect_tone_tx_on; + else + len = max_len; + vec_zeroi16(amp, len); + s->modem_connect_tone_tx_on -= len; + } + } + if (s->fsk_tx_on && len < max_len) + { + max_len -= len; + len = fsk_tx(&s->v21tx, amp + len, max_len); + if (len < max_len) + { + span_log(&s->logging, SPAN_LOG_FLOW, "FSK ends\n"); + s->fsk_tx_on = FALSE; + } + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +static void v8_send_ci(v8_state_t *s) +{ + int i; + + /* Send 4 CI packets in a burst (the spec says at least 3) */ + for (i = 0; i < 4; i++) + { + v8_put_preamble(s); + v8_put_byte(s, V8_CI_SYNC_OCTET); + v8_put_byte(s, (s->result.call_function << 5) | V8_CALL_FUNCTION_TAG); + } +} +/*- End of function --------------------------------------------------------*/ + +static void handle_modem_connect_tone(v8_state_t *s, int tone) +{ + s->result.modem_connect_tone = tone; + span_log(&s->logging, SPAN_LOG_FLOW, "'%s' recognised\n", modem_connect_tone_to_str(tone)); + if (tone == MODEM_CONNECT_TONES_ANSAM + || + tone == MODEM_CONNECT_TONES_ANSAM_PR) + { + /* Set the Te interval. The spec. says 500ms is the minimum, + but gives reasons why 1 second is a better value. */ + s->state = V8_HEARD_ANSAM; + s->ci_timer = ms_to_samples(1000); + } + else + { + /* If we found a connect tone, and it isn't one of the modulated answer tones, + indicating V.8 startup, we are not going to do V.8 processing. */ + span_log(&s->logging, SPAN_LOG_FLOW, "Non-V.8 modem connect tone detected\n"); + s->state = V8_PARKED; + if (s->result_handler) + s->result_handler(s->result_handler_user_data, &s->result); + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE_NONSTD(int) v8_rx(v8_state_t *s, const int16_t *amp, int len) +{ + int i; + int residual_samples; + int tone; + + //span_log(&s->logging, SPAN_LOG_FLOW, "v8_rx state %d\n", s->state); + residual_samples = 0; + switch (s->state) + { + case V8_WAIT_1S: + residual_samples = modem_connect_tones_rx(&s->ansam_rx, amp, len); + /* Wait 1 second before sending the first CI packet */ + if ((s->negotiation_timer -= len) > 0) + break; + fsk_tx_restart(&s->v21tx, &preset_fsk_specs[FSK_V21CH1]); + v8_send_ci(s); + s->state = V8_CI_ON; + s->fsk_tx_on = TRUE; + break; + case V8_CI_ON: + residual_samples = modem_connect_tones_rx(&s->ansam_rx, amp, len); + /* Check if an ANSam or ANSam/ tone has been detected */ + if ((tone = modem_connect_tones_rx_get(&s->ansam_rx)) != MODEM_CONNECT_TONES_NONE) + { + handle_modem_connect_tone(s, tone); + break; + } + if (queue_empty(s->tx_queue)) + { + s->state = V8_CI_OFF; + s->ci_timer = ms_to_samples(500); + break; + } + break; + case V8_CI_OFF: + residual_samples = modem_connect_tones_rx(&s->ansam_rx, amp, len); + /* Check if an ANSam or ANSam/ tone has been detected */ + if ((tone = modem_connect_tones_rx_get(&s->ansam_rx)) != MODEM_CONNECT_TONES_NONE) + { + handle_modem_connect_tone(s, tone); + break; + } + if ((s->ci_timer -= len) <= 0) + { + if (++s->ci_count >= 10) + { + /* The spec says we should give up now. */ + span_log(&s->logging, SPAN_LOG_FLOW, "Timeout waiting for modem connect tone\n"); + s->state = V8_PARKED; + if (s->result_handler) + s->result_handler(s->result_handler_user_data, NULL); + } + else + { + /* Try again */ + fsk_tx_restart(&s->v21tx, &preset_fsk_specs[FSK_V21CH1]); + v8_send_ci(s); + s->state = V8_CI_ON; + s->fsk_tx_on = TRUE; + } + } + break; + case V8_HEARD_ANSAM: + /* We have heard the ANSam or ANSam/ signal, but we still need to wait for the + end of the Te timeout period to comply with the spec. */ + if ((s->ci_timer -= len) <= 0) + { + v8_decode_init(s); + s->negotiation_timer = ms_to_samples(5000); + fsk_tx_restart(&s->v21tx, &preset_fsk_specs[FSK_V21CH1]); + send_cm_jm(s); + s->state = V8_CM_ON; + s->fsk_tx_on = TRUE; + } + break; + case V8_CM_ON: + residual_samples = fsk_rx(&s->v21rx, amp, len); + if (s->got_cm_jm) + { + span_log(&s->logging, SPAN_LOG_FLOW, "JM recognised\n"); + /* Now JM has been detected, we send CJ and wait for 75 ms + before finishing the V.8 analysis. */ + fsk_tx_restart(&s->v21tx, &preset_fsk_specs[FSK_V21CH1]); + for (i = 0; i < 3; i++) + v8_put_byte(s, 0); + s->state = V8_CJ_ON; + s->fsk_tx_on = TRUE; + break; + } + if ((s->negotiation_timer -= len) <= 0) + { + /* Timeout */ + span_log(&s->logging, SPAN_LOG_FLOW, "Timeout waiting for JM\n"); + s->state = V8_PARKED; + if (s->result_handler) + s->result_handler(s->result_handler_user_data, NULL); + } + if (queue_contents(s->tx_queue) < 10) + { + /* Send CM again */ + send_cm_jm(s); + } + break; + case V8_CJ_ON: + residual_samples = fsk_rx(&s->v21rx, amp, len); + if (queue_empty(s->tx_queue)) + { + s->negotiation_timer = ms_to_samples(75); + s->state = V8_SIGC; + } + break; + case V8_SIGC: + if ((s->negotiation_timer -= len) <= 0) + { + /* The V.8 negotiation has succeeded. */ + span_log(&s->logging, SPAN_LOG_FLOW, "Negotiation succeeded\n"); + s->state = V8_PARKED; + if (s->result_handler) + s->result_handler(s->result_handler_user_data, &s->result); + } + break; + case V8_CM_WAIT: + residual_samples = fsk_rx(&s->v21rx, amp, len); + if (s->got_cm_jm) + { + span_log(&s->logging, SPAN_LOG_FLOW, "CM recognised\n"); + + /* TODO: negotiate if the call function is acceptable */ + + /* Stop sending ANSam or ANSam/ and send JM instead */ + fsk_tx_init(&s->v21tx, &preset_fsk_specs[FSK_V21CH2], get_bit, s); + /* Set the timeout for JM */ + s->negotiation_timer = ms_to_samples(5000); + s->state = V8_JM_ON; + send_cm_jm(s); + s->modem_connect_tone_tx_on = ms_to_samples(75); + s->fsk_tx_on = TRUE; + break; + } + if ((s->negotiation_timer -= len) <= 0) + { + /* Timeout */ + span_log(&s->logging, SPAN_LOG_FLOW, "Timeout waiting for CM\n"); + s->state = V8_PARKED; + if (s->result_handler) + s->result_handler(s->result_handler_user_data, NULL); + } + break; + case V8_JM_ON: + residual_samples = fsk_rx(&s->v21rx, amp, len); + if (s->got_cj) + { + span_log(&s->logging, SPAN_LOG_FLOW, "CJ recognised\n"); + /* Stop sending JM, flushing anything left in the buffer, and wait 75 ms */ + queue_flush(s->tx_queue); + s->negotiation_timer = ms_to_samples(75); + s->state = V8_SIGA; + break; + } + if ((s->negotiation_timer -= len) <= 0) + { + /* Timeout */ + span_log(&s->logging, SPAN_LOG_FLOW, "Timeout waiting for CJ\n"); + s->state = V8_PARKED; + if (s->result_handler) + s->result_handler(s->result_handler_user_data, NULL); + break; + } + if (queue_contents(s->tx_queue) < 10) + { + /* Send JM */ + send_cm_jm(s); + } + break; + case V8_SIGA: + if ((s->negotiation_timer -= len) <= 0) + { + /* The V.8 negotiation has succeeded. */ + span_log(&s->logging, SPAN_LOG_FLOW, "Negotiation succeeded\n"); + s->state = V8_PARKED; + if (s->result_handler) + s->result_handler(s->result_handler_user_data, &s->result); + } + break; + case V8_PARKED: + residual_samples = len; + break; + } + return residual_samples; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(logging_state_t *) v8_get_logging_state(v8_state_t *s) +{ + return &s->logging; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v8_restart(v8_state_t *s, + int calling_party, + v8_parms_t *parms) +{ + memcpy(&s->parms, parms, sizeof(s->parms)); + memset(&s->result, 0, sizeof(s->result)); + + s->result.call_function = s->parms.call_function; + s->result.nsf = -1; + s->result.t66 = -1; + + s->ci_timer = 0; + if (calling_party) + { + s->calling_party = TRUE; + s->state = V8_WAIT_1S; + s->negotiation_timer = ms_to_samples(1000); + s->ci_count = 0; + modem_connect_tones_rx_init(&s->ansam_rx, MODEM_CONNECT_TONES_ANS_PR, NULL, NULL); + fsk_tx_init(&s->v21tx, &preset_fsk_specs[FSK_V21CH1], get_bit, s); + } + else + { + /* Send the ANSam or ANSam/ tone */ + s->calling_party = FALSE; + modem_connect_tones_tx_init(&s->ansam_tx, s->parms.modem_connect_tone); + + v8_decode_init(s); + s->state = V8_CM_WAIT; + s->negotiation_timer = ms_to_samples(200 + 5000); + s->modem_connect_tone_tx_on = ms_to_samples(75) + 1; + } + s->result.modem_connect_tone = MODEM_CONNECT_TONES_NONE; + + if ((s->tx_queue = queue_init(NULL, 1024, 0)) == NULL) + return -1; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(v8_state_t *) v8_init(v8_state_t *s, + int calling_party, + v8_parms_t *parms, + v8_result_handler_t *result_handler, + void *user_data) +{ + if (s == NULL) + { + if ((s = (v8_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "V.8"); + s->result_handler = result_handler; + s->result_handler_user_data = user_data; + + v8_restart(s, calling_party, parms); + + memcpy(&s->parms, parms, sizeof(s->parms)); + + s->result.call_function = s->parms.call_function; + s->result.nsf = -1; + s->result.t66 = -1; + + s->ci_timer = 0; + if (calling_party) + { + s->calling_party = TRUE; + s->state = V8_WAIT_1S; + s->negotiation_timer = ms_to_samples(1000); + s->ci_count = 0; + modem_connect_tones_rx_init(&s->ansam_rx, MODEM_CONNECT_TONES_ANS_PR, NULL, NULL); + fsk_tx_init(&s->v21tx, &preset_fsk_specs[FSK_V21CH1], get_bit, s); + } + else + { + /* Send the ANSam or ANSam/ tone */ + s->calling_party = FALSE; + modem_connect_tones_tx_init(&s->ansam_tx, s->parms.modem_connect_tone); + + v8_decode_init(s); + s->state = V8_CM_WAIT; + s->negotiation_timer = ms_to_samples(200 + 5000); + s->modem_connect_tone_tx_on = ms_to_samples(75) + 1; + } + s->result.modem_connect_tone = MODEM_CONNECT_TONES_NONE; + + if ((s->tx_queue = queue_init(NULL, 1024, 0)) == NULL) + return NULL; + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v8_release(v8_state_t *s) +{ + return queue_free(s->tx_queue); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) v8_free(v8_state_t *s) +{ + int ret; + + ret = queue_free(s->tx_queue); + free(s); + return ret; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/vector_float.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/vector_float.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,920 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * vector_float.c - Floating vector arithmetic routines. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: vector_float.c,v 1.22 2009/07/12 09:23:09 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include + +#include "floating_fudge.h" +#include "mmx_sse_decs.h" + +#include "spandsp/telephony.h" +#include "spandsp/vector_float.h" + +#if defined(__GNUC__) && defined(SPANDSP_USE_SSE2) +SPAN_DECLARE(void) vec_copyf(float z[], const float x[], int n) +{ + int i; + __m128 n1; + + if ((i = n & ~3)) + { + for (i -= 4; i >= 0; i -= 4) + { + n1 = _mm_loadu_ps(x + i); + _mm_storeu_ps(z + i, n1); + } + } + /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */ + switch (n & 3) + { + case 3: + z[n - 3] = x[n - 3]; + case 2: + z[n - 2] = x[n - 2]; + case 1: + z[n - 1] = x[n - 1]; + } +} +#else +SPAN_DECLARE(void) vec_copyf(float z[], const float x[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]; +} +#endif +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) vec_copy(double z[], const double x[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_copyl(long double z[], const long double x[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]; +} +/*- End of function --------------------------------------------------------*/ +#endif + +#if defined(__GNUC__) && defined(SPANDSP_USE_SSE2) +SPAN_DECLARE(void) vec_negatef(float z[], const float x[], int n) +{ + int i; + static const uint32_t mask = 0x80000000; + static const float *fmask = (float *) &mask; + __m128 n1; + __m128 n2; + + if ((i = n & ~3)) + { + n2 = _mm_set1_ps(*fmask); + for (i -= 4; i >= 0; i -= 4) + { + n1 = _mm_loadu_ps(x + i); + n1 = _mm_xor_ps(n1, n2); + _mm_storeu_ps(z + i, n1); + } + } + /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */ + switch (n & 3) + { + case 3: + z[n - 3] = -x[n - 3]; + case 2: + z[n - 2] = -x[n - 2]; + case 1: + z[n - 1] = -x[n - 1]; + } +} +#else +SPAN_DECLARE(void) vec_negatef(float z[], const float x[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = -x[i]; +} +#endif +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) vec_negate(double z[], const double x[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = -x[i]; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_negatel(long double z[], const long double x[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = -x[i]; +} +/*- End of function --------------------------------------------------------*/ +#endif + +#if defined(__GNUC__) && defined(SPANDSP_USE_SSE2) +SPAN_DECLARE(void) vec_zerof(float z[], int n) +{ + int i; + __m128 n1; + + if ((i = n & ~3)) + { + n1 = _mm_setzero_ps(); + for (i -= 4; i >= 0; i -= 4) + _mm_storeu_ps(z + i, n1); + } + /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */ + switch (n & 3) + { + case 3: + z[n - 3] = 0; + case 2: + z[n - 2] = 0; + case 1: + z[n - 1] = 0; + } +} +#else +SPAN_DECLARE(void) vec_zerof(float z[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = 0.0f; +} +#endif +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) vec_zero(double z[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = 0.0; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_zerol(long double z[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = 0.0L; +} +/*- End of function --------------------------------------------------------*/ +#endif + +#if defined(__GNUC__) && defined(SPANDSP_USE_SSE2) +SPAN_DECLARE(void) vec_setf(float z[], float x, int n) +{ + int i; + __m128 n1; + + if ((i = n & ~3)) + { + n1 = _mm_set1_ps(x); + for (i -= 4; i >= 0; i -= 4) + _mm_storeu_ps(z + i, n1); + } + /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */ + switch (n & 3) + { + case 3: + z[n - 3] = x; + case 2: + z[n - 2] = x; + case 1: + z[n - 1] = x; + } +} +#else +SPAN_DECLARE(void) vec_setf(float z[], float x, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x; +} +#endif +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) vec_set(double z[], double x, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_setl(long double z[], long double x, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x; +} +/*- End of function --------------------------------------------------------*/ +#endif + +#if defined(__GNUC__) && defined(SPANDSP_USE_SSE2) +SPAN_DECLARE(void) vec_addf(float z[], const float x[], const float y[], int n) +{ + int i; + __m128 n1; + __m128 n2; + + if ((i = n & ~3)) + { + for (i -= 4; i >= 0; i -= 4) + { + n1 = _mm_loadu_ps(x + i); + n2 = _mm_loadu_ps(y + i); + n2 = _mm_add_ps(n1, n2); + _mm_storeu_ps(z + i, n2); + } + } + /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */ + switch (n & 3) + { + case 3: + z[n - 3] = x[n - 3] + y[n - 3]; + case 2: + z[n - 2] = x[n - 2] + y[n - 2]; + case 1: + z[n - 1] = x[n - 1] + y[n - 1]; + } +} +#else +SPAN_DECLARE(void) vec_addf(float z[], const float x[], const float y[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i] + y[i]; +} +#endif +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) vec_add(double z[], const double x[], const double y[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i] + y[i]; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_addl(long double z[], const long double x[], const long double y[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i] + y[i]; +} +/*- End of function --------------------------------------------------------*/ +#endif + +#if defined(__GNUC__) && defined(SPANDSP_USE_SSE2) +SPAN_DECLARE(void) vec_scaledxy_addf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n) +{ + int i; + __m128 n1; + __m128 n2; + __m128 n3; + __m128 n4; + + if ((i = n & ~3)) + { + n3 = _mm_set1_ps(x_scale); + n4 = _mm_set1_ps(y_scale); + for (i -= 4; i >= 0; i -= 4) + { + n1 = _mm_loadu_ps(x + i); + n2 = _mm_loadu_ps(y + i); + n1 = _mm_mul_ps(n1, n3); + n2 = _mm_mul_ps(n2, n4); + n2 = _mm_add_ps(n1, n2); + _mm_storeu_ps(z + i, n2); + } + } + /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */ + switch (n & 3) + { + case 3: + z[n - 3] = x[n - 3]*x_scale + y[n - 3]*y_scale; + case 2: + z[n - 2] = x[n - 2]*x_scale + y[n - 2]*y_scale; + case 1: + z[n - 1] = x[n - 1]*x_scale + y[n - 1]*y_scale; + } +} +#else +SPAN_DECLARE(void) vec_scaledxy_addf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]*x_scale + y[i]*y_scale; +} +#endif +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) vec_scaledxy_add(double z[], const double x[], double x_scale, const double y[], double y_scale, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]*x_scale + y[i]*y_scale; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_scaledxy_addl(long double z[], const long double x[], long double x_scale, const long double y[], long double y_scale, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]*x_scale + y[i]*y_scale; +} +/*- End of function --------------------------------------------------------*/ +#endif + +#if defined(__GNUC__) && defined(SPANDSP_USE_SSE2) +SPAN_DECLARE(void) vec_scaledy_addf(float z[], const float x[], const float y[], float y_scale, int n) +{ + int i; + __m128 n1; + __m128 n2; + __m128 n3; + + if ((i = n & ~3)) + { + n3 = _mm_set1_ps(y_scale); + for (i -= 4; i >= 0; i -= 4) + { + n1 = _mm_loadu_ps(x + i); + n2 = _mm_loadu_ps(y + i); + n2 = _mm_mul_ps(n2, n3); + n2 = _mm_add_ps(n1, n2); + _mm_storeu_ps(z + i, n2); + } + } + /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */ + switch (n & 3) + { + case 3: + z[n - 3] = x[n - 3] + y[n - 3]*y_scale; + case 2: + z[n - 2] = x[n - 2] + y[n - 2]*y_scale; + case 1: + z[n - 1] = x[n - 1] + y[n - 1]*y_scale; + } +} +#else +SPAN_DECLARE(void) vec_scaledy_addf(float z[], const float x[], const float y[], float y_scale, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i] + y[i]*y_scale; +} +#endif +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) vec_scaledy_add(double z[], const double x[], const double y[], double y_scale, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i] + y[i]*y_scale; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_scaledy_addl(long double z[], const long double x[], const long double y[], long double y_scale, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i] + y[i]*y_scale; +} +/*- End of function --------------------------------------------------------*/ +#endif + +#if defined(__GNUC__) && defined(SPANDSP_USE_SSE2) +SPAN_DECLARE(void) vec_subf(float z[], const float x[], const float y[], int n) +{ + int i; + __m128 n1; + __m128 n2; + + if ((i = n & ~3)) + { + for (i -= 4; i >= 0; i -= 4) + { + n1 = _mm_loadu_ps(x + i); + n2 = _mm_loadu_ps(y + i); + n2 = _mm_sub_ps(n1, n2); + _mm_storeu_ps(z + i, n2); + } + } + /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */ + switch (n & 3) + { + case 3: + z[n - 3] = x[n - 3] - y[n - 3]; + case 2: + z[n - 2] = x[n - 2] - y[n - 2]; + case 1: + z[n - 1] = x[n - 1] - y[n - 1]; + } +} +#else +SPAN_DECLARE(void) vec_subf(float z[], const float x[], const float y[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i] - y[i]; +} +#endif +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) vec_sub(double z[], const double x[], const double y[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i] - y[i]; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_subl(long double z[], const long double x[], const long double y[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i] - y[i]; +} +/*- End of function --------------------------------------------------------*/ +#endif + +SPAN_DECLARE(void) vec_scaledxy_subf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]*x_scale - y[i]*y_scale; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) vec_scaledxy_sub(double z[], const double x[], double x_scale, const double y[], double y_scale, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]*x_scale - y[i]*y_scale; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_scaledxy_subl(long double z[], const long double x[], long double x_scale, const long double y[], long double y_scale, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]*x_scale - y[i]*y_scale; +} +/*- End of function --------------------------------------------------------*/ +#endif + +#if defined(__GNUC__) && defined(SPANDSP_USE_SSE2) +SPAN_DECLARE(void) vec_scalar_mulf(float z[], const float x[], float y, int n) +{ + int i; + __m128 n1; + __m128 n2; + + if ((i = n & ~3)) + { + n2 = _mm_set1_ps(y); + for (i -= 4; i >= 0; i -= 4) + { + n1 = _mm_loadu_ps(x + i); + n1 = _mm_mul_ps(n1, n2); + _mm_storeu_ps(z + i, n1); + } + } + /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */ + switch (n & 3) + { + case 3: + z[n - 3] = x[n - 3]*y; + case 2: + z[n - 2] = x[n - 2]*y; + case 1: + z[n - 1] = x[n - 1]*y; + } +} +#else +SPAN_DECLARE(void) vec_scalar_mulf(float z[], const float x[], float y, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]*y; +} +#endif +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) vec_scalar_mul(double z[], const double x[], double y, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]*y; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(__GNUC__) && defined(SPANDSP_USE_SSE2) +SPAN_DECLARE(void) vec_scalar_addf(float z[], const float x[], float y, int n) +{ + int i; + __m128 n1; + __m128 n2; + + if ((i = n & ~3)) + { + n2 = _mm_set1_ps(y); + for (i -= 4; i >= 0; i -= 4) + { + n1 = _mm_loadu_ps(x + i); + n1 = _mm_add_ps(n1, n2); + _mm_storeu_ps(z + i, n1); + } + } + /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */ + switch (n & 3) + { + case 3: + z[n - 3] = x[n - 3] + y; + case 2: + z[n - 2] = x[n - 2] + y; + case 1: + z[n - 1] = x[n - 1] + y; + } +} +#else +SPAN_DECLARE(void) vec_scalar_addf(float z[], const float x[], float y, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i] + y; +} +#endif +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) vec_scalar_add(double z[], const double x[], double y, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i] + y; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_scalar_addl(long double z[], const long double x[], long double y, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i] + y; +} +/*- End of function --------------------------------------------------------*/ +#endif + +#if defined(__GNUC__) && defined(SPANDSP_USE_SSE2) +SPAN_DECLARE(void) vec_scalar_subf(float z[], const float x[], float y, int n) +{ + int i; + __m128 n1; + __m128 n2; + + if ((i = n & ~3)) + { + n2 = _mm_set1_ps(y); + for (i -= 4; i >= 0; i -= 4) + { + n1 = _mm_loadu_ps(x + i); + n1 = _mm_sub_ps(n1, n2); + _mm_storeu_ps(z + i, n1); + } + } + /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */ + switch (n & 3) + { + case 3: + z[n - 3] = x[n - 3] - y; + case 2: + z[n - 2] = x[n - 2] - y; + case 1: + z[n - 1] = x[n - 1] - y; + } +} +#else +SPAN_DECLARE(void) vec_scalar_subf(float z[], const float x[], float y, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i] - y; +} +#endif +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) vec_scalar_sub(double z[], const double x[], double y, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i] - y; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_scalar_subl(long double z[], const long double x[], long double y, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i] - y; +} +/*- End of function --------------------------------------------------------*/ +#endif + +#if defined(__GNUC__) && defined(SPANDSP_USE_SSE2) +SPAN_DECLARE(void) vec_mulf(float z[], const float x[], const float y[], int n) +{ + int i; + __m128 n1; + __m128 n2; + __m128 n3; + + if ((i = n & ~3)) + { + for (i -= 4; i >= 0; i -= 4) + { + n1 = _mm_loadu_ps(x + i); + n2 = _mm_loadu_ps(y + i); + n3 = _mm_mul_ps(n1, n2); + _mm_storeu_ps(z + i, n3); + } + } + /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */ + switch (n & 3) + { + case 3: + z[n - 3] = x[n - 3]*y[n - 3]; + case 2: + z[n - 2] = x[n - 2]*y[n - 2]; + case 1: + z[n - 1] = x[n - 1]*y[n - 1]; + } +} +#else +SPAN_DECLARE(void) vec_mulf(float z[], const float x[], const float y[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]*y[i]; +} +/*- End of function --------------------------------------------------------*/ +#endif + +SPAN_DECLARE(void) vec_mul(double z[], const double x[], const double y[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]*y[i]; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_mull(long double z[], const long double x[], const long double y[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]*y[i]; +} +/*- End of function --------------------------------------------------------*/ +#endif + +#if defined(__GNUC__) && defined(SPANDSP_USE_SSE2) +SPAN_DECLARE(float) vec_dot_prodf(const float x[], const float y[], int n) +{ + int i; + float z; + __m128 n1; + __m128 n2; + __m128 n3; + __m128 n4; + + z = 0.0f; + if ((i = n & ~3)) + { + n4 = _mm_setzero_ps(); //sets sum to zero + for (i -= 4; i >= 0; i -= 4) + { + n1 = _mm_loadu_ps(x + i); + n2 = _mm_loadu_ps(y + i); + n3 = _mm_mul_ps(n1, n2); + n4 = _mm_add_ps(n4, n3); + } + n4 = _mm_add_ps(_mm_movehl_ps(n4, n4), n4); + n4 = _mm_add_ss(_mm_shuffle_ps(n4, n4, 1), n4); + _mm_store_ss(&z, n4); + } + /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */ + switch (n & 3) + { + case 3: + z += x[n - 3]*y[n - 3]; + case 2: + z += x[n - 2]*y[n - 2]; + case 1: + z += x[n - 1]*y[n - 1]; + } + return z; +} +#else +SPAN_DECLARE(float) vec_dot_prodf(const float x[], const float y[], int n) +{ + int i; + float z; + + z = 0.0f; + for (i = 0; i < n; i++) + z += x[i]*y[i]; + return z; +} +/*- End of function --------------------------------------------------------*/ +#endif + +SPAN_DECLARE(double) vec_dot_prod(const double x[], const double y[], int n) +{ + int i; + double z; + + z = 0.0; + for (i = 0; i < n; i++) + z += x[i]*y[i]; + return z; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(long double) vec_dot_prodl(const long double x[], const long double y[], int n) +{ + int i; + long double z; + + z = 0.0L; + for (i = 0; i < n; i++) + z += x[i]*y[i]; + return z; +} +/*- End of function --------------------------------------------------------*/ +#endif + +SPAN_DECLARE(float) vec_circular_dot_prodf(const float x[], const float y[], int n, int pos) +{ + float z; + + z = vec_dot_prodf(&x[pos], &y[0], n - pos); + z += vec_dot_prodf(&x[0], &y[n - pos], pos); + return z; +} +/*- End of function --------------------------------------------------------*/ + +#define LMS_LEAK_RATE 0.9999f + +#if defined(__GNUC__) && defined(SPANDSP_USE_SSE2) +SPAN_DECLARE(void) vec_lmsf(const float x[], float y[], int n, float error) +{ + int i; + __m128 n1; + __m128 n2; + __m128 n3; + __m128 n4; + + if ((i = n & ~3)) + { + n3 = _mm_set1_ps(error); + n4 = _mm_set1_ps(LMS_LEAK_RATE); + for (i -= 4; i >= 0; i -= 4) + { + n1 = _mm_loadu_ps(x + i); + n2 = _mm_loadu_ps(y + i); + n1 = _mm_mul_ps(n1, n3); + n2 = _mm_mul_ps(n2, n4); + n1 = _mm_add_ps(n1, n2); + _mm_storeu_ps(y + i, n1); + } + } + /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */ + switch (n & 3) + { + case 3: + y[n - 3] = y[n - 3]*LMS_LEAK_RATE + x[n - 3]*error; + case 2: + y[n - 2] = y[n - 2]*LMS_LEAK_RATE + x[n - 2]*error; + case 1: + y[n - 1] = y[n - 1]*LMS_LEAK_RATE + x[n - 1]*error; + } +} +#else +SPAN_DECLARE(void) vec_lmsf(const float x[], float y[], int n, float error) +{ + int i; + + for (i = 0; i < n; i++) + { + /* Leak a little to tame uncontrolled wandering */ + y[i] = y[i]*LMS_LEAK_RATE + x[i]*error; + } +} +#endif +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) vec_circular_lmsf(const float x[], float y[], int n, int pos, float error) +{ + vec_lmsf(&x[pos], &y[0], n - pos, error); + vec_lmsf(&x[0], &y[n - pos], pos, error); +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/src/vector_int.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/src/vector_int.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,628 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * vector_int.c - Integer vector arithmetic + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: vector_int.c,v 1.26.4.1 2009/12/28 11:54:59 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include + +#include "floating_fudge.h" +#include "mmx_sse_decs.h" + +#include "spandsp/telephony.h" +#include "spandsp/vector_int.h" + +SPAN_DECLARE(int32_t) vec_dot_prodi16(const int16_t x[], const int16_t y[], int n) +{ + int32_t z; + +#if defined(__GNUC__) && defined(SPANDSP_USE_MMX) && defined(__x86_64__) + __asm__ __volatile__( + " emms;\n" + " pxor %%mm0,%%mm0;\n" + " leaq -32(%%rsi,%%rax,2),%%rdx;\n" /* rdx = top - 32 */ + + " cmpq %%rdx,%%rsi;\n" + " ja 1f;\n" + + /* Work in blocks of 16 int16_t's until we are near the end */ + " .p2align 2;\n" + "2:\n" + " movq (%%rdi),%%mm1;\n" + " movq (%%rsi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 8(%%rdi),%%mm1;\n" + " movq 8(%%rsi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 16(%%rdi),%%mm1;\n" + " movq 16(%%rsi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 24(%%rdi),%%mm1;\n" + " movq 24(%%rsi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + + " addq $32,%%rsi;\n" + " addq $32,%%rdi;\n" + " cmpq %%rdx,%%rsi;\n" + " jbe 2b;\n" + + " .p2align 2;\n" + "1:\n" + " addq $24,%%rdx;\n" /* Now edx = top - 8 */ + " cmpq %%rdx,%%rsi;\n" + " ja 3f;\n" + + /* Work in blocks of 4 int16_t's until we are near the end */ + " .p2align 2;\n" + "4:\n" + " movq (%%rdi),%%mm1;\n" + " movq (%%rsi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + + " addq $8,%%rsi;\n" + " addq $8,%%rdi;\n" + " cmpq %%rdx,%%rsi;" + " jbe 4b;\n" + + " .p2align 2;\n" + "3:\n" + " addq $4,%%rdx;\n" /* Now edx = top - 4 */ + " cmpq %%rdx,%%rsi;\n" + " ja 5f;\n" + + /* Work in a block of 2 int16_t's */ + " movd (%%rdi),%%mm1;\n" + " movd (%%rsi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + + " addq $4,%%rsi;\n" + " addq $4,%%rdi;\n" + + " .p2align 2;\n" + "5:\n" + " addq $2,%%rdx;\n" /* Now edx = top - 2 */ + " cmpq %%rdx,%%rsi;\n" + " ja 6f;\n" + + /* Deal with the very last int16_t, when n is odd */ + " movswl (%%rdi),%%eax;\n" + " andl $65535,%%eax;\n" + " movd %%eax,%%mm1;\n" + " movswl (%%rsi),%%eax;\n" + " andl $65535,%%eax;\n" + " movd %%eax,%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + + " .p2align 2;\n" + "6:\n" + /* Merge the pieces of the answer */ + " movq %%mm0,%%mm1;\n" + " punpckhdq %%mm0,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + /* Et voila, eax has the final result */ + " movd %%mm0,%%eax;\n" + + " emms;\n" + : "=a" (z) + : "S" (x), "D" (y), "a" (n) + : "cc" + ); +#elif defined(__GNUC__) && defined(SPANDSP_USE_MMX) && defined(__i386__) + __asm__ __volatile__( + " emms;\n" + " pxor %%mm0,%%mm0;\n" + " leal -32(%%esi,%%eax,2),%%edx;\n" /* edx = top - 32 */ + + " cmpl %%edx,%%esi;\n" + " ja 1f;\n" + + /* Work in blocks of 16 int16_t's until we are near the end */ + " .p2align 2;\n" + "2:\n" + " movq (%%edi),%%mm1;\n" + " movq (%%esi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 8(%%edi),%%mm1;\n" + " movq 8(%%esi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 16(%%edi),%%mm1;\n" + " movq 16(%%esi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 24(%%edi),%%mm1;\n" + " movq 24(%%esi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + + " addl $32,%%esi;\n" + " addl $32,%%edi;\n" + " cmpl %%edx,%%esi;\n" + " jbe 2b;\n" + + " .p2align 2;\n" + "1:\n" + " addl $24,%%edx;\n" /* Now edx = top - 8 */ + " cmpl %%edx,%%esi;\n" + " ja 3f;\n" + + /* Work in blocks of 4 int16_t's until we are near the end */ + " .p2align 2;\n" + "4:\n" + " movq (%%edi),%%mm1;\n" + " movq (%%esi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + + " addl $8,%%esi;\n" + " addl $8,%%edi;\n" + " cmpl %%edx,%%esi;" + " jbe 4b;\n" + + " .p2align 2;\n" + "3:\n" + " addl $4,%%edx;\n" /* Now edx = top - 4 */ + " cmpl %%edx,%%esi;\n" + " ja 5f;\n" + + /* Work in a block of 2 int16_t's */ + " movd (%%edi),%%mm1;\n" + " movd (%%esi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + + " addl $4,%%esi;\n" + " addl $4,%%edi;\n" + + " .p2align 2;\n" + "5:\n" + " addl $2,%%edx;\n" /* Now edx = top - 2 */ + " cmpl %%edx,%%esi;\n" + " ja 6f;\n" + + /* Deal with the very last int16_t, when n is odd */ + " movswl (%%edi),%%eax;\n" + " andl $65535,%%eax;\n" + " movd %%eax,%%mm1;\n" + " movswl (%%esi),%%eax;\n" + " andl $65535,%%eax;\n" + " movd %%eax,%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + + " .p2align 2;\n" + "6:\n" + /* Merge the pieces of the answer */ + " movq %%mm0,%%mm1;\n" + " punpckhdq %%mm0,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + /* Et voila, eax has the final result */ + " movd %%mm0,%%eax;\n" + + " emms;\n" + : "=a" (z) + : "S" (x), "D" (y), "a" (n) + : "cc" + ); +#else + int i; + + z = 0; + for (i = 0; i < n; i++) + z += (int32_t) x[i]*(int32_t) y[i]; +#endif + return z; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int32_t) vec_circular_dot_prodi16(const int16_t x[], const int16_t y[], int n, int pos) +{ + int32_t z; + + z = vec_dot_prodi16(&x[pos], &y[0], n - pos); + z += vec_dot_prodi16(&x[0], &y[n - pos], pos); + return z; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) vec_lmsi16(const int16_t x[], int16_t y[], int n, int16_t error) +{ + int i; + + for (i = 0; i < n; i++) + y[i] += (int16_t) (((int32_t) x[i]*(int32_t) error) >> 15); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) vec_circular_lmsi16(const int16_t x[], int16_t y[], int n, int pos, int16_t error) +{ + vec_lmsi16(&x[pos], &y[0], n - pos, error); + vec_lmsi16(&x[0], &y[n - pos], pos, error); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int32_t) vec_min_maxi16(const int16_t x[], int n, int16_t out[]) +{ +#if defined(__GNUC__) && defined(SPANDSP_USE_MMX) && defined(__x86_64__) + static const int32_t lower_bound = 0x80008000; + static const int32_t upper_bound = 0x7FFF7FFF; + int32_t max; + + __asm__ __volatile__( + " emms;\n" + " pushq %%rdx;\n" + " leaq -8(%%rsi,%%rax,2),%%rdx;\n" + + " cmpq %%rdx,%%rsi;\n" + " jbe 2f;\n" + " movd %[lower],%%mm0;\n" + " movd %[upper],%%mm1;\n" + " jmp 1f;\n" + + " .p2align 2;\n" + "2:\n" + " movq (%%rsi),%%mm0;\n" /* mm0 will be max's */ + " movq %%mm0,%%mm1;\n" /* mm1 will be min's */ + " addq $8,%%rsi;\n" + " cmpq %%rdx,%%rsi;\n" + " ja 4f;\n" + + "3:\n" + " movq (%%rsi),%%mm2;\n" + + " movq %%mm2,%%mm3;\n" + " pcmpgtw %%mm0,%%mm3;\n" /* mm3 is bitmask for words where mm2 > mm0 */ + " movq %%mm3,%%mm4;\n" + " pand %%mm2,%%mm3;\n" /* mm3 is mm2 masked to new max's */ + " pandn %%mm0,%%mm4;\n" /* mm4 is mm0 masked to its max's */ + " por %%mm3,%%mm4;\n" + " movq %%mm4,%%mm0;\n" /* Now mm0 is updated max's */ + + " movq %%mm1,%%mm3;\n" + " pcmpgtw %%mm2,%%mm3;\n" /* mm3 is bitmask for words where mm2 < mm1 */ + " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new min's */ + " pandn %%mm1,%%mm3;\n" /* mm3 is mm1 masked to its min's */ + " por %%mm3,%%mm2;\n" + " movq %%mm2,%%mm1;\n" /* now mm1 is updated min's */ + + " addq $8,%%rsi;\n" + " cmpq %%rdx,%%rsi;\n" + " jbe 3b;\n" + + " .p2align 2;\n" + "4:\n" + /* Merge down the 4-word max/mins to lower 2 words */ + " movq %%mm0,%%mm2;\n" + " psrlq $32,%%mm2;\n" + " movq %%mm2,%%mm3;\n" + " pcmpgtw %%mm0,%%mm3;\n" /* mm3 is bitmask for words where mm2 > mm0 */ + " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new max's */ + " pandn %%mm0,%%mm3;\n" /* mm3 is mm0 masked to its max's */ + " por %%mm3,%%mm2;\n" + " movq %%mm2,%%mm0;\n" /* now mm0 is updated max's */ + + " movq %%mm1,%%mm2;\n" + " psrlq $32,%%mm2;\n" + " movq %%mm1,%%mm3;\n" + " pcmpgtw %%mm2,%%mm3;\n" /* mm3 is bitmask for words where mm2 < mm1 */ + " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new min's */ + " pandn %%mm1,%%mm3;\n" /* mm3 is mm1 masked to its min's */ + " por %%mm3,%%mm2;\n" + " movq %%mm2,%%mm1;\n" /* now mm1 is updated min's */ + + " .p2align 2;\n" + "1:\n" + " addq $4,%%rdx;\n" /* now dx = top-4 */ + " cmpq %%rdx,%%rsi;\n" + " ja 5f;\n" + /* Here, there are >= 2 words of input remaining */ + " movd (%%rsi),%%mm2;\n" + + " movq %%mm2,%%mm3;\n" + " pcmpgtw %%mm0,%%mm3;\n" /* mm3 is bitmask for words where mm2 > mm0 */ + " movq %%mm3,%%mm4;\n" + " pand %%mm2,%%mm3;\n" /* mm3 is mm2 masked to new max's */ + " pandn %%mm0,%%mm4;\n" /* mm4 is mm0 masked to its max's */ + " por %%mm3,%%mm4;\n" + " movq %%mm4,%%mm0;\n" /* now mm0 is updated max's */ + + " movq %%mm1,%%mm3;\n" + " pcmpgtw %%mm2,%%mm3;\n" /* mm3 is bitmask for words where mm2 < mm1 */ + " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new min's */ + " pandn %%mm1,%%mm3;\n" /* mm3 is mm1 masked to its min's */ + " por %%mm3,%%mm2;\n" + " movq %%mm2,%%mm1;\n" /* now mm1 is updated min's */ + + " addq $4,%%rsi;\n" + + " .p2align 2;\n" + "5:\n" + /* Merge down the 2-word max/mins to 1 word */ + " movq %%mm0,%%mm2;\n" + " psrlq $16,%%mm2;\n" + " movq %%mm2,%%mm3;\n" + " pcmpgtw %%mm0,%%mm3;\n" /* mm3 is bitmask for words where mm2 > mm0 */ + " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new max's */ + " pandn %%mm0,%%mm3;\n" /* mm3 is mm0 masked to its max's */ + " por %%mm3,%%mm2;\n" + " movd %%mm2,%%ecx;\n" /* cx is max so far */ + + " movq %%mm1,%%mm2;\n" + " psrlq $16,%%mm2;\n" + " movq %%mm1,%%mm3;\n" + " pcmpgtw %%mm2,%%mm3;\n" /* mm3 is bitmask for words where mm2 < mm1 */ + " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new min's */ + " pandn %%mm1,%%mm3;\n" /* mm3 is mm1 masked to its min's */ + " por %%mm3,%%mm2;\n" + " movd %%mm2,%%eax;\n" /* ax is min so far */ + + " addq $2,%%rdx;\n" /* now dx = top-2 */ + " cmpq %%rdx,%%rsi;\n" + " ja 6f;\n" + + /* Here, there is one word of input left */ + " cmpw (%%rsi),%%cx;\n" + " jge 9f;\n" + " movw (%%rsi),%%cx;\n" + " .p2align 2;\n" + "9:\n" + " cmpw (%%rsi),%%ax;\n" + " jle 6f;\n" + " movw (%%rsi),%%ax;\n" + + " .p2align 2;\n" + "6:\n" + /* (finally!) cx is the max, ax the min */ + " movswl %%cx,%%ecx;\n" + " movswl %%ax,%%eax;\n" + + " popq %%rdx;\n" /* ptr to output max,min vals */ + " andq %%rdx,%%rdx;\n" + " jz 7f;\n" + " movw %%cx,(%%rdx);\n" /* max */ + " movw %%ax,2(%%rdx);\n" /* min */ + " .p2align 2;\n" + "7:\n" + /* Now calculate max absolute value */ + " negl %%eax;\n" + " cmpl %%ecx,%%eax;\n" + " jge 8f;\n" + " movl %%ecx,%%eax;\n" + " .p2align 2;\n" + "8:\n" + " emms;\n" + : "=a" (max) + : "S" (x), "a" (n), "d" (out), [lower] "m" (lower_bound), [upper] "m" (upper_bound) + : "ecx" + ); +#elif defined(__GNUC__) && defined(SPANDSP_USE_MMX) && defined(__i386__) + static const int32_t lower_bound = 0x80008000; + static const int32_t upper_bound = 0x7FFF7FFF; + int32_t max; + + __asm__ __volatile__( + " emms;\n" + " pushl %%edx;\n" + " leal -8(%%esi,%%eax,2),%%edx;\n" + + " cmpl %%edx,%%esi;\n" + " jbe 2f;\n" + " movd %[lower],%%mm0;\n" + " movd %[upper],%%mm1;\n" + " jmp 1f;\n" + + " .p2align 2;\n" + "2:\n" + " movq (%%esi),%%mm0;\n" /* mm0 will be max's */ + " movq %%mm0,%%mm1;\n" /* mm1 will be min's */ + " addl $8,%%esi;\n" + " cmpl %%edx,%%esi;\n" + " ja 4f;\n" + + " .p2align 2;\n" + "3:\n" + " movq (%%esi),%%mm2;\n" + + " movq %%mm2,%%mm3;\n" + " pcmpgtw %%mm0,%%mm3;\n" /* mm3 is bitmask for words where mm2 > mm0 */ + " movq %%mm3,%%mm4;\n" + " pand %%mm2,%%mm3;\n" /* mm3 is mm2 masked to new max's */ + " pandn %%mm0,%%mm4;\n" /* mm4 is mm0 masked to its max's */ + " por %%mm3,%%mm4;\n" + " movq %%mm4,%%mm0;\n" /* Now mm0 is updated max's */ + + " movq %%mm1,%%mm3;\n" + " pcmpgtw %%mm2,%%mm3;\n" /* mm3 is bitmask for words where mm2 < mm1 */ + " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new min's */ + " pandn %%mm1,%%mm3;\n" /* mm3 is mm1 masked to its min's */ + " por %%mm3,%%mm2;\n" + " movq %%mm2,%%mm1;\n" /* now mm1 is updated min's */ + + " addl $8,%%esi;\n" + " cmpl %%edx,%%esi;\n" + " jbe 3b;\n" + + " .p2align 2;\n" + "4:\n" + /* Merge down the 4-word max/mins to lower 2 words */ + " movq %%mm0,%%mm2;\n" + " psrlq $32,%%mm2;\n" + " movq %%mm2,%%mm3;\n" + " pcmpgtw %%mm0,%%mm3;\n" /* mm3 is bitmask for words where mm2 > mm0 */ + " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new max's */ + " pandn %%mm0,%%mm3;\n" /* mm3 is mm0 masked to its max's */ + " por %%mm3,%%mm2;\n" + " movq %%mm2,%%mm0;\n" /* now mm0 is updated max's */ + + " movq %%mm1,%%mm2;\n" + " psrlq $32,%%mm2;\n" + " movq %%mm1,%%mm3;\n" + " pcmpgtw %%mm2,%%mm3;\n" /* mm3 is bitmask for words where mm2 < mm1 */ + " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new min's */ + " pandn %%mm1,%%mm3;\n" /* mm3 is mm1 masked to its min's */ + " por %%mm3,%%mm2;\n" + " movq %%mm2,%%mm1;\n" /* now mm1 is updated min's */ + + " .p2align 2;\n" + "1:\n" + " addl $4,%%edx;\n" /* now dx = top-4 */ + " cmpl %%edx,%%esi;\n" + " ja 5f;\n" + /* Here, there are >= 2 words of input remaining */ + " movd (%%esi),%%mm2;\n" + + " movq %%mm2,%%mm3;\n" + " pcmpgtw %%mm0,%%mm3;\n" /* mm3 is bitmask for words where mm2 > mm0 */ + " movq %%mm3,%%mm4;\n" + " pand %%mm2,%%mm3;\n" /* mm3 is mm2 masked to new max's */ + " pandn %%mm0,%%mm4;\n" /* mm4 is mm0 masked to its max's */ + " por %%mm3,%%mm4;\n" + " movq %%mm4,%%mm0;\n" /* now mm0 is updated max's */ + + " movq %%mm1,%%mm3;\n" + " pcmpgtw %%mm2,%%mm3;\n" /* mm3 is bitmask for words where mm2 < mm1 */ + " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new min's */ + " pandn %%mm1,%%mm3;\n" /* mm3 is mm1 masked to its min's */ + " por %%mm3,%%mm2;\n" + " movq %%mm2,%%mm1;\n" /* now mm1 is updated min's */ + + " addl $4,%%esi;\n" + + " .p2align 2;\n" + "5:\n" + /* Merge down the 2-word max/mins to 1 word */ + " movq %%mm0,%%mm2;\n" + " psrlq $16,%%mm2;\n" + " movq %%mm2,%%mm3;\n" + " pcmpgtw %%mm0,%%mm3;\n" /* mm3 is bitmask for words where mm2 > mm0 */ + " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new max's */ + " pandn %%mm0,%%mm3;\n" /* mm3 is mm0 masked to its max's */ + " por %%mm3,%%mm2;\n" + " movd %%mm2,%%ecx;\n" /* cx is max so far */ + + " movq %%mm1,%%mm2;\n" + " psrlq $16,%%mm2;\n" + " movq %%mm1,%%mm3;\n" + " pcmpgtw %%mm2,%%mm3;\n" /* mm3 is bitmask for words where mm2 < mm1 */ + " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new min's */ + " pandn %%mm1,%%mm3;\n" /* mm3 is mm1 masked to its min's */ + " por %%mm3,%%mm2;\n" + " movd %%mm2,%%eax;\n" /* ax is min so far */ + + " addl $2,%%edx;\n" /* now dx = top-2 */ + " cmpl %%edx,%%esi;\n" + " ja 6f;\n" + + /* Here, there is one word of input left */ + " cmpw (%%esi),%%cx;\n" + " jge 9f;\n" + " movw (%%esi),%%cx;\n" + " .p2align 2;\n" + "9:\n" + " cmpw (%%esi),%%ax;\n" + " jle 6f;\n" + " movw (%%esi),%%ax;\n" + + " .p2align 2;\n" + "6:\n" + /* (finally!) cx is the max, ax the min */ + " movswl %%cx,%%ecx;\n" + " movswl %%ax,%%eax;\n" + + " popl %%edx;\n" /* ptr to output max,min vals */ + " andl %%edx,%%edx;\n" + " jz 7f;\n" + " movw %%cx,(%%edx);\n" /* max */ + " movw %%ax,2(%%edx);\n" /* min */ + " .p2align 2;\n" + "7:\n" + /* Now calculate max absolute value */ + " negl %%eax;\n" + " cmpl %%ecx,%%eax;\n" + " jge 8f;\n" + " movl %%ecx,%%eax;\n" + " .p2align 2;\n" + "8:\n" + " emms;\n" + : "=a" (max) + : "S" (x), "a" (n), "d" (out), [lower] "m" (lower_bound), [upper] "m" (upper_bound) + : "ecx" + ); +#else + int i; + int16_t min; + int16_t max; + int16_t temp; + int32_t z; + + max = INT16_MIN; + min = INT16_MAX; + for (i = 0; i < n; i++) + { + temp = x[i]; + if (temp > max) + max = temp; + /*endif*/ + if (temp < min) + min = temp; + /*endif*/ + } + /*endfor*/ + if (out) + { + out[0] = max; + out[1] = min; + } + z = abs(min); + if (z > max) + return z; +#endif + return max; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/test-data/Makefile.am Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,28 @@ +## +## SpanDSP - a series of DSP components for telephony +## +## Makefile.am - Process this file with automake to produce Makefile.in +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU Lesser General Public License version 2.1, +## as published by the Free Software Foundation. +## +## 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 Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this program; if not, write to the Free Software +## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +## +## $Id: Makefile.am,v 1.3 2008/07/10 12:44:54 steveu Exp $ + +SUBDIRS = itu etsi + +DIST_SUBDIRS = itu etsi local + +all: + +clean: + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/Makefile.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/test-data/Makefile.in Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,519 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = test-data +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/config/ax_compiler_vendor.m4 \ + $(top_srcdir)/config/ax_check_real_file.m4 \ + $(top_srcdir)/config/ax_fixed_point_machine.m4 \ + $(top_srcdir)/config/ax_misaligned_access_fails.m4 \ + $(top_srcdir)/config/ax_c99_features.m4 \ + $(top_srcdir)/config/ax_check_export_capability.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_FOR_BUILD = @CC_FOR_BUILD@ +CFLAGS = @CFLAGS@ +COMP_VENDOR_CFLAGS = @COMP_VENDOR_CFLAGS@ +COMP_VENDOR_LDFLAGS = @COMP_VENDOR_LDFLAGS@ +COND_DOC_FALSE = @COND_DOC_FALSE@ +COND_DOC_TRUE = @COND_DOC_TRUE@ +COND_MMX_FALSE = @COND_MMX_FALSE@ +COND_MMX_TRUE = @COND_MMX_TRUE@ +COND_SSE2_FALSE = @COND_SSE2_FALSE@ +COND_SSE2_TRUE = @COND_SSE2_TRUE@ +COND_SSE3_FALSE = @COND_SSE3_FALSE@ +COND_SSE3_TRUE = @COND_SSE3_TRUE@ +COND_SSE4A_FALSE = @COND_SSE4A_FALSE@ +COND_SSE4A_TRUE = @COND_SSE4A_TRUE@ +COND_SSE4_1_FALSE = @COND_SSE4_1_FALSE@ +COND_SSE4_1_TRUE = @COND_SSE4_1_TRUE@ +COND_SSE4_2_FALSE = @COND_SSE4_2_FALSE@ +COND_SSE4_2_TRUE = @COND_SSE4_2_TRUE@ +COND_SSE5_FALSE = @COND_SSE5_FALSE@ +COND_SSE5_TRUE = @COND_SSE5_TRUE@ +COND_SSE_FALSE = @COND_SSE_FALSE@ +COND_SSE_TRUE = @COND_SSE_TRUE@ +COND_SSSE3_FALSE = @COND_SSSE3_FALSE@ +COND_SSSE3_TRUE = @COND_SSSE3_TRUE@ +COND_TESTDATA_FALSE = @COND_TESTDATA_FALSE@ +COND_TESTDATA_TRUE = @COND_TESTDATA_TRUE@ +COND_TESTS_FALSE = @COND_TESTS_FALSE@ +COND_TESTS_TRUE = @COND_TESTS_TRUE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSERT_INTTYPES_HEADER = @INSERT_INTTYPES_HEADER@ +INSERT_MATH_HEADER = @INSERT_MATH_HEADER@ +INSERT_STDINT_HEADER = @INSERT_STDINT_HEADER@ +INSERT_TGMATH_HEADER = @INSERT_TGMATH_HEADER@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIMLIBS = @SIMLIBS@ +SPANDSP_LT_AGE = @SPANDSP_LT_AGE@ +SPANDSP_LT_CURRENT = @SPANDSP_LT_CURRENT@ +SPANDSP_LT_REVISION = @SPANDSP_LT_REVISION@ +SPANDSP_MISALIGNED_ACCESS_FAILS = @SPANDSP_MISALIGNED_ACCESS_FAILS@ +SPANDSP_USE_EXPORT_CAPABILITY = @SPANDSP_USE_EXPORT_CAPABILITY@ +SPANDSP_USE_FIXED_POINT = @SPANDSP_USE_FIXED_POINT@ +STRIP = @STRIP@ +TESTLIBS = @TESTLIBS@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DSYMUTIL = @ac_ct_DSYMUTIL@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_NMEDIT = @ac_ct_NMEDIT@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +SUBDIRS = itu etsi +DIST_SUBDIRS = itu etsi local +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test-data/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu test-data/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-libtool \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + + +all: + +clean: +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/etsi/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/test-data/etsi/Makefile.am Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,28 @@ +## +## SpanDSP - a series of DSP components for telephony +## +## Makefile.am -- Process this file with automake to produce Makefile.in +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU Lesser General Public License version 2.1, +## as published by the Free Software Foundation. +## +## 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 Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this program; if not, write to the Free Software +## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +## +## $Id: Makefile.am,v 1.4 2008/07/10 12:44:54 steveu Exp $ + +SUBDIRS = fax + +DIST_SUBDIRS = fax + +all: + +clean: + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/etsi/Makefile.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/test-data/etsi/Makefile.in Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,519 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = test-data/etsi +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/config/ax_compiler_vendor.m4 \ + $(top_srcdir)/config/ax_check_real_file.m4 \ + $(top_srcdir)/config/ax_fixed_point_machine.m4 \ + $(top_srcdir)/config/ax_misaligned_access_fails.m4 \ + $(top_srcdir)/config/ax_c99_features.m4 \ + $(top_srcdir)/config/ax_check_export_capability.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_FOR_BUILD = @CC_FOR_BUILD@ +CFLAGS = @CFLAGS@ +COMP_VENDOR_CFLAGS = @COMP_VENDOR_CFLAGS@ +COMP_VENDOR_LDFLAGS = @COMP_VENDOR_LDFLAGS@ +COND_DOC_FALSE = @COND_DOC_FALSE@ +COND_DOC_TRUE = @COND_DOC_TRUE@ +COND_MMX_FALSE = @COND_MMX_FALSE@ +COND_MMX_TRUE = @COND_MMX_TRUE@ +COND_SSE2_FALSE = @COND_SSE2_FALSE@ +COND_SSE2_TRUE = @COND_SSE2_TRUE@ +COND_SSE3_FALSE = @COND_SSE3_FALSE@ +COND_SSE3_TRUE = @COND_SSE3_TRUE@ +COND_SSE4A_FALSE = @COND_SSE4A_FALSE@ +COND_SSE4A_TRUE = @COND_SSE4A_TRUE@ +COND_SSE4_1_FALSE = @COND_SSE4_1_FALSE@ +COND_SSE4_1_TRUE = @COND_SSE4_1_TRUE@ +COND_SSE4_2_FALSE = @COND_SSE4_2_FALSE@ +COND_SSE4_2_TRUE = @COND_SSE4_2_TRUE@ +COND_SSE5_FALSE = @COND_SSE5_FALSE@ +COND_SSE5_TRUE = @COND_SSE5_TRUE@ +COND_SSE_FALSE = @COND_SSE_FALSE@ +COND_SSE_TRUE = @COND_SSE_TRUE@ +COND_SSSE3_FALSE = @COND_SSSE3_FALSE@ +COND_SSSE3_TRUE = @COND_SSSE3_TRUE@ +COND_TESTDATA_FALSE = @COND_TESTDATA_FALSE@ +COND_TESTDATA_TRUE = @COND_TESTDATA_TRUE@ +COND_TESTS_FALSE = @COND_TESTS_FALSE@ +COND_TESTS_TRUE = @COND_TESTS_TRUE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSERT_INTTYPES_HEADER = @INSERT_INTTYPES_HEADER@ +INSERT_MATH_HEADER = @INSERT_MATH_HEADER@ +INSERT_STDINT_HEADER = @INSERT_STDINT_HEADER@ +INSERT_TGMATH_HEADER = @INSERT_TGMATH_HEADER@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIMLIBS = @SIMLIBS@ +SPANDSP_LT_AGE = @SPANDSP_LT_AGE@ +SPANDSP_LT_CURRENT = @SPANDSP_LT_CURRENT@ +SPANDSP_LT_REVISION = @SPANDSP_LT_REVISION@ +SPANDSP_MISALIGNED_ACCESS_FAILS = @SPANDSP_MISALIGNED_ACCESS_FAILS@ +SPANDSP_USE_EXPORT_CAPABILITY = @SPANDSP_USE_EXPORT_CAPABILITY@ +SPANDSP_USE_FIXED_POINT = @SPANDSP_USE_FIXED_POINT@ +STRIP = @STRIP@ +TESTLIBS = @TESTLIBS@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DSYMUTIL = @ac_ct_DSYMUTIL@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_NMEDIT = @ac_ct_NMEDIT@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +SUBDIRS = fax +DIST_SUBDIRS = fax +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test-data/etsi/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu test-data/etsi/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-libtool \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + + +all: + +clean: +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/etsi/fax/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/test-data/etsi/fax/Makefile.am Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,61 @@ +## +## SpanDSP - a series of DSP components for telephony +## +## Makefile.am -- Process this file with automake to produce Makefile.in +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License version 2, as +## published by the Free Software Foundation. +## +## 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., 675 Mass Ave, Cambridge, MA 02139, USA. +## +## $Id: Makefile.am,v 1.4 2009/02/25 17:52:51 steveu Exp $ + +AM_CFLAGS = $(COMP_VENDOR_CFLAGS) + +PBM2G3 = pbmtog3 +FAX2TIFF = fax2tiff +TIFFCP = tiffcp + +ETSI_TEST_PAGES = etsi_300_242_a4_diago1.tif \ + etsi_300_242_a4_diago2.tif \ + etsi_300_242_a4_duration1.tif \ + etsi_300_242_a4_duration2.tif \ + etsi_300_242_a4_error.tif \ + etsi_300_242_a4_impress.tif \ + etsi_300_242_a4_impress_white.tif \ + etsi_300_242_a4_stairstep.tif \ + etsi_300_242_a4_white.tif \ + etsi_300_242_a4_white_2p.tif + +EXTRA_DIST = + +MAINTAINERCLEANFILES = Makefile.in + +LIBDIR = -L$(top_builddir)/src + +nobase_data_DATA = ${ETSI_TEST_PAGES} + +noinst_PROGRAMS = generate_etsi_300_242_pages + +generate_etsi_300_242_pages_SOURCES = generate_etsi_300_242_pages.c +generate_etsi_300_242_pages_LDADD = $(LIBDIR) -lspandsp -ltiff + +clean: + rm -f *.tif *.g3 + +.g3.tif: + ${FAX2TIFF} -M -o $*.tif $*.g3 + +.pbm.g3: + ${PBM2G3} $*.pbm >$*.g3 + +${ETSI_TEST_PAGES}: generate_etsi_300_242_pages$(EXEEXT) + ./generate_etsi_300_242_pages$(EXEEXT) diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/etsi/fax/Makefile.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/test-data/etsi/fax/Makefile.in Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,535 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +noinst_PROGRAMS = generate_etsi_300_242_pages$(EXEEXT) +subdir = test-data/etsi/fax +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/config/ax_compiler_vendor.m4 \ + $(top_srcdir)/config/ax_check_real_file.m4 \ + $(top_srcdir)/config/ax_fixed_point_machine.m4 \ + $(top_srcdir)/config/ax_misaligned_access_fails.m4 \ + $(top_srcdir)/config/ax_c99_features.m4 \ + $(top_srcdir)/config/ax_check_export_capability.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am_generate_etsi_300_242_pages_OBJECTS = \ + generate_etsi_300_242_pages.$(OBJEXT) +generate_etsi_300_242_pages_OBJECTS = \ + $(am_generate_etsi_300_242_pages_OBJECTS) +am__DEPENDENCIES_1 = +generate_etsi_300_242_pages_DEPENDENCIES = $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(generate_etsi_300_242_pages_SOURCES) +DIST_SOURCES = $(generate_etsi_300_242_pages_SOURCES) +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(datadir)" +nobase_dataDATA_INSTALL = $(install_sh_DATA) +DATA = $(nobase_data_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_FOR_BUILD = @CC_FOR_BUILD@ +CFLAGS = @CFLAGS@ +COMP_VENDOR_CFLAGS = @COMP_VENDOR_CFLAGS@ +COMP_VENDOR_LDFLAGS = @COMP_VENDOR_LDFLAGS@ +COND_DOC_FALSE = @COND_DOC_FALSE@ +COND_DOC_TRUE = @COND_DOC_TRUE@ +COND_MMX_FALSE = @COND_MMX_FALSE@ +COND_MMX_TRUE = @COND_MMX_TRUE@ +COND_SSE2_FALSE = @COND_SSE2_FALSE@ +COND_SSE2_TRUE = @COND_SSE2_TRUE@ +COND_SSE3_FALSE = @COND_SSE3_FALSE@ +COND_SSE3_TRUE = @COND_SSE3_TRUE@ +COND_SSE4A_FALSE = @COND_SSE4A_FALSE@ +COND_SSE4A_TRUE = @COND_SSE4A_TRUE@ +COND_SSE4_1_FALSE = @COND_SSE4_1_FALSE@ +COND_SSE4_1_TRUE = @COND_SSE4_1_TRUE@ +COND_SSE4_2_FALSE = @COND_SSE4_2_FALSE@ +COND_SSE4_2_TRUE = @COND_SSE4_2_TRUE@ +COND_SSE5_FALSE = @COND_SSE5_FALSE@ +COND_SSE5_TRUE = @COND_SSE5_TRUE@ +COND_SSE_FALSE = @COND_SSE_FALSE@ +COND_SSE_TRUE = @COND_SSE_TRUE@ +COND_SSSE3_FALSE = @COND_SSSE3_FALSE@ +COND_SSSE3_TRUE = @COND_SSSE3_TRUE@ +COND_TESTDATA_FALSE = @COND_TESTDATA_FALSE@ +COND_TESTDATA_TRUE = @COND_TESTDATA_TRUE@ +COND_TESTS_FALSE = @COND_TESTS_FALSE@ +COND_TESTS_TRUE = @COND_TESTS_TRUE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSERT_INTTYPES_HEADER = @INSERT_INTTYPES_HEADER@ +INSERT_MATH_HEADER = @INSERT_MATH_HEADER@ +INSERT_STDINT_HEADER = @INSERT_STDINT_HEADER@ +INSERT_TGMATH_HEADER = @INSERT_TGMATH_HEADER@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIMLIBS = @SIMLIBS@ +SPANDSP_LT_AGE = @SPANDSP_LT_AGE@ +SPANDSP_LT_CURRENT = @SPANDSP_LT_CURRENT@ +SPANDSP_LT_REVISION = @SPANDSP_LT_REVISION@ +SPANDSP_MISALIGNED_ACCESS_FAILS = @SPANDSP_MISALIGNED_ACCESS_FAILS@ +SPANDSP_USE_EXPORT_CAPABILITY = @SPANDSP_USE_EXPORT_CAPABILITY@ +SPANDSP_USE_FIXED_POINT = @SPANDSP_USE_FIXED_POINT@ +STRIP = @STRIP@ +TESTLIBS = @TESTLIBS@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DSYMUTIL = @ac_ct_DSYMUTIL@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_NMEDIT = @ac_ct_NMEDIT@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AM_CFLAGS = $(COMP_VENDOR_CFLAGS) +PBM2G3 = pbmtog3 +FAX2TIFF = fax2tiff +TIFFCP = tiffcp +ETSI_TEST_PAGES = etsi_300_242_a4_diago1.tif \ + etsi_300_242_a4_diago2.tif \ + etsi_300_242_a4_duration1.tif \ + etsi_300_242_a4_duration2.tif \ + etsi_300_242_a4_error.tif \ + etsi_300_242_a4_impress.tif \ + etsi_300_242_a4_impress_white.tif \ + etsi_300_242_a4_stairstep.tif \ + etsi_300_242_a4_white.tif \ + etsi_300_242_a4_white_2p.tif + +EXTRA_DIST = +MAINTAINERCLEANFILES = Makefile.in +LIBDIR = -L$(top_builddir)/src +nobase_data_DATA = ${ETSI_TEST_PAGES} +generate_etsi_300_242_pages_SOURCES = generate_etsi_300_242_pages.c +generate_etsi_300_242_pages_LDADD = $(LIBDIR) -lspandsp -ltiff +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .g3 .lo .o .obj .pbm .tif +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test-data/etsi/fax/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu test-data/etsi/fax/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +generate_etsi_300_242_pages$(EXEEXT): $(generate_etsi_300_242_pages_OBJECTS) $(generate_etsi_300_242_pages_DEPENDENCIES) + @rm -f generate_etsi_300_242_pages$(EXEEXT) + $(LINK) $(generate_etsi_300_242_pages_LDFLAGS) $(generate_etsi_300_242_pages_OBJECTS) $(generate_etsi_300_242_pages_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generate_etsi_300_242_pages.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-nobase_dataDATA: $(nobase_data_DATA) + @$(NORMAL_INSTALL) + test -z "$(datadir)" || $(mkdir_p) "$(DESTDIR)$(datadir)" + @$(am__vpath_adj_setup) \ + list='$(nobase_data_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + $(am__vpath_adj) \ + echo " $(nobase_dataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(datadir)/$$f'"; \ + $(nobase_dataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(datadir)/$$f"; \ + done + +uninstall-nobase_dataDATA: + @$(NORMAL_UNINSTALL) + @$(am__vpath_adj_setup) \ + list='$(nobase_data_DATA)'; for p in $$list; do \ + $(am__vpath_adj) \ + echo " rm -f '$(DESTDIR)$(datadir)/$$f'"; \ + rm -f "$(DESTDIR)$(datadir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(datadir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-nobase_dataDATA + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-nobase_dataDATA + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-nobase_dataDATA install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-nobase_dataDATA + + +clean: + rm -f *.tif *.g3 + +.g3.tif: + ${FAX2TIFF} -M -o $*.tif $*.g3 + +.pbm.g3: + ${PBM2G3} $*.pbm >$*.g3 + +${ETSI_TEST_PAGES}: generate_etsi_300_242_pages$(EXEEXT) + ./generate_etsi_300_242_pages$(EXEEXT) +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/etsi/fax/generate_etsi_300_242_pages.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/test-data/etsi/fax/generate_etsi_300_242_pages.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,690 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * generate_etsi_300_242_pages.c - Create the test pages defined in ETSI ETS 300 242. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: generate_etsi_300_242_pages.c,v 1.5 2009/03/23 14:34:13 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif + +#include "spandsp.h" + +struct +{ + const char *name; + int x_res; + int y_res; + int width; + int length; + int compression; + int type; +} sequence[] = +{ + { + "etsi_300_242_a4_diago1.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_A4, + 1100, + COMPRESSION_CCITT_T4, + 0 + }, + { + "etsi_300_242_a4_diago2.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_A4, + 1100, + COMPRESSION_CCITT_T4, + 1 + }, + { + "etsi_300_242_a4_duration1.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_A4, + 1100, + COMPRESSION_CCITT_T4, + 2 + }, + { + "etsi_300_242_a4_duration2.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_A4, + 1100, + COMPRESSION_CCITT_T4, + 3 + }, + { + "etsi_300_242_a4_error.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_A4, + 1100, + COMPRESSION_CCITT_T4, + 4 + }, + { + "etsi_300_242_a4_impress.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_A4, + 1100, + COMPRESSION_CCITT_T4, + 5 + }, + { + "etsi_300_242_a4_stairstep.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_A4, + 1100, + COMPRESSION_CCITT_T4, + 6 + }, + { + "etsi_300_242_a4_white.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_A4, + 1100, + COMPRESSION_CCITT_T4, + 7 + }, + { + "etsi_300_242_a4_white_2p.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_A4, + 1100, + COMPRESSION_CCITT_T4, + 7 + }, + { /* Second page of the above file */ + "", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_A4, + 1100, + COMPRESSION_CCITT_T4, + 7 + }, + { + "etsi_300_242_a4_impress_white.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_A4, + 1100, + COMPRESSION_CCITT_T4, + 5 + }, + { /* Second page of the above file */ + "", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_A4, + 1100, + COMPRESSION_CCITT_T4, + 7 + }, + { + NULL, + 0, + 0, + 0, + 0 + }, +}; + +int photo_metric = PHOTOMETRIC_MINISWHITE; +int fill_order = FILLORDER_LSB2MSB; + +static void clear_row(uint8_t buf[], int width) +{ + memset(buf, 0, width/8 + 1); +} +/*- End of function --------------------------------------------------------*/ + +static void set_pixel(uint8_t buf[], int row, int pixel) +{ + row--; + buf[row*1728/8 + pixel/8] |= (0x80 >> (pixel & 0x07)); +} +/*- End of function --------------------------------------------------------*/ + +static void clear_pixel(uint8_t buf[], int row, int pixel) +{ + row--; + buf[row*1728/8 + pixel/8] &= ~(0x80 >> (pixel & 0x07)); +} +/*- End of function --------------------------------------------------------*/ + +static void set_pixel_range(uint8_t buf[], int row, int start, int end) +{ + int i; + + for (i = start; i <= end; i++) + set_pixel(buf, row, i); +} +/*- End of function --------------------------------------------------------*/ + +static void clear_pixel_range(uint8_t buf[], int row, int start, int end) +{ + int i; + + for (i = start; i <= end; i++) + clear_pixel(buf, row, i); +} +/*- End of function --------------------------------------------------------*/ + +static int create_white_page(TIFF *tiff_file) +{ + uint8_t image_buffer[8192]; + int row; + + /* TSB-85 WHITE page. */ + for (row = 0; row < 1100; row++) + { + clear_row(image_buffer, 1728); + if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + } + return 1100; +} +/*- End of function --------------------------------------------------------*/ + +static int create_stairstep_page(TIFF *tiff_file) +{ + uint8_t image_buffer[8192]; + int row; + int start_pixel; + int i; + + /* TSB-85 STAIRSTEP page. */ + start_pixel = 0; + for (row = 0; row < 1728; row++) + { + clear_row(image_buffer, 1728); + set_pixel_range(image_buffer, 1, start_pixel, start_pixel + 63); + if (photo_metric != PHOTOMETRIC_MINISWHITE) + { + for (i = 0; i < 1728/8; i++) + image_buffer[i] = ~image_buffer[i]; + } +#if 0 + if (fill_order != FILLORDER_LSB2MSB) + bit_reverse(image_buffer, image_buffer, 1728/8); +#endif + if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + start_pixel += 64; + if (start_pixel >= 1728) + start_pixel = 0; + } + return 1728; +} +/*- End of function --------------------------------------------------------*/ + +static int create_diago1_page(TIFF *tiff_file) +{ + uint8_t image_buffer[1728/8]; + int row; + + /* ETSI ETS 300 242 B.5.1 One dimensional coding test chart - the DIAGO1 page. */ + for (row = 0; row < 1001; row++) + { + clear_row(image_buffer, 1728); + set_pixel_range(image_buffer, 1, row, 1727); + if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + } + clear_row(image_buffer, 1728); + set_pixel_range(image_buffer, 1, 0, 1727); + if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + return 1002; +} +/*- End of function --------------------------------------------------------*/ + +static int create_diago2_page(TIFF *tiff_file) +{ + uint8_t image_buffer[1728/8]; + int row; + + /* ETSI ETS 300 242 B.5.1 One dimensional coding test chart - the DIAGO2 page. */ + for (row = 0; row < 1001; row++) + { + clear_row(image_buffer, 1728); + set_pixel_range(image_buffer, 1, row + 728, 1727); + if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + } + clear_row(image_buffer, 1728); + set_pixel_range(image_buffer, 1, 0, 1727); + if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + return 1002; +} +/*- End of function --------------------------------------------------------*/ + +static int create_impress_page(TIFF *tiff_file) +{ + int j; + int row; + uint8_t *page; + + /* ETSI ETS 300 242 B.5.2 Printing resolution - the IMPRESS page */ + if ((page = malloc(1079*1728/8)) == NULL) + return 0; + memset(page, 0, 1079*1728/8); + + set_pixel_range(page, 1, 0, 1727); + for (row = 2; row <= 78; row++) + { + set_pixel_range(page, row, 850, 850 + 27); + set_pixel_range(page, row, 850 + 27 + 745, 850 + 27 + 745 + 26); + } + for (row = 80; row <= 117; row++) + { + for (j = 0; j < 1728; j += 2) + set_pixel(page, row, j); + } + for (row = 118; row <= 155; row++) + { + for (j = 1; j < 1728; j += 2) + set_pixel(page, row, j); + } + for (row = 194; row <= 231; row += 2) + set_pixel_range(page, row, 0, 1727); + for (row = 270; row <= 276; row++) + set_pixel_range(page, row, 60, 60 + 1607); + for (j = 0; j < 1728; j += 27) + set_pixel(page, 315, j); + for (row = 354; row <= 480; row++) + set_pixel_range(page, row, 209, 768); + for (row = 358; row <= 476; row++) + clear_pixel_range(page, row, 488, 489); + clear_pixel_range(page, 417, 217, 760); + + for (row = 354; row <= 357; row++) + set_pixel_range(page, row, 962, 1521); + for (row = 477; row <= 480; row++) + set_pixel_range(page, row, 962, 1521); + for (row = 358; row <= 476; row++) + set_pixel_range(page, row, 962, 969); + for (row = 358; row <= 476; row++) + set_pixel_range(page, row, 1514, 1521); + for (row = 358; row <= 476; row++) + set_pixel(page, row, 1241); + set_pixel_range(page, 417, 970, 1513); + + for (row = 354; row <= 1079; row++) + set_pixel(page, row, 864); + for (row = 157; row <= 926; row++) + set_pixel_range(page, row, 884, 899); + for (row = 0; row < 1079; row++) + { + if (TIFFWriteScanline(tiff_file, page + row*1728/8, row, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + } + free(page); + return 1079; +} +/*- End of function --------------------------------------------------------*/ + +static int create_duration1_page(TIFF *tiff_file) +{ + uint8_t image_buffer[1728/8]; + int row; + int i; + + /* ETSI ETS 300 242 B.5.3 Acceptance of total coded scan line duration - the DURATION1 page */ + row = 0; + clear_row(image_buffer, 1728); + set_pixel_range(image_buffer, 1, 0, 1727); + if (TIFFWriteScanline(tiff_file, image_buffer, row++, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + for ( ; row < 117; row++) + { + clear_row(image_buffer, 1728); + if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + } + clear_row(image_buffer, 1728); + set_pixel_range(image_buffer, 1, 0, 1727); + if (TIFFWriteScanline(tiff_file, image_buffer, row++, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + clear_row(image_buffer, 1728); + for (i = 1; i < 1728; i += 2) + set_pixel(image_buffer, 1, i); + if (TIFFWriteScanline(tiff_file, image_buffer, row++, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + clear_row(image_buffer, 1728); + set_pixel_range(image_buffer, 1, 0, 1727); + if (TIFFWriteScanline(tiff_file, image_buffer, row++, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + for ( ; row < 236; row++) + { + clear_row(image_buffer, 1728); + if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + } + clear_row(image_buffer, 1728); + set_pixel_range(image_buffer, 1, 0, 1727); + if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + return 237; +} +/*- End of function --------------------------------------------------------*/ + +static int create_duration2_page(TIFF *tiff_file) +{ + return create_duration1_page(tiff_file); +} +/*- End of function --------------------------------------------------------*/ + +static int create_error_page(TIFF *tiff_file) +{ + uint8_t image_buffer[1728/8]; + int row; + int start_pixel; + int i; + + /* ETSI ETS 300 242 B.5.4 Copy quality criteria - the ERROR page. */ + for (row = 0; row < 68; row++) + { + clear_row(image_buffer, 1728); + if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + } + + clear_row(image_buffer, 1728); + set_pixel_range(image_buffer, 1, 0, 1727); + if (TIFFWriteScanline(tiff_file, image_buffer, row++, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + + clear_row(image_buffer, 1728); + if (TIFFWriteScanline(tiff_file, image_buffer, row++, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + + for (i = 0; i < 10; i++) + { + for (start_pixel = 16; start_pixel <= 1616; start_pixel += 64) + { + clear_row(image_buffer, 1728); + set_pixel_range(image_buffer, 1, start_pixel, start_pixel + 63); + if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + row++; + } + } + + clear_row(image_buffer, 1728); + if (TIFFWriteScanline(tiff_file, image_buffer, row++, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + + clear_row(image_buffer, 1728); + set_pixel_range(image_buffer, 1, 0, 1727); + if (TIFFWriteScanline(tiff_file, image_buffer, row++, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + + for (row = 332; row < 400; row++) + { + clear_row(image_buffer, 1728); + if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + } + + return 400; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int row; + TIFF *tiff_file; + struct tm *tm; + time_t now; + char buf[133]; + float x_resolution; + float y_resolution; + int i; + int image_length; + int opt; + int compression; + + compression = T4_COMPRESSION_ITU_T6; + photo_metric = PHOTOMETRIC_MINISWHITE; + fill_order = FILLORDER_LSB2MSB; + while ((opt = getopt(argc, argv, "126ir")) != -1) + { + switch (opt) + { + case '1': + compression = T4_COMPRESSION_ITU_T4_1D; + break; + case '2': + compression = T4_COMPRESSION_ITU_T4_2D; + break; + case '6': + compression = T4_COMPRESSION_ITU_T6; + break; + case 'i': + photo_metric = PHOTOMETRIC_MINISBLACK; + break; + case 'r': + fill_order = FILLORDER_MSB2LSB; + break; + default: + //usage(); + exit(2); + break; + } + } + + tiff_file = NULL; + for (i = 0; sequence[i].name; i++) + { + if (sequence[i].name[0]) + { + if (tiff_file) + TIFFClose(tiff_file); + if ((tiff_file = TIFFOpen(sequence[i].name, "w")) == NULL) + exit(2); + } + /* Prepare the directory entry fully before writing the image, or libtiff complains */ + TIFFSetField(tiff_file, TIFFTAG_COMPRESSION, sequence[i].compression); + if (sequence[i].compression == COMPRESSION_CCITT_T4) + { + TIFFSetField(tiff_file, TIFFTAG_T4OPTIONS, GROUP3OPT_FILLBITS); // | GROUP3OPT_2DENCODING); + TIFFSetField(tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF); + } + TIFFSetField(tiff_file, TIFFTAG_IMAGEWIDTH, sequence[i].width); + TIFFSetField(tiff_file, TIFFTAG_BITSPERSAMPLE, 1); + TIFFSetField(tiff_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); + TIFFSetField(tiff_file, TIFFTAG_SAMPLESPERPIXEL, 1); + TIFFSetField(tiff_file, TIFFTAG_ROWSPERSTRIP, -1L); + TIFFSetField(tiff_file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); + TIFFSetField(tiff_file, TIFFTAG_PHOTOMETRIC, photo_metric); + TIFFSetField(tiff_file, TIFFTAG_FILLORDER, fill_order); + x_resolution = sequence[i].x_res/100.0f; + y_resolution = sequence[i].y_res/100.0f; + TIFFSetField(tiff_file, TIFFTAG_XRESOLUTION, floorf(x_resolution*2.54f + 0.5f)); + TIFFSetField(tiff_file, TIFFTAG_YRESOLUTION, floorf(y_resolution*2.54f + 0.5f)); + TIFFSetField(tiff_file, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); + + TIFFSetField(tiff_file, TIFFTAG_SOFTWARE, "spandsp"); + if (gethostname(buf, sizeof(buf)) == 0) + TIFFSetField(tiff_file, TIFFTAG_HOSTCOMPUTER, buf); + + TIFFSetField(tiff_file, TIFFTAG_IMAGEDESCRIPTION, "Blank test image"); + TIFFSetField(tiff_file, TIFFTAG_MAKE, "soft-switch.org"); + TIFFSetField(tiff_file, TIFFTAG_MODEL, "test data"); + + time(&now); + tm = localtime(&now); + sprintf(buf, + "%4d/%02d/%02d %02d:%02d:%02d", + tm->tm_year + 1900, + tm->tm_mon + 1, + tm->tm_mday, + tm->tm_hour, + tm->tm_min, + tm->tm_sec); + TIFFSetField(tiff_file, TIFFTAG_DATETIME, buf); + image_length = sequence[i].length; + + /* Write the image first.... */ + row = 0; + switch (sequence[i].type) + { + case 0: + /* The DIAGO1 page */ + image_length = create_diago1_page(tiff_file); + break; + case 1: + /* The DIAGO2 page */ + image_length = create_diago2_page(tiff_file); + break; + case 2: + /* The DURATION1 page */ + image_length = create_duration1_page(tiff_file); + break; + case 3: + /* The DURATION2 page */ + image_length = create_duration2_page(tiff_file); + break; + case 4: + /* The ERROR page */ + image_length = create_error_page(tiff_file); + break; + case 5: + /* The IMPRESS page */ + image_length = create_impress_page(tiff_file); + break; + case 6: + /* A stairstep of 64 pixel dashes */ + image_length = create_stairstep_page(tiff_file); + break; + case 7: + /* A white A4 page */ + image_length = create_white_page(tiff_file); + break; + } + /* ....then the directory entry, and libtiff is happy. */ + TIFFSetField(tiff_file, TIFFTAG_IMAGELENGTH, image_length); + TIFFSetField(tiff_file, TIFFTAG_PAGENUMBER, 0, 1); + TIFFSetField(tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN); + + TIFFWriteDirectory(tiff_file); + } + if (tiff_file) + TIFFClose(tiff_file); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/itu/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/test-data/itu/Makefile.am Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,28 @@ +## +## SpanDSP - a series of DSP components for telephony +## +## Makefile.am - Process this file with automake to produce Makefile.in +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU Lesser General Public License version 2.1, +## as published by the Free Software Foundation. +## +## 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 Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this program; if not, write to the Free Software +## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +## +## $Id: Makefile.am,v 1.3 2008/05/03 10:26:15 steveu Exp $ + +SUBDIRS = fax + +DIST_SUBDIRS = fax + +all: + +clean: + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/itu/Makefile.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/test-data/itu/Makefile.in Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,519 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = test-data/itu +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/config/ax_compiler_vendor.m4 \ + $(top_srcdir)/config/ax_check_real_file.m4 \ + $(top_srcdir)/config/ax_fixed_point_machine.m4 \ + $(top_srcdir)/config/ax_misaligned_access_fails.m4 \ + $(top_srcdir)/config/ax_c99_features.m4 \ + $(top_srcdir)/config/ax_check_export_capability.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_FOR_BUILD = @CC_FOR_BUILD@ +CFLAGS = @CFLAGS@ +COMP_VENDOR_CFLAGS = @COMP_VENDOR_CFLAGS@ +COMP_VENDOR_LDFLAGS = @COMP_VENDOR_LDFLAGS@ +COND_DOC_FALSE = @COND_DOC_FALSE@ +COND_DOC_TRUE = @COND_DOC_TRUE@ +COND_MMX_FALSE = @COND_MMX_FALSE@ +COND_MMX_TRUE = @COND_MMX_TRUE@ +COND_SSE2_FALSE = @COND_SSE2_FALSE@ +COND_SSE2_TRUE = @COND_SSE2_TRUE@ +COND_SSE3_FALSE = @COND_SSE3_FALSE@ +COND_SSE3_TRUE = @COND_SSE3_TRUE@ +COND_SSE4A_FALSE = @COND_SSE4A_FALSE@ +COND_SSE4A_TRUE = @COND_SSE4A_TRUE@ +COND_SSE4_1_FALSE = @COND_SSE4_1_FALSE@ +COND_SSE4_1_TRUE = @COND_SSE4_1_TRUE@ +COND_SSE4_2_FALSE = @COND_SSE4_2_FALSE@ +COND_SSE4_2_TRUE = @COND_SSE4_2_TRUE@ +COND_SSE5_FALSE = @COND_SSE5_FALSE@ +COND_SSE5_TRUE = @COND_SSE5_TRUE@ +COND_SSE_FALSE = @COND_SSE_FALSE@ +COND_SSE_TRUE = @COND_SSE_TRUE@ +COND_SSSE3_FALSE = @COND_SSSE3_FALSE@ +COND_SSSE3_TRUE = @COND_SSSE3_TRUE@ +COND_TESTDATA_FALSE = @COND_TESTDATA_FALSE@ +COND_TESTDATA_TRUE = @COND_TESTDATA_TRUE@ +COND_TESTS_FALSE = @COND_TESTS_FALSE@ +COND_TESTS_TRUE = @COND_TESTS_TRUE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSERT_INTTYPES_HEADER = @INSERT_INTTYPES_HEADER@ +INSERT_MATH_HEADER = @INSERT_MATH_HEADER@ +INSERT_STDINT_HEADER = @INSERT_STDINT_HEADER@ +INSERT_TGMATH_HEADER = @INSERT_TGMATH_HEADER@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIMLIBS = @SIMLIBS@ +SPANDSP_LT_AGE = @SPANDSP_LT_AGE@ +SPANDSP_LT_CURRENT = @SPANDSP_LT_CURRENT@ +SPANDSP_LT_REVISION = @SPANDSP_LT_REVISION@ +SPANDSP_MISALIGNED_ACCESS_FAILS = @SPANDSP_MISALIGNED_ACCESS_FAILS@ +SPANDSP_USE_EXPORT_CAPABILITY = @SPANDSP_USE_EXPORT_CAPABILITY@ +SPANDSP_USE_FIXED_POINT = @SPANDSP_USE_FIXED_POINT@ +STRIP = @STRIP@ +TESTLIBS = @TESTLIBS@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DSYMUTIL = @ac_ct_DSYMUTIL@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_NMEDIT = @ac_ct_NMEDIT@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +SUBDIRS = fax +DIST_SUBDIRS = fax +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test-data/itu/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu test-data/itu/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-libtool \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + + +all: + +clean: +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/itu/fax/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/test-data/itu/fax/Makefile.am Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,149 @@ +## +## SpanDSP - a series of DSP components for telephony +## +## Makefile.am - Process this file with automake to produce Makefile.in +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License version 2, as +## as published by the Free Software Foundation. +## +## 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 +## License along with this program; if not, write to the Free Software +## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +## +## $Id: Makefile.am,v 1.5 2009/02/25 17:52:52 steveu Exp $ + +AM_CFLAGS = $(COMP_VENDOR_CFLAGS) +AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) + +PBM2G3 = pbmtog3 +FAX2TIFF = fax2tiff +TIFFCP = tiffcp + +ITU_TEST_PAGES_PBM = itu1.pbm \ + itu2.pbm \ + itu3.pbm \ + itu4.pbm \ + itu5.pbm \ + itu6.pbm \ + itu7.pbm \ + itu8.pbm \ + test1.pbm \ + test2.pbm \ + test3.pbm \ + test4.pbm + +ITU_TEST_PAGES_G3 = itu1.g3 \ + itu2.g3 \ + itu3.g3 \ + itu4.g3 \ + itu5.g3 \ + itu6.g3 \ + itu7.g3 \ + itu8.g3 \ + test1.g3 \ + test2.g3 \ + test3.g3 \ + test4.g3 + +ITU_TEST_PAGES = itu1.tif \ + itu2.tif \ + itu3.tif \ + itu4.tif \ + itu5.tif \ + itu6.tif \ + itu7.tif \ + itu8.tif \ + test1.tif \ + test2.tif \ + test3.tif \ + test4.tif + +MIXED_SIZE_PAGES = R1200_1200_A4.tif \ + R1200_1200_B4.tif \ + R1200_1200_A3.tif \ + R600_1200_A4.tif \ + R600_1200_B4.tif \ + R600_1200_A3.tif \ + R600_600_A4.tif \ + R600_600_B4.tif \ + R600_600_A3.tif \ + R16_800_A4.tif \ + R16_800_B4.tif \ + R16_800_A3.tif \ + R16_154_A4.tif \ + R16_154_B4.tif \ + R16_154_A3.tif \ + R300_600_A4.tif \ + R300_600_B4.tif \ + R300_600_A3.tif \ + R300_300_A4.tif \ + R300_300_B4.tif \ + R300_300_A3.tif \ + R8_154_A4.tif \ + R8_154_B4.tif \ + R8_154_A3.tif \ + R8_77_A4.tif \ + R8_77_B4.tif \ + R8_77_A3.tif \ + R8_385_A4.tif \ + R8_385_B4.tif \ + R8_385_A3.tif + +EXTRA_DIST = ${ITU_TEST_PAGES_PBM} + +MAINTAINERCLEANFILES = Makefile.in + +nobase_data_DATA = itutests.tif \ + ${ITU_TEST_PAGES} \ + dithered.tif \ + 100pages.tif \ + ${MIXED_SIZE_PAGES} \ + mixed_size_pages.tif + +noinst_PROGRAMS = generate_dithered_tif \ + generate_sized_pages + +generate_dithered_tif_SOURCES = generate_dithered_tif.c +generate_dithered_tif_LDADD = -ltiff + +generate_sized_pages_SOURCES = generate_sized_pages.c +generate_sized_pages_LDADD = -ltiff + +clean: + rm -f *.tif *.g3 + +itutests.tif: ${ITU_TEST_PAGES_G3} + $(FAX2TIFF) -M -o $@ ${ITU_TEST_PAGES_G3} + +100pages.tif: ${ITU_TEST_PAGES_G3} + $(FAX2TIFF) -M -o $@ \ + ${ITU_TEST_PAGES_G3} \ + ${ITU_TEST_PAGES_G3} \ + ${ITU_TEST_PAGES_G3} \ + ${ITU_TEST_PAGES_G3} \ + ${ITU_TEST_PAGES_G3} \ + ${ITU_TEST_PAGES_G3} \ + ${ITU_TEST_PAGES_G3} \ + ${ITU_TEST_PAGES_G3} \ + itu1.g3 itu2.g3 itu3.g3 itu4.g3 + +.g3.tif: + ${FAX2TIFF} -M -o $*.tif $*.g3 + +.pbm.g3: + ${PBM2G3} $*.pbm >$*.g3 + +dithered.tif: generate_dithered_tif$(EXEEXT) + ./generate_dithered_tif$(EXEEXT) + +${MIXED_SIZE_PAGES}: generate_sized_pages$(EXEEXT) + ./generate_sized_pages$(EXEEXT) + +mixed_size_pages.tif: ${MIXED_SIZE_PAGES} + $(TIFFCP) ${MIXED_SIZE_PAGES} $@ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/itu/fax/Makefile.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/test-data/itu/fax/Makefile.in Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,630 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +noinst_PROGRAMS = generate_dithered_tif$(EXEEXT) \ + generate_sized_pages$(EXEEXT) +subdir = test-data/itu/fax +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/config/ax_compiler_vendor.m4 \ + $(top_srcdir)/config/ax_check_real_file.m4 \ + $(top_srcdir)/config/ax_fixed_point_machine.m4 \ + $(top_srcdir)/config/ax_misaligned_access_fails.m4 \ + $(top_srcdir)/config/ax_c99_features.m4 \ + $(top_srcdir)/config/ax_check_export_capability.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am_generate_dithered_tif_OBJECTS = generate_dithered_tif.$(OBJEXT) +generate_dithered_tif_OBJECTS = $(am_generate_dithered_tif_OBJECTS) +generate_dithered_tif_DEPENDENCIES = +am_generate_sized_pages_OBJECTS = generate_sized_pages.$(OBJEXT) +generate_sized_pages_OBJECTS = $(am_generate_sized_pages_OBJECTS) +generate_sized_pages_DEPENDENCIES = +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(generate_dithered_tif_SOURCES) \ + $(generate_sized_pages_SOURCES) +DIST_SOURCES = $(generate_dithered_tif_SOURCES) \ + $(generate_sized_pages_SOURCES) +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(datadir)" +nobase_dataDATA_INSTALL = $(install_sh_DATA) +DATA = $(nobase_data_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_FOR_BUILD = @CC_FOR_BUILD@ +CFLAGS = @CFLAGS@ +COMP_VENDOR_CFLAGS = @COMP_VENDOR_CFLAGS@ +COMP_VENDOR_LDFLAGS = @COMP_VENDOR_LDFLAGS@ +COND_DOC_FALSE = @COND_DOC_FALSE@ +COND_DOC_TRUE = @COND_DOC_TRUE@ +COND_MMX_FALSE = @COND_MMX_FALSE@ +COND_MMX_TRUE = @COND_MMX_TRUE@ +COND_SSE2_FALSE = @COND_SSE2_FALSE@ +COND_SSE2_TRUE = @COND_SSE2_TRUE@ +COND_SSE3_FALSE = @COND_SSE3_FALSE@ +COND_SSE3_TRUE = @COND_SSE3_TRUE@ +COND_SSE4A_FALSE = @COND_SSE4A_FALSE@ +COND_SSE4A_TRUE = @COND_SSE4A_TRUE@ +COND_SSE4_1_FALSE = @COND_SSE4_1_FALSE@ +COND_SSE4_1_TRUE = @COND_SSE4_1_TRUE@ +COND_SSE4_2_FALSE = @COND_SSE4_2_FALSE@ +COND_SSE4_2_TRUE = @COND_SSE4_2_TRUE@ +COND_SSE5_FALSE = @COND_SSE5_FALSE@ +COND_SSE5_TRUE = @COND_SSE5_TRUE@ +COND_SSE_FALSE = @COND_SSE_FALSE@ +COND_SSE_TRUE = @COND_SSE_TRUE@ +COND_SSSE3_FALSE = @COND_SSSE3_FALSE@ +COND_SSSE3_TRUE = @COND_SSSE3_TRUE@ +COND_TESTDATA_FALSE = @COND_TESTDATA_FALSE@ +COND_TESTDATA_TRUE = @COND_TESTDATA_TRUE@ +COND_TESTS_FALSE = @COND_TESTS_FALSE@ +COND_TESTS_TRUE = @COND_TESTS_TRUE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSERT_INTTYPES_HEADER = @INSERT_INTTYPES_HEADER@ +INSERT_MATH_HEADER = @INSERT_MATH_HEADER@ +INSERT_STDINT_HEADER = @INSERT_STDINT_HEADER@ +INSERT_TGMATH_HEADER = @INSERT_TGMATH_HEADER@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIMLIBS = @SIMLIBS@ +SPANDSP_LT_AGE = @SPANDSP_LT_AGE@ +SPANDSP_LT_CURRENT = @SPANDSP_LT_CURRENT@ +SPANDSP_LT_REVISION = @SPANDSP_LT_REVISION@ +SPANDSP_MISALIGNED_ACCESS_FAILS = @SPANDSP_MISALIGNED_ACCESS_FAILS@ +SPANDSP_USE_EXPORT_CAPABILITY = @SPANDSP_USE_EXPORT_CAPABILITY@ +SPANDSP_USE_FIXED_POINT = @SPANDSP_USE_FIXED_POINT@ +STRIP = @STRIP@ +TESTLIBS = @TESTLIBS@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DSYMUTIL = @ac_ct_DSYMUTIL@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_NMEDIT = @ac_ct_NMEDIT@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AM_CFLAGS = $(COMP_VENDOR_CFLAGS) +AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) +PBM2G3 = pbmtog3 +FAX2TIFF = fax2tiff +TIFFCP = tiffcp +ITU_TEST_PAGES_PBM = itu1.pbm \ + itu2.pbm \ + itu3.pbm \ + itu4.pbm \ + itu5.pbm \ + itu6.pbm \ + itu7.pbm \ + itu8.pbm \ + test1.pbm \ + test2.pbm \ + test3.pbm \ + test4.pbm + +ITU_TEST_PAGES_G3 = itu1.g3 \ + itu2.g3 \ + itu3.g3 \ + itu4.g3 \ + itu5.g3 \ + itu6.g3 \ + itu7.g3 \ + itu8.g3 \ + test1.g3 \ + test2.g3 \ + test3.g3 \ + test4.g3 + +ITU_TEST_PAGES = itu1.tif \ + itu2.tif \ + itu3.tif \ + itu4.tif \ + itu5.tif \ + itu6.tif \ + itu7.tif \ + itu8.tif \ + test1.tif \ + test2.tif \ + test3.tif \ + test4.tif + +MIXED_SIZE_PAGES = R1200_1200_A4.tif \ + R1200_1200_B4.tif \ + R1200_1200_A3.tif \ + R600_1200_A4.tif \ + R600_1200_B4.tif \ + R600_1200_A3.tif \ + R600_600_A4.tif \ + R600_600_B4.tif \ + R600_600_A3.tif \ + R16_800_A4.tif \ + R16_800_B4.tif \ + R16_800_A3.tif \ + R16_154_A4.tif \ + R16_154_B4.tif \ + R16_154_A3.tif \ + R300_600_A4.tif \ + R300_600_B4.tif \ + R300_600_A3.tif \ + R300_300_A4.tif \ + R300_300_B4.tif \ + R300_300_A3.tif \ + R8_154_A4.tif \ + R8_154_B4.tif \ + R8_154_A3.tif \ + R8_77_A4.tif \ + R8_77_B4.tif \ + R8_77_A3.tif \ + R8_385_A4.tif \ + R8_385_B4.tif \ + R8_385_A3.tif + +EXTRA_DIST = ${ITU_TEST_PAGES_PBM} +MAINTAINERCLEANFILES = Makefile.in +nobase_data_DATA = itutests.tif \ + ${ITU_TEST_PAGES} \ + dithered.tif \ + 100pages.tif \ + ${MIXED_SIZE_PAGES} \ + mixed_size_pages.tif + +generate_dithered_tif_SOURCES = generate_dithered_tif.c +generate_dithered_tif_LDADD = -ltiff +generate_sized_pages_SOURCES = generate_sized_pages.c +generate_sized_pages_LDADD = -ltiff +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .g3 .lo .o .obj .pbm .tif +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test-data/itu/fax/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu test-data/itu/fax/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +generate_dithered_tif$(EXEEXT): $(generate_dithered_tif_OBJECTS) $(generate_dithered_tif_DEPENDENCIES) + @rm -f generate_dithered_tif$(EXEEXT) + $(LINK) $(generate_dithered_tif_LDFLAGS) $(generate_dithered_tif_OBJECTS) $(generate_dithered_tif_LDADD) $(LIBS) +generate_sized_pages$(EXEEXT): $(generate_sized_pages_OBJECTS) $(generate_sized_pages_DEPENDENCIES) + @rm -f generate_sized_pages$(EXEEXT) + $(LINK) $(generate_sized_pages_LDFLAGS) $(generate_sized_pages_OBJECTS) $(generate_sized_pages_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generate_dithered_tif.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generate_sized_pages.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-nobase_dataDATA: $(nobase_data_DATA) + @$(NORMAL_INSTALL) + test -z "$(datadir)" || $(mkdir_p) "$(DESTDIR)$(datadir)" + @$(am__vpath_adj_setup) \ + list='$(nobase_data_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + $(am__vpath_adj) \ + echo " $(nobase_dataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(datadir)/$$f'"; \ + $(nobase_dataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(datadir)/$$f"; \ + done + +uninstall-nobase_dataDATA: + @$(NORMAL_UNINSTALL) + @$(am__vpath_adj_setup) \ + list='$(nobase_data_DATA)'; for p in $$list; do \ + $(am__vpath_adj) \ + echo " rm -f '$(DESTDIR)$(datadir)/$$f'"; \ + rm -f "$(DESTDIR)$(datadir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(datadir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-nobase_dataDATA + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-nobase_dataDATA + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-nobase_dataDATA install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-nobase_dataDATA + + +clean: + rm -f *.tif *.g3 + +itutests.tif: ${ITU_TEST_PAGES_G3} + $(FAX2TIFF) -M -o $@ ${ITU_TEST_PAGES_G3} + +100pages.tif: ${ITU_TEST_PAGES_G3} + $(FAX2TIFF) -M -o $@ \ + ${ITU_TEST_PAGES_G3} \ + ${ITU_TEST_PAGES_G3} \ + ${ITU_TEST_PAGES_G3} \ + ${ITU_TEST_PAGES_G3} \ + ${ITU_TEST_PAGES_G3} \ + ${ITU_TEST_PAGES_G3} \ + ${ITU_TEST_PAGES_G3} \ + ${ITU_TEST_PAGES_G3} \ + itu1.g3 itu2.g3 itu3.g3 itu4.g3 + +.g3.tif: + ${FAX2TIFF} -M -o $*.tif $*.g3 + +.pbm.g3: + ${PBM2G3} $*.pbm >$*.g3 + +dithered.tif: generate_dithered_tif$(EXEEXT) + ./generate_dithered_tif$(EXEEXT) + +${MIXED_SIZE_PAGES}: generate_sized_pages$(EXEEXT) + ./generate_sized_pages$(EXEEXT) + +mixed_size_pages.tif: ${MIXED_SIZE_PAGES} + $(TIFFCP) ${MIXED_SIZE_PAGES} $@ +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/itu/fax/generate_dithered_tif.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/test-data/itu/fax/generate_dithered_tif.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,162 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * generate_dithered_tif.c - Create a fine checkerboard TIFF file for test purposes. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: generate_dithered_tif.c,v 1.2 2008/07/10 13:34:01 steveu Exp $ + */ + +/*! \file */ + +/* + This program generates an A4 sized FAX image of a fine checkerboard. This doesn't + compress well, so it results in a rather large file for a single page. This is + good for testing the handling of extreme pages. + + Note that due to a bug in FAX image handling, versions of libtiff up to 3.8.2 fail + to handle this complex image properly, if 2-D compression is used. The bug should + be fixed in CVS at the time of writing, and so should be fixed in released versions + after 3.8.2. This code uses 1-D compression to avoid the issue. + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include + +#include "spandsp.h" + +int main(int argc, char *argv[]) +{ + int image_width; + int row; + int resunit; + int output_compression; + int output_t4_options; + uint8_t image_buffer[1024]; + TIFF *tiff_file; + struct tm *tm; + time_t now; + char buf[133]; + float x_resolution; + float y_resolution; + int x_res; + int y_res; + int image_length; + + if ((tiff_file = TIFFOpen("dithered.tif", "w")) == NULL) + exit(2); + + output_compression = COMPRESSION_CCITT_T4; + /* Use 1-D compression until a fixed libtiff is the norm. */ + //output_t4_options = GROUP3OPT_FILLBITS | GROUP3OPT_2DENCODING; + output_t4_options = GROUP3OPT_FILLBITS; + + x_res = T4_X_RESOLUTION_R8; + y_res = T4_Y_RESOLUTION_FINE; + image_width = 1728; + image_length = 2200; + + /* Prepare the directory entry fully before writing the image, or libtiff complains */ + TIFFSetField(tiff_file, TIFFTAG_COMPRESSION, output_compression); + if (output_compression == COMPRESSION_CCITT_T4) + { + TIFFSetField(tiff_file, TIFFTAG_T4OPTIONS, output_t4_options); + TIFFSetField(tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF); + } + TIFFSetField(tiff_file, TIFFTAG_IMAGEWIDTH, image_width); + TIFFSetField(tiff_file, TIFFTAG_BITSPERSAMPLE, 1); + TIFFSetField(tiff_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); + TIFFSetField(tiff_file, TIFFTAG_SAMPLESPERPIXEL, 1); + TIFFSetField(tiff_file, TIFFTAG_ROWSPERSTRIP, -1L); + TIFFSetField(tiff_file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); + TIFFSetField(tiff_file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE); + TIFFSetField(tiff_file, TIFFTAG_FILLORDER, FILLORDER_LSB2MSB); + + x_resolution = x_res/100.0f; + y_resolution = y_res/100.0f; + TIFFSetField(tiff_file, TIFFTAG_XRESOLUTION, floorf(x_resolution*2.54f + 0.5f)); + TIFFSetField(tiff_file, TIFFTAG_YRESOLUTION, floorf(y_resolution*2.54f + 0.5f)); + resunit = RESUNIT_INCH; + TIFFSetField(tiff_file, TIFFTAG_RESOLUTIONUNIT, resunit); + + TIFFSetField(tiff_file, TIFFTAG_SOFTWARE, "spandsp"); + if (gethostname(buf, sizeof(buf)) == 0) + TIFFSetField(tiff_file, TIFFTAG_HOSTCOMPUTER, buf); + + TIFFSetField(tiff_file, TIFFTAG_IMAGEDESCRIPTION, "Checkerboard or dithered ones"); + TIFFSetField(tiff_file, TIFFTAG_MAKE, "soft-switch.org"); + TIFFSetField(tiff_file, TIFFTAG_MODEL, "test data"); + + time(&now); + tm = localtime(&now); + sprintf(buf, + "%4d/%02d/%02d %02d:%02d:%02d", + tm->tm_year + 1900, + tm->tm_mon + 1, + tm->tm_mday, + tm->tm_hour, + tm->tm_min, + tm->tm_sec); + TIFFSetField(tiff_file, TIFFTAG_DATETIME, buf); + + TIFFSetField(tiff_file, TIFFTAG_IMAGELENGTH, image_length); + TIFFSetField(tiff_file, TIFFTAG_PAGENUMBER, 0, 1); + TIFFSetField(tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN); + TIFFSetField(tiff_file, TIFFTAG_IMAGEWIDTH, image_width); + + /* Write the image first.... */ + for (row = 0; row < image_length; row++) + { + if ((row & 1) == 0) + memset(image_buffer, 0xAA, image_width/8 + 1); + else + memset(image_buffer, 0x55, image_width/8 + 1); + if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + } + /* ....then the directory entry, and libtiff is happy. */ + TIFFWriteDirectory(tiff_file); + TIFFClose(tiff_file); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/itu/fax/generate_sized_pages.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/test-data/itu/fax/generate_sized_pages.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,390 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * generate_sized_pages.c - Create a series of TIFF files in the various page sizes + * and resolutions. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: generate_sized_pages.c,v 1.3 2009/03/01 12:39:02 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif + +#include "spandsp.h" + +struct +{ + const char *name; + int x_res; + int y_res; + int width; + int length; +} sequence[] = +{ + { + "R8_385_A4.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_A4, + 1100 + }, + { + "R8_385_B4.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_B4, + 1200 + }, + { + "R8_385_A3.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_STANDARD, + T4_WIDTH_R8_A3, + 1556 + }, + { + "R8_77_A4.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_FINE, + T4_WIDTH_R8_A4, + 2200 + }, + { + "R8_77_B4.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_FINE, + T4_WIDTH_R8_B4, + 2400 + }, + { + "R8_77_A3.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_FINE, + T4_WIDTH_R8_A3, + 3111 + }, + { + "R8_154_A4.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_SUPERFINE, + T4_WIDTH_R8_A4, + 4400 + }, + { + "R8_154_B4.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_SUPERFINE, + T4_WIDTH_R8_B4, + 4800 + }, + { + "R8_154_A3.tif", + T4_X_RESOLUTION_R8, + T4_Y_RESOLUTION_SUPERFINE, + T4_WIDTH_R8_A3, + 6222 + }, + { + "R300_300_A4.tif", + T4_X_RESOLUTION_300, + T4_Y_RESOLUTION_300, + T4_WIDTH_300_A4, + 4400 + }, + { + "R300_300_B4.tif", + T4_X_RESOLUTION_300, + T4_Y_RESOLUTION_300, + T4_WIDTH_300_B4, + 4800 + }, + { + "R300_300_A3.tif", + T4_X_RESOLUTION_300, + T4_Y_RESOLUTION_300, + T4_WIDTH_300_A3, + 6222 + }, + { + "R300_600_A4.tif", + T4_X_RESOLUTION_300, + T4_Y_RESOLUTION_600, + T4_WIDTH_300_A4, + 4400 + }, + { + "R300_600_B4.tif", + T4_X_RESOLUTION_300, + T4_Y_RESOLUTION_600, + T4_WIDTH_300_B4, + 4800 + }, + { + "R300_600_A3.tif", + T4_X_RESOLUTION_300, + T4_Y_RESOLUTION_600, + T4_WIDTH_300_A3, + 6222 + }, + { + "R16_154_A4.tif", + T4_X_RESOLUTION_R16, + T4_Y_RESOLUTION_SUPERFINE, + T4_WIDTH_R16_A4, + 4400 + }, + { + "R16_154_B4.tif", + T4_X_RESOLUTION_R16, + T4_Y_RESOLUTION_SUPERFINE, + T4_WIDTH_R16_B4, + 4800 + }, + { + "R16_154_A3.tif", + T4_X_RESOLUTION_R16, + T4_Y_RESOLUTION_SUPERFINE, + T4_WIDTH_R16_A3, + 6222 + }, + { + "R16_800_A4.tif", + T4_X_RESOLUTION_R16, + T4_Y_RESOLUTION_800, + T4_WIDTH_R16_A4, + 4400 + }, + { + "R16_800_B4.tif", + T4_X_RESOLUTION_R16, + T4_Y_RESOLUTION_800, + T4_WIDTH_R16_B4, + 4800 + }, + { + "R16_800_A3.tif", + T4_X_RESOLUTION_R16, + T4_Y_RESOLUTION_800, + T4_WIDTH_R16_A3, + 6222 + }, + { + "R600_600_A4.tif", + T4_X_RESOLUTION_600, + T4_Y_RESOLUTION_600, + T4_WIDTH_600_A4, + 4400 + }, + { + "R600_600_B4.tif", + T4_X_RESOLUTION_600, + T4_Y_RESOLUTION_600, + T4_WIDTH_600_B4, + 4800 + }, + { + "R600_600_A3.tif", + T4_X_RESOLUTION_600, + T4_Y_RESOLUTION_600, + T4_WIDTH_600_A3, + 6222 + }, + { + "R600_1200_A4.tif", + T4_X_RESOLUTION_600, + T4_Y_RESOLUTION_1200, + T4_WIDTH_600_A4, + 4400 + }, + { + "R600_1200_B4.tif", + T4_X_RESOLUTION_600, + T4_Y_RESOLUTION_1200, + T4_WIDTH_600_B4, + 4800 + }, + { + "R600_1200_A3.tif", + T4_X_RESOLUTION_600, + T4_Y_RESOLUTION_1200, + T4_WIDTH_600_A3, + 6222 + }, + { + "R1200_1200_A4.tif", + T4_X_RESOLUTION_1200, + T4_Y_RESOLUTION_1200, + T4_WIDTH_1200_A4, + 4400 + }, + { + "R1200_1200_B4.tif", + T4_X_RESOLUTION_1200, + T4_Y_RESOLUTION_1200, + T4_WIDTH_1200_B4, + 4800 + }, + { + "R1200_1200_A3.tif", + T4_X_RESOLUTION_1200, + T4_Y_RESOLUTION_1200, + T4_WIDTH_1200_A3, + 6222 + }, + { + NULL, + 0, + 0, + 0, + 0 + }, +}; + +int main(int argc, char *argv[]) +{ + int row; + uint8_t image_buffer[8192]; + TIFF *tiff_file; + struct tm *tm; + time_t now; + char buf[133]; + float x_resolution; + float y_resolution; + int i; + int opt; + int compression; + int photo_metric; + int fill_order; + + compression = T4_COMPRESSION_ITU_T6; + photo_metric = PHOTOMETRIC_MINISWHITE; + fill_order = FILLORDER_LSB2MSB; + while ((opt = getopt(argc, argv, "126ir")) != -1) + { + switch (opt) + { + case '1': + compression = T4_COMPRESSION_ITU_T4_1D; + break; + case '2': + compression = T4_COMPRESSION_ITU_T4_2D; + break; + case '6': + compression = T4_COMPRESSION_ITU_T6; + break; + case 'i': + photo_metric = PHOTOMETRIC_MINISBLACK; + break; + case 'r': + fill_order = FILLORDER_MSB2LSB; + break; + default: + //usage(); + exit(2); + break; + } + } + + for (i = 0; sequence[i].name; i++) + { + if ((tiff_file = TIFFOpen(sequence[i].name, "w")) == NULL) + exit(2); + + /* Prepare the directory entry fully before writing the image, or libtiff complains */ + TIFFSetField(tiff_file, TIFFTAG_COMPRESSION, compression); + TIFFSetField(tiff_file, TIFFTAG_IMAGEWIDTH, sequence[i].width); + TIFFSetField(tiff_file, TIFFTAG_BITSPERSAMPLE, 1); + TIFFSetField(tiff_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); + TIFFSetField(tiff_file, TIFFTAG_SAMPLESPERPIXEL, 1); + TIFFSetField(tiff_file, TIFFTAG_ROWSPERSTRIP, -1L); + TIFFSetField(tiff_file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); + TIFFSetField(tiff_file, TIFFTAG_PHOTOMETRIC, photo_metric); + TIFFSetField(tiff_file, TIFFTAG_FILLORDER, fill_order); + + x_resolution = sequence[i].x_res/100.0f; + y_resolution = sequence[i].y_res/100.0f; + TIFFSetField(tiff_file, TIFFTAG_XRESOLUTION, floorf(x_resolution*2.54f + 0.5f)); + TIFFSetField(tiff_file, TIFFTAG_YRESOLUTION, floorf(y_resolution*2.54f + 0.5f)); + TIFFSetField(tiff_file, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); + + TIFFSetField(tiff_file, TIFFTAG_SOFTWARE, "spandsp"); + if (gethostname(buf, sizeof(buf)) == 0) + TIFFSetField(tiff_file, TIFFTAG_HOSTCOMPUTER, buf); + + TIFFSetField(tiff_file, TIFFTAG_IMAGEDESCRIPTION, "Blank test image"); + TIFFSetField(tiff_file, TIFFTAG_MAKE, "soft-switch.org"); + TIFFSetField(tiff_file, TIFFTAG_MODEL, "test data"); + + time(&now); + tm = localtime(&now); + sprintf(buf, + "%4d/%02d/%02d %02d:%02d:%02d", + tm->tm_year + 1900, + tm->tm_mon + 1, + tm->tm_mday, + tm->tm_hour, + tm->tm_min, + tm->tm_sec); + TIFFSetField(tiff_file, TIFFTAG_DATETIME, buf); + + TIFFSetField(tiff_file, TIFFTAG_IMAGELENGTH, sequence[i].length); + TIFFSetField(tiff_file, TIFFTAG_PAGENUMBER, 0, 1); + TIFFSetField(tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN); + TIFFSetField(tiff_file, TIFFTAG_IMAGEWIDTH, sequence[i].width); + + /* Write the image first.... */ + for (row = 0; row < sequence[i].length; row++) + { + memset(image_buffer, 0, sequence[i].width/8 + 1); + if (TIFFWriteScanline(tiff_file, image_buffer, row, 0) < 0) + { + printf("Write error at row %d.\n", row); + exit(2); + } + } + /* ....then the directory entry, and libtiff is happy. */ + TIFFWriteDirectory(tiff_file); + TIFFClose(tiff_file); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/itu/fax/itu1.pbm Binary file spandsp-0.0.6pre17/test-data/itu/fax/itu1.pbm has changed diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/itu/fax/itu2.pbm Binary file spandsp-0.0.6pre17/test-data/itu/fax/itu2.pbm has changed diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/itu/fax/itu3.pbm Binary file spandsp-0.0.6pre17/test-data/itu/fax/itu3.pbm has changed diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/itu/fax/itu4.pbm Binary file spandsp-0.0.6pre17/test-data/itu/fax/itu4.pbm has changed diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/itu/fax/itu5.pbm Binary file spandsp-0.0.6pre17/test-data/itu/fax/itu5.pbm has changed diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/itu/fax/itu6.pbm Binary file spandsp-0.0.6pre17/test-data/itu/fax/itu6.pbm has changed diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/itu/fax/itu7.pbm Binary file spandsp-0.0.6pre17/test-data/itu/fax/itu7.pbm has changed diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/itu/fax/itu8.pbm Binary file spandsp-0.0.6pre17/test-data/itu/fax/itu8.pbm has changed diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/itu/fax/test1.pbm Binary file spandsp-0.0.6pre17/test-data/itu/fax/test1.pbm has changed diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/itu/fax/test2.pbm Binary file spandsp-0.0.6pre17/test-data/itu/fax/test2.pbm has changed diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/itu/fax/test3.pbm Binary file spandsp-0.0.6pre17/test-data/itu/fax/test3.pbm has changed diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/itu/fax/test4.pbm Binary file spandsp-0.0.6pre17/test-data/itu/fax/test4.pbm has changed diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/local/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/test-data/local/Makefile.am Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,32 @@ +## +## SpanDSP - a series of DSP components for telephony +## +## Makefile.am - Process this file with automake to produce Makefile.in +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU Lesser General Public License version 2.1, +## as published by the Free Software Foundation. +## +## 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 Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this program; if not, write to the Free Software +## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +## +## $Id: Makefile.am,v 1.1 2008/05/03 07:30:19 steveu Exp $ + +SUBDIRS = + +DIST_SUBDIRS = + +EXTRA_DIST = dam9_lpc55.wav \ + dam9.wav \ + short_nb_voice.wav \ + short_wb_voice.wav + +all: + +clean: diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/local/Makefile.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/test-data/local/Makefile.in Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,524 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = test-data/local +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/config/ax_compiler_vendor.m4 \ + $(top_srcdir)/config/ax_check_real_file.m4 \ + $(top_srcdir)/config/ax_fixed_point_machine.m4 \ + $(top_srcdir)/config/ax_misaligned_access_fails.m4 \ + $(top_srcdir)/config/ax_c99_features.m4 \ + $(top_srcdir)/config/ax_check_export_capability.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_FOR_BUILD = @CC_FOR_BUILD@ +CFLAGS = @CFLAGS@ +COMP_VENDOR_CFLAGS = @COMP_VENDOR_CFLAGS@ +COMP_VENDOR_LDFLAGS = @COMP_VENDOR_LDFLAGS@ +COND_DOC_FALSE = @COND_DOC_FALSE@ +COND_DOC_TRUE = @COND_DOC_TRUE@ +COND_MMX_FALSE = @COND_MMX_FALSE@ +COND_MMX_TRUE = @COND_MMX_TRUE@ +COND_SSE2_FALSE = @COND_SSE2_FALSE@ +COND_SSE2_TRUE = @COND_SSE2_TRUE@ +COND_SSE3_FALSE = @COND_SSE3_FALSE@ +COND_SSE3_TRUE = @COND_SSE3_TRUE@ +COND_SSE4A_FALSE = @COND_SSE4A_FALSE@ +COND_SSE4A_TRUE = @COND_SSE4A_TRUE@ +COND_SSE4_1_FALSE = @COND_SSE4_1_FALSE@ +COND_SSE4_1_TRUE = @COND_SSE4_1_TRUE@ +COND_SSE4_2_FALSE = @COND_SSE4_2_FALSE@ +COND_SSE4_2_TRUE = @COND_SSE4_2_TRUE@ +COND_SSE5_FALSE = @COND_SSE5_FALSE@ +COND_SSE5_TRUE = @COND_SSE5_TRUE@ +COND_SSE_FALSE = @COND_SSE_FALSE@ +COND_SSE_TRUE = @COND_SSE_TRUE@ +COND_SSSE3_FALSE = @COND_SSSE3_FALSE@ +COND_SSSE3_TRUE = @COND_SSSE3_TRUE@ +COND_TESTDATA_FALSE = @COND_TESTDATA_FALSE@ +COND_TESTDATA_TRUE = @COND_TESTDATA_TRUE@ +COND_TESTS_FALSE = @COND_TESTS_FALSE@ +COND_TESTS_TRUE = @COND_TESTS_TRUE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSERT_INTTYPES_HEADER = @INSERT_INTTYPES_HEADER@ +INSERT_MATH_HEADER = @INSERT_MATH_HEADER@ +INSERT_STDINT_HEADER = @INSERT_STDINT_HEADER@ +INSERT_TGMATH_HEADER = @INSERT_TGMATH_HEADER@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIMLIBS = @SIMLIBS@ +SPANDSP_LT_AGE = @SPANDSP_LT_AGE@ +SPANDSP_LT_CURRENT = @SPANDSP_LT_CURRENT@ +SPANDSP_LT_REVISION = @SPANDSP_LT_REVISION@ +SPANDSP_MISALIGNED_ACCESS_FAILS = @SPANDSP_MISALIGNED_ACCESS_FAILS@ +SPANDSP_USE_EXPORT_CAPABILITY = @SPANDSP_USE_EXPORT_CAPABILITY@ +SPANDSP_USE_FIXED_POINT = @SPANDSP_USE_FIXED_POINT@ +STRIP = @STRIP@ +TESTLIBS = @TESTLIBS@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DSYMUTIL = @ac_ct_DSYMUTIL@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_NMEDIT = @ac_ct_NMEDIT@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +SUBDIRS = +DIST_SUBDIRS = +EXTRA_DIST = dam9_lpc55.wav \ + dam9.wav \ + short_nb_voice.wav \ + short_wb_voice.wav + +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test-data/local/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu test-data/local/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-libtool \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + + +all: + +clean: +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/local/dam9.wav Binary file spandsp-0.0.6pre17/test-data/local/dam9.wav has changed diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/local/dam9_lpc55.wav Binary file spandsp-0.0.6pre17/test-data/local/dam9_lpc55.wav has changed diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/local/short_nb_voice.wav Binary file spandsp-0.0.6pre17/test-data/local/short_nb_voice.wav has changed diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/test-data/local/short_wb_voice.wav Binary file spandsp-0.0.6pre17/test-data/local/short_wb_voice.wav has changed diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/Makefile.am Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,358 @@ +## +## SpanDSP - a series of DSP components for telephony +## +## Makefile.am - Process this file with automake to produce Makefile.in +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License version 2, as +## published by the Free Software Foundation. +## +## 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., 675 Mass Ave, Cambridge, MA 02139, USA. +## +## $Id: Makefile.am,v 1.117 2009/09/22 13:11:04 steveu Exp $ + +AM_CFLAGS = $(COMP_VENDOR_CFLAGS) +AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) + +LIBS += $(TESTLIBS) + +noinst_DATA = sound_c1_8k.wav sound_c3_8k.wav + +EXTRA_DIST = regression_tests.sh \ + v42bis_tests.sh \ + fax_tests.sh \ + tsb85_tests.sh \ + msvc/adsi_tests.vcproj \ + msvc/complex_tests.vcproj \ + msvc/complex_vector_float_tests.vcproj \ + msvc/complex_vector_int_tests.vcproj \ + msvc/dtmf_rx_tests.vcproj \ + msvc/dtmf_tx_tests.vcproj \ + msvc/queue_tests.vcproj \ + msvc/t38_core_tests.vcproj \ + msvc/t38_non_ecm_buffer_tests.vcproj \ + msvc/t38_terminal_tests.vcproj \ + msvc/v22bis_tests.vcproj \ + msvc/v29_tests.vcproj \ + msvc/v8_tests.vcproj \ + msvc/v80_tests.vcproj \ + msvc/vector_float_tests.vcproj \ + msvc/vector_int_tests.vcproj + +MAINTAINERCLEANFILES = Makefile.in + +INCLUDES = -I$(top_builddir)/src -I$(top_builddir)/spandsp-sim -DDATADIR="\"$(pkgdatadir)\"" + +LIBDIR = -L$(top_builddir)/src + +noinst_PROGRAMS = adsi_tests \ + async_tests \ + at_interpreter_tests \ + awgn_tests \ + bell_mf_rx_tests \ + bell_mf_tx_tests \ + bert_tests \ + bit_operations_tests \ + complex_tests \ + complex_vector_float_tests \ + complex_vector_int_tests \ + crc_tests \ + dc_restore_tests \ + dds_tests \ + dtmf_rx_tests \ + dtmf_tx_tests \ + echo_tests \ + fax_decode \ + fax_tests \ + fsk_tests \ + g1050_tests \ + g168_tests \ + g711_tests \ + g722_tests \ + g726_tests \ + gsm0610_tests \ + hdlc_tests \ + ima_adpcm_tests \ + line_model_tests \ + logging_tests \ + lpc10_tests \ + make_g168_css \ + modem_connect_tones_tests \ + modem_echo_tests \ + noise_tests \ + oki_adpcm_tests \ + playout_tests \ + plc_tests \ + power_meter_tests \ + queue_tests \ + r2_mf_rx_tests \ + r2_mf_tx_tests \ + rfc2198_sim_tests \ + schedule_tests \ + sig_tone_tests \ + super_tone_rx_tests \ + super_tone_tx_tests \ + swept_tone_tests \ + t4_tests \ + t31_tests \ + t38_core_tests \ + t38_gateway_tests \ + t38_gateway_to_terminal_tests \ + t38_non_ecm_buffer_tests \ + t38_terminal_tests \ + t38_terminal_to_gateway_tests \ + time_scale_tests \ + tone_detect_tests \ + tone_generate_tests \ + tsb85_tests \ + v17_tests \ + v18_tests \ + v22bis_tests \ + v27ter_tests \ + v29_tests \ + v42_tests \ + v42bis_tests \ + v8_tests \ + vector_float_tests \ + vector_int_tests \ + testadsi \ + testfax \ + tsb85_tests + +noinst_HEADERS = echo_monitor.h \ + fax_tester.h \ + fax_utils.h \ + line_model_monitor.h \ + media_monitor.h \ + modem_monitor.h + +adsi_tests_SOURCES = adsi_tests.c +adsi_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +async_tests_SOURCES = async_tests.c +async_tests_LDADD = $(LIBDIR) -lspandsp + +at_interpreter_tests_SOURCES = at_interpreter_tests.c +at_interpreter_tests_LDADD = $(LIBDIR) -lspandsp + +awgn_tests_SOURCES = awgn_tests.c +awgn_tests_LDADD = $(LIBDIR) -lspandsp + +bell_mf_rx_tests_SOURCES = bell_mf_rx_tests.c +bell_mf_rx_tests_LDADD = $(LIBDIR) -lspandsp + +bell_mf_tx_tests_SOURCES = bell_mf_tx_tests.c +bell_mf_tx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +bert_tests_SOURCES = bert_tests.c +bert_tests_LDADD = $(LIBDIR) -lspandsp + +bit_operations_tests_SOURCES = bit_operations_tests.c +bit_operations_tests_LDADD = $(LIBDIR) -lspandsp + +complex_tests_SOURCES = complex_tests.c +complex_tests_LDADD = $(LIBDIR) -lspandsp + +complex_vector_float_tests_SOURCES = complex_vector_float_tests.c +complex_vector_float_tests_LDADD = $(LIBDIR) -lspandsp + +complex_vector_int_tests_SOURCES = complex_vector_int_tests.c +complex_vector_int_tests_LDADD = $(LIBDIR) -lspandsp + +crc_tests_SOURCES = crc_tests.c +crc_tests_LDADD = $(LIBDIR) -lspandsp + +dc_restore_tests_SOURCES = dc_restore_tests.c +dc_restore_tests_LDADD = $(LIBDIR) -lspandsp + +dds_tests_SOURCES = dds_tests.c +dds_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +dtmf_rx_tests_SOURCES = dtmf_rx_tests.c +dtmf_rx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +dtmf_tx_tests_SOURCES = dtmf_tx_tests.c +dtmf_tx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +echo_tests_SOURCES = echo_tests.c echo_monitor.cpp +echo_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +fax_decode_SOURCES = fax_decode.c +fax_decode_LDADD = $(LIBDIR) -lspandsp + +fax_tests_SOURCES = fax_tests.c fax_utils.c +fax_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +fsk_tests_SOURCES = fsk_tests.c +fsk_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +g1050_tests_SOURCES = g1050_tests.c media_monitor.cpp +g1050_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +g168_tests_SOURCES = g168_tests.c +g168_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +g711_tests_SOURCES = g711_tests.c +g711_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +g722_tests_SOURCES = g722_tests.c +g722_tests_LDADD = $(LIBDIR) -lspandsp + +g726_tests_SOURCES = g726_tests.c +g726_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +gsm0610_tests_SOURCES = gsm0610_tests.c +gsm0610_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +hdlc_tests_SOURCES = hdlc_tests.c +hdlc_tests_LDADD = $(LIBDIR) -lspandsp + +ima_adpcm_tests_SOURCES = ima_adpcm_tests.c +ima_adpcm_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +line_model_tests_SOURCES = line_model_tests.c +line_model_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +logging_tests_SOURCES = logging_tests.c +logging_tests_LDADD = $(LIBDIR) -lspandsp + +lpc10_tests_SOURCES = lpc10_tests.c +lpc10_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +make_g168_css_SOURCES = make_g168_css.c +make_g168_css_LDADD = $(LIBDIR) -lspandsp + +modem_echo_tests_SOURCES = modem_echo_tests.c echo_monitor.cpp +modem_echo_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +modem_connect_tones_tests_SOURCES = modem_connect_tones_tests.c +modem_connect_tones_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +noise_tests_SOURCES = noise_tests.c +noise_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +oki_adpcm_tests_SOURCES = oki_adpcm_tests.c +oki_adpcm_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +playout_tests_SOURCES = playout_tests.c media_monitor.cpp +playout_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +plc_tests_SOURCES = plc_tests.c +plc_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +power_meter_tests_SOURCES = power_meter_tests.c +power_meter_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +queue_tests_SOURCES = queue_tests.c +queue_tests_LDADD = $(LIBDIR) -lspandsp + +r2_mf_rx_tests_SOURCES = r2_mf_rx_tests.c +r2_mf_rx_tests_LDADD = $(LIBDIR) -lspandsp + +r2_mf_tx_tests_SOURCES = r2_mf_tx_tests.c +r2_mf_tx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +rfc2198_sim_tests_SOURCES = rfc2198_sim_tests.c media_monitor.cpp +rfc2198_sim_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +schedule_tests_SOURCES = schedule_tests.c +schedule_tests_LDADD = $(LIBDIR) -lspandsp + +sig_tone_tests_SOURCES = sig_tone_tests.c +sig_tone_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +super_tone_rx_tests_SOURCES = super_tone_rx_tests.c +super_tone_rx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +super_tone_tx_tests_SOURCES = super_tone_tx_tests.c +super_tone_tx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +swept_tone_tests_SOURCES = swept_tone_tests.c +swept_tone_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +t4_tests_SOURCES = t4_tests.c +t4_tests_LDADD = $(LIBDIR) -lspandsp + +t31_tests_SOURCES = t31_tests.c fax_utils.c media_monitor.cpp +t31_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +t38_core_tests_SOURCES = t38_core_tests.c +t38_core_tests_LDADD = $(LIBDIR) -lspandsp + +t38_gateway_tests_SOURCES = t38_gateway_tests.c fax_utils.c media_monitor.cpp +t38_gateway_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +t38_gateway_to_terminal_tests_SOURCES = t38_gateway_to_terminal_tests.c fax_utils.c media_monitor.cpp +t38_gateway_to_terminal_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +t38_non_ecm_buffer_tests_SOURCES = t38_non_ecm_buffer_tests.c +t38_non_ecm_buffer_tests_LDADD = $(LIBDIR) -lspandsp + +t38_terminal_tests_SOURCES = t38_terminal_tests.c fax_utils.c media_monitor.cpp +t38_terminal_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +t38_terminal_to_gateway_tests_SOURCES = t38_terminal_to_gateway_tests.c fax_utils.c media_monitor.cpp +t38_terminal_to_gateway_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +time_scale_tests_SOURCES = time_scale_tests.c +time_scale_tests_LDADD = $(LIBDIR) -lspandsp + +tone_detect_tests_SOURCES = tone_detect_tests.c +tone_detect_tests_LDADD = $(LIBDIR) -lspandsp + +tone_generate_tests_SOURCES = tone_generate_tests.c +tone_generate_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +tsb85_tests_SOURCES = tsb85_tests.c fax_utils.c fax_tester.c +tsb85_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +v17_tests_SOURCES = v17_tests.c line_model_monitor.cpp modem_monitor.cpp +v17_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +v18_tests_SOURCES = v18_tests.c +v18_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +v22bis_tests_SOURCES = v22bis_tests.c line_model_monitor.cpp modem_monitor.cpp +v22bis_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +v27ter_tests_SOURCES = v27ter_tests.c line_model_monitor.cpp modem_monitor.cpp +v27ter_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +v29_tests_SOURCES = v29_tests.c line_model_monitor.cpp modem_monitor.cpp +v29_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +v42_tests_SOURCES = v42_tests.c +v42_tests_LDADD = $(LIBDIR) -lspandsp + +v42bis_tests_SOURCES = v42bis_tests.c +v42bis_tests_LDADD = $(LIBDIR) -lspandsp + +v8_tests_SOURCES = v8_tests.c +v8_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + +vector_float_tests_SOURCES = vector_float_tests.c +vector_float_tests_LDADD = $(LIBDIR) -lspandsp + +vector_int_tests_SOURCES = vector_int_tests.c +vector_int_tests_LDADD = $(LIBDIR) -lspandsp + +testadsi_SOURCES = testadsi.c +testadsi_LDADD = $(LIBDIR) -lspandsp + +testfax_SOURCES = testfax.c +testfax_LDADD = $(LIBDIR) -lspandsp + +# We need to create the CSS files for echo cancellation tests. + +sound_c1_8k.wav sound_c3_8k.wav: make_g168_css$(EXEEXT) + ./make_g168_css$(EXEEXT) + sox sound_c1.wav -r8000 sound_c1_8k.wav + sox sound_c3.wav -r8000 sound_c3_8k.wav + rm sound_c1.wav sound_c3.wav diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/Makefile.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/Makefile.in Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1325 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +noinst_PROGRAMS = adsi_tests$(EXEEXT) async_tests$(EXEEXT) \ + at_interpreter_tests$(EXEEXT) awgn_tests$(EXEEXT) \ + bell_mf_rx_tests$(EXEEXT) bell_mf_tx_tests$(EXEEXT) \ + bert_tests$(EXEEXT) bit_operations_tests$(EXEEXT) \ + complex_tests$(EXEEXT) complex_vector_float_tests$(EXEEXT) \ + complex_vector_int_tests$(EXEEXT) crc_tests$(EXEEXT) \ + dc_restore_tests$(EXEEXT) dds_tests$(EXEEXT) \ + dtmf_rx_tests$(EXEEXT) dtmf_tx_tests$(EXEEXT) \ + echo_tests$(EXEEXT) fax_decode$(EXEEXT) fax_tests$(EXEEXT) \ + fsk_tests$(EXEEXT) g1050_tests$(EXEEXT) g168_tests$(EXEEXT) \ + g711_tests$(EXEEXT) g722_tests$(EXEEXT) g726_tests$(EXEEXT) \ + gsm0610_tests$(EXEEXT) hdlc_tests$(EXEEXT) \ + ima_adpcm_tests$(EXEEXT) line_model_tests$(EXEEXT) \ + logging_tests$(EXEEXT) lpc10_tests$(EXEEXT) \ + make_g168_css$(EXEEXT) modem_connect_tones_tests$(EXEEXT) \ + modem_echo_tests$(EXEEXT) noise_tests$(EXEEXT) \ + oki_adpcm_tests$(EXEEXT) playout_tests$(EXEEXT) \ + plc_tests$(EXEEXT) power_meter_tests$(EXEEXT) \ + queue_tests$(EXEEXT) r2_mf_rx_tests$(EXEEXT) \ + r2_mf_tx_tests$(EXEEXT) rfc2198_sim_tests$(EXEEXT) \ + schedule_tests$(EXEEXT) sig_tone_tests$(EXEEXT) \ + super_tone_rx_tests$(EXEEXT) super_tone_tx_tests$(EXEEXT) \ + swept_tone_tests$(EXEEXT) t4_tests$(EXEEXT) t31_tests$(EXEEXT) \ + t38_core_tests$(EXEEXT) t38_gateway_tests$(EXEEXT) \ + t38_gateway_to_terminal_tests$(EXEEXT) \ + t38_non_ecm_buffer_tests$(EXEEXT) t38_terminal_tests$(EXEEXT) \ + t38_terminal_to_gateway_tests$(EXEEXT) \ + time_scale_tests$(EXEEXT) tone_detect_tests$(EXEEXT) \ + tone_generate_tests$(EXEEXT) tsb85_tests$(EXEEXT) \ + v17_tests$(EXEEXT) v18_tests$(EXEEXT) v22bis_tests$(EXEEXT) \ + v27ter_tests$(EXEEXT) v29_tests$(EXEEXT) v42_tests$(EXEEXT) \ + v42bis_tests$(EXEEXT) v8_tests$(EXEEXT) \ + vector_float_tests$(EXEEXT) vector_int_tests$(EXEEXT) \ + testadsi$(EXEEXT) testfax$(EXEEXT) tsb85_tests$(EXEEXT) +subdir = tests +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/config/ax_compiler_vendor.m4 \ + $(top_srcdir)/config/ax_check_real_file.m4 \ + $(top_srcdir)/config/ax_fixed_point_machine.m4 \ + $(top_srcdir)/config/ax_misaligned_access_fails.m4 \ + $(top_srcdir)/config/ax_c99_features.m4 \ + $(top_srcdir)/config/ax_check_export_capability.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am_adsi_tests_OBJECTS = adsi_tests.$(OBJEXT) +adsi_tests_OBJECTS = $(am_adsi_tests_OBJECTS) +am__DEPENDENCIES_1 = +adsi_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_async_tests_OBJECTS = async_tests.$(OBJEXT) +async_tests_OBJECTS = $(am_async_tests_OBJECTS) +async_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_at_interpreter_tests_OBJECTS = at_interpreter_tests.$(OBJEXT) +at_interpreter_tests_OBJECTS = $(am_at_interpreter_tests_OBJECTS) +at_interpreter_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_awgn_tests_OBJECTS = awgn_tests.$(OBJEXT) +awgn_tests_OBJECTS = $(am_awgn_tests_OBJECTS) +awgn_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_bell_mf_rx_tests_OBJECTS = bell_mf_rx_tests.$(OBJEXT) +bell_mf_rx_tests_OBJECTS = $(am_bell_mf_rx_tests_OBJECTS) +bell_mf_rx_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_bell_mf_tx_tests_OBJECTS = bell_mf_tx_tests.$(OBJEXT) +bell_mf_tx_tests_OBJECTS = $(am_bell_mf_tx_tests_OBJECTS) +bell_mf_tx_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_bert_tests_OBJECTS = bert_tests.$(OBJEXT) +bert_tests_OBJECTS = $(am_bert_tests_OBJECTS) +bert_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_bit_operations_tests_OBJECTS = bit_operations_tests.$(OBJEXT) +bit_operations_tests_OBJECTS = $(am_bit_operations_tests_OBJECTS) +bit_operations_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_complex_tests_OBJECTS = complex_tests.$(OBJEXT) +complex_tests_OBJECTS = $(am_complex_tests_OBJECTS) +complex_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_complex_vector_float_tests_OBJECTS = \ + complex_vector_float_tests.$(OBJEXT) +complex_vector_float_tests_OBJECTS = \ + $(am_complex_vector_float_tests_OBJECTS) +complex_vector_float_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_complex_vector_int_tests_OBJECTS = \ + complex_vector_int_tests.$(OBJEXT) +complex_vector_int_tests_OBJECTS = \ + $(am_complex_vector_int_tests_OBJECTS) +complex_vector_int_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_crc_tests_OBJECTS = crc_tests.$(OBJEXT) +crc_tests_OBJECTS = $(am_crc_tests_OBJECTS) +crc_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_dc_restore_tests_OBJECTS = dc_restore_tests.$(OBJEXT) +dc_restore_tests_OBJECTS = $(am_dc_restore_tests_OBJECTS) +dc_restore_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_dds_tests_OBJECTS = dds_tests.$(OBJEXT) +dds_tests_OBJECTS = $(am_dds_tests_OBJECTS) +dds_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_dtmf_rx_tests_OBJECTS = dtmf_rx_tests.$(OBJEXT) +dtmf_rx_tests_OBJECTS = $(am_dtmf_rx_tests_OBJECTS) +dtmf_rx_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_dtmf_tx_tests_OBJECTS = dtmf_tx_tests.$(OBJEXT) +dtmf_tx_tests_OBJECTS = $(am_dtmf_tx_tests_OBJECTS) +dtmf_tx_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_echo_tests_OBJECTS = echo_tests.$(OBJEXT) echo_monitor.$(OBJEXT) +echo_tests_OBJECTS = $(am_echo_tests_OBJECTS) +echo_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_fax_decode_OBJECTS = fax_decode.$(OBJEXT) +fax_decode_OBJECTS = $(am_fax_decode_OBJECTS) +fax_decode_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_fax_tests_OBJECTS = fax_tests.$(OBJEXT) fax_utils.$(OBJEXT) +fax_tests_OBJECTS = $(am_fax_tests_OBJECTS) +fax_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_fsk_tests_OBJECTS = fsk_tests.$(OBJEXT) +fsk_tests_OBJECTS = $(am_fsk_tests_OBJECTS) +fsk_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_g1050_tests_OBJECTS = g1050_tests.$(OBJEXT) media_monitor.$(OBJEXT) +g1050_tests_OBJECTS = $(am_g1050_tests_OBJECTS) +g1050_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_g168_tests_OBJECTS = g168_tests.$(OBJEXT) +g168_tests_OBJECTS = $(am_g168_tests_OBJECTS) +g168_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_g711_tests_OBJECTS = g711_tests.$(OBJEXT) +g711_tests_OBJECTS = $(am_g711_tests_OBJECTS) +g711_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_g722_tests_OBJECTS = g722_tests.$(OBJEXT) +g722_tests_OBJECTS = $(am_g722_tests_OBJECTS) +g722_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_g726_tests_OBJECTS = g726_tests.$(OBJEXT) +g726_tests_OBJECTS = $(am_g726_tests_OBJECTS) +g726_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_gsm0610_tests_OBJECTS = gsm0610_tests.$(OBJEXT) +gsm0610_tests_OBJECTS = $(am_gsm0610_tests_OBJECTS) +gsm0610_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_hdlc_tests_OBJECTS = hdlc_tests.$(OBJEXT) +hdlc_tests_OBJECTS = $(am_hdlc_tests_OBJECTS) +hdlc_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_ima_adpcm_tests_OBJECTS = ima_adpcm_tests.$(OBJEXT) +ima_adpcm_tests_OBJECTS = $(am_ima_adpcm_tests_OBJECTS) +ima_adpcm_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_line_model_tests_OBJECTS = line_model_tests.$(OBJEXT) +line_model_tests_OBJECTS = $(am_line_model_tests_OBJECTS) +line_model_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_logging_tests_OBJECTS = logging_tests.$(OBJEXT) +logging_tests_OBJECTS = $(am_logging_tests_OBJECTS) +logging_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_lpc10_tests_OBJECTS = lpc10_tests.$(OBJEXT) +lpc10_tests_OBJECTS = $(am_lpc10_tests_OBJECTS) +lpc10_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_make_g168_css_OBJECTS = make_g168_css.$(OBJEXT) +make_g168_css_OBJECTS = $(am_make_g168_css_OBJECTS) +make_g168_css_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_modem_connect_tones_tests_OBJECTS = \ + modem_connect_tones_tests.$(OBJEXT) +modem_connect_tones_tests_OBJECTS = \ + $(am_modem_connect_tones_tests_OBJECTS) +modem_connect_tones_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_modem_echo_tests_OBJECTS = modem_echo_tests.$(OBJEXT) \ + echo_monitor.$(OBJEXT) +modem_echo_tests_OBJECTS = $(am_modem_echo_tests_OBJECTS) +modem_echo_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_noise_tests_OBJECTS = noise_tests.$(OBJEXT) +noise_tests_OBJECTS = $(am_noise_tests_OBJECTS) +noise_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_oki_adpcm_tests_OBJECTS = oki_adpcm_tests.$(OBJEXT) +oki_adpcm_tests_OBJECTS = $(am_oki_adpcm_tests_OBJECTS) +oki_adpcm_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_playout_tests_OBJECTS = playout_tests.$(OBJEXT) \ + media_monitor.$(OBJEXT) +playout_tests_OBJECTS = $(am_playout_tests_OBJECTS) +playout_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_plc_tests_OBJECTS = plc_tests.$(OBJEXT) +plc_tests_OBJECTS = $(am_plc_tests_OBJECTS) +plc_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_power_meter_tests_OBJECTS = power_meter_tests.$(OBJEXT) +power_meter_tests_OBJECTS = $(am_power_meter_tests_OBJECTS) +power_meter_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_queue_tests_OBJECTS = queue_tests.$(OBJEXT) +queue_tests_OBJECTS = $(am_queue_tests_OBJECTS) +queue_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_r2_mf_rx_tests_OBJECTS = r2_mf_rx_tests.$(OBJEXT) +r2_mf_rx_tests_OBJECTS = $(am_r2_mf_rx_tests_OBJECTS) +r2_mf_rx_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_r2_mf_tx_tests_OBJECTS = r2_mf_tx_tests.$(OBJEXT) +r2_mf_tx_tests_OBJECTS = $(am_r2_mf_tx_tests_OBJECTS) +r2_mf_tx_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_rfc2198_sim_tests_OBJECTS = rfc2198_sim_tests.$(OBJEXT) \ + media_monitor.$(OBJEXT) +rfc2198_sim_tests_OBJECTS = $(am_rfc2198_sim_tests_OBJECTS) +rfc2198_sim_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_schedule_tests_OBJECTS = schedule_tests.$(OBJEXT) +schedule_tests_OBJECTS = $(am_schedule_tests_OBJECTS) +schedule_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_sig_tone_tests_OBJECTS = sig_tone_tests.$(OBJEXT) +sig_tone_tests_OBJECTS = $(am_sig_tone_tests_OBJECTS) +sig_tone_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_super_tone_rx_tests_OBJECTS = super_tone_rx_tests.$(OBJEXT) +super_tone_rx_tests_OBJECTS = $(am_super_tone_rx_tests_OBJECTS) +super_tone_rx_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_super_tone_tx_tests_OBJECTS = super_tone_tx_tests.$(OBJEXT) +super_tone_tx_tests_OBJECTS = $(am_super_tone_tx_tests_OBJECTS) +super_tone_tx_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_swept_tone_tests_OBJECTS = swept_tone_tests.$(OBJEXT) +swept_tone_tests_OBJECTS = $(am_swept_tone_tests_OBJECTS) +swept_tone_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_t31_tests_OBJECTS = t31_tests.$(OBJEXT) fax_utils.$(OBJEXT) \ + media_monitor.$(OBJEXT) +t31_tests_OBJECTS = $(am_t31_tests_OBJECTS) +t31_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_t38_core_tests_OBJECTS = t38_core_tests.$(OBJEXT) +t38_core_tests_OBJECTS = $(am_t38_core_tests_OBJECTS) +t38_core_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_t38_gateway_tests_OBJECTS = t38_gateway_tests.$(OBJEXT) \ + fax_utils.$(OBJEXT) media_monitor.$(OBJEXT) +t38_gateway_tests_OBJECTS = $(am_t38_gateway_tests_OBJECTS) +t38_gateway_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_t38_gateway_to_terminal_tests_OBJECTS = \ + t38_gateway_to_terminal_tests.$(OBJEXT) fax_utils.$(OBJEXT) \ + media_monitor.$(OBJEXT) +t38_gateway_to_terminal_tests_OBJECTS = \ + $(am_t38_gateway_to_terminal_tests_OBJECTS) +t38_gateway_to_terminal_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_t38_non_ecm_buffer_tests_OBJECTS = \ + t38_non_ecm_buffer_tests.$(OBJEXT) +t38_non_ecm_buffer_tests_OBJECTS = \ + $(am_t38_non_ecm_buffer_tests_OBJECTS) +t38_non_ecm_buffer_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_t38_terminal_tests_OBJECTS = t38_terminal_tests.$(OBJEXT) \ + fax_utils.$(OBJEXT) media_monitor.$(OBJEXT) +t38_terminal_tests_OBJECTS = $(am_t38_terminal_tests_OBJECTS) +t38_terminal_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_t38_terminal_to_gateway_tests_OBJECTS = \ + t38_terminal_to_gateway_tests.$(OBJEXT) fax_utils.$(OBJEXT) \ + media_monitor.$(OBJEXT) +t38_terminal_to_gateway_tests_OBJECTS = \ + $(am_t38_terminal_to_gateway_tests_OBJECTS) +t38_terminal_to_gateway_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_t4_tests_OBJECTS = t4_tests.$(OBJEXT) +t4_tests_OBJECTS = $(am_t4_tests_OBJECTS) +t4_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_testadsi_OBJECTS = testadsi.$(OBJEXT) +testadsi_OBJECTS = $(am_testadsi_OBJECTS) +testadsi_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_testfax_OBJECTS = testfax.$(OBJEXT) +testfax_OBJECTS = $(am_testfax_OBJECTS) +testfax_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_time_scale_tests_OBJECTS = time_scale_tests.$(OBJEXT) +time_scale_tests_OBJECTS = $(am_time_scale_tests_OBJECTS) +time_scale_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_tone_detect_tests_OBJECTS = tone_detect_tests.$(OBJEXT) +tone_detect_tests_OBJECTS = $(am_tone_detect_tests_OBJECTS) +tone_detect_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_tone_generate_tests_OBJECTS = tone_generate_tests.$(OBJEXT) +tone_generate_tests_OBJECTS = $(am_tone_generate_tests_OBJECTS) +tone_generate_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_tsb85_tests_OBJECTS = tsb85_tests.$(OBJEXT) fax_utils.$(OBJEXT) \ + fax_tester.$(OBJEXT) +tsb85_tests_OBJECTS = $(am_tsb85_tests_OBJECTS) +tsb85_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_v17_tests_OBJECTS = v17_tests.$(OBJEXT) \ + line_model_monitor.$(OBJEXT) modem_monitor.$(OBJEXT) +v17_tests_OBJECTS = $(am_v17_tests_OBJECTS) +v17_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_v18_tests_OBJECTS = v18_tests.$(OBJEXT) +v18_tests_OBJECTS = $(am_v18_tests_OBJECTS) +v18_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_v22bis_tests_OBJECTS = v22bis_tests.$(OBJEXT) \ + line_model_monitor.$(OBJEXT) modem_monitor.$(OBJEXT) +v22bis_tests_OBJECTS = $(am_v22bis_tests_OBJECTS) +v22bis_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_v27ter_tests_OBJECTS = v27ter_tests.$(OBJEXT) \ + line_model_monitor.$(OBJEXT) modem_monitor.$(OBJEXT) +v27ter_tests_OBJECTS = $(am_v27ter_tests_OBJECTS) +v27ter_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_v29_tests_OBJECTS = v29_tests.$(OBJEXT) \ + line_model_monitor.$(OBJEXT) modem_monitor.$(OBJEXT) +v29_tests_OBJECTS = $(am_v29_tests_OBJECTS) +v29_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_v42_tests_OBJECTS = v42_tests.$(OBJEXT) +v42_tests_OBJECTS = $(am_v42_tests_OBJECTS) +v42_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_v42bis_tests_OBJECTS = v42bis_tests.$(OBJEXT) +v42bis_tests_OBJECTS = $(am_v42bis_tests_OBJECTS) +v42bis_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_v8_tests_OBJECTS = v8_tests.$(OBJEXT) +v8_tests_OBJECTS = $(am_v8_tests_OBJECTS) +v8_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_vector_float_tests_OBJECTS = vector_float_tests.$(OBJEXT) +vector_float_tests_OBJECTS = $(am_vector_float_tests_OBJECTS) +vector_float_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_vector_int_tests_OBJECTS = vector_int_tests.$(OBJEXT) +vector_int_tests_OBJECTS = $(am_vector_int_tests_OBJECTS) +vector_int_tests_DEPENDENCIES = $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(adsi_tests_SOURCES) $(async_tests_SOURCES) \ + $(at_interpreter_tests_SOURCES) $(awgn_tests_SOURCES) \ + $(bell_mf_rx_tests_SOURCES) $(bell_mf_tx_tests_SOURCES) \ + $(bert_tests_SOURCES) $(bit_operations_tests_SOURCES) \ + $(complex_tests_SOURCES) $(complex_vector_float_tests_SOURCES) \ + $(complex_vector_int_tests_SOURCES) $(crc_tests_SOURCES) \ + $(dc_restore_tests_SOURCES) $(dds_tests_SOURCES) \ + $(dtmf_rx_tests_SOURCES) $(dtmf_tx_tests_SOURCES) \ + $(echo_tests_SOURCES) $(fax_decode_SOURCES) \ + $(fax_tests_SOURCES) $(fsk_tests_SOURCES) \ + $(g1050_tests_SOURCES) $(g168_tests_SOURCES) \ + $(g711_tests_SOURCES) $(g722_tests_SOURCES) \ + $(g726_tests_SOURCES) $(gsm0610_tests_SOURCES) \ + $(hdlc_tests_SOURCES) $(ima_adpcm_tests_SOURCES) \ + $(line_model_tests_SOURCES) $(logging_tests_SOURCES) \ + $(lpc10_tests_SOURCES) $(make_g168_css_SOURCES) \ + $(modem_connect_tones_tests_SOURCES) \ + $(modem_echo_tests_SOURCES) $(noise_tests_SOURCES) \ + $(oki_adpcm_tests_SOURCES) $(playout_tests_SOURCES) \ + $(plc_tests_SOURCES) $(power_meter_tests_SOURCES) \ + $(queue_tests_SOURCES) $(r2_mf_rx_tests_SOURCES) \ + $(r2_mf_tx_tests_SOURCES) $(rfc2198_sim_tests_SOURCES) \ + $(schedule_tests_SOURCES) $(sig_tone_tests_SOURCES) \ + $(super_tone_rx_tests_SOURCES) $(super_tone_tx_tests_SOURCES) \ + $(swept_tone_tests_SOURCES) $(t31_tests_SOURCES) \ + $(t38_core_tests_SOURCES) $(t38_gateway_tests_SOURCES) \ + $(t38_gateway_to_terminal_tests_SOURCES) \ + $(t38_non_ecm_buffer_tests_SOURCES) \ + $(t38_terminal_tests_SOURCES) \ + $(t38_terminal_to_gateway_tests_SOURCES) $(t4_tests_SOURCES) \ + $(testadsi_SOURCES) $(testfax_SOURCES) \ + $(time_scale_tests_SOURCES) $(tone_detect_tests_SOURCES) \ + $(tone_generate_tests_SOURCES) $(tsb85_tests_SOURCES) \ + $(v17_tests_SOURCES) $(v18_tests_SOURCES) \ + $(v22bis_tests_SOURCES) $(v27ter_tests_SOURCES) \ + $(v29_tests_SOURCES) $(v42_tests_SOURCES) \ + $(v42bis_tests_SOURCES) $(v8_tests_SOURCES) \ + $(vector_float_tests_SOURCES) $(vector_int_tests_SOURCES) +DIST_SOURCES = $(adsi_tests_SOURCES) $(async_tests_SOURCES) \ + $(at_interpreter_tests_SOURCES) $(awgn_tests_SOURCES) \ + $(bell_mf_rx_tests_SOURCES) $(bell_mf_tx_tests_SOURCES) \ + $(bert_tests_SOURCES) $(bit_operations_tests_SOURCES) \ + $(complex_tests_SOURCES) $(complex_vector_float_tests_SOURCES) \ + $(complex_vector_int_tests_SOURCES) $(crc_tests_SOURCES) \ + $(dc_restore_tests_SOURCES) $(dds_tests_SOURCES) \ + $(dtmf_rx_tests_SOURCES) $(dtmf_tx_tests_SOURCES) \ + $(echo_tests_SOURCES) $(fax_decode_SOURCES) \ + $(fax_tests_SOURCES) $(fsk_tests_SOURCES) \ + $(g1050_tests_SOURCES) $(g168_tests_SOURCES) \ + $(g711_tests_SOURCES) $(g722_tests_SOURCES) \ + $(g726_tests_SOURCES) $(gsm0610_tests_SOURCES) \ + $(hdlc_tests_SOURCES) $(ima_adpcm_tests_SOURCES) \ + $(line_model_tests_SOURCES) $(logging_tests_SOURCES) \ + $(lpc10_tests_SOURCES) $(make_g168_css_SOURCES) \ + $(modem_connect_tones_tests_SOURCES) \ + $(modem_echo_tests_SOURCES) $(noise_tests_SOURCES) \ + $(oki_adpcm_tests_SOURCES) $(playout_tests_SOURCES) \ + $(plc_tests_SOURCES) $(power_meter_tests_SOURCES) \ + $(queue_tests_SOURCES) $(r2_mf_rx_tests_SOURCES) \ + $(r2_mf_tx_tests_SOURCES) $(rfc2198_sim_tests_SOURCES) \ + $(schedule_tests_SOURCES) $(sig_tone_tests_SOURCES) \ + $(super_tone_rx_tests_SOURCES) $(super_tone_tx_tests_SOURCES) \ + $(swept_tone_tests_SOURCES) $(t31_tests_SOURCES) \ + $(t38_core_tests_SOURCES) $(t38_gateway_tests_SOURCES) \ + $(t38_gateway_to_terminal_tests_SOURCES) \ + $(t38_non_ecm_buffer_tests_SOURCES) \ + $(t38_terminal_tests_SOURCES) \ + $(t38_terminal_to_gateway_tests_SOURCES) $(t4_tests_SOURCES) \ + $(testadsi_SOURCES) $(testfax_SOURCES) \ + $(time_scale_tests_SOURCES) $(tone_detect_tests_SOURCES) \ + $(tone_generate_tests_SOURCES) $(tsb85_tests_SOURCES) \ + $(v17_tests_SOURCES) $(v18_tests_SOURCES) \ + $(v22bis_tests_SOURCES) $(v27ter_tests_SOURCES) \ + $(v29_tests_SOURCES) $(v42_tests_SOURCES) \ + $(v42bis_tests_SOURCES) $(v8_tests_SOURCES) \ + $(vector_float_tests_SOURCES) $(vector_int_tests_SOURCES) +DATA = $(noinst_DATA) +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_FOR_BUILD = @CC_FOR_BUILD@ +CFLAGS = @CFLAGS@ +COMP_VENDOR_CFLAGS = @COMP_VENDOR_CFLAGS@ +COMP_VENDOR_LDFLAGS = @COMP_VENDOR_LDFLAGS@ +COND_DOC_FALSE = @COND_DOC_FALSE@ +COND_DOC_TRUE = @COND_DOC_TRUE@ +COND_MMX_FALSE = @COND_MMX_FALSE@ +COND_MMX_TRUE = @COND_MMX_TRUE@ +COND_SSE2_FALSE = @COND_SSE2_FALSE@ +COND_SSE2_TRUE = @COND_SSE2_TRUE@ +COND_SSE3_FALSE = @COND_SSE3_FALSE@ +COND_SSE3_TRUE = @COND_SSE3_TRUE@ +COND_SSE4A_FALSE = @COND_SSE4A_FALSE@ +COND_SSE4A_TRUE = @COND_SSE4A_TRUE@ +COND_SSE4_1_FALSE = @COND_SSE4_1_FALSE@ +COND_SSE4_1_TRUE = @COND_SSE4_1_TRUE@ +COND_SSE4_2_FALSE = @COND_SSE4_2_FALSE@ +COND_SSE4_2_TRUE = @COND_SSE4_2_TRUE@ +COND_SSE5_FALSE = @COND_SSE5_FALSE@ +COND_SSE5_TRUE = @COND_SSE5_TRUE@ +COND_SSE_FALSE = @COND_SSE_FALSE@ +COND_SSE_TRUE = @COND_SSE_TRUE@ +COND_SSSE3_FALSE = @COND_SSSE3_FALSE@ +COND_SSSE3_TRUE = @COND_SSSE3_TRUE@ +COND_TESTDATA_FALSE = @COND_TESTDATA_FALSE@ +COND_TESTDATA_TRUE = @COND_TESTDATA_TRUE@ +COND_TESTS_FALSE = @COND_TESTS_FALSE@ +COND_TESTS_TRUE = @COND_TESTS_TRUE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSERT_INTTYPES_HEADER = @INSERT_INTTYPES_HEADER@ +INSERT_MATH_HEADER = @INSERT_MATH_HEADER@ +INSERT_STDINT_HEADER = @INSERT_STDINT_HEADER@ +INSERT_TGMATH_HEADER = @INSERT_TGMATH_HEADER@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ $(TESTLIBS) +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIMLIBS = @SIMLIBS@ +SPANDSP_LT_AGE = @SPANDSP_LT_AGE@ +SPANDSP_LT_CURRENT = @SPANDSP_LT_CURRENT@ +SPANDSP_LT_REVISION = @SPANDSP_LT_REVISION@ +SPANDSP_MISALIGNED_ACCESS_FAILS = @SPANDSP_MISALIGNED_ACCESS_FAILS@ +SPANDSP_USE_EXPORT_CAPABILITY = @SPANDSP_USE_EXPORT_CAPABILITY@ +SPANDSP_USE_FIXED_POINT = @SPANDSP_USE_FIXED_POINT@ +STRIP = @STRIP@ +TESTLIBS = @TESTLIBS@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DSYMUTIL = @ac_ct_DSYMUTIL@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_NMEDIT = @ac_ct_NMEDIT@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AM_CFLAGS = $(COMP_VENDOR_CFLAGS) +AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) +noinst_DATA = sound_c1_8k.wav sound_c3_8k.wav +EXTRA_DIST = regression_tests.sh \ + v42bis_tests.sh \ + fax_tests.sh \ + tsb85_tests.sh \ + msvc/adsi_tests.vcproj \ + msvc/complex_tests.vcproj \ + msvc/complex_vector_float_tests.vcproj \ + msvc/complex_vector_int_tests.vcproj \ + msvc/dtmf_rx_tests.vcproj \ + msvc/dtmf_tx_tests.vcproj \ + msvc/queue_tests.vcproj \ + msvc/t38_core_tests.vcproj \ + msvc/t38_non_ecm_buffer_tests.vcproj \ + msvc/t38_terminal_tests.vcproj \ + msvc/v22bis_tests.vcproj \ + msvc/v29_tests.vcproj \ + msvc/v8_tests.vcproj \ + msvc/v80_tests.vcproj \ + msvc/vector_float_tests.vcproj \ + msvc/vector_int_tests.vcproj + +MAINTAINERCLEANFILES = Makefile.in +INCLUDES = -I$(top_builddir)/src -I$(top_builddir)/spandsp-sim -DDATADIR="\"$(pkgdatadir)\"" +LIBDIR = -L$(top_builddir)/src +noinst_HEADERS = echo_monitor.h \ + fax_tester.h \ + fax_utils.h \ + line_model_monitor.h \ + media_monitor.h \ + modem_monitor.h + +adsi_tests_SOURCES = adsi_tests.c +adsi_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +async_tests_SOURCES = async_tests.c +async_tests_LDADD = $(LIBDIR) -lspandsp +at_interpreter_tests_SOURCES = at_interpreter_tests.c +at_interpreter_tests_LDADD = $(LIBDIR) -lspandsp +awgn_tests_SOURCES = awgn_tests.c +awgn_tests_LDADD = $(LIBDIR) -lspandsp +bell_mf_rx_tests_SOURCES = bell_mf_rx_tests.c +bell_mf_rx_tests_LDADD = $(LIBDIR) -lspandsp +bell_mf_tx_tests_SOURCES = bell_mf_tx_tests.c +bell_mf_tx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +bert_tests_SOURCES = bert_tests.c +bert_tests_LDADD = $(LIBDIR) -lspandsp +bit_operations_tests_SOURCES = bit_operations_tests.c +bit_operations_tests_LDADD = $(LIBDIR) -lspandsp +complex_tests_SOURCES = complex_tests.c +complex_tests_LDADD = $(LIBDIR) -lspandsp +complex_vector_float_tests_SOURCES = complex_vector_float_tests.c +complex_vector_float_tests_LDADD = $(LIBDIR) -lspandsp +complex_vector_int_tests_SOURCES = complex_vector_int_tests.c +complex_vector_int_tests_LDADD = $(LIBDIR) -lspandsp +crc_tests_SOURCES = crc_tests.c +crc_tests_LDADD = $(LIBDIR) -lspandsp +dc_restore_tests_SOURCES = dc_restore_tests.c +dc_restore_tests_LDADD = $(LIBDIR) -lspandsp +dds_tests_SOURCES = dds_tests.c +dds_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +dtmf_rx_tests_SOURCES = dtmf_rx_tests.c +dtmf_rx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +dtmf_tx_tests_SOURCES = dtmf_tx_tests.c +dtmf_tx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +echo_tests_SOURCES = echo_tests.c echo_monitor.cpp +echo_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +fax_decode_SOURCES = fax_decode.c +fax_decode_LDADD = $(LIBDIR) -lspandsp +fax_tests_SOURCES = fax_tests.c fax_utils.c +fax_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +fsk_tests_SOURCES = fsk_tests.c +fsk_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +g1050_tests_SOURCES = g1050_tests.c media_monitor.cpp +g1050_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +g168_tests_SOURCES = g168_tests.c +g168_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +g711_tests_SOURCES = g711_tests.c +g711_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +g722_tests_SOURCES = g722_tests.c +g722_tests_LDADD = $(LIBDIR) -lspandsp +g726_tests_SOURCES = g726_tests.c +g726_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +gsm0610_tests_SOURCES = gsm0610_tests.c +gsm0610_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +hdlc_tests_SOURCES = hdlc_tests.c +hdlc_tests_LDADD = $(LIBDIR) -lspandsp +ima_adpcm_tests_SOURCES = ima_adpcm_tests.c +ima_adpcm_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +line_model_tests_SOURCES = line_model_tests.c +line_model_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +logging_tests_SOURCES = logging_tests.c +logging_tests_LDADD = $(LIBDIR) -lspandsp +lpc10_tests_SOURCES = lpc10_tests.c +lpc10_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +make_g168_css_SOURCES = make_g168_css.c +make_g168_css_LDADD = $(LIBDIR) -lspandsp +modem_echo_tests_SOURCES = modem_echo_tests.c echo_monitor.cpp +modem_echo_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +modem_connect_tones_tests_SOURCES = modem_connect_tones_tests.c +modem_connect_tones_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +noise_tests_SOURCES = noise_tests.c +noise_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +oki_adpcm_tests_SOURCES = oki_adpcm_tests.c +oki_adpcm_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +playout_tests_SOURCES = playout_tests.c media_monitor.cpp +playout_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +plc_tests_SOURCES = plc_tests.c +plc_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +power_meter_tests_SOURCES = power_meter_tests.c +power_meter_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +queue_tests_SOURCES = queue_tests.c +queue_tests_LDADD = $(LIBDIR) -lspandsp +r2_mf_rx_tests_SOURCES = r2_mf_rx_tests.c +r2_mf_rx_tests_LDADD = $(LIBDIR) -lspandsp +r2_mf_tx_tests_SOURCES = r2_mf_tx_tests.c +r2_mf_tx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +rfc2198_sim_tests_SOURCES = rfc2198_sim_tests.c media_monitor.cpp +rfc2198_sim_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +schedule_tests_SOURCES = schedule_tests.c +schedule_tests_LDADD = $(LIBDIR) -lspandsp +sig_tone_tests_SOURCES = sig_tone_tests.c +sig_tone_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +super_tone_rx_tests_SOURCES = super_tone_rx_tests.c +super_tone_rx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +super_tone_tx_tests_SOURCES = super_tone_tx_tests.c +super_tone_tx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +swept_tone_tests_SOURCES = swept_tone_tests.c +swept_tone_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +t4_tests_SOURCES = t4_tests.c +t4_tests_LDADD = $(LIBDIR) -lspandsp +t31_tests_SOURCES = t31_tests.c fax_utils.c media_monitor.cpp +t31_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +t38_core_tests_SOURCES = t38_core_tests.c +t38_core_tests_LDADD = $(LIBDIR) -lspandsp +t38_gateway_tests_SOURCES = t38_gateway_tests.c fax_utils.c media_monitor.cpp +t38_gateway_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +t38_gateway_to_terminal_tests_SOURCES = t38_gateway_to_terminal_tests.c fax_utils.c media_monitor.cpp +t38_gateway_to_terminal_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +t38_non_ecm_buffer_tests_SOURCES = t38_non_ecm_buffer_tests.c +t38_non_ecm_buffer_tests_LDADD = $(LIBDIR) -lspandsp +t38_terminal_tests_SOURCES = t38_terminal_tests.c fax_utils.c media_monitor.cpp +t38_terminal_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +t38_terminal_to_gateway_tests_SOURCES = t38_terminal_to_gateway_tests.c fax_utils.c media_monitor.cpp +t38_terminal_to_gateway_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +time_scale_tests_SOURCES = time_scale_tests.c +time_scale_tests_LDADD = $(LIBDIR) -lspandsp +tone_detect_tests_SOURCES = tone_detect_tests.c +tone_detect_tests_LDADD = $(LIBDIR) -lspandsp +tone_generate_tests_SOURCES = tone_generate_tests.c +tone_generate_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +tsb85_tests_SOURCES = tsb85_tests.c fax_utils.c fax_tester.c +tsb85_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +v17_tests_SOURCES = v17_tests.c line_model_monitor.cpp modem_monitor.cpp +v17_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +v18_tests_SOURCES = v18_tests.c +v18_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +v22bis_tests_SOURCES = v22bis_tests.c line_model_monitor.cpp modem_monitor.cpp +v22bis_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +v27ter_tests_SOURCES = v27ter_tests.c line_model_monitor.cpp modem_monitor.cpp +v27ter_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +v29_tests_SOURCES = v29_tests.c line_model_monitor.cpp modem_monitor.cpp +v29_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +v42_tests_SOURCES = v42_tests.c +v42_tests_LDADD = $(LIBDIR) -lspandsp +v42bis_tests_SOURCES = v42bis_tests.c +v42bis_tests_LDADD = $(LIBDIR) -lspandsp +v8_tests_SOURCES = v8_tests.c +v8_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +vector_float_tests_SOURCES = vector_float_tests.c +vector_float_tests_LDADD = $(LIBDIR) -lspandsp +vector_int_tests_SOURCES = vector_int_tests.c +vector_int_tests_LDADD = $(LIBDIR) -lspandsp +testadsi_SOURCES = testadsi.c +testadsi_LDADD = $(LIBDIR) -lspandsp +testfax_SOURCES = testfax.c +testfax_LDADD = $(LIBDIR) -lspandsp +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .cpp .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +adsi_tests$(EXEEXT): $(adsi_tests_OBJECTS) $(adsi_tests_DEPENDENCIES) + @rm -f adsi_tests$(EXEEXT) + $(LINK) $(adsi_tests_LDFLAGS) $(adsi_tests_OBJECTS) $(adsi_tests_LDADD) $(LIBS) +async_tests$(EXEEXT): $(async_tests_OBJECTS) $(async_tests_DEPENDENCIES) + @rm -f async_tests$(EXEEXT) + $(LINK) $(async_tests_LDFLAGS) $(async_tests_OBJECTS) $(async_tests_LDADD) $(LIBS) +at_interpreter_tests$(EXEEXT): $(at_interpreter_tests_OBJECTS) $(at_interpreter_tests_DEPENDENCIES) + @rm -f at_interpreter_tests$(EXEEXT) + $(LINK) $(at_interpreter_tests_LDFLAGS) $(at_interpreter_tests_OBJECTS) $(at_interpreter_tests_LDADD) $(LIBS) +awgn_tests$(EXEEXT): $(awgn_tests_OBJECTS) $(awgn_tests_DEPENDENCIES) + @rm -f awgn_tests$(EXEEXT) + $(LINK) $(awgn_tests_LDFLAGS) $(awgn_tests_OBJECTS) $(awgn_tests_LDADD) $(LIBS) +bell_mf_rx_tests$(EXEEXT): $(bell_mf_rx_tests_OBJECTS) $(bell_mf_rx_tests_DEPENDENCIES) + @rm -f bell_mf_rx_tests$(EXEEXT) + $(LINK) $(bell_mf_rx_tests_LDFLAGS) $(bell_mf_rx_tests_OBJECTS) $(bell_mf_rx_tests_LDADD) $(LIBS) +bell_mf_tx_tests$(EXEEXT): $(bell_mf_tx_tests_OBJECTS) $(bell_mf_tx_tests_DEPENDENCIES) + @rm -f bell_mf_tx_tests$(EXEEXT) + $(LINK) $(bell_mf_tx_tests_LDFLAGS) $(bell_mf_tx_tests_OBJECTS) $(bell_mf_tx_tests_LDADD) $(LIBS) +bert_tests$(EXEEXT): $(bert_tests_OBJECTS) $(bert_tests_DEPENDENCIES) + @rm -f bert_tests$(EXEEXT) + $(LINK) $(bert_tests_LDFLAGS) $(bert_tests_OBJECTS) $(bert_tests_LDADD) $(LIBS) +bit_operations_tests$(EXEEXT): $(bit_operations_tests_OBJECTS) $(bit_operations_tests_DEPENDENCIES) + @rm -f bit_operations_tests$(EXEEXT) + $(LINK) $(bit_operations_tests_LDFLAGS) $(bit_operations_tests_OBJECTS) $(bit_operations_tests_LDADD) $(LIBS) +complex_tests$(EXEEXT): $(complex_tests_OBJECTS) $(complex_tests_DEPENDENCIES) + @rm -f complex_tests$(EXEEXT) + $(LINK) $(complex_tests_LDFLAGS) $(complex_tests_OBJECTS) $(complex_tests_LDADD) $(LIBS) +complex_vector_float_tests$(EXEEXT): $(complex_vector_float_tests_OBJECTS) $(complex_vector_float_tests_DEPENDENCIES) + @rm -f complex_vector_float_tests$(EXEEXT) + $(LINK) $(complex_vector_float_tests_LDFLAGS) $(complex_vector_float_tests_OBJECTS) $(complex_vector_float_tests_LDADD) $(LIBS) +complex_vector_int_tests$(EXEEXT): $(complex_vector_int_tests_OBJECTS) $(complex_vector_int_tests_DEPENDENCIES) + @rm -f complex_vector_int_tests$(EXEEXT) + $(LINK) $(complex_vector_int_tests_LDFLAGS) $(complex_vector_int_tests_OBJECTS) $(complex_vector_int_tests_LDADD) $(LIBS) +crc_tests$(EXEEXT): $(crc_tests_OBJECTS) $(crc_tests_DEPENDENCIES) + @rm -f crc_tests$(EXEEXT) + $(LINK) $(crc_tests_LDFLAGS) $(crc_tests_OBJECTS) $(crc_tests_LDADD) $(LIBS) +dc_restore_tests$(EXEEXT): $(dc_restore_tests_OBJECTS) $(dc_restore_tests_DEPENDENCIES) + @rm -f dc_restore_tests$(EXEEXT) + $(LINK) $(dc_restore_tests_LDFLAGS) $(dc_restore_tests_OBJECTS) $(dc_restore_tests_LDADD) $(LIBS) +dds_tests$(EXEEXT): $(dds_tests_OBJECTS) $(dds_tests_DEPENDENCIES) + @rm -f dds_tests$(EXEEXT) + $(LINK) $(dds_tests_LDFLAGS) $(dds_tests_OBJECTS) $(dds_tests_LDADD) $(LIBS) +dtmf_rx_tests$(EXEEXT): $(dtmf_rx_tests_OBJECTS) $(dtmf_rx_tests_DEPENDENCIES) + @rm -f dtmf_rx_tests$(EXEEXT) + $(LINK) $(dtmf_rx_tests_LDFLAGS) $(dtmf_rx_tests_OBJECTS) $(dtmf_rx_tests_LDADD) $(LIBS) +dtmf_tx_tests$(EXEEXT): $(dtmf_tx_tests_OBJECTS) $(dtmf_tx_tests_DEPENDENCIES) + @rm -f dtmf_tx_tests$(EXEEXT) + $(LINK) $(dtmf_tx_tests_LDFLAGS) $(dtmf_tx_tests_OBJECTS) $(dtmf_tx_tests_LDADD) $(LIBS) +echo_tests$(EXEEXT): $(echo_tests_OBJECTS) $(echo_tests_DEPENDENCIES) + @rm -f echo_tests$(EXEEXT) + $(CXXLINK) $(echo_tests_LDFLAGS) $(echo_tests_OBJECTS) $(echo_tests_LDADD) $(LIBS) +fax_decode$(EXEEXT): $(fax_decode_OBJECTS) $(fax_decode_DEPENDENCIES) + @rm -f fax_decode$(EXEEXT) + $(LINK) $(fax_decode_LDFLAGS) $(fax_decode_OBJECTS) $(fax_decode_LDADD) $(LIBS) +fax_tests$(EXEEXT): $(fax_tests_OBJECTS) $(fax_tests_DEPENDENCIES) + @rm -f fax_tests$(EXEEXT) + $(LINK) $(fax_tests_LDFLAGS) $(fax_tests_OBJECTS) $(fax_tests_LDADD) $(LIBS) +fsk_tests$(EXEEXT): $(fsk_tests_OBJECTS) $(fsk_tests_DEPENDENCIES) + @rm -f fsk_tests$(EXEEXT) + $(LINK) $(fsk_tests_LDFLAGS) $(fsk_tests_OBJECTS) $(fsk_tests_LDADD) $(LIBS) +g1050_tests$(EXEEXT): $(g1050_tests_OBJECTS) $(g1050_tests_DEPENDENCIES) + @rm -f g1050_tests$(EXEEXT) + $(CXXLINK) $(g1050_tests_LDFLAGS) $(g1050_tests_OBJECTS) $(g1050_tests_LDADD) $(LIBS) +g168_tests$(EXEEXT): $(g168_tests_OBJECTS) $(g168_tests_DEPENDENCIES) + @rm -f g168_tests$(EXEEXT) + $(LINK) $(g168_tests_LDFLAGS) $(g168_tests_OBJECTS) $(g168_tests_LDADD) $(LIBS) +g711_tests$(EXEEXT): $(g711_tests_OBJECTS) $(g711_tests_DEPENDENCIES) + @rm -f g711_tests$(EXEEXT) + $(LINK) $(g711_tests_LDFLAGS) $(g711_tests_OBJECTS) $(g711_tests_LDADD) $(LIBS) +g722_tests$(EXEEXT): $(g722_tests_OBJECTS) $(g722_tests_DEPENDENCIES) + @rm -f g722_tests$(EXEEXT) + $(LINK) $(g722_tests_LDFLAGS) $(g722_tests_OBJECTS) $(g722_tests_LDADD) $(LIBS) +g726_tests$(EXEEXT): $(g726_tests_OBJECTS) $(g726_tests_DEPENDENCIES) + @rm -f g726_tests$(EXEEXT) + $(LINK) $(g726_tests_LDFLAGS) $(g726_tests_OBJECTS) $(g726_tests_LDADD) $(LIBS) +gsm0610_tests$(EXEEXT): $(gsm0610_tests_OBJECTS) $(gsm0610_tests_DEPENDENCIES) + @rm -f gsm0610_tests$(EXEEXT) + $(LINK) $(gsm0610_tests_LDFLAGS) $(gsm0610_tests_OBJECTS) $(gsm0610_tests_LDADD) $(LIBS) +hdlc_tests$(EXEEXT): $(hdlc_tests_OBJECTS) $(hdlc_tests_DEPENDENCIES) + @rm -f hdlc_tests$(EXEEXT) + $(LINK) $(hdlc_tests_LDFLAGS) $(hdlc_tests_OBJECTS) $(hdlc_tests_LDADD) $(LIBS) +ima_adpcm_tests$(EXEEXT): $(ima_adpcm_tests_OBJECTS) $(ima_adpcm_tests_DEPENDENCIES) + @rm -f ima_adpcm_tests$(EXEEXT) + $(LINK) $(ima_adpcm_tests_LDFLAGS) $(ima_adpcm_tests_OBJECTS) $(ima_adpcm_tests_LDADD) $(LIBS) +line_model_tests$(EXEEXT): $(line_model_tests_OBJECTS) $(line_model_tests_DEPENDENCIES) + @rm -f line_model_tests$(EXEEXT) + $(LINK) $(line_model_tests_LDFLAGS) $(line_model_tests_OBJECTS) $(line_model_tests_LDADD) $(LIBS) +logging_tests$(EXEEXT): $(logging_tests_OBJECTS) $(logging_tests_DEPENDENCIES) + @rm -f logging_tests$(EXEEXT) + $(LINK) $(logging_tests_LDFLAGS) $(logging_tests_OBJECTS) $(logging_tests_LDADD) $(LIBS) +lpc10_tests$(EXEEXT): $(lpc10_tests_OBJECTS) $(lpc10_tests_DEPENDENCIES) + @rm -f lpc10_tests$(EXEEXT) + $(LINK) $(lpc10_tests_LDFLAGS) $(lpc10_tests_OBJECTS) $(lpc10_tests_LDADD) $(LIBS) +make_g168_css$(EXEEXT): $(make_g168_css_OBJECTS) $(make_g168_css_DEPENDENCIES) + @rm -f make_g168_css$(EXEEXT) + $(LINK) $(make_g168_css_LDFLAGS) $(make_g168_css_OBJECTS) $(make_g168_css_LDADD) $(LIBS) +modem_connect_tones_tests$(EXEEXT): $(modem_connect_tones_tests_OBJECTS) $(modem_connect_tones_tests_DEPENDENCIES) + @rm -f modem_connect_tones_tests$(EXEEXT) + $(LINK) $(modem_connect_tones_tests_LDFLAGS) $(modem_connect_tones_tests_OBJECTS) $(modem_connect_tones_tests_LDADD) $(LIBS) +modem_echo_tests$(EXEEXT): $(modem_echo_tests_OBJECTS) $(modem_echo_tests_DEPENDENCIES) + @rm -f modem_echo_tests$(EXEEXT) + $(CXXLINK) $(modem_echo_tests_LDFLAGS) $(modem_echo_tests_OBJECTS) $(modem_echo_tests_LDADD) $(LIBS) +noise_tests$(EXEEXT): $(noise_tests_OBJECTS) $(noise_tests_DEPENDENCIES) + @rm -f noise_tests$(EXEEXT) + $(LINK) $(noise_tests_LDFLAGS) $(noise_tests_OBJECTS) $(noise_tests_LDADD) $(LIBS) +oki_adpcm_tests$(EXEEXT): $(oki_adpcm_tests_OBJECTS) $(oki_adpcm_tests_DEPENDENCIES) + @rm -f oki_adpcm_tests$(EXEEXT) + $(LINK) $(oki_adpcm_tests_LDFLAGS) $(oki_adpcm_tests_OBJECTS) $(oki_adpcm_tests_LDADD) $(LIBS) +playout_tests$(EXEEXT): $(playout_tests_OBJECTS) $(playout_tests_DEPENDENCIES) + @rm -f playout_tests$(EXEEXT) + $(CXXLINK) $(playout_tests_LDFLAGS) $(playout_tests_OBJECTS) $(playout_tests_LDADD) $(LIBS) +plc_tests$(EXEEXT): $(plc_tests_OBJECTS) $(plc_tests_DEPENDENCIES) + @rm -f plc_tests$(EXEEXT) + $(LINK) $(plc_tests_LDFLAGS) $(plc_tests_OBJECTS) $(plc_tests_LDADD) $(LIBS) +power_meter_tests$(EXEEXT): $(power_meter_tests_OBJECTS) $(power_meter_tests_DEPENDENCIES) + @rm -f power_meter_tests$(EXEEXT) + $(LINK) $(power_meter_tests_LDFLAGS) $(power_meter_tests_OBJECTS) $(power_meter_tests_LDADD) $(LIBS) +queue_tests$(EXEEXT): $(queue_tests_OBJECTS) $(queue_tests_DEPENDENCIES) + @rm -f queue_tests$(EXEEXT) + $(LINK) $(queue_tests_LDFLAGS) $(queue_tests_OBJECTS) $(queue_tests_LDADD) $(LIBS) +r2_mf_rx_tests$(EXEEXT): $(r2_mf_rx_tests_OBJECTS) $(r2_mf_rx_tests_DEPENDENCIES) + @rm -f r2_mf_rx_tests$(EXEEXT) + $(LINK) $(r2_mf_rx_tests_LDFLAGS) $(r2_mf_rx_tests_OBJECTS) $(r2_mf_rx_tests_LDADD) $(LIBS) +r2_mf_tx_tests$(EXEEXT): $(r2_mf_tx_tests_OBJECTS) $(r2_mf_tx_tests_DEPENDENCIES) + @rm -f r2_mf_tx_tests$(EXEEXT) + $(LINK) $(r2_mf_tx_tests_LDFLAGS) $(r2_mf_tx_tests_OBJECTS) $(r2_mf_tx_tests_LDADD) $(LIBS) +rfc2198_sim_tests$(EXEEXT): $(rfc2198_sim_tests_OBJECTS) $(rfc2198_sim_tests_DEPENDENCIES) + @rm -f rfc2198_sim_tests$(EXEEXT) + $(CXXLINK) $(rfc2198_sim_tests_LDFLAGS) $(rfc2198_sim_tests_OBJECTS) $(rfc2198_sim_tests_LDADD) $(LIBS) +schedule_tests$(EXEEXT): $(schedule_tests_OBJECTS) $(schedule_tests_DEPENDENCIES) + @rm -f schedule_tests$(EXEEXT) + $(LINK) $(schedule_tests_LDFLAGS) $(schedule_tests_OBJECTS) $(schedule_tests_LDADD) $(LIBS) +sig_tone_tests$(EXEEXT): $(sig_tone_tests_OBJECTS) $(sig_tone_tests_DEPENDENCIES) + @rm -f sig_tone_tests$(EXEEXT) + $(LINK) $(sig_tone_tests_LDFLAGS) $(sig_tone_tests_OBJECTS) $(sig_tone_tests_LDADD) $(LIBS) +super_tone_rx_tests$(EXEEXT): $(super_tone_rx_tests_OBJECTS) $(super_tone_rx_tests_DEPENDENCIES) + @rm -f super_tone_rx_tests$(EXEEXT) + $(LINK) $(super_tone_rx_tests_LDFLAGS) $(super_tone_rx_tests_OBJECTS) $(super_tone_rx_tests_LDADD) $(LIBS) +super_tone_tx_tests$(EXEEXT): $(super_tone_tx_tests_OBJECTS) $(super_tone_tx_tests_DEPENDENCIES) + @rm -f super_tone_tx_tests$(EXEEXT) + $(LINK) $(super_tone_tx_tests_LDFLAGS) $(super_tone_tx_tests_OBJECTS) $(super_tone_tx_tests_LDADD) $(LIBS) +swept_tone_tests$(EXEEXT): $(swept_tone_tests_OBJECTS) $(swept_tone_tests_DEPENDENCIES) + @rm -f swept_tone_tests$(EXEEXT) + $(LINK) $(swept_tone_tests_LDFLAGS) $(swept_tone_tests_OBJECTS) $(swept_tone_tests_LDADD) $(LIBS) +t31_tests$(EXEEXT): $(t31_tests_OBJECTS) $(t31_tests_DEPENDENCIES) + @rm -f t31_tests$(EXEEXT) + $(CXXLINK) $(t31_tests_LDFLAGS) $(t31_tests_OBJECTS) $(t31_tests_LDADD) $(LIBS) +t38_core_tests$(EXEEXT): $(t38_core_tests_OBJECTS) $(t38_core_tests_DEPENDENCIES) + @rm -f t38_core_tests$(EXEEXT) + $(LINK) $(t38_core_tests_LDFLAGS) $(t38_core_tests_OBJECTS) $(t38_core_tests_LDADD) $(LIBS) +t38_gateway_tests$(EXEEXT): $(t38_gateway_tests_OBJECTS) $(t38_gateway_tests_DEPENDENCIES) + @rm -f t38_gateway_tests$(EXEEXT) + $(CXXLINK) $(t38_gateway_tests_LDFLAGS) $(t38_gateway_tests_OBJECTS) $(t38_gateway_tests_LDADD) $(LIBS) +t38_gateway_to_terminal_tests$(EXEEXT): $(t38_gateway_to_terminal_tests_OBJECTS) $(t38_gateway_to_terminal_tests_DEPENDENCIES) + @rm -f t38_gateway_to_terminal_tests$(EXEEXT) + $(CXXLINK) $(t38_gateway_to_terminal_tests_LDFLAGS) $(t38_gateway_to_terminal_tests_OBJECTS) $(t38_gateway_to_terminal_tests_LDADD) $(LIBS) +t38_non_ecm_buffer_tests$(EXEEXT): $(t38_non_ecm_buffer_tests_OBJECTS) $(t38_non_ecm_buffer_tests_DEPENDENCIES) + @rm -f t38_non_ecm_buffer_tests$(EXEEXT) + $(LINK) $(t38_non_ecm_buffer_tests_LDFLAGS) $(t38_non_ecm_buffer_tests_OBJECTS) $(t38_non_ecm_buffer_tests_LDADD) $(LIBS) +t38_terminal_tests$(EXEEXT): $(t38_terminal_tests_OBJECTS) $(t38_terminal_tests_DEPENDENCIES) + @rm -f t38_terminal_tests$(EXEEXT) + $(CXXLINK) $(t38_terminal_tests_LDFLAGS) $(t38_terminal_tests_OBJECTS) $(t38_terminal_tests_LDADD) $(LIBS) +t38_terminal_to_gateway_tests$(EXEEXT): $(t38_terminal_to_gateway_tests_OBJECTS) $(t38_terminal_to_gateway_tests_DEPENDENCIES) + @rm -f t38_terminal_to_gateway_tests$(EXEEXT) + $(CXXLINK) $(t38_terminal_to_gateway_tests_LDFLAGS) $(t38_terminal_to_gateway_tests_OBJECTS) $(t38_terminal_to_gateway_tests_LDADD) $(LIBS) +t4_tests$(EXEEXT): $(t4_tests_OBJECTS) $(t4_tests_DEPENDENCIES) + @rm -f t4_tests$(EXEEXT) + $(LINK) $(t4_tests_LDFLAGS) $(t4_tests_OBJECTS) $(t4_tests_LDADD) $(LIBS) +testadsi$(EXEEXT): $(testadsi_OBJECTS) $(testadsi_DEPENDENCIES) + @rm -f testadsi$(EXEEXT) + $(LINK) $(testadsi_LDFLAGS) $(testadsi_OBJECTS) $(testadsi_LDADD) $(LIBS) +testfax$(EXEEXT): $(testfax_OBJECTS) $(testfax_DEPENDENCIES) + @rm -f testfax$(EXEEXT) + $(LINK) $(testfax_LDFLAGS) $(testfax_OBJECTS) $(testfax_LDADD) $(LIBS) +time_scale_tests$(EXEEXT): $(time_scale_tests_OBJECTS) $(time_scale_tests_DEPENDENCIES) + @rm -f time_scale_tests$(EXEEXT) + $(LINK) $(time_scale_tests_LDFLAGS) $(time_scale_tests_OBJECTS) $(time_scale_tests_LDADD) $(LIBS) +tone_detect_tests$(EXEEXT): $(tone_detect_tests_OBJECTS) $(tone_detect_tests_DEPENDENCIES) + @rm -f tone_detect_tests$(EXEEXT) + $(LINK) $(tone_detect_tests_LDFLAGS) $(tone_detect_tests_OBJECTS) $(tone_detect_tests_LDADD) $(LIBS) +tone_generate_tests$(EXEEXT): $(tone_generate_tests_OBJECTS) $(tone_generate_tests_DEPENDENCIES) + @rm -f tone_generate_tests$(EXEEXT) + $(LINK) $(tone_generate_tests_LDFLAGS) $(tone_generate_tests_OBJECTS) $(tone_generate_tests_LDADD) $(LIBS) +tsb85_tests$(EXEEXT): $(tsb85_tests_OBJECTS) $(tsb85_tests_DEPENDENCIES) + @rm -f tsb85_tests$(EXEEXT) + $(LINK) $(tsb85_tests_LDFLAGS) $(tsb85_tests_OBJECTS) $(tsb85_tests_LDADD) $(LIBS) +v17_tests$(EXEEXT): $(v17_tests_OBJECTS) $(v17_tests_DEPENDENCIES) + @rm -f v17_tests$(EXEEXT) + $(CXXLINK) $(v17_tests_LDFLAGS) $(v17_tests_OBJECTS) $(v17_tests_LDADD) $(LIBS) +v18_tests$(EXEEXT): $(v18_tests_OBJECTS) $(v18_tests_DEPENDENCIES) + @rm -f v18_tests$(EXEEXT) + $(LINK) $(v18_tests_LDFLAGS) $(v18_tests_OBJECTS) $(v18_tests_LDADD) $(LIBS) +v22bis_tests$(EXEEXT): $(v22bis_tests_OBJECTS) $(v22bis_tests_DEPENDENCIES) + @rm -f v22bis_tests$(EXEEXT) + $(CXXLINK) $(v22bis_tests_LDFLAGS) $(v22bis_tests_OBJECTS) $(v22bis_tests_LDADD) $(LIBS) +v27ter_tests$(EXEEXT): $(v27ter_tests_OBJECTS) $(v27ter_tests_DEPENDENCIES) + @rm -f v27ter_tests$(EXEEXT) + $(CXXLINK) $(v27ter_tests_LDFLAGS) $(v27ter_tests_OBJECTS) $(v27ter_tests_LDADD) $(LIBS) +v29_tests$(EXEEXT): $(v29_tests_OBJECTS) $(v29_tests_DEPENDENCIES) + @rm -f v29_tests$(EXEEXT) + $(CXXLINK) $(v29_tests_LDFLAGS) $(v29_tests_OBJECTS) $(v29_tests_LDADD) $(LIBS) +v42_tests$(EXEEXT): $(v42_tests_OBJECTS) $(v42_tests_DEPENDENCIES) + @rm -f v42_tests$(EXEEXT) + $(LINK) $(v42_tests_LDFLAGS) $(v42_tests_OBJECTS) $(v42_tests_LDADD) $(LIBS) +v42bis_tests$(EXEEXT): $(v42bis_tests_OBJECTS) $(v42bis_tests_DEPENDENCIES) + @rm -f v42bis_tests$(EXEEXT) + $(LINK) $(v42bis_tests_LDFLAGS) $(v42bis_tests_OBJECTS) $(v42bis_tests_LDADD) $(LIBS) +v8_tests$(EXEEXT): $(v8_tests_OBJECTS) $(v8_tests_DEPENDENCIES) + @rm -f v8_tests$(EXEEXT) + $(LINK) $(v8_tests_LDFLAGS) $(v8_tests_OBJECTS) $(v8_tests_LDADD) $(LIBS) +vector_float_tests$(EXEEXT): $(vector_float_tests_OBJECTS) $(vector_float_tests_DEPENDENCIES) + @rm -f vector_float_tests$(EXEEXT) + $(LINK) $(vector_float_tests_LDFLAGS) $(vector_float_tests_OBJECTS) $(vector_float_tests_LDADD) $(LIBS) +vector_int_tests$(EXEEXT): $(vector_int_tests_OBJECTS) $(vector_int_tests_DEPENDENCIES) + @rm -f vector_int_tests$(EXEEXT) + $(LINK) $(vector_int_tests_LDFLAGS) $(vector_int_tests_OBJECTS) $(vector_int_tests_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adsi_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/async_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/at_interpreter_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/awgn_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bell_mf_rx_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bell_mf_tx_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bert_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bit_operations_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/complex_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/complex_vector_float_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/complex_vector_int_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dc_restore_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dds_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtmf_rx_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtmf_tx_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/echo_monitor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/echo_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fax_decode.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fax_tester.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fax_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fax_utils.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsk_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g1050_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g168_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g711_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g722_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g726_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm0610_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hdlc_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ima_adpcm_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/line_model_monitor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/line_model_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logging_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc10_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/make_g168_css.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/media_monitor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modem_connect_tones_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modem_echo_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modem_monitor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/noise_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oki_adpcm_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/playout_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plc_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/power_meter_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/queue_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r2_mf_rx_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r2_mf_tx_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfc2198_sim_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/schedule_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sig_tone_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/super_tone_rx_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/super_tone_tx_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/swept_tone_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t31_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t38_core_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t38_gateway_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t38_gateway_to_terminal_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t38_non_ecm_buffer_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t38_terminal_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t38_terminal_to_gateway_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t4_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testadsi.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testfax.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time_scale_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tone_detect_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tone_generate_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsb85_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v17_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v18_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v22bis_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v27ter_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v29_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v42_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v42bis_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v8_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector_float_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector_int_tests.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(mkdir_p) $(distdir)/msvc + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(DATA) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-info-am + + +# We need to create the CSS files for echo cancellation tests. + +sound_c1_8k.wav sound_c3_8k.wav: make_g168_css$(EXEEXT) + ./make_g168_css$(EXEEXT) + sox sound_c1.wav -r8000 sound_c1_8k.wav + sox sound_c3.wav -r8000 sound_c3_8k.wav + rm sound_c1.wav sound_c3.wav +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/adsi_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/adsi_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,874 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * adsi_tests.c - tests for analogue display service handling. + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: adsi_tests.c,v 1.57 2009/05/30 15:23:13 steveu Exp $ + */ + +/*! \page adsi_tests_page ADSI tests +\section adsi_tests_page_sec_1 What does it do? +These tests exercise the ADSI module, for all supported standards. A transmit +and a receive instance of the ADSI module are connected together. A quantity +of messages is passed between these instances, and checked for accuracy at +the receiver. Since the FSK modems used for this are exercised fully by other +tests, these tests do not include line modelling. + +\section adsi_tests_page_sec_2 How does it work? +*/ + +/* Enable the following definition to enable direct probing into the FAX structures */ +//#define WITH_SPANDSP_INTERNALS + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define OUTPUT_FILE_NAME "adsi.wav" + +#define BLOCK_LEN 160 + +#define MITEL_DIR "../test-data/mitel/" +#define BELLCORE_DIR "../test-data/bellcore/" + +const char *bellcore_files[] = +{ + MITEL_DIR "mitel-cm7291-talkoff.wav", + BELLCORE_DIR "tr-tsy-00763-1.wav", + BELLCORE_DIR "tr-tsy-00763-2.wav", + BELLCORE_DIR "tr-tsy-00763-3.wav", + BELLCORE_DIR "tr-tsy-00763-4.wav", + BELLCORE_DIR "tr-tsy-00763-5.wav", + BELLCORE_DIR "tr-tsy-00763-6.wav", + "" +}; + +char *decode_test_file = NULL; + +int errors = 0; +int basic_testing = FALSE; + +adsi_rx_state_t *rx_adsi; +adsi_tx_state_t *tx_adsi; + +int current_standard = 0; +int good_message_received; +int log_audio = FALSE; +SNDFILE *outhandle = NULL; +int short_preamble = FALSE; + +static int adsi_create_message(adsi_tx_state_t *s, uint8_t *msg) +{ + const char *t; + int len; + static int cycle = 0; + + len = 0; + switch (current_standard) + { + case ADSI_STANDARD_CLASS: + if (cycle > 3) + cycle = 0; + switch (cycle) + { + case 0: + len = adsi_add_field(s, msg, -1, CLASS_MDMF_CALLERID, NULL, 0); + /* Date and time as MMDDHHMM */ + len = adsi_add_field(s, msg, len, MCLASS_DATETIME, (uint8_t *) "10011750", 8); + len = adsi_add_field(s, msg, len, MCLASS_CALLER_NUMBER, (uint8_t *) "12345678", 8); + len = adsi_add_field(s, msg, len, MCLASS_DIALED_NUMBER, (uint8_t *) "87654321", 8); + len = adsi_add_field(s, msg, len, MCLASS_CALLER_NAME, (uint8_t *) "Chan Dai Man", 15); + break; + case 1: + len = adsi_add_field(s, msg, -1, CLASS_SDMF_MSG_WAITING, NULL, 0); + /* Active */ + len = adsi_add_field(s, msg, len, 0, (uint8_t *) "\x42", 1); + len = adsi_add_field(s, msg, len, 0, (uint8_t *) "\x42", 1); + len = adsi_add_field(s, msg, len, 0, (uint8_t *) "\x42", 1); + break; + case 2: + len = adsi_add_field(s, msg, -1, CLASS_SDMF_MSG_WAITING, NULL, 0); + /* Inactive */ + len = adsi_add_field(s, msg, len, 0, (uint8_t *) "\x6F", 1); + len = adsi_add_field(s, msg, len, 0, (uint8_t *) "\x6F", 1); + len = adsi_add_field(s, msg, len, 0, (uint8_t *) "\x6F", 1); + break; + case 3: + len = adsi_add_field(s, msg, -1, CLASS_SDMF_CALLERID, NULL, 0); + /* Date and time as MMDDHHMM */ + len = adsi_add_field(s, msg, len, 0, (uint8_t *) "10011750", 8); + len = adsi_add_field(s, msg, len, 0, (uint8_t *) "6095551212", 10); + break; + } + break; + case ADSI_STANDARD_CLIP: + if (cycle > 4) + cycle = 0; + switch (cycle) + { + case 0: + len = adsi_add_field(s, msg, -1, CLIP_MDMF_CALLERID, NULL, 0); + len = adsi_add_field(s, msg, len, CLIP_CALLTYPE, (uint8_t *) "\x81", 1); + /* Date and time as MMDDHHMM */ + len = adsi_add_field(s, msg, len, CLIP_DATETIME, (uint8_t *) "10011750", 8); + len = adsi_add_field(s, msg, len, CLIP_DIALED_NUMBER, (uint8_t *) "12345678", 8); + len = adsi_add_field(s, msg, len, CLIP_CALLER_NUMBER, (uint8_t *) "87654321", 8); + len = adsi_add_field(s, msg, len, CLIP_CALLER_NAME, (uint8_t *) "Chan Dai Man", 15); + break; + case 1: + len = adsi_add_field(s, msg, -1, CLIP_MDMF_MSG_WAITING, NULL, 0); + /* Inactive */ + len = adsi_add_field(s, msg, len, CLIP_VISUAL_INDICATOR, (uint8_t *) "\x00", 1); + break; + case 2: + len = adsi_add_field(s, msg, -1, CLIP_MDMF_MSG_WAITING, NULL, 0); + /* Active */ + len = adsi_add_field(s, msg, len, CLIP_VISUAL_INDICATOR, (uint8_t *) "\xFF", 1); + len = adsi_add_field(s, msg, len, CLIP_NUM_MSG, (uint8_t *) "\x05", 1); + break; + case 3: + len = adsi_add_field(s, msg, -1, CLIP_MDMF_SMS, NULL, 0); + /* Active */ + len = adsi_add_field(s, msg, len, CLIP_DISPLAY_INFO, (uint8_t *) "\x00" "ABC", 4); + break; + case 4: + len = adsi_add_field(s, msg, -1, CLIP_MDMF_CALLERID, NULL, 0); + len = adsi_add_field(s, msg, len, CLIP_NUM_MSG, (uint8_t *) "\x03", 1); + break; + } + break; + case ADSI_STANDARD_ACLIP: + if (cycle > 0) + cycle = 0; + switch (cycle) + { + case 0: + len = adsi_add_field(s, msg, -1, ACLIP_MDMF_CALLERID, NULL, 0); + /* Date and time as MMDDHHMM */ + len = adsi_add_field(s, msg, len, ACLIP_DATETIME, (uint8_t *) "10011750", 8); + len = adsi_add_field(s, msg, len, ACLIP_DIALED_NUMBER, (uint8_t *) "12345678", 8); + len = adsi_add_field(s, msg, len, ACLIP_CALLER_NUMBER, (uint8_t *) "87654321", 8); + len = adsi_add_field(s, msg, len, ACLIP_CALLER_NAME, (uint8_t *) "Chan Dai Man", 15); + break; + } + break; + case ADSI_STANDARD_JCLIP: + len = adsi_add_field(s, msg, -1, JCLIP_MDMF_CALLERID, NULL, 0); + len = adsi_add_field(s, msg, len, JCLIP_CALLER_NUMBER, (uint8_t *) "12345678", 8); + len = adsi_add_field(s, msg, len, JCLIP_CALLER_NUM_DES, (uint8_t *) "215", 3); + len = adsi_add_field(s, msg, len, JCLIP_DIALED_NUMBER, (uint8_t *) "87654321", 8); + len = adsi_add_field(s, msg, len, JCLIP_DIALED_NUM_DES, (uint8_t *) "215", 3); + break; + case ADSI_STANDARD_CLIP_DTMF: + if (cycle > 4) + cycle = 0; + switch (cycle) + { + case 0: + len = adsi_add_field(s, msg, -1, CLIP_DTMF_C_TERMINATED, NULL, 0); + len = adsi_add_field(s, msg, len, CLIP_DTMF_C_CALLER_NUMBER, (uint8_t *) "12345678", 8); + len = adsi_add_field(s, msg, len, CLIP_DTMF_C_ABSENCE, (uint8_t *) "10", 2); + len = adsi_add_field(s, msg, len, CLIP_DTMF_C_REDIRECT_NUMBER, (uint8_t *) "87654321", 8); + break; + case 1: + len = adsi_add_field(s, msg, -1, CLIP_DTMF_HASH_TERMINATED, NULL, 0); + len = adsi_add_field(s, msg, len, CLIP_DTMF_HASH_CALLER_NUMBER, (uint8_t *) "12345678", 8); + break; + case 2: + len = adsi_add_field(s, msg, -1, CLIP_DTMF_HASH_TERMINATED, NULL, 0); + len = adsi_add_field(s, msg, len, CLIP_DTMF_HASH_ABSENCE, (uint8_t *) "1", 1); + break; + case 3: + /* Test the DC format, used in Taiwan and Kuwait */ + len = adsi_add_field(s, msg, -1, CLIP_DTMF_HASH_TERMINATED, NULL, 0); + len = adsi_add_field(s, msg, len, CLIP_DTMF_HASH_ABSENCE, (uint8_t *) "12345678", 8); + break; + case 4: + /* Test the # format, with no header */ + len = adsi_add_field(s, msg, -1, CLIP_DTMF_HASH_TERMINATED, NULL, 0); + len = adsi_add_field(s, msg, len, CLIP_DTMF_HASH_UNSPECIFIED, (uint8_t *) "12345678", 8); + break; + } + break; + case ADSI_STANDARD_TDD: + t = "The quick Brown Fox Jumps Over The Lazy dog 0123456789!@#$%^&*()"; + len = adsi_add_field(s, msg, -1, 0, (uint8_t *) t, strlen(t)); + break; + } + cycle++; + return len; +} +/*- End of function --------------------------------------------------------*/ + +static void put_adsi_msg(void *user_data, const uint8_t *msg, int len) +{ + int i; + int l; + uint8_t field_type; + const uint8_t *field_body; + int field_len; + int message_type; + uint8_t body[256]; + + printf("Good message received (%d bytes)\n", len); + good_message_received = TRUE; + for (i = 0; i < len; i++) + { + printf("%02x ", msg[i]); + if ((i & 0xF) == 0xF) + printf("\n"); + } + printf("\n"); + l = -1; + message_type = -1; + printf("Message breakdown\n"); + do + { + l = adsi_next_field(rx_adsi, msg, len, l, &field_type, &field_body, &field_len); + if (l > 0) + { + if (field_body) + { + memcpy(body, field_body, field_len); + body[field_len] = '\0'; + printf("Field type 0x%x, len %d, '%s' - ", field_type, field_len, body); + switch (current_standard) + { + case ADSI_STANDARD_CLASS: + switch (message_type) + { + case CLASS_SDMF_CALLERID: + break; + case CLASS_MDMF_CALLERID: + switch (field_type) + { + case MCLASS_DATETIME: + printf("Date and time (MMDDHHMM)"); + break; + case MCLASS_CALLER_NUMBER: + printf("Caller's number"); + break; + case MCLASS_DIALED_NUMBER: + printf("Dialed number"); + break; + case MCLASS_ABSENCE1: + printf("Caller's number absent: 'O' or 'P'"); + break; + case MCLASS_REDIRECT: + printf("Call forward: universal ('0'), on busy ('1'), or on unanswered ('2')"); + break; + case MCLASS_QUALIFIER: + printf("Long distance: 'L'"); + break; + case MCLASS_CALLER_NAME: + printf("Caller's name"); + break; + case MCLASS_ABSENCE2: + printf("Caller's name absent: 'O' or 'P'"); + break; + } + break; + case CLASS_SDMF_MSG_WAITING: + break; + case CLASS_MDMF_MSG_WAITING: + switch (field_type) + { + case MCLASS_VISUAL_INDICATOR: + printf("Message waiting/not waiting"); + break; + } + break; + } + break; + case ADSI_STANDARD_CLIP: + switch (message_type) + { + case CLIP_MDMF_CALLERID: + case CLIP_MDMF_MSG_WAITING: + case CLIP_MDMF_CHARGE_INFO: + case CLIP_MDMF_SMS: + switch (field_type) + { + case CLIP_DATETIME: + printf("Date and time (MMDDHHMM)"); + break; + case CLIP_CALLER_NUMBER: + printf("Caller's number"); + break; + case CLIP_DIALED_NUMBER: + printf("Dialed number"); + break; + case CLIP_ABSENCE1: + printf("Caller's number absent"); + break; + case CLIP_CALLER_NAME: + printf("Caller's name"); + break; + case CLIP_ABSENCE2: + printf("Caller's name absent"); + break; + case CLIP_VISUAL_INDICATOR: + printf("Visual indicator"); + break; + case CLIP_MESSAGE_ID: + printf("Message ID"); + break; + case CLIP_CALLTYPE: + printf("Voice call, ring-back-when-free call, or msg waiting call"); + break; + case CLIP_NUM_MSG: + printf("Number of messages"); + break; +#if 0 + case CLIP_REDIR_NUMBER: + printf("Redirecting number"); + break; +#endif + case CLIP_CHARGE: + printf("Charge"); + break; + case CLIP_DURATION: + printf("Duration of the call"); + break; + case CLIP_ADD_CHARGE: + printf("Additional charge"); + break; + case CLIP_DISPLAY_INFO: + printf("Display information"); + break; + case CLIP_SERVICE_INFO: + printf("Service information"); + break; + } + break; + } + break; + case ADSI_STANDARD_ACLIP: + switch (message_type) + { + case ACLIP_SDMF_CALLERID: + break; + case ACLIP_MDMF_CALLERID: + switch (field_type) + { + case ACLIP_DATETIME: + printf("Date and time (MMDDHHMM)"); + break; + case ACLIP_CALLER_NUMBER: + printf("Caller's number"); + break; + case ACLIP_DIALED_NUMBER: + printf("Dialed number"); + break; + case ACLIP_NUMBER_ABSENCE: + printf("Caller's number absent: 'O' or 'P'"); + break; + case ACLIP_REDIRECT: + printf("Call forward: universal, on busy, or on unanswered"); + break; + case ACLIP_QUALIFIER: + printf("Long distance call: 'L'"); + break; + case ACLIP_CALLER_NAME: + printf("Caller's name"); + break; + case ACLIP_NAME_ABSENCE: + printf("Caller's name absent: 'O' or 'P'"); + break; + } + break; + } + break; + case ADSI_STANDARD_JCLIP: + switch (message_type) + { + case JCLIP_MDMF_CALLERID: + switch (field_type) + { + case JCLIP_CALLER_NUMBER: + printf("Caller's number"); + break; + case JCLIP_CALLER_NUM_DES: + printf("Caller's number data extension signal"); + break; + case JCLIP_DIALED_NUMBER: + printf("Dialed number"); + break; + case JCLIP_DIALED_NUM_DES: + printf("Dialed number data extension signal"); + break; + case JCLIP_ABSENCE: + printf("Caller's number absent: 'C', 'O', 'P' or 'S'"); + break; + } + break; + } + break; + case ADSI_STANDARD_CLIP_DTMF: + switch (message_type) + { + case CLIP_DTMF_HASH_TERMINATED: + switch (field_type) + { + case CLIP_DTMF_HASH_CALLER_NUMBER: + printf("Caller's number"); + break; + case CLIP_DTMF_HASH_ABSENCE: + printf("Caller's number absent: private (1), overseas (2) or not available (3)"); + break; + case CLIP_DTMF_HASH_UNSPECIFIED: + printf("Unspecified"); + break; + } + break; + case CLIP_DTMF_C_TERMINATED: + switch (field_type) + { + case CLIP_DTMF_C_CALLER_NUMBER: + printf("Caller's number"); + break; + case CLIP_DTMF_C_REDIRECT_NUMBER: + printf("Redirect number"); + break; + case CLIP_DTMF_C_ABSENCE: + printf("Caller's number absent"); + break; + } + break; + } + break; + case ADSI_STANDARD_TDD: + if (basic_testing) + { + if (len != 59 + || + memcmp(msg, "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG 0123456789#$*()", 59)) + { + printf("\n"); + printf("String error\n"); + exit(2); + } + } + break; + } + } + else + { + printf("Message type 0x%x - ", field_type); + message_type = field_type; + switch (current_standard) + { + case ADSI_STANDARD_CLASS: + switch (message_type) + { + case CLASS_SDMF_CALLERID: + printf("Single data message caller ID"); + break; + case CLASS_MDMF_CALLERID: + printf("Multiple data message caller ID"); + break; + case CLASS_SDMF_MSG_WAITING: + printf("Single data message message waiting"); + break; + case CLASS_MDMF_MSG_WAITING: + printf("Multiple data message message waiting"); + break; + default: + printf("Unknown"); + break; + } + break; + case ADSI_STANDARD_CLIP: + switch (message_type) + { + case CLIP_MDMF_CALLERID: + printf("Multiple data message caller ID"); + break; + case CLIP_MDMF_MSG_WAITING: + printf("Multiple data message message waiting"); + break; + case CLIP_MDMF_CHARGE_INFO: + printf("Multiple data message charge info"); + break; + case CLIP_MDMF_SMS: + printf("Multiple data message SMS"); + break; + default: + printf("Unknown"); + break; + } + break; + case ADSI_STANDARD_ACLIP: + switch (message_type) + { + case ACLIP_SDMF_CALLERID: + printf("Single data message caller ID frame"); + break; + case ACLIP_MDMF_CALLERID: + printf("Multiple data message caller ID frame"); + break; + default: + printf("Unknown"); + break; + } + break; + case ADSI_STANDARD_JCLIP: + switch (message_type) + { + case JCLIP_MDMF_CALLERID: + printf("Multiple data message caller ID frame"); + break; + default: + printf("Unknown"); + break; + } + break; + case ADSI_STANDARD_CLIP_DTMF: + switch (message_type) + { + case CLIP_DTMF_HASH_TERMINATED: + printf("# terminated"); + break; + case CLIP_DTMF_C_TERMINATED: + printf("C terminated"); + break; + default: + printf("Unknown"); + break; + } + break; + case ADSI_STANDARD_TDD: + printf("Unknown"); + break; + } + } + printf("\n"); + } + } + while (l > 0); + if (l < -1) + { + /* This message appears corrupt */ + printf("Bad message contents\n"); + exit(2); + } + printf("\n"); +} +/*- End of function --------------------------------------------------------*/ + +static void tdd_character_set_tests(void) +{ +#if 0 + char *s; + int ch; + int xx; + int yy; + + /* This part tests internal static routines in the ADSI module. It can + only be run with a modified version of the ADSI module, which makes + the routines visible. */ + /* Check the character encode/decode cycle */ + tx_adsi = adsi_tx_init(NULL, ADSI_STANDARD_TDD); + rx_adsi = adsi_rx_init(NULL, ADSI_STANDARD_TDD, put_adsi_msg, NULL); + s = "The quick Brown Fox Jumps Over The Lazy dog 0123456789!@#$%^&*()"; + while ((ch = *s++)) + { + xx = adsi_encode_baudot(tx_adsi, ch); + if ((xx & 0x3E0)) + { + yy = adsi_decode_baudot(rx_adsi, (xx >> 5) & 0x1F); + if (yy) + printf("%c", yy); + } + yy = adsi_decode_baudot(rx_adsi, xx & 0x1F); + if (yy) + printf("%c", yy); + } + adsi_tx_free(tx_adsi); + adsi_rx_free(rx_adsi); + printf("\n"); +#endif +} +/*- End of function --------------------------------------------------------*/ + +static void basic_tests(int standard) +{ + int16_t amp[BLOCK_LEN]; + uint8_t adsi_msg[256 + 42]; + int outframes; + int len; + int adsi_msg_len; + int push; + int i; + + basic_testing = TRUE; + printf("Testing %s\n", adsi_standard_to_str(standard)); + tx_adsi = adsi_tx_init(NULL, standard); + if (short_preamble) + adsi_tx_set_preamble(tx_adsi, 50, 20, 5, -1); + rx_adsi = adsi_rx_init(NULL, standard, put_adsi_msg, NULL); + + /* Fake an OK condition for the first message test */ + good_message_received = TRUE; + push = 0; + for (i = 0; i < 100000; i++) + { + if (push == 0) + { + if ((len = adsi_tx(tx_adsi, amp, BLOCK_LEN)) == 0) + push = 10; + } + else + { + len = 0; + /* Push a little silence through, to flush things out */ + if (--push == 0) + { + if (!good_message_received) + { + printf("No message received %s (%d)\n", adsi_standard_to_str(standard), i); + exit(2); + } + good_message_received = FALSE; + adsi_msg_len = adsi_create_message(tx_adsi, adsi_msg); + adsi_msg_len = adsi_tx_put_message(tx_adsi, adsi_msg, adsi_msg_len); + } + } + if (len < BLOCK_LEN) + { + memset(&[len], 0, sizeof(int16_t)*(BLOCK_LEN - len)); + len = BLOCK_LEN; + } + if (log_audio) + { + outframes = sf_writef_short(outhandle, + amp, + len); + if (outframes != len) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + } + adsi_rx(rx_adsi, amp, len); + } + adsi_rx_free(rx_adsi); + adsi_tx_free(tx_adsi); + basic_testing = FALSE; +} +/*- End of function --------------------------------------------------------*/ + +static void mitel_cm7291_side_2_and_bellcore_tests(int standard) +{ + int j; + int16_t amp[BLOCK_LEN]; + SNDFILE *inhandle; + int frames; + + /* The remainder of the Mitel tape is the talk-off test */ + /* Here we use the Bellcore test tapes (much tougher), in six + files - 1 from each side of the original 3 cassette tapes */ + printf("Talk-off tests for %s\n", adsi_standard_to_str(standard)); + rx_adsi = adsi_rx_init(NULL, standard, put_adsi_msg, NULL); + for (j = 0; bellcore_files[j][0]; j++) + { + printf("Testing with %s\n", bellcore_files[j]); + if ((inhandle = sf_open_telephony_read(bellcore_files[j], 1)) == NULL) + { + printf(" Cannot open speech file '%s'\n", bellcore_files[j]); + exit(2); + } + while ((frames = sf_readf_short(inhandle, amp, BLOCK_LEN))) + { + adsi_rx(rx_adsi, amp, frames); + } + if (sf_close(inhandle) != 0) + { + printf(" Cannot close speech file '%s'\n", bellcore_files[j]); + exit(2); + } + } + adsi_rx_free(rx_adsi); + if (j > 470) + { + printf(" Failed\n"); + exit(2); + } + printf(" Passed\n"); +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int16_t amp[BLOCK_LEN]; + SNDFILE *inhandle; + int len; + int test_standard; + int first_standard; + int last_standard; + int opt; + int enable_basic_tests; + int enable_talkoff_tests; + + log_audio = FALSE; + decode_test_file = NULL; + test_standard = -1; + short_preamble = FALSE; + enable_basic_tests = TRUE; + enable_talkoff_tests = FALSE; + while ((opt = getopt(argc, argv, "bd:lps:t")) != -1) + { + switch (opt) + { + case 'b': + enable_basic_tests = TRUE; + enable_talkoff_tests = FALSE; + break; + case 'd': + decode_test_file = optarg; + break; + case 'l': + log_audio = TRUE; + break; + case 'p': + short_preamble = TRUE; + break; + case 's': + if (strcasecmp("CLASS", optarg) == 0) + test_standard = ADSI_STANDARD_CLASS; + else if (strcasecmp("CLIP", optarg) == 0) + test_standard = ADSI_STANDARD_CLIP; + else if (strcasecmp("A-CLIP", optarg) == 0) + test_standard = ADSI_STANDARD_ACLIP; + else if (strcasecmp("J-CLIP", optarg) == 0) + test_standard = ADSI_STANDARD_JCLIP; + else if (strcasecmp("CLIP-DTMF", optarg) == 0) + test_standard = ADSI_STANDARD_CLIP_DTMF; + else if (strcasecmp("TDD", optarg) == 0) + test_standard = ADSI_STANDARD_TDD; + else + test_standard = atoi(optarg); + break; + case 't': + enable_basic_tests = FALSE; + enable_talkoff_tests = TRUE; + break; + default: + //usage(); + exit(2); + break; + } + } + outhandle = NULL; + + tdd_character_set_tests(); + + if (decode_test_file) + { + /* We will decode the audio from a file. */ + if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", decode_test_file); + exit(2); + } + if (test_standard < 0) + current_standard = ADSI_STANDARD_CLASS; + else + current_standard = test_standard; + + rx_adsi = adsi_rx_init(NULL, current_standard, put_adsi_msg, NULL); +#if 0 + span_log_set_level(rx_adsi.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + span_log_set_tag(rx_adsi.logging, "ADSI"); +#endif + for (;;) + { + len = sf_readf_short(inhandle, amp, BLOCK_LEN); + if (len == 0) + break; + adsi_rx(rx_adsi, amp, len); + } + if (sf_close(inhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", decode_test_file); + exit(2); + } + adsi_rx_free(rx_adsi); + } + else + { + if (log_audio) + { + if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + } + /* Go through all the standards */ + /* This assumes standard 0 is NULL, and TDD is the last in the list */ + if (test_standard < 0) + { + first_standard = ADSI_STANDARD_CLASS; + last_standard = ADSI_STANDARD_TDD; + } + else + { + first_standard = + last_standard = test_standard; + } + for (current_standard = first_standard; current_standard <= last_standard; current_standard++) + { + if (enable_basic_tests) + basic_tests(current_standard); + if (enable_talkoff_tests) + mitel_cm7291_side_2_and_bellcore_tests(current_standard); + } + if (log_audio) + { + if (sf_close(outhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + } + printf("Tests passed.\n"); + } + + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/async_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/async_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,250 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * async_tests.c - Tests for asynchronous serial processing. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: async_tests.c,v 1.19 2009/05/30 15:23:13 steveu Exp $ + */ + +/*! \file */ + +/*! \page async_tests_page Asynchronous bit stream tests +\section async_tests_page_sec_1 What does it do? +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" + +async_rx_state_t rx_async; +async_tx_state_t tx_async; + +int full_len; +uint8_t old_buf[1000]; +uint8_t new_buf[1000]; + +volatile int tx_async_chars; +volatile int rx_async_chars; +volatile int rx_async_char_mask; + +int v14_test_async_tx_get_bit(void *user_data); + +int v14_test_async_tx_get_bit(void *user_data) +{ + async_tx_state_t *s; + int bit; + static int destuff = 0; + + /* Special routine to test V.14 rate adaption, by randomly skipping + stop bits. */ + s = (async_tx_state_t *) user_data; + if (s->bitpos == 0) + { + /* Start bit */ + bit = 0; + s->byte_in_progress = s->get_byte(s->user_data); + s->parity_bit = 0; + s->bitpos++; + } + else if (s->bitpos <= s->data_bits) + { + bit = s->byte_in_progress & 1; + s->byte_in_progress >>= 1; + s->parity_bit ^= bit; + s->bitpos++; + if (!s->parity && s->bitpos == s->data_bits + 1) + { + /* Drop the stop bit on every fourth character for V.14 simulation*/ + if ((++destuff & 3) == 0) + s->bitpos = 0; + } + } + else if (s->parity && s->bitpos == s->data_bits + 1) + { + if (s->parity == ASYNC_PARITY_ODD) + s->parity_bit ^= 1; + bit = s->parity_bit; + s->bitpos++; + /* Drop the stop bit on every fourth character for V.14 simulation */ + if ((++destuff & 3) == 0) + s->bitpos = 0; + } + else + { + /* Stop bit(s) */ + bit = 1; + s->bitpos++; + if (s->bitpos > s->data_bits + s->stop_bits) + s->bitpos = 0; + } + return bit; +} +/*- End of function --------------------------------------------------------*/ + +static int test_get_async_byte(void *user_data) +{ + int byte; + + byte = tx_async_chars & 0xFF; + tx_async_chars++; + return byte; +} +/*- End of function --------------------------------------------------------*/ + +static void test_put_async_byte(void *user_data, int byte) +{ + if ((rx_async_chars & rx_async_char_mask) != byte) + printf("Received byte is 0x%X (expected 0x%X)\n", byte, rx_async_chars); + rx_async_chars++; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int bit; + + printf("Test with async 8N1\n"); + async_tx_init(&tx_async, 8, ASYNC_PARITY_NONE, 1, FALSE, test_get_async_byte, NULL); + async_rx_init(&rx_async, 8, ASYNC_PARITY_NONE, 1, FALSE, test_put_async_byte, NULL); + tx_async_chars = 0; + rx_async_chars = 0; + rx_async_char_mask = 0xFF; + while (rx_async_chars < 1000) + { + bit = async_tx_get_bit(&tx_async); + async_rx_put_bit(&rx_async, bit); + } + printf("Chars=%d/%d, PE=%d, FE=%d\n", tx_async_chars, rx_async_chars, rx_async.parity_errors, rx_async.framing_errors); + if (tx_async_chars != rx_async_chars + || + rx_async.parity_errors + || + rx_async.framing_errors) + { + printf("Test failed.\n"); + exit(2); + } + + printf("Test with async 7E1\n"); + async_tx_init(&tx_async, 7, ASYNC_PARITY_EVEN, 1, FALSE, test_get_async_byte, NULL); + async_rx_init(&rx_async, 7, ASYNC_PARITY_EVEN, 1, FALSE, test_put_async_byte, NULL); + tx_async_chars = 0; + rx_async_chars = 0; + rx_async_char_mask = 0x7F; + while (rx_async_chars < 1000) + { + bit = async_tx_get_bit(&tx_async); + async_rx_put_bit(&rx_async, bit); + } + printf("Chars=%d/%d, PE=%d, FE=%d\n", tx_async_chars, rx_async_chars, rx_async.parity_errors, rx_async.framing_errors); + if (tx_async_chars != rx_async_chars + || + rx_async.parity_errors + || + rx_async.framing_errors) + { + printf("Test failed.\n"); + exit(2); + } + + printf("Test with async 8O1\n"); + async_tx_init(&tx_async, 8, ASYNC_PARITY_ODD, 1, FALSE, test_get_async_byte, NULL); + async_rx_init(&rx_async, 8, ASYNC_PARITY_ODD, 1, FALSE, test_put_async_byte, NULL); + tx_async_chars = 0; + rx_async_chars = 0; + rx_async_char_mask = 0xFF; + while (rx_async_chars < 1000) + { + bit = async_tx_get_bit(&tx_async); + async_rx_put_bit(&rx_async, bit); + } + printf("Chars=%d/%d, PE=%d, FE=%d\n", tx_async_chars, rx_async_chars, rx_async.parity_errors, rx_async.framing_errors); + if (tx_async_chars != rx_async_chars + || + rx_async.parity_errors + || + rx_async.framing_errors) + { + printf("Test failed.\n"); + exit(2); + } + + printf("Test with async 8O1 and V.14\n"); + async_tx_init(&tx_async, 8, ASYNC_PARITY_ODD, 1, TRUE, test_get_async_byte, NULL); + async_rx_init(&rx_async, 8, ASYNC_PARITY_ODD, 1, TRUE, test_put_async_byte, NULL); + tx_async_chars = 0; + rx_async_chars = 0; + rx_async_char_mask = 0xFF; + while (rx_async_chars < 1000) + { + bit = v14_test_async_tx_get_bit(&tx_async); + async_rx_put_bit(&rx_async, bit); + } + printf("Chars=%d/%d, PE=%d, FE=%d\n", tx_async_chars, rx_async_chars, rx_async.parity_errors, rx_async.framing_errors); + if (tx_async_chars != rx_async_chars + 1 + || + rx_async.parity_errors + || + rx_async.framing_errors) + { + printf("Test failed.\n"); + exit(2); + } + + printf("Test with async 5N2\n"); + async_tx_init(&tx_async, 5, ASYNC_PARITY_NONE, 2, FALSE, test_get_async_byte, NULL); + async_rx_init(&rx_async, 5, ASYNC_PARITY_NONE, 2, FALSE, test_put_async_byte, NULL); + tx_async_chars = 0; + rx_async_chars = 0; + rx_async_char_mask = 0x1F; + while (rx_async_chars < 1000) + { + bit = async_tx_get_bit(&tx_async); + async_rx_put_bit(&rx_async, bit); + } + printf("Chars=%d/%d, PE=%d, FE=%d\n", tx_async_chars, rx_async_chars, rx_async.parity_errors, rx_async.framing_errors); + if (tx_async_chars != rx_async_chars + || + rx_async.parity_errors + || + rx_async.framing_errors) + { + printf("Test failed.\n"); + exit(2); + } + + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/at_interpreter_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/at_interpreter_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,571 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * at_interpreter_tests.c - Tests for the AT interpreter. + * + * Written by Steve Underwood + * + * Copyright (C) 2004, 2005, 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: at_interpreter_tests.c,v 1.24 2009/10/09 14:53:57 steveu Exp $ + */ + +/*! \file */ + +/*! \page at_interpreter_tests_page AT interpreter tests +\section at_interpreter_tests_page_sec_1 What does it do? +These tests exercise all the commands which should be understood by the AT interpreter. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include + +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +#include "spandsp.h" + +#define DLE 0x10 +#define ETX 0x03 +#define SUB 0x1A + +#define MANUFACTURER "www.soft-switch.org" + +struct command_response_s +{ + const char *command; + const char *response; +}; + +static const struct command_response_s general_test_seq[] = +{ + /* Try the various cases for "AT" */ + {"atE1\r", "atE1\r\r\nOK\r\n"}, + {"AtE1\r", "AtE1\r\r\nOK\r\n"}, + {"aTE1\r", "aTE1\r\r\nOK\r\n"}, + {"ATE1\r", "ATE1\r\r\nOK\r\n"}, + {"ATE0\r", "ATE0\r\r\nOK\r\n"}, + + /* Try the various command formats */ + {"ATS8?\r", "\r\n005\r\n\r\nOK\r\n"}, + {"ATS8=1\r", "\r\nOK\r\n"}, + {"ATS8.5?\r", "\r\n0\r\n\r\nOK\r\n"}, + {"ATS8.5=1\r", "\r\nOK\r\n"}, + {"ATS8.5?\r", "\r\n1\r\n\r\nOK\r\n"}, + {"ATS8?\r", "\r\n033\r\n\r\nOK\r\n"}, + {"AT+FCLASS=1\r", "\r\nOK\r\n"}, + {"AT+FCLASS?\r", "\r\n1\r\n\r\nOK\r\n"}, + {"AT+FCLASS=?\r", "\r\n0,1,1.0\r\n\r\nOK\r\n"}, + + /* Try all the commands */ + {"AT&C\r", "\r\nOK\r\n"}, /* V.250 6.2.8 - Circuit 109 (received line signal detector), behaviour */ + {"AT&D\r", "\r\nOK\r\n"}, /* V.250 6.2.9 - Circuit 108 (data terminal ready) behaviour */ + {"AT&F\r", "\r\nOK\r\n"}, /* V.250 6.1.2 - Set to factory-defined configuration */ + {"ATE0\r", "ATE0\r\r\nOK\r\n"}, /* Counteract the effects of the above */ + {"AT+A8E=?\r", "\r\n+A8E:(0-6),(0-5),(00-FF)\r\n\r\nOK\r\n"}, /* V.251 5.1 - V.8 and V.8bis operation controls */ + {"AT+A8M\r", "\r\nOK\r\n"}, /* V.251 5.2 - Send V.8 menu signals */ + {"AT+A8T=?\r", "\r\n+A8T:(0-10)\r\n\r\nOK\r\n"}, /* V.251 5.3 - Send V.8bis signal and/or message(s) */ + {"AT+ASTO=?\r", "\r\n+ASTO:\r\n\r\nOK\r\n"}, /* V.250 6.3.15 - Store telephone number */ + {"AT+CAAP=?\r", "\r\n+CAAP:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.25 - Automatic answer for eMLPP Service */ + {"AT+CACM=?\r", "\r\n+CACM:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.25 - Accumulated call meter */ + {"AT+CACSP=?\r", "\r\n+CACSP:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 11.1.7 - Voice Group or Voice Broadcast Call State Attribute Presentation */ + {"AT+CAEMLPP=?\r", "\r\n+CAEMLPP:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.22 - eMLPP Priority Registration and Interrogation */ + {"AT+CAHLD=?\r", "\r\n+CAHLD:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 11.1.3 - Leave an ongoing Voice Group or Voice Broadcast Call */ + {"AT+CAJOIN=?\r", "\r\n+CAJOIN:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 11.1.1 - Accept an incoming Voice Group or Voice Broadcast Call */ + {"AT+CALA=?\r", "\r\n+CALA:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.16 - Alarm */ + {"AT+CALCC=?\r", "\r\n+CALCC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 11.1.6 - List current Voice Group and Voice Broadcast Calls */ + {"AT+CALD=?\r", "\r\n+CALD:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.38 - Delete alar m */ + {"AT+CALM=?\r", "\r\n+CALM:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.20 - Alert sound mode */ + {"AT+CAMM=?\r", "\r\n+CAMM:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.26 - Accumulated call meter maximum */ + {"AT+CANCHEV=?\r", "\r\n+CANCHEV:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 11.1.8 - NCH Support Indication */ + {"AT+CAOC=?\r", "\r\n+CAOC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.16 - Advice of Charge */ + {"AT+CAPD=?\r", "\r\n+CAPD:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.39 - Postpone or dismiss an alarm */ + {"AT+CAPTT=?\r", "\r\n+CAPTT:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 11.1.4 - Talker Access for Voice Group Call */ + {"AT+CAREJ=?\r", "\r\n+CAREJ:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 11.1.2 - Reject an incoming Voice Group or Voice Broadcast Call */ + {"AT+CAULEV=?\r", "\r\n+CAULEV:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 11.1.5 - Voice Group Call Uplink Status Presentation */ + {"AT+CBC=?\r", "\r\n+CBC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.4 - Battery charge */ + {"AT+CBCS=?\r", "\r\n+CBCS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 11.3.2 - VBS subscriptions and GId status */ + {"AT+CBST=?\r", "\r\n+CBST:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.7 - Select bearer service type */ + {"AT+CCFC=?\r", "\r\n+CCFC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.11 - Call forwarding number and conditions */ + {"AT+CCLK=?\r", "\r\n+CCLK:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.15 - Clock */ + {"AT+CCUG=?\r", "\r\n+CCUG:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.10 - Closed user group */ + {"AT+CCWA=?\r", "\r\n+CCWA:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.12 - Call waiting */ + {"AT+CCWE=?\r", "\r\n+CCWE:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.28 - Call Meter maximum event */ + {"AT+CDIP=?\r", "\r\n+CDIP:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.9 - Called line identification presentation */ + {"AT+CDIS=?\r", "\r\n+CDIS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.8 - Display control */ + {"AT+CEER=?\r", "\r\n+CEER:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.10 - Extended error report */ + {"AT+CFCS=?\r", "\r\n+CFCS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.24 - Fast call setup conditions */ + {"AT+CFUN=?\r", "\r\n+CFUN:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.2 - Set phone functionality */ + {"AT+CGACT=?\r", "\r\n+CGACT:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.10 - PDP context activate or deactivate */ + {"AT+CGANS=?\r", "\r\n+CGANS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.16 - Manual response to a network request for PDP context activation */ + {"AT+CGATT=?\r", "\r\n+CGATT:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.9 - PS attach or detach */ + {"AT+CGAUTO=?\r", "\r\n+CGAUTO:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.15 - Automatic response to a network request for PDP context activation */ + {"AT+CGCLASS=?\r", "\r\n+CGCLASS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.17 - GPRS mobile station class (GPRS only) */ + {"AT+CGCLOSP=?\r", "\r\n+CGCLOSP:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.13 - Configure local octet stream PAD parameters (Obsolete) */ + {"AT+CGCLPAD=?\r", "\r\n+CGCLPAD:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.12 - Configure local triple-X PAD parameters (GPRS only) (Obsolete) */ + {"AT+CGCMOD=?\r", "\r\n+CGCMOD:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.11 - PDP Context Modify */ + {"AT+CGCS=?\r", "\r\n+CGCS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 11.3.1 - VGCS subscriptions and GId status */ + {"AT+CGDATA=?\r", "\r\n+CGDATA:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.12 - Enter data state */ + {"AT+CGDCONT=?\r", "\r\n+CGDCONT:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.1 - Define PDP Context */ + {"AT+CGDSCONT=?\r", "\r\n+CGDSCONT:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.2 - Define Secondary PDP Context */ + {"AT+CGEQMIN=?\r", "\r\n+CGEQMIN:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.7 - 3G Quality of Service Profile (Minimum acceptable) */ + {"AT+CGEQNEG=?\r", "\r\n+CGEQNEG:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.8 - 3G Quality of Service Profile (Negotiated) */ + {"AT+CGEQREQ=?\r", "\r\n+CGEQREQ:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.6 - 3G Quality of Service Profile (Requested) */ + {"AT+CGEREP=?\r", "\r\n+CGEREP:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.18 - Packet Domain event reporting */ + {"AT+CGMI=?\r", "\r\n+CGMI:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 5.1 - Request manufacturer identification */ + {"AT+CGMM=?\r", "\r\n+CGMM:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 5.2 - Request model identification */ + {"AT+CGMR=?\r", "\r\n+CGMR:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 5.3 - Request revision identification */ + {"AT+CGPADDR=?\r", "\r\n+CGPADDR:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.14 - Show PDP address */ + {"AT+CGQMIN=?\r", "\r\n+CGQMIN:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.5 - Quality of Service Profile (Minimum acceptable) */ + {"AT+CGQREQ=?\r", "\r\n+CGQREQ:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.4 - Quality of Service Profile (Requested) */ + {"AT+CGREG=?\r", "\r\n+CGREG:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.19 - GPRS network registration status */ + {"AT+CGSMS=?\r", "\r\n+CGSMS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.20 - Select service for MO SMS messages */ + {"AT+CGSN=?\r", "\r\n+CGSN:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 5.4 - Request product serial number identification */ + {"AT+CGTFT=?\r", "\r\n+CGTFT:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.3 - Traffic Flow Template */ + {"AT+CHLD=?\r", "\r\n+CHLD:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.13 - Call related supplementary services */ + {"AT+CHSA=?\r", "\r\n+CHSA:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.18 - HSCSD non-transparent asymmetry configuration */ + {"AT+CHSC=?\r", "\r\n+CHSC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.15 - HSCSD current call parameters */ + {"AT+CHSD=?\r", "\r\n+CHSD:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.12 - HSCSD device parameters */ + {"AT+CHSN=?\r", "\r\n+CHSN:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.14 - HSCSD non-transparent call configuration */ + {"AT+CHSR=?\r", "\r\n+CHSR:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.16 - HSCSD parameters report */ + {"AT+CHST=?\r", "\r\n+CHST:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.13 - HSCSD transparent call configuration */ + {"AT+CHSU=?\r", "\r\n+CHSU:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.17 - HSCSD automatic user initiated upgrading */ + {"AT+CHUP=?\r", "\r\n+CHUP:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.5 - Hangup call */ + {"AT+CIMI=?\r", "\r\n+CIMI:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 5.6 - Request international mobile subscriber identity */ + {"AT+CIND=?\r", "\r\n+CIND:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.9 - Indicator control */ + {"AT+CKPD=?\r", "\r\n+CKPD:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.7 - Keypad control */ + {"AT+CLAC=?\r", "\r\n+CLAC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.37 - List all available AT commands */ + {"AT+CLAE=?\r", "\r\n+CLAE:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.31 - Language Event */ + {"AT+CLAN=?\r", "\r\n+CLAN:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.30 - Set Language */ + {"AT+CLCC=?\r", "\r\n+CLCC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.18 - List current calls */ + {"AT+CLCK=?\r", "\r\n+CLCK:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.4 - Facility lock */ + {"AT+CLIP=?\r", "\r\n+CLIP:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.6 - Calling line identification presentation */ + {"AT+CLIR=?\r", "\r\n+CLIR:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.7 - Calling line identification restriction */ + {"AT+CLVL=?\r", "\r\n+CLVL:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.23 - Loudspeaker volume level */ + {"AT+CMAR=?\r", "\r\n+CMAR:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.36 - Master Reset */ + {"AT+CMEC=?\r", "\r\n+CMEC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.6 - Mobile Termination control mode */ + {"AT+CMER=?\r", "\r\n+CMER:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.10 - Mobile Termination event reporting */ + {"AT+CMOD=?\r", "\r\n+CMOD:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.4 - Call mode */ + {"AT+CMUT=?\r", "\r\n+CMUT:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.24 - Mute control */ + {"AT+CMUX=?\r", "\r\n+CMUX:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 5.7 - Multiplexing mode */ + {"AT+CNUM=?\r", "\r\n+CNUM:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.1 - Subscriber number */ + {"AT+COLP=?\r", "\r\n+COLP:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.8 - Connected line identification presentation */ + {"AT+COPN=?\r", "\r\n+COPN:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.21 - Read operator names */ + {"AT+COPS=?\r", "\r\n+COPS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.3 - PLMN selection */ + {"AT+COTDI=?\r", "\r\n+COTDI:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 11.1.9 - Originator to Dispatcher Information */ + {"AT+CPAS=?\r", "\r\n+CPAS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.1 - Phone activity status */ + {"AT+CPBF=?\r", "\r\n+CPBF:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.13 - Find phonebook entries */ + {"AT+CPBR=?\r", "\r\n+CPBR:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.12 - Read phonebook entries */ + {"AT+CPBS=?\r", "\r\n+CPBS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.11 - Select phonebook memory storage */ + {"AT+CPBW=?\r", "\r\n+CPBW:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.14 - Write phonebook entry */ + {"AT+CPIN=?\r", "\r\n+CPIN:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.3 - Enter PIN */ + {"AT+CPLS=?\r", "\r\n+CPLS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.20 - Selection of preferred PLMN list */ + {"AT+CPOL=?\r", "\r\n+CPOL:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.19 - Preferred PLMN list */ + {"AT+CPPS=?\r", "\r\n+CPPS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.23 - eMLPP subscriptions */ + {"AT+CPROT=?\r", "\r\n+CPROT:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.42 - Enter protocol mode */ + {"AT+CPUC=?\r", "\r\n+CPUC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.27 - Price per unit and currency table */ + {"AT+CPWC=?\r", "\r\n+CPWC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.29 - Power class */ + {"AT+CPWD=?\r", "\r\n+CPWD:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.5 - Change password */ + {"AT+CR=?\r", "\r\n+CR:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.9 - Service reporting control */ + {"AT+CRC=?\r", "\r\n+CRC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.11 - Cellular result codes */ + {"AT+CREG=?\r", "\r\n+CREG:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.2 - Network registration */ + {"AT+CRLP=?\r", "\r\n+CRLP:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.8 - Radio link protocol */ + {"AT+CRMC=?\r", "\r\n+CRMC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.34 - Ring Melody Control */ + {"AT+CRMP=?\r", "\r\n+CRMP:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.35 - Ring Melody Playback */ + {"AT+CRSL=?\r", "\r\n+CRSL:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.21 - Ringer sound level */ + {"AT+CRSM=?\r", "\r\n+CRSM:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.18 - Restricted SIM access */ + {"AT+CSCC=?\r", "\r\n+CSCC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.19 - Secure control command */ + {"AT+CSCS=?\r", "\r\n+CSCS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 5.5 - Select TE character set */ + {"AT+CSDF=?\r", "\r\n+CSDF:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.22 - Settings date format */ + {"AT+CSGT=?\r", "\r\n+CSGT:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.32 - Set Greeting Text */ + {"AT+CSIL=?\r", "\r\n+CSIL:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.23 - Silence Command */ + {"AT+CSIM=?\r", "\r\n+CSIM:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.17 - Generic SIM access */ + {"AT+CSNS=?\r", "\r\n+CSNS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.19 - Single numbering scheme */ + {"AT+CSQ=?\r", "\r\n+CSQ:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.5 - Signal quality */ + {"AT+CSSN=?\r", "\r\n+CSSN:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.17 - Supplementary service notifications */ + {"AT+CSTA=?\r", "\r\n+CSTA:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.1 - Select type of address */ + {"AT+CSTF=?\r", "\r\n+CSTF:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.24 - Settings time format */ + {"AT+CSVM=?\r", "\r\n+CSVM:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.33 - Set Voice Mail Number */ + {"AT+CTFR=?\r", "\r\n+CTFR:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.14 - Call deflection */ + {"AT+CTZR=?\r", "\r\n+CTZR:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.41 - Time Zone Reporting */ + {"AT+CTZU=?\r", "\r\n+CTZU:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.40 - Automatic Time Zone Update */ + {"AT+CUSD=?\r", "\r\n+CUSD:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.15 - Unstructured supplementary service data */ + {"AT+CUUS1=?\r", "\r\n+CUUS1:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.26 - User to User Signalling Service 1 */ + {"AT+CV120=?\r", "\r\n+CV120:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.21 - V.120 rate adaption protocol */ + {"AT+CVHU=?\r", "\r\n+CVHU:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.20 - Voice Hangup Control */ + {"AT+CVIB=?\r", "\r\n+CVIB:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.22 - Vibrator mode */ + {"AT+DR=?\r", "\r\n+DR:\r\n\r\nOK\r\n"}, /* V.250 6.6.2 - Data compression reporting */ + {"AT+DS=?\r", "\r\n+DS:\r\n\r\nOK\r\n"}, /* V.250 6.6.1 - Data compression */ + {"AT+EB=?\r", "\r\n+EB:\r\n\r\nOK\r\n"}, /* V.250 6.5.2 - Break handling in error control operation */ + {"AT+EFCS=?\r", "\r\n+EFCS:(0-2)\r\n\r\nOK\r\n"}, /* V.250 6.5.4 - 32-bit frame check sequence */ + {"AT+EFCS?\r", "\r\n+EFCS:0\r\n\r\nOK\r\n"}, + {"AT+EFRAM=?\r", "\r\n+EFRAM:(1-65535),(1-65535)\r\n\r\nOK\r\n"}, + /* V.250 6.5.8 - Frame length */ + {"AT+ER=?\r", "\r\n+ER:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.5.5 - Error control reporting */ + {"AT+ES=?\r", "\r\n+ES:(0-7),(0-4),(0-9)\r\n\r\nOK\r\n"}, /* V.250 6.5.1 - Error control selection */ + {"AT+ES?\r", "\r\n+ES:0,0,0\r\n\r\nOK\r\n"}, + {"AT+ESA=?\r", "\r\n+ESA:(0-2),(0-1),(0-1),(0-1),(0-2),(0-1),(0-255),(0-255)\r\n\r\nOK\r\n"}, + /* V.80 8.2 - Synchronous access mode configuration */ + {"AT+ESA?\r", "\r\n+ESA:0,0,0,0,0,0,0,0\r\n\r\nOK\r\n"}, + {"AT+ESR\r", "\r\nOK\r\n"}, /* V.250 6.5.3 - Selective repeat */ + {"AT+ETBM=?\r", "\r\n+ETBM:(0-2),(0-2),(0-30)\r\n\r\nOK\r\n"}, /* T.31 8.5.1 - Adaptive reception control */ + {"AT+ETBM?\r", "\r\n+ETBM:0,0\r\n\r\nOK\r\n"}, + {"AT+EWIND=?\r", "\r\n+EWIND:(1-127),(1-127)\r\n\r\nOK\r\n"}, /* V.250 6.5.7 - Window size */ + {"AT+EWIND?\r", "\r\n+EWIND:0,0\r\n\r\nOK\r\n"}, + {"AT+F34=?\r", "\r\n+F34:(0-14),(0-14),(0-2),(0-14),(0-14)\r\n\r\nOK\r\n"}, + /* T.31 B.6.1 - Initial V.34 rate controls for FAX */ + {"AT+F34?\r", "\r\n+F34:0,0,0,0,0\r\n\r\nOK\r\n"}, + {"AT+FAR=?\r", "\r\n0,1\r\n\r\nOK\r\n"}, /* T.31 8.5.1 - Adaptive reception control */ + {"AT+FAR?\r", "\r\n0\r\n\r\nOK\r\n"}, + {"AT+FCL=?\r", "\r\n(0-255)\r\n\r\nOK\r\n"}, /* T.31 8.5.2 - Carrier loss timeout */ + {"AT+FCLASS=?\r", "\r\n0,1,1.0\r\n\r\nOK\r\n"}, /* T.31 8.2 - Capabilities identification and control */ + {"AT+FCLASS?\r", "\r\n1\r\n\r\nOK\r\n"}, + {"AT+FDD=?\r", "\r\n(0,1)\r\n\r\nOK\r\n"}, /* T.31 8.5.3 - Double escape character replacement */ + {"AT+FDD?\r", "\r\n0\r\n\r\nOK\r\n"}, + {"AT+FIT=?\r", "\r\n+FIT:(0-255),(0-1)\r\n\r\nOK\r\n"}, /* T.31 8.5.4 - DTE inactivity timeout */ + {"AT+FIT?\r", "\r\n+FIT:0,0\r\n\r\nOK\r\n"}, + {"AT+FLO\r", "\r\nOK\r\n"}, /* T.31 says to implement something similar to +IFC */ + {"AT+FMI?\r", "\r\n" MANUFACTURER "\r\n\r\nOK\r\n"}, /* T.31 says to duplicate +GMI */ + {"AT+FMM?\r", "\r\n" PACKAGE "\r\n\r\nOK\r\n"}, /* T.31 says to duplicate +GMM */ + {"AT+FMR?\r", "\r\n" VERSION "\r\n\r\nOK\r\n"}, /* T.31 says to duplicate +GMR */ + {"AT+FPR=?\r", "\r\n115200\r\n\r\nOK\r\n"}, /* T.31 says to implement something similar to +IPR */ + {"AT+FPR?\r", "\r\n0\r\n\r\nOK\r\n"}, + {"AT+FRH=?\r", "\r\n3\r\n\r\nOK\r\n"}, /* T.31 8.3.6 - HDLC receive */ + {"AT+FRH?\r", "\r\n-1\r\n\r\nOK\r\n"}, + {"AT+FRM=?\r", "\r\n24,48,72,73,74,96,97,98,121,122,145,146\r\n\r\nOK\r\n"}, /* T.31 8.3.4 - Facsimile receive */ + {"AT+FRM?\r", "\r\n-1\r\n\r\nOK\r\n"}, + {"AT+FRS=?\r", "\r\n0-255\r\n\r\nOK\r\n"}, /* T.31 8.3.2 - Receive silence */ + {"AT+FRS?\r", "\r\n-1\r\n\r\nOK\r\n"}, + {"AT+FTH=?\r", "\r\n3\r\n\r\nOK\r\n"}, /* T.31 8.3.5 - HDLC transmit */ + {"AT+FTH?\r", "\r\n-1\r\n\r\nOK\r\n"}, + {"AT+FTM=?\r", "\r\n24,48,72,73,74,96,97,98,121,122,145,146\r\n\r\nOK\r\n"}, /* T.31 8.3.3 - Facsimile transmit */ + {"AT+FTM?\r", "\r\n-1\r\n\r\nOK\r\n"}, + {"AT+FTS=?\r", "\r\n0-255\r\n\r\nOK\r\n"}, /* T.31 8.3.1 - Transmit silence */ + {"AT+FTS?\r", "\r\n-1\r\n\r\nOK\r\n"}, + {"AT+GCAP\r", "\r\nOK\r\n"}, /* V.250 6.1.9 - Request complete capabilities list */ + {"AT+GCI=?\r", "\r\n+GCI:(00-FF)\r\n\r\nOK\r\n"}, /* V.250 6.1.10 - Country of installation, */ + {"AT+GCI?\r", "\r\n+GCI:00\r\n\r\nOK\r\n"}, + {"AT+GMI?\r", "\r\n" MANUFACTURER "\r\n\r\nOK\r\n"}, /* V.250 6.1.4 - Request manufacturer identification */ + {"AT+GMM?\r", "\r\n" PACKAGE "\r\n\r\nOK\r\n"}, /* V.250 6.1.5 - Request model identification */ + {"AT+GMR?\r", "\r\n" VERSION "\r\n\r\nOK\r\n"}, /* V.250 6.1.6 - Request revision identification */ + {"AT+GOI\r", "\r\nOK\r\n"}, /* V.250 6.1.8 - Request global object identification */ + {"AT+GSN?\r", "\r\n42\r\n\r\nOK\r\n"}, /* V.250 6.1.7 - Request product serial number identification */ + {"AT+IBC=?\r", "\r\n+IBC:(0-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)\r\n\r\nOK\r\n"}, + /* V.80 7.9 - Control of in-band control */ + {"AT+IBC?\r", "\r\n+IBC:0,0,0,0,0,0,0,0,0,0,0,0,0\r\n\r\nOK\r\n"}, + {"AT+IBM=?\r", "\r\n+IBM:(0-7),(0-255),(0-255)\r\n\r\nOK\r\n"}, /* V.80 7.10 - In-band MARK idle reporting control */ + {"AT+IBM?\r", "\r\n+IBM:0,0,0\r\n\r\nOK\r\n"}, + {"AT+ICF?\r", "\r\n+ICF:0,0\r\n\r\nOK\r\n"}, /* V.250 6.2.11 - DTE-DCE character framing */ + {"AT+ICLOK?\r", "\r\n+ICLOK:0\r\n\r\nOK\r\n"}, /* V.250 6.2.14 - Select sync transmit clock source */ + {"AT+IDSR?\r", "\r\n+IDSR:0\r\n\r\nOK\r\n"}, /* V.250 6.2.16 - Select data set ready option */ + {"AT+IFC\r", "\r\nOK\r\n"}, /* V.250 6.2.12 - DTE-DCE local flow control */ + {"AT+ILRR\r", "\r\nOK\r\n"}, /* V.250 6.2.13 - DTE-DCE local rate reporting */ + {"AT+ILSD=?\r", "\r\n+ILSD:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.2.15 - Select long space disconnect option */ + {"AT+ILSD?\r", "\r\n+ILSD:0\r\n\r\nOK\r\n"}, + {"AT+IPR=?\r", "\r\n+IPR:(115200),(115200)\r\n\r\nOK\r\n"}, /* V.250 6.2.10 - Fixed DTE rate */ + {"AT+IPR?\r", "\r\n+IPR:0\r\n\r\nOK\r\n"}, + {"AT+IRTS=?\r", "\r\n+IRTS:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.2.17 - Select synchronous mode RTS option */ + {"AT+IRTS?\r", "\r\n+IRTS:0\r\n\r\nOK\r\n"}, + {"AT+MA\r", "\r\nOK\r\n"}, /* V.250 6.4.2 - Modulation automode control */ + {"AT+MR=?\r", "\r\n+MR:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.4.3 - Modulation reporting control */ + {"AT+MR?\r", "\r\n+MR:0\r\n\r\nOK\r\n"}, + {"AT+MS\r", "\r\nOK\r\n"}, /* V.250 6.4.1 - Modulation selection */ + {"AT+MSC=?\r", "\r\n+MSC:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.4.8 - Seamless rate change enable */ + {"AT+MSC?\r", "\r\n+MSC:0\r\n\r\nOK\r\n"}, + {"AT+MV18AM\r", "\r\nOK\r\n"}, /* V.250 6.4.6 - V.18 answering message editing */ + {"AT+MV18P=?\r", "\r\n+MV18P:(2-7)\r\n\r\nOK\r\n"}, /* V.250 6.4.7 - Order of probes */ + {"AT+MV18P?\r", "\r\n+MV18P:0\r\n\r\nOK\r\n"}, + {"AT+MV18R=?\r", "\r\n+MV18R:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.4.5 - V.18 reporting control */ + {"AT+MV18R?\r", "\r\n+MV18R:0\r\n\r\nOK\r\n"}, + {"AT+MV18S\r", "\r\nOK\r\n"}, /* V.250 6.4.4 - V.18 selection */ + {"AT+TADR\r", "\r\nOK\r\n"}, /* V.250 6.7.2.9 - Local V.54 address */ + {"AT+TAL=?\r", "\r\n+TAL:(0,1),(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.15 - Local analogue loop */ + {"AT+TAL?\r", "\r\n+TAL:0,0\r\n\r\nOK\r\n"}, + {"AT+TALS=?\r", "\r\n+TALS:(0-3)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.6 - Analogue loop status */ + {"AT+TALS?\r", "\r\n+TALS:0\r\n\r\nOK\r\n"}, + {"AT+TDLS=?\r", "\r\n+TDLS:(0-4)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.7 - Local digital loop status */ + {"AT+TDLS?\r", "\r\n+TDLS:0\r\n\r\nOK\r\n"}, + {"AT+TE140=?\r", "\r\n+TE140:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.1 - Enable ckt 140 */ + {"AT+TE140?\r", "\r\n+TE140:0\r\n\r\nOK\r\n"}, + {"AT+TE141=?\r", "\r\n+TE141:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.2 - Enable ckt 141 */ + {"AT+TE141?\r", "\r\n+TE141:0\r\n\r\nOK\r\n"}, + {"AT+TEPAL=?\r", "\r\n+TEPAL:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.5 - Enable front panel analogue loop */ + {"AT+TEPAL?\r", "\r\n+TEPAL:0\r\n\r\nOK\r\n"}, + {"AT+TEPDL=?\r", "\r\n+TEPDL:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.4 - Enable front panel RDL */ + {"AT+TEPDL?\r", "\r\n+TEPDL:0\r\n\r\nOK\r\n"}, + {"AT+TERDL=?\r", "\r\n+TERDL:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.3 - Enable RDL from remote */ + {"AT+TERDL?\r", "\r\n+TERDL:0\r\n\r\nOK\r\n"}, + {"AT+TLDL=?\r", "\r\n+TLDL:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.13 - Local digital loop */ + {"AT+TLDL?\r", "\r\n+TLDL:0\r\n\r\nOK\r\n"}, + {"AT+TMODE=?\r", "\r\n+TMODE:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.10 - Set V.54 mode */ + {"AT+TMODE?\r", "\r\n+TMODE:0\r\n\r\nOK\r\n"}, + {"AT+TNUM\r", "\r\nOK\r\n"}, /* V.250 6.7.2.12 - Errored bit and block counts */ + {"AT+TRDL=?\r", "\r\n+TRDL:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.14 - Request remote digital loop */ + {"AT+TRDL?\r", "\r\n+TRDL:0\r\n\r\nOK\r\n"}, + {"AT+TRDLS\r", "\r\nOK\r\n"}, /* V.250 6.7.2.8 - Remote digital loop status */ + {"AT+TRES=?\r", "\r\n+TRES:(0-2)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.17 - Self test result */ + {"AT+TRES?\r", "\r\n+TRES:0\r\n\r\nOK\r\n"}, + {"AT+TSELF=?\r", "\r\n+TSELF:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.16 - Self test */ + {"AT+TSELF?\r", "\r\n+TSELF:0\r\n\r\nOK\r\n"}, + {"AT+TTER=?\r", "\r\n+TTER:(0-65535),(0-65535)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.11 - Test error rate */ + {"AT+TTER?\r", "\r\n+TTER:0,0\r\n\r\nOK\r\n"}, + {"AT+VBT\r", "\r\nOK\r\n"}, /* 3GPP TS 27.007 C.2.2 - Buffer threshold setting */ + {"AT+VCID=?\r", "\r\n0,1\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 C.2.3 - Calling number ID presentation */ + {"AT+VCID?\r", "\r\n0\r\n\r\nOK\r\n"}, + {"AT+VDR\r", "\r\nOK\r\n"}, /* V.253 10.3.1 - Distinctive ring (ring cadence reporting) */ + {"AT+VDT\r", "\r\nOK\r\n"}, /* V.253 10.3.2 - Control tone cadence reporting */ + {"AT+VDX\r", "\r\nOK\r\n"}, /* V.253 10.5.6 - Speakerphone duplex mode */ + {"AT+VEM\r", "\r\nOK\r\n"}, /* V.253 10.5.7 - Deliver event reports */ + {"AT+VGM\r", "\r\nOK\r\n"}, /* V.253 10.5.2 - Microphone gain */ + {"AT+VGR\r", "\r\nOK\r\n"}, /* V.253 10.2.1 - Receive gain selection */ + {"AT+VGS\r", "\r\nOK\r\n"}, /* V.253 10.5.3 - Speaker gain */ + {"AT+VGT\r", "\r\nOK\r\n"}, /* V.253 10.2.2 - Volume selection */ + {"AT+VIP\r", "\r\nOK\r\n"}, /* V.253 10.1.1 - Initialize voice parameters */ + {"AT+VIT\r", "\r\nOK\r\n"}, /* V.253 10.2.3 - DTE/DCE inactivity timer */ + {"AT+VLS\r", "\r\nOK\r\n"}, /* V.253 10.2.4 - Analogue source/destination selection */ + {"AT+VPP\r", "\r\nOK\r\n"}, /* V.253 10.4.2 - Voice packet protocol */ + {"AT+VRA\r", "\r\nOK\r\n"}, /* V.253 10.2.5 - Ringing tone goes away timer */ + {"AT+VRID?\r", "\r\n0\r\n\r\nOK\r\n"}, /* Extension - Find the originating and destination numbers */ + {"AT+VRL\r", "\r\nOK\r\n"}, /* V.253 10.1.2 - Ring local phone */ + {"AT+VRN\r", "\r\nOK\r\n"}, /* V.253 10.2.6 - Ringing tone never appeared timer */ + {"AT+VRX\r", "\r\nOK\r\n"}, /* V.253 10.1.3 - Voice receive state */ + {"AT+VSD\r", "\r\nOK\r\n"}, /* V.253 10.2.7 - Silence detection (QUIET and SILENCE) */ + {"AT+VSID=12345\r", "\r\nOK\r\n"}, /* Extension - Set the originating number */ + {"AT+VSID?\r", "\r\n12345\r\n\r\nOK\r\n"}, + {"AT+VSM\r", "\r\nOK\r\n"}, /* V.253 10.2.8 - Compression method selection */ + {"AT+VSP\r", "\r\nOK\r\n"}, /* V.253 10.5.1 - Voice speakerphone state */ + {"AT+VTA\r", "\r\nOK\r\n"}, /* V.253 10.5.4 - Train acoustic echo-canceller */ + {"AT+VTD\r", "\r\nOK\r\n"}, /* V.253 10.2.9 - Beep tone duration timer */ + {"AT+VTH\r", "\r\nOK\r\n"}, /* V.253 10.5.5 - Train line echo-canceller */ + {"AT+VTR\r", "\r\nOK\r\n"}, /* V.253 10.1.4 - Voice duplex state */ + {"AT+VTS\r", "\r\nOK\r\n"}, /* V.253 10.1.5 - DTMF and tone generation in voice */ + {"AT+VTX\r", "\r\nOK\r\n"}, /* V.253 10.1.6 - Transmit data state */ + {"AT+WS46\r", "\r\nOK\r\n"}, /* 3GPP TS 27.007 5.9 - PCCA STD-101 [17] select wireless network */ + {"ATA\r", "\r\nERROR\r\n"}, /* V.250 6.3.5 - Answer */ + {"ATDT -1234567890ABCDPSTW*#+,!@\r;", ""}, /* V.250 6.3.1 - Dial */ + {"ATE1\r", "\r\nOK\r\n"}, /* V.250 6.2.4 - Command echo */ + {"ATE0\r", "ATE0\r\r\nOK\r\n"}, /* V.250 6.2.4 - Command echo */ + {"ATH\r", "\r\nOK\r\n"}, /* V.250 6.3.6 - Hook control */ + {"ATI\r", "\r\n" PACKAGE "\r\n\r\nOK\r\n"}, /* V.250 6.1.3 - Request identification information */ + {"ATL\r", "\r\nOK\r\n"}, /* V.250 6.3.13 - Monitor speaker loudness */ + {"ATM\r", "\r\nOK\r\n"}, /* V.250 6.3.14 - Monitor speaker mode */ + {"ATO\r", "\r\nCONNECT\r\n\r\nOK\r\n"}, /* V.250 6.3.7 - Return to online data state */ + {"ATP\r", "\r\nOK\r\n"}, /* V.250 6.3.3 - Select pulse dialling (command) */ + {"ATQ\r", "\r\nOK\r\n"}, /* V.250 6.2.5 - Result code suppression */ + {"ATS0=?\r", "\r\n000\r\n\r\nOK\r\n"}, /* V.250 6.3.8 - Automatic answer */ + {"ATS0?\r", "\r\n000\r\n\r\nOK\r\n"}, + {"ATS10=?\r", "\r\n000\r\n\r\nOK\r\n"}, /* V.250 6.3.12 - Automatic disconnect delay */ + {"ATS10?\r", "\r\n000\r\n\r\nOK\r\n"}, + {"ATS3=?\r", "\r\n000\r\n\r\nOK\r\n"}, /* V.250 6.2.1 - Command line termination character */ + {"ATS3?\r", "\r\n013\r\n\r\nOK\r\n"}, + {"ATS4=?\r", "\r\n000\r\n\r\nOK\r\n"}, /* V.250 6.2.2 - Response formatting character */ + {"ATS4?\r", "\r\n010\r\n\r\nOK\r\n"}, + {"ATS5=?\r", "\r\n000\r\n\r\nOK\r\n"}, /* V.250 6.2.3 - Command line editing character */ + {"ATS5?\r", "\r\n008\r\n\r\nOK\r\n"}, + {"ATS6=?\r", "\r\n000\r\n\r\nOK\r\n"}, /* V.250 6.3.9 - Pause before blind dialling */ + {"ATS6?\r", "\r\n001\r\n\r\nOK\r\n"}, + {"ATS7=?\r", "\r\n000\r\n\r\nOK\r\n"}, /* V.250 6.3.10 - Connection completion timeout */ + {"ATS7?\r", "\r\n060\r\n\r\nOK\r\n"}, + {"ATS8=?\r", "\r\n000\r\n\r\nOK\r\n"}, /* V.250 6.3.11 - Comma dial modifier time */ + {"ATS8?\r", "\r\n005\r\n\r\nOK\r\n"}, + {"ATT\r", "\r\nOK\r\n"}, /* V.250 6.3.2 - Select tone dialling (command) */ + {"ATV0\r", "0\r"}, /* V.250 6.2.6 - DCE response format */ + {"ATV1\r", "\r\nOK\r\n"}, + {"ATX4\r", "\r\nOK\r\n"}, /* V.250 6.2.7 - Result code selection and call progress monitoring control */ + {"ATZ\r", "\r\nOK\r\n"}, /* V.250 6.1.1 - Reset to default configuration */ + {"", ""} +}; + +char *decode_test_file = NULL; +int countdown = 0; +int command_response_test_step = -1; +char response_buf[1000]; +int response_buf_ptr = 0; + +static int at_rx(at_state_t *s, const char *t, int len) +{ + at_interpreter(s, t, len); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int at_send(at_state_t *s, const char *t) +{ + printf("%s", t); + at_rx(s, t, strlen(t)); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +#if 0 +static int at_send_at(at_state_t *s, const char *t) +{ + uint8_t buf[500]; + + sprintf((char *) buf, "AT%s\r", t); + printf("%s", t); + at_rx(s, t, strlen(t)); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int at_expect(at_state_t *s, const char *t) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int at_send_hdlc(at_state_t *s, uint8_t *t, int len) +{ + uint8_t buf[100]; + int i; + int j; + + for (i = 0, j = 0; i < len; i++) + { + if (*t == DLE) + buf[j++] = DLE; + buf[j++] = *t++; + } + buf[j++] = DLE; + buf[j++] = ETX; + at_rx(s, (char *) buf, j); + return 0; +} +/*- End of function --------------------------------------------------------*/ +#endif + +static int general_test(at_state_t *s) +{ + int i; + + for (i = 0; general_test_seq[i].command[0]; i++) + { + response_buf_ptr = 0; + response_buf[0] = '\0'; + command_response_test_step = i; + at_send(s, general_test_seq[i].command); + if (strcmp(general_test_seq[command_response_test_step].response, response_buf) != 0) + { + printf("Incorrect response\n"); + printf("Expected: '%s'\n", general_test_seq[command_response_test_step].response); + printf("Received: '%s'\n", response_buf); + return -1; + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int modem_call_control(at_state_t *s, void *user_data, int op, const char *num) +{ + switch (op) + { + case AT_MODEM_CONTROL_CALL: + printf("\nModem control - Dialing '%s'\n", num); + break; + case AT_MODEM_CONTROL_ANSWER: + printf("\nModem control - Answering\n"); + /* Force an error response, so we get something well defined for the test. */ + return -1; + case AT_MODEM_CONTROL_HANGUP: + printf("\nModem control - Hanging up\n"); + break; + case AT_MODEM_CONTROL_OFFHOOK: + printf("\nModem control - Going off hook\n"); + break; + case AT_MODEM_CONTROL_ONHOOK: + printf("\nModem control - Going on hook\n"); + break; + case AT_MODEM_CONTROL_DTR: + printf("\nModem control - DTR %d\n", (int) (intptr_t) num); + break; + case AT_MODEM_CONTROL_RTS: + printf("\nModem control - RTS %d\n", (int) (intptr_t) num); + break; + case AT_MODEM_CONTROL_CTS: + printf("\nModem control - CTS %d\n", (int) (intptr_t) num); + break; + case AT_MODEM_CONTROL_CAR: + printf("\nModem control - CAR %d\n", (int) (intptr_t) num); + break; + case AT_MODEM_CONTROL_RNG: + printf("\nModem control - RNG %d\n", (int) (intptr_t) num); + break; + case AT_MODEM_CONTROL_DSR: + printf("\nModem control - DSR %d\n", (int) (intptr_t) num); + break; + case AT_MODEM_CONTROL_SETID: + printf("\nModem control - Set ID '%s'\n", num); + break; + case AT_MODEM_CONTROL_RESTART: + printf("\nModem control - Restart %d\n", (int) (intptr_t) num); + break; + case AT_MODEM_CONTROL_DTE_TIMEOUT: + printf("\nModem control - Set DTE timeout %d\n", (int) (intptr_t) num); + break; + default: + printf("\nModem control - operation %d\n", op); + break; + } + /*endswitch*/ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int at_tx_handler(at_state_t *s, void *user_data, const uint8_t *buf, size_t len) +{ + int i; + + for (i = 0; i < len; i++) + { + response_buf[response_buf_ptr++] = buf[i]; + putchar(buf[i]); + } + response_buf[response_buf_ptr] = '\0'; + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + at_state_t at_state; + + if (at_init(&at_state, at_tx_handler, NULL, modem_call_control, NULL) == NULL) + { + fprintf(stderr, "Cannot start the AT interpreter\n"); + exit(2); + } + if (general_test(&at_state)) + { + printf("Tests failed.\n"); + exit(2); + } + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/awgn_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/awgn_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,146 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * awgn_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: awgn_tests.c,v 1.18 2008/11/30 12:38:27 steveu Exp $ + */ + +/*! \page awgn_tests_page AWGN tests +\section awgn_tests_page_sec_1 What does it do? +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" + +#if !defined(M_PI) +# define M_PI 3.14159265358979323846 /* pi */ +#endif + +#define OUT_FILE_NAME "awgn.wav" + +/* Some simple sanity tests for the Gaussian noise generation routines */ + +int main (int argc, char *argv[]) +{ + int i; + int j; + int clip_high; + int clip_low; + int total_samples; + int idum = 1234567; + int16_t value; + double total; + double x; + double p; + double o; + double error; + int bins[65536]; + awgn_state_t noise_source; + + /* Generate noise at several RMS levels between -50dBm and 0dBm. Noise is + generated for a large number of samples (1,000,000), and the RMS value + of the noise is calculated along the way. If the resulting level is + close to the requested RMS level, at least the scaling of the noise + should be Ok. At high level some clipping may distort the result a + little. */ + for (j = -50; j <= 0; j += 5) + { + clip_high = 0; + clip_low = 0; + total = 0.0; + awgn_init_dbm0(&noise_source, idum, (float) j); + total_samples = 1000000; + for (i = 0; i < total_samples; i++) + { + value = awgn(&noise_source); + if (value == 32767) + clip_high++; + else if (value == -32768) + clip_low++; + total += ((double) value)*((double) value); + } + error = 100.0*(1.0 - sqrt(total/total_samples)/noise_source.rms); + printf("RMS = %.3f (expected %d) %.2f%% error [clipped samples %d+%d]\n", + log10(sqrt(total/total_samples)/32768.0)*20.0 + DBM0_MAX_POWER, + j, + error, + clip_low, + clip_high); + /* We don't check the result at 0dBm0, as there will definitely be a lot of error due to clipping */ + if (j < 0 && fabs(error) > 0.2) + { + printf("Test failed.\n"); + exit(2); + } + } + /* Now look at the statistical spread of the results, by collecting data in + bins from a large number of samples. Use a fairly high noise level, but + low enough to avoid significant clipping. Use the Gaussian model to + predict the real probability, and present the results for graphing. */ + memset(bins, 0, sizeof(bins)); + clip_high = 0; + clip_low = 0; + awgn_init_dbm0(&noise_source, idum, -15); + total_samples = 10000000; + for (i = 0; i < total_samples; i++) + { + value = awgn(&noise_source); + if (value == 32767) + clip_high++; + else if (value == -32768) + clip_low++; + bins[value + 32768]++; + } + o = noise_source.rms; + for (i = 0; i < 65536 - 10; i++) + { + x = i - 32768; + /* Find the real probability for this bin */ + p = (1.0/(o*sqrt(2.0*M_PI)))*exp(-(x*x)/(2.0*o*o)); + /* Now do a little smoothing on the real data to get a reasonably + steady answer */ + x = 0; + for (j = 0; j < 10; j++) + x += bins[i + j]; + x /= 10.0; + x /= total_samples; + /* Now send it out for graphing. */ + printf("%6d %.7f %.7f\n", i - 32768, x, p); + } + + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/bell_mf_rx_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/bell_mf_rx_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,554 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * bell_mf_tests.c - Test the Bell MF detector against the spec., whatever the + * spec. may be :) + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: bell_mf_rx_tests.c,v 1.16 2009/05/30 15:23:13 steveu Exp $ + */ + +/*! \file */ + +/*! \page bell_mf_tests_page Bell MF tone generation and detection tests +\section bell_mf_tests_page_sec_1 What does it do? +These tests are fashioned after those on the CM7291 test tape from +Mitel. Those tests are for DTMF, rather than Bell MF, but make a +fair starting point for a set of meaningful tests of Bell MF. + +These tests include conversion to and from A-law. It is assumed the +distortion this produces is comparable to u-law, so it should be +a fair test of performance in a real PSTN channel. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" + +/* Basic Bell MF specs: + * + * Signal generation: + * Tone on time = KP: 100+-7ms. All other signals: 68+-7ms + * Tone off time (between digits) = 68+-7ms + * Frequency tolerance +- 1.5% + * Signal level -7+-1dBm per frequency + * + * Signal reception: + * Frequency tolerance +- 1.5% +-10Hz + * Signal level -14dBm to 0dBm + * Perform a "two and only two tones present" test. + * Twist <= 6dB accepted + * Receiver sensitive to signals above -22dBm per frequency + * Test for a minimum of 55ms if KP, or 30ms of other signals. + * Signals to be recognised if the two tones arrive within 8ms of each other. + * Invalid signals result in the return of the re-order tone. + */ + +#define MF_DURATION (68*8) +#define MF_PAUSE (68*8) +#define MF_CYCLE (MF_DURATION + MF_PAUSE) + +/*! + MF tone descriptor for tests. +*/ +typedef struct +{ + float f1; /* First freq */ + float f2; /* Second freq */ + int8_t level1; /* Level of the first freq (dB) */ + int8_t level2; /* Level of the second freq (dB) */ + uint8_t on_time; /* Tone on time (ms) */ + uint8_t off_time; /* Minimum post tone silence (ms) */ +} mf_digit_tones_t; + +static const mf_digit_tones_t bell_mf_tones[] = +{ + { 700.0, 900.0, -7, -7, 68, 68}, + { 700.0, 1100.0, -7, -7, 68, 68}, + { 900.0, 1100.0, -7, -7, 68, 68}, + { 700.0, 1300.0, -7, -7, 68, 68}, + { 900.0, 1300.0, -7, -7, 68, 68}, + {1100.0, 1300.0, -7, -7, 68, 68}, + { 700.0, 1500.0, -7, -7, 68, 68}, + { 900.0, 1500.0, -7, -7, 68, 68}, + {1100.0, 1500.0, -7, -7, 68, 68}, + {1300.0, 1500.0, -7, -7, 68, 68}, + { 700.0, 1700.0, -7, -7, 68, 68}, /* ST''' - use 'C' */ + { 900.0, 1700.0, -7, -7, 68, 68}, /* ST' - use 'A' */ + {1100.0, 1700.0, -7, -7, 100, 68}, /* KP - use '*' */ + {1300.0, 1700.0, -7, -7, 68, 68}, /* ST'' - use 'B' */ + {1500.0, 1700.0, -7, -7, 68, 68}, /* ST - use '#' */ + {0.0, 0.0, 0, 0, 0, 0} +}; + +static tone_gen_descriptor_t my_mf_digit_tones[16]; + +static char bell_mf_tone_codes[] = "1234567890CA*B#"; + +int callback_ok; +int callback_roll; + +static void my_mf_gen_init(float low_fudge, + int low_level, + float high_fudge, + int high_level, + int duration, + int gap) +{ + int i; + + /* The fiddle factor on the tone duration is to make KP consistently + 50% longer than the other digits, as the digit durations are varied + for the tests. This is an approximation, as the real scaling should + be 100/68 */ + for (i = 0; i < 15; i++) + { + make_tone_gen_descriptor(&my_mf_digit_tones[i], + bell_mf_tones[i].f1*(1.0 + low_fudge), + low_level, + bell_mf_tones[i].f2*(1.0 + high_fudge), + high_level, + (i == 12) ? 3*duration/2 : duration, + gap, + 0, + 0, + FALSE); + } +} +/*- End of function --------------------------------------------------------*/ + +static int my_mf_generate(int16_t amp[], const char *digits) +{ + int len; + char *cp; + tone_gen_state_t tone; + + len = 0; + while (*digits) + { + if ((cp = strchr(bell_mf_tone_codes, *digits))) + { + tone_gen_init(&tone, &my_mf_digit_tones[cp - bell_mf_tone_codes]); + len += tone_gen(&tone, amp + len, 9999); + } + digits++; + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +static void codec_munge(int16_t amp[], int len) +{ + int i; + uint8_t alaw; + + for (i = 0; i < len; i++) + { + alaw = linear_to_alaw (amp[i]); + amp[i] = alaw_to_linear (alaw); + } +} +/*- End of function --------------------------------------------------------*/ + +#define ALL_POSSIBLE_DIGITS "1234567890CA*B#" + +static void digit_delivery(void *data, const char *digits, int len) +{ + int i; + int seg; + const char *s = ALL_POSSIBLE_DIGITS; + const char *t; + + if (data != (void *) 0x12345678) + { + callback_ok = FALSE; + return; + } + callback_ok = TRUE; + t = s + callback_roll; + seg = 15 - callback_roll; + for (i = 0; i < len; i += seg, seg = 15) + { + if (i + seg > len) + seg = len - i; + if (memcmp(digits + i, t, seg)) + { + callback_ok = FALSE; + printf("Fail at %d %d\n", i, seg); + break; + } + t = s; + callback_roll = (callback_roll + seg)%15; + } +} +/*- End of function --------------------------------------------------------*/ + +static int16_t amp[1000000]; + +int main(int argc, char *argv[]) +{ + int duration; + int i; + int j; + int len; + int sample; + const char *s; + char digit[2]; + char buf[MAX_BELL_MF_DIGITS + 1]; + int actual; + int nplus; + int nminus; + float rrb; + float rcfo; + time_t now; + bell_mf_rx_state_t *mf_state; + awgn_state_t noise_source; + + time(&now); + mf_state = bell_mf_rx_init(NULL, NULL, NULL); + + /* Test 1: Mitel's test 1 isn't really a test. Its a calibration step, + which has no meaning here. */ + printf ("Test 1: Calibration\n"); + printf (" Passed\n"); + + /* Test 2: Decode check + This is a sanity check, that all digits are reliably detected + under ideal conditions. Each possible digit is repeated 10 times, + with 68ms bursts. The level of each tone is about 6dB down from clip */ + printf ("Test 2: Decode check\n"); + my_mf_gen_init(0.0, -3, 0.0, -3, 68, 68); + s = ALL_POSSIBLE_DIGITS; + digit[1] = '\0'; + while (*s) + { + digit[0] = *s++; + for (i = 0; i < 10; i++) + { + len = my_mf_generate(amp, digit); + codec_munge(amp, len); + bell_mf_rx(mf_state, amp, len); + actual = bell_mf_rx_get(mf_state, buf, 128); + if (actual != 1 || buf[0] != digit[0]) + { + printf (" Sent '%s'\n", digit); + printf (" Received '%s' [%d]\n", buf, actual); + printf (" Failed\n"); + exit (2); + } + } + } + printf (" Passed\n"); + + /* Test 3: Recognition bandwidth and channel centre frequency check. + Use all digits. Each digit types requires four tests to complete + the check. Each section contains 40 pulses of 68ms duration, + with an amplitude of -20dB from clip per frequency. + + Four sections covering the tests for one tone (1 digit) are: + a. H frequency at 0% deviation from center, L frequency at +0.1%. + L frequency is then increments in +01.% steps up to +4%. The + number of tone bursts is noted and designated N+. + b. H frequency at 0% deviation, L frequency at -0.1%. L frequency + is then incremental in -0.1% steps, up to -4%. The number of + tone bursts is noted and designated N-. + c. The test in (a) is repeated with the L frequency at 0% and the + H frequency varied up to +4%. + d. The test in (b) is repeated with the L frequency and 0% and the + H frequency varied to -4%. + + Receiver Recognition Bandwidth (RRB) is calculated as follows: + RRB% = (N+ + N-)/10 + Receiver Center Frequency Offset (RCFO) is calculated as follows: + RCFO% = X + (N+ - N-)/20 + + Note that this test doesn't test what it says it is testing at all, + and the results are quite inaccurate, if not a downright lie! However, + it follows the Mitel procedure, so how can it be bad? :) + + The spec calls for +-1.5% +-10Hz of bandwidth. + */ + printf ("Test 3: Recognition bandwidth and channel centre frequency check\n"); + s = ALL_POSSIBLE_DIGITS; + digit[1] = '\0'; + j = 0; + while (*s) + { + digit[0] = *s++; + for (nplus = 0, i = 1; i <= 60; i++) + { + my_mf_gen_init((float) i/1000.0, -17, 0.0, -17, 68, 68); + len = my_mf_generate(amp, digit); + codec_munge(amp, len); + bell_mf_rx(mf_state, amp, len); + nplus += bell_mf_rx_get(mf_state, buf, 128); + } + for (nminus = 0, i = -1; i >= -60; i--) + { + my_mf_gen_init((float) i/1000.0, -17, 0.0, -17, 68, 68); + len = my_mf_generate(amp, digit); + codec_munge(amp, len); + bell_mf_rx(mf_state, amp, len); + nminus += bell_mf_rx_get(mf_state, buf, 128); + } + rrb = (float) (nplus + nminus)/10.0; + rcfo = (float) (nplus - nminus)/10.0; + printf (" %c (low) rrb = %5.2f%%, rcfo = %5.2f%%, max -ve = %5.2f, max +ve = %5.2f\n", + digit[0], + rrb, + rcfo, + (float) nminus/10.0, + (float) nplus/10.0); + + if (rrb < 3.0 + rcfo + (2.0*100.0*10.0/bell_mf_tones[j].f1) || rrb >= 15.0 + rcfo) + { + printf (" Failed\n"); + exit (2); + } + + for (nplus = 0, i = 1; i <= 60; i++) + { + my_mf_gen_init(0.0, -17, (float) i/1000.0, -17, 68, 68); + len = my_mf_generate(amp, digit); + codec_munge(amp, len); + bell_mf_rx(mf_state, amp, len); + nplus += bell_mf_rx_get(mf_state, buf, 128); + } + for (nminus = 0, i = -1; i >= -60; i--) + { + my_mf_gen_init(0.0, -17, (float) i/1000.0, -17, 68, 68); + len = my_mf_generate(amp, digit); + codec_munge(amp, len); + bell_mf_rx(mf_state, amp, len); + nminus += bell_mf_rx_get(mf_state, buf, 128); + } + rrb = (float) (nplus + nminus)/10.0; + rcfo = (float) (nplus - nminus)/10.0; + printf (" %c (high) rrb = %5.2f%%, rcfo = %5.2f%%, max -ve = %5.2f, max +ve = %5.2f\n", + digit[0], + rrb, + rcfo, + (float) nminus/10.0, + (float) nplus/10.0); + if (rrb < 3.0 + rcfo + (2.0*100.0*10.0/bell_mf_tones[j].f2) || rrb >= 15.0 + rcfo) + { + printf (" Failed\n"); + exit (2); + } + j++; + } + printf (" Passed\n"); + + /* Test 4: Acceptable amplitude ratio (twist). + Twist all digits in both directions, and check the maximum twist + we can accept. The way this is done is styled after the Mitel DTMF + test, and has good and bad points. */ + + printf ("Test 4: Acceptable amplitude ratio (twist)\n"); + s = ALL_POSSIBLE_DIGITS; + digit[1] = '\0'; + while (*s) + { + digit[0] = *s++; + for (nplus = 0, i = -50; i >= -250; i--) + { + my_mf_gen_init(0.0, -5, 0.0, i/10, 68, 68); + + len = my_mf_generate(amp, digit); + codec_munge(amp, len); + bell_mf_rx(mf_state, amp, len); + nplus += bell_mf_rx_get(mf_state, buf, 128); + } + printf(" %c normal twist = %.2fdB\n", digit[0], (float) nplus/10.0); + if (nplus < 60) + { + printf(" Failed\n"); + exit(2); + } + for (nminus = 0, i = -50; i >= -250; i--) + { + my_mf_gen_init(0.0, i/10, 0.0, -5, 68, 68); + + len = my_mf_generate(amp, digit); + codec_munge(amp, len); + bell_mf_rx(mf_state, amp, len); + nminus += bell_mf_rx_get(mf_state, buf, 128); + } + printf(" %c reverse twist = %.2fdB\n", digit[0], (float) nminus/10.0); + if (nminus < 60) + { + printf(" Failed\n"); + exit(2); + } + } + printf(" Passed\n"); + + /* Test 5: Dynamic range + This test sends all possible digits, with gradually increasing + amplitude. We determine the span over which we achieve reliable + detection. The spec says we should detect between -14dBm and 0dBm, + but the tones clip above -3dBm, so this cannot really work. */ + + printf("Test 5: Dynamic range\n"); + for (nplus = nminus = -1000, i = -50; i <= 3; i++) + { + my_mf_gen_init(0.0, i, 0.0, i, 68, 68); + for (j = 0; j < 100; j++) + { + len = my_mf_generate(amp, ALL_POSSIBLE_DIGITS); + codec_munge(amp, len); + bell_mf_rx(mf_state, amp, len); + if (bell_mf_rx_get(mf_state, buf, 128) != 15) + break; + if (strcmp(buf, ALL_POSSIBLE_DIGITS) != 0) + break; + } + if (j == 100) + { + if (nplus == -1000) + nplus = i; + } + else + { + if (nplus != -1000 && nminus == -1000) + nminus = i; + } + } + printf(" Dynamic range = %ddB to %ddB\n", nplus, nminus - 1); + if (nplus > -22 || nminus <= -3) + { + printf(" Failed\n"); + exit(2); + } + printf(" Passed\n"); + + /* Test 6: Guard time + This test sends all possible digits, with a gradually reducing + duration. The spec defines a narrow range of tone duration + times we can expect, so as long as we detect reliably at the + specified minimum we should be OK. However, the spec also says + we should detect on a minimum of 55ms of KP, or 30ms of other + digits. */ + + printf("Test 6: Guard time\n"); + for (i = 30; i < 62; i++) + { + my_mf_gen_init(0.0, -5, 0.0, -3, i, 68); + for (j = 0; j < 500; j++) + { + len = my_mf_generate(amp, ALL_POSSIBLE_DIGITS); + codec_munge(amp, len); + bell_mf_rx(mf_state, amp, len); + if (bell_mf_rx_get(mf_state, buf, 128) != 15) + break; + if (strcmp(buf, ALL_POSSIBLE_DIGITS) != 0) + break; + } + if (j == 500) + break; + } + printf(" Guard time = %dms\n", i); + if (i > 61) + { + printf(" Failed\n"); + exit(2); + } + printf(" Passed\n"); + + /* Test 7: Acceptable signal to noise ratio + We send all possible digits at -6dBm from clip, mixed with AWGN. + We gradually reduce the noise until we get clean detection. */ + + printf("Test 7: Acceptable signal to noise ratio\n"); + my_mf_gen_init(0.0, -3, 0.0, -3, 68, 68); + for (i = -10; i > -50; i--) + { + awgn_init_dbm0(&noise_source, 1234567, (float) i); + for (j = 0; j < 500; j++) + { + len = my_mf_generate(amp, ALL_POSSIBLE_DIGITS); + for (sample = 0; sample < len; sample++) + amp[sample] = saturate(amp[sample] + awgn(&noise_source)); + codec_munge(amp, len); + bell_mf_rx(mf_state, amp, len); + if (bell_mf_rx_get(mf_state, buf, 128) != 15) + break; + if (strcmp(buf, ALL_POSSIBLE_DIGITS) != 0) + break; + } + if (j == 500) + break; + } + printf(" Acceptable S/N ratio is %ddB\n", -3 - i); + if (-3 - i > 26) + { + printf(" Failed\n"); + exit(2); + } + printf(" Passed\n"); + + /* The remainder of the Mitel tape is the talk-off test. This is + meaningless for Bell MF. However the decoder's tolerance of + out of band noise is significant. */ + /* TODO: add a OOB tolerance test. */ + + /* Test the callback mode for delivering detected digits */ + + printf("Test: Callback digit delivery mode.\n"); + callback_ok = FALSE; + callback_roll = 0; + mf_state = bell_mf_rx_init(NULL, digit_delivery, (void *) 0x12345678); + my_mf_gen_init(0.0, -10, 0.0, -10, 68, 68); + for (i = 1; i < 10; i++) + { + len = 0; + for (j = 0; j < i; j++) + len += my_mf_generate(amp + len, ALL_POSSIBLE_DIGITS); + bell_mf_rx(mf_state, amp, len); + if (!callback_ok) + break; + } + if (!callback_ok) + { + printf(" Failed\n"); + exit (2); + } + printf(" Passed\n"); + + duration = time (NULL) - now; + printf ("Tests passed in %ds\n", duration); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/bell_mf_tx_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/bell_mf_tx_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,175 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * bell_mf_tx_tests.c - Test the Bell MF generator. + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: bell_mf_tx_tests.c,v 1.15 2009/05/30 15:23:13 steveu Exp $ + */ + +/*! \file */ + +/*! \page bell_mf_tx_tests_page Bell MF generation tests +\section bell_mf_tx_tests_page_sec_1 What does it do? +???. + +\section bell_mf_tx_tests_page_sec_2 How does it work? +???. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define OUTPUT_FILE_NAME "bell_mf.wav" + +int main(int argc, char *argv[]) +{ + bell_mf_tx_state_t *gen; + int16_t amp[16384]; + int len; + SNDFILE *outhandle; + int outframes; + int add_digits; + + if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + + gen = bell_mf_tx_init(NULL); + len = bell_mf_tx(gen, amp, 16384); + printf("Generated %d samples\n", len); + outframes = sf_writef_short(outhandle, amp, len); + if (bell_mf_tx_put(gen, "123", -1)) + printf("Ooops\n"); + len = bell_mf_tx(gen, amp, 16384); + printf("Generated %d samples\n", len); + outframes = sf_writef_short(outhandle, amp, len); + if (bell_mf_tx_put(gen, "456", -1)) + printf("Ooops\n"); + len = bell_mf_tx(gen, amp, 160); + printf("Generated %d samples\n", len); + outframes = sf_writef_short(outhandle, amp, len); + if (bell_mf_tx_put(gen, "789", -1)) + printf("Ooops\n"); + len = bell_mf_tx(gen, amp, 160); + printf("Generated %d samples\n", len); + outframes = sf_writef_short(outhandle, amp, len); + if (bell_mf_tx_put(gen, "*#", -1)) + printf("Ooops\n"); + len = bell_mf_tx(gen, amp, 160); + printf("Generated %d samples\n", len); + outframes = sf_writef_short(outhandle, amp, len); + add_digits = 1; + do + { + len = bell_mf_tx(gen, amp, 160); + printf("Generated %d samples\n", len); + if (len > 0) + { + outframes = sf_writef_short(outhandle, amp, len); + } + if (add_digits) + { + if (bell_mf_tx_put(gen, "1234567890", -1)) + { + printf("Digit buffer full\n"); + add_digits = 0; + } + } + } + while (len > 0); + + bell_mf_tx_init(gen); + len = bell_mf_tx(gen, amp, 16384); + printf("Generated %d samples\n", len); + outframes = sf_writef_short(outhandle, amp, len); + if (bell_mf_tx_put(gen, "123", -1)) + printf("Ooops\n"); + len = bell_mf_tx(gen, amp, 16384); + printf("Generated %d samples\n", len); + outframes = sf_writef_short(outhandle, amp, len); + if (bell_mf_tx_put(gen, "456", -1)) + printf("Ooops\n"); + len = bell_mf_tx(gen, amp, 160); + printf("Generated %d samples\n", len); + outframes = sf_writef_short(outhandle, amp, len); + if (bell_mf_tx_put(gen, "789", -1)) + printf("Ooops\n"); + len = bell_mf_tx(gen, amp, 160); + printf("Generated %d samples\n", len); + outframes = sf_writef_short(outhandle, amp, len); + if (bell_mf_tx_put(gen, "0*#", -1)) + printf("Ooops\n"); + len = bell_mf_tx(gen, amp, 160); + printf("Generated %d samples\n", len); + outframes = sf_writef_short(outhandle, amp, len); + if (bell_mf_tx_put(gen, "ABC", -1)) + printf("Ooops\n"); + len = bell_mf_tx(gen, amp, 160); + printf("Generated %d samples\n", len); + outframes = sf_writef_short(outhandle, amp, len); + add_digits = 1; + do + { + len = bell_mf_tx(gen, amp, 160); + printf("Generated %d samples\n", len); + if (len > 0) + { + outframes = sf_writef_short(outhandle, amp, len); + } + if (add_digits) + { + if (bell_mf_tx_put(gen, "1234567890", -1)) + { + printf("Digit buffer full\n"); + add_digits = 0; + } + } + } + while (len > 0); + + if (sf_close(outhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME); + exit (2); + } + + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/bert_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/bert_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,459 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * bert_tests.c - Tests for the BER tester. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: bert_tests.c,v 1.28 2009/05/30 15:23:13 steveu Exp $ + */ + +/*! \file */ + +/*! \page bert_tests_page BERT tests +\section bert_tests_page_sec_1 What does it do? +These tests exercise each of the BERT standards supported by the BERT module. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" + +/* Use a local random generator, so the results are consistent across platforms */ +static int my_rand(void) +{ + static int rndnum = 1234567; + + return (rndnum = 1664525U*rndnum + 1013904223U); +} +/*- End of function --------------------------------------------------------*/ + +static void reporter(void *user_data, int reason, bert_results_t *results) +{ + int channel; + + channel = (int) (intptr_t) user_data; + printf("BERT report '%s' ", bert_event_to_str(reason)); + switch (reason) + { + case BERT_REPORT_REGULAR: + printf("%d bits, %d bad bits, %d resyncs", results->total_bits, results->bad_bits, results->resyncs); + break; + } + printf("\r"); +} +/*- End of function --------------------------------------------------------*/ + +int8_t test[0x800000]; + +int main(int argc, char *argv[]) +{ + bert_state_t tx_bert; + bert_state_t rx_bert; + bert_state_t bert; + bert_results_t bert_results; + int i; + int bit; + int zeros; + int max_zeros; + int failed; + + bert_init(&tx_bert, 0, BERT_PATTERN_ZEROS, 300, 20); + bert_init(&rx_bert, 0, BERT_PATTERN_ZEROS, 300, 20); + for (i = 0; i < 511*2; i++) + { + bit = bert_get_bit(&tx_bert); + bert_put_bit(&rx_bert, bit); + } + bert_result(&rx_bert, &bert_results); + printf("Zeros: Bad bits %d/%d\n", bert_results.bad_bits, bert_results.total_bits); + if (bert_results.bad_bits || bert_results.total_bits != 950) + { + printf("Test failed.\n"); + exit(2); + } + + bert_init(&tx_bert, 0, BERT_PATTERN_ONES, 300, 20); + bert_init(&rx_bert, 0, BERT_PATTERN_ONES, 300, 20); + for (i = 0; i < 511*2; i++) + { + bit = bert_get_bit(&tx_bert); + bert_put_bit(&rx_bert, bit); + } + bert_result(&rx_bert, &bert_results); + printf("Ones: Bad bits %d/%d\n", bert_results.bad_bits, bert_results.total_bits); + if (bert_results.bad_bits || bert_results.total_bits != 950) + { + printf("Test failed.\n"); + exit(2); + } + + bert_init(&tx_bert, 0, BERT_PATTERN_1_TO_7, 300, 20); + bert_init(&rx_bert, 0, BERT_PATTERN_1_TO_7, 300, 20); + for (i = 0; i < 511*2; i++) + { + bit = bert_get_bit(&tx_bert); + bert_put_bit(&rx_bert, bit); + } + bert_result(&rx_bert, &bert_results); + printf("1 to 7: Bad bits %d/%d\n", bert_results.bad_bits, bert_results.total_bits); + if (bert_results.bad_bits || bert_results.total_bits != 950) + { + printf("Test failed.\n"); + exit(2); + } + + bert_init(&tx_bert, 0, BERT_PATTERN_1_TO_3, 300, 20); + bert_init(&rx_bert, 0, BERT_PATTERN_1_TO_3, 300, 20); + for (i = 0; i < 511*2; i++) + { + bit = bert_get_bit(&tx_bert); + bert_put_bit(&rx_bert, bit); + } + bert_result(&rx_bert, &bert_results); + printf("1 to 3: Bad bits %d/%d\n", bert_results.bad_bits, bert_results.total_bits); + if (bert_results.bad_bits || bert_results.total_bits != 950) + { + printf("Test failed.\n"); + exit(2); + } + + bert_init(&tx_bert, 0, BERT_PATTERN_1_TO_1, 300, 20); + bert_init(&rx_bert, 0, BERT_PATTERN_1_TO_1, 300, 20); + for (i = 0; i < 511*2; i++) + { + bit = bert_get_bit(&tx_bert); + bert_put_bit(&rx_bert, bit); + } + bert_result(&rx_bert, &bert_results); + printf("1 to 1: Bad bits %d/%d\n", bert_results.bad_bits, bert_results.total_bits); + if (bert_results.bad_bits || bert_results.total_bits != 950) + { + printf("Test failed.\n"); + exit(2); + } + + bert_init(&tx_bert, 0, BERT_PATTERN_3_TO_1, 300, 20); + bert_init(&rx_bert, 0, BERT_PATTERN_3_TO_1, 300, 20); + for (i = 0; i < 511*2; i++) + { + bit = bert_get_bit(&tx_bert); + bert_put_bit(&rx_bert, bit); + } + bert_result(&rx_bert, &bert_results); + printf("3 to 1: Bad bits %d/%d\n", bert_results.bad_bits, bert_results.total_bits); + if (bert_results.bad_bits || bert_results.total_bits != 950) + { + printf("Test failed.\n"); + exit(2); + } + + bert_init(&tx_bert, 0, BERT_PATTERN_7_TO_1, 300, 20); + bert_init(&rx_bert, 0, BERT_PATTERN_7_TO_1, 300, 20); + for (i = 0; i < 511*2; i++) + { + bit = bert_get_bit(&tx_bert); + bert_put_bit(&rx_bert, bit); + } + bert_result(&rx_bert, &bert_results); + printf("7 to 1: Bad bits %d/%d\n", bert_results.bad_bits, bert_results.total_bits); + if (bert_results.bad_bits || bert_results.total_bits != 950) + { + printf("Test failed.\n"); + exit(2); + } + + bert_init(&tx_bert, 0, BERT_PATTERN_ITU_O153_9, 300, 20); + bert_init(&rx_bert, 0, BERT_PATTERN_ITU_O153_9, 300, 20); + for (i = 0; i < 0x200; i++) + test[i] = 0; + max_zeros = 0; + zeros = 0; + for (i = 0; i < 511*2; i++) + { + bit = bert_get_bit(&tx_bert); + if (bit) + { + if (zeros > max_zeros) + max_zeros = zeros; + zeros = 0; + } + else + { + zeros++; + } + bert_put_bit(&rx_bert, bit); + test[tx_bert.tx.reg]++; + } + failed = FALSE; + if (test[0] != 0) + { + printf("XXX %d %d\n", 0, test[0]); + failed = TRUE; + } + for (i = 1; i < 0x200; i++) + { + if (test[i] != 2) + { + printf("XXX %d %d\n", i, test[i]); + failed = TRUE; + } + } + bert_result(&rx_bert, &bert_results); + printf("O.153(9): Bad bits %d/%d, max zeros %d\n", bert_results.bad_bits, bert_results.total_bits, max_zeros); + if (bert_results.bad_bits || bert_results.total_bits != 986 || failed) + { + printf("Test failed.\n"); + exit(2); + } + + bert_init(&tx_bert, 0, BERT_PATTERN_ITU_O152_11, 300, 20); + bert_init(&rx_bert, 0, BERT_PATTERN_ITU_O152_11, 300, 20); + for (i = 0; i < 0x800; i++) + test[i] = 0; + max_zeros = 0; + zeros = 0; + for (i = 0; i < 2047*2; i++) + { + bit = bert_get_bit(&tx_bert); + if (bit) + { + if (zeros > max_zeros) + max_zeros = zeros; + zeros = 0; + } + else + { + zeros++; + } + bert_put_bit(&rx_bert, bit); + test[tx_bert.tx.reg]++; + } + failed = FALSE; + if (test[0] != 0) + { + printf("XXX %d %d\n", 0, test[0]); + failed = TRUE; + } + for (i = 1; i < 0x800; i++) + { + if (test[i] != 2) + { + printf("XXX %d %d\n", i, test[i]); + failed = TRUE; + } + } + bert_result(&rx_bert, &bert_results); + printf("O.152(11): Bad bits %d/%d, max zeros %d\n", bert_results.bad_bits, bert_results.total_bits, max_zeros); + if (bert_results.bad_bits || bert_results.total_bits != 4052 || failed) + { + printf("Test failed.\n"); + exit(2); + } + + bert_init(&tx_bert, 0, BERT_PATTERN_ITU_O151_15, 300, 20); + bert_init(&rx_bert, 0, BERT_PATTERN_ITU_O151_15, 300, 20); + for (i = 0; i < 0x8000; i++) + test[i] = 0; + max_zeros = 0; + zeros = 0; + for (i = 0; i < 32767*2; i++) + { + bit = bert_get_bit(&tx_bert); + if (bit) + { + if (zeros > max_zeros) + max_zeros = zeros; + zeros = 0; + } + else + { + zeros++; + } + bert_put_bit(&rx_bert, bit); + test[tx_bert.tx.reg]++; + } + failed = FALSE; + if (test[0] != 0) + { + printf("XXX %d %d\n", 0, test[0]); + failed = TRUE; + } + for (i = 1; i < 0x8000; i++) + { + if (test[i] != 2) + { + printf("XXX %d %d\n", i, test[i]); + failed = TRUE; + } + } + bert_result(&rx_bert, &bert_results); + printf("O.151(15): Bad bits %d/%d, max zeros %d\n", bert_results.bad_bits, bert_results.total_bits, max_zeros); + if (bert_results.bad_bits || bert_results.total_bits != 65480 || failed) + { + printf("Test failed.\n"); + exit(2); + } + + bert_init(&tx_bert, 0, BERT_PATTERN_ITU_O151_20, 300, 20); + bert_init(&rx_bert, 0, BERT_PATTERN_ITU_O151_20, 300, 20); + for (i = 0; i < 0x100000; i++) + test[i] = 0; + max_zeros = 0; + zeros = 0; + for (i = 0; i < 1048575*2; i++) + { + bit = bert_get_bit(&tx_bert); + if (bit) + { + if (zeros > max_zeros) + max_zeros = zeros; + zeros = 0; + } + else + { + zeros++; + } + bert_put_bit(&rx_bert, bit); + test[tx_bert.tx.reg]++; + } + failed = FALSE; + if (test[0] != 0) + { + printf("XXX %d %d\n", 0, test[0]); + failed = TRUE; + } + for (i = 1; i < 0x100000; i++) + { + if (test[i] != 2) + printf("XXX %d %d\n", i, test[i]); + } + bert_result(&rx_bert, &bert_results); + printf("O.151(20): Bad bits %d/%d, max zeros %d\n", bert_results.bad_bits, bert_results.total_bits, max_zeros); + if (bert_results.bad_bits || bert_results.total_bits != 2097066 || failed) + { + printf("Test failed.\n"); + exit(2); + } + + bert_init(&tx_bert, 0, BERT_PATTERN_ITU_O151_23, 300, 20); + bert_init(&rx_bert, 0, BERT_PATTERN_ITU_O151_23, 300, 20); + for (i = 0; i < 0x800000; i++) + test[i] = 0; + max_zeros = 0; + zeros = 0; + for (i = 0; i < 8388607*2; i++) + { + bit = bert_get_bit(&tx_bert); + if (bit) + { + if (zeros > max_zeros) + max_zeros = zeros; + zeros = 0; + } + else + { + zeros++; + } + bert_put_bit(&rx_bert, bit); + test[tx_bert.tx.reg]++; + } + failed = FALSE; + if (test[0] != 0) + { + printf("XXX %d %d\n", 0, test[0]); + failed = TRUE; + } + for (i = 1; i < 0x800000; i++) + { + if (test[i] != 2) + printf("XXX %d %d\n", i, test[i]); + } + bert_result(&rx_bert, &bert_results); + printf("O.151(23): Bad bits %d/%d, max zeros %d\n", bert_results.bad_bits, bert_results.total_bits, max_zeros); + if (bert_results.bad_bits || bert_results.total_bits != 16777136 || failed) + { + printf("Test failed.\n"); + exit(2); + } + + bert_init(&tx_bert, 0, BERT_PATTERN_QBF, 300, 20); + bert_init(&rx_bert, 0, BERT_PATTERN_QBF, 300, 20); + for (i = 0; i < 100000; i++) + { + bit = bert_get_bit(&tx_bert); + bert_put_bit(&rx_bert, bit); + } + bert_result(&rx_bert, &bert_results); + printf("QBF: Bad bits %d/%d\n", bert_results.bad_bits, bert_results.total_bits); + if (bert_results.bad_bits || bert_results.total_bits != 100000) + { + printf("Test failed.\n"); + exit(2); + } + + /* Test the mechanism for categorising the error rate into <10^x bands */ + /* TODO: The result of this test is not checked automatically */ + bert_init(&bert, 15000000, BERT_PATTERN_ITU_O152_11, 300, 20); + bert_set_report(&bert, 100000, reporter, (intptr_t) 0); + for (;;) + { + if ((bit = bert_get_bit(&bert)) == SIG_STATUS_END_OF_DATA) + { + bert_result(&bert, &bert_results); + printf("Rate test: %d bits, %d bad bits, %d resyncs\n", bert_results.total_bits, bert_results.bad_bits, bert_results.resyncs); + if (bert_results.total_bits != 15000000 - 42 + || + bert_results.bad_bits != 58 + || + bert_results.resyncs != 0) + { + printf("Tests failed\n"); + exit(2); + } + break; + //bert_init(&bert, 15000000, BERT_PATTERN_ITU_O152_11, 300, 20); + //bert_set_report(&bert, 100000, reporter, (intptr_t) 0); + //continue; + } + if ((my_rand() & 0x3FFFF) == 0) + bit ^= 1; + //if ((my_rand() & 0xFFF) == 0) + // bert_put_bit(&bert, bit); + bert_put_bit(&bert, bit); + } + + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/bit_operations_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/bit_operations_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,295 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * bit_operations_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: bit_operations_tests.c,v 1.14 2008/05/13 13:17:25 steveu Exp $ + */ + +/*! \page bit_operations_tests_page Bit operations tests +\section bit_operations_tests_page_sec_1 What does it do? +These tests check the operation of efficient bit manipulation routines, by comparing +their operation with very dumb brute force versions of the same functionality. + +\section bit_operations_tests_page_sec_2 How is it used? +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +#include "spandsp.h" + +uint8_t from[1000000]; +uint8_t to[1000000]; + +static __inline__ int top_bit_dumb(unsigned int data) +{ + int i; + + if (data == 0) + return -1; + for (i = 31; i >= 0; i--) + { + if ((data & (1 << i))) + return i; + } + return -1; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int bottom_bit_dumb(unsigned int data) +{ + int i; + + if (data == 0) + return -1; + for (i = 0; i < 32; i++) + { + if ((data & (1 << i))) + return i; + } + return -1; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ uint8_t bit_reverse8_dumb(uint8_t data) +{ + int i; + int result; + + result = 0; + for (i = 0; i < 8; i++) + { + result = (result << 1) | (data & 1); + data >>= 1; + } + return result; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ uint32_t bit_reverse_4bytes_dumb(uint32_t data) +{ + int i; + uint32_t result; + + result = 0; + for (i = 0; i < 8; i++) + { + result = (result << 1) | (data & 0x01010101); + data >>= 1; + } + return result; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ uint16_t bit_reverse16_dumb(uint16_t data) +{ + int i; + uint16_t result; + + result = 0; + for (i = 0; i < 16; i++) + { + result = (result << 1) | (data & 1); + data >>= 1; + } + return result; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ uint32_t bit_reverse32_dumb(uint32_t data) +{ + int i; + uint32_t result; + + result = 0; + for (i = 0; i < 32; i++) + { + result = (result << 1) | (data & 1); + data >>= 1; + } + return result; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int parity8_dumb(uint8_t x) +{ + uint8_t y; + int i; + + for (y = 0, i = 0; i < 8; i++) + { + y ^= (x & 1); + x >>= 1; + } + return y; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int one_bits32_dumb(uint32_t x) +{ + int i; + int bits; + + bits = 0; + for (i = 0; i < 32; i++) + { + if (x & 1) + bits++; + x >>= 1; + } + return bits; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int i; + uint32_t x; + uint8_t ax; + uint8_t bx; + uint16_t ax16; + uint16_t bx16; + uint32_t ax32; + uint32_t bx32; + + for (i = 0, x = 0; i < 100000; i++) + { + ax = top_bit_dumb(x); + bx = top_bit(x); + if (ax != bx) + { + printf("Test failed: top bit mismatch 0x%" PRIx32 " -> %u %u\n", x, ax, bx); + exit(2); + } + ax = bottom_bit_dumb(x); + bx = bottom_bit(x); + if (ax != bx) + { + printf("Test failed: bottom bit mismatch 0x%" PRIx32 " -> %u %u\n", x, ax, bx); + exit(2); + } + x = rand(); + } + for (i = 0; i < 256; i++) + { + ax = bit_reverse8_dumb(i); + bx = bit_reverse8(i); + if (ax != bx) + { + printf("Test failed: bit reverse 8 - %02x %02x %02x\n", i, ax, bx); + exit(2); + } + } + for (i = 0; i < 1000000; i++) + from[i] = rand(); + bit_reverse(to, from, 1000000); + for (i = 0; i < 1000000; i++) + { + if (bit_reverse8_dumb(from[i]) != to[i]) + { + printf("Test failed: bit reverse - at %d, %02x %02x %02x\n", i, from[i], bit_reverse8(from[i]), to[i]); + exit(2); + } + } + for (i = 0; i < 256; i++) + { + x = i | (((i + 1) & 0xFF) << 8) | (((i + 2) & 0xFF) << 16) | (((i + 3) & 0xFF) << 24); + ax32 = bit_reverse_4bytes_dumb(x); + bx32 = bit_reverse_4bytes(x); + if (ax32 != bx32) + { + printf("Test failed: bit reverse 4 bytes - %" PRIx32 " %" PRIx32 " %" PRIx32 "\n", x, ax32, bx32); + exit(2); + } + } + for (i = 0; i < 65536; i++) + { + ax16 = bit_reverse16_dumb(i); + bx16 = bit_reverse16(i); + if (ax16 != bx16) + { + printf("Test failed: bit reverse 16 - %x %x %x\n", i, ax16, bx16); + exit(2); + } + } + for (i = 0; i < 0x7FFFFF00; i += 127) + { + ax32 = bit_reverse32_dumb(i); + bx32 = bit_reverse32(i); + if (ax32 != bx32) + { + printf("Test failed: bit reverse 32 - %d %" PRIx32 " %" PRIx32 "\n", i, ax32, bx32); + exit(2); + } + } + + for (i = 0; i < 256; i++) + { + ax = parity8(i); + bx = parity8_dumb(i); + if (ax != bx) + { + printf("Test failed: parity 8 - %x %x %x\n", i, ax, bx); + exit(2); + } + } + + for (i = -1; i < 32; i++) + { + ax32 = most_significant_one32(1 << i); + if (ax32 != (1 << i)) + { + printf("Test failed: most significant one 32 - %x %" PRIx32 " %x\n", i, ax32, (1 << i)); + exit(2); + } + ax32 = least_significant_one32(1 << i); + if (ax32 != (1 << i)) + { + printf("Test failed: least significant one 32 - %x %" PRIx32 " %x\n", i, ax32, (1 << i)); + exit(2); + } + } + + for (i = 0x80000000; i < 0x800FFFFF; i++) + { + ax = one_bits32_dumb(i); + bx = one_bits32(i); + if (ax != bx) + { + printf("Test failed: one bits - %d, %x %x\n", i, ax, bx); + exit(2); + } + } + + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/complex_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/complex_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,81 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * complex.c + * + * Written by Steve Underwood + * + * Copyright (C) 2008 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: complex_tests.c,v 1.2 2009/01/28 03:41:27 steveu Exp $ + */ + +/*! \page complex_tests_page Complex arithmetic tests +\section complex_tests_page_sec_1 What does it do? + +\section complex_tests_page_sec_2 How is it used? +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include + +#include "spandsp.h" + +int main(int argc, char *argv[]) +{ + complexf_t fa; + complexf_t fb; + complexf_t fz; + complexi16_t i16a; + complexi16_t i16b; + complexi16_t i16z; +#if 0 + complexi32_t i32a; + complexi32_t i32b; + complexi32_t i32z; +#endif + + fa = complex_setf(0.5f, 0.25f); + fb = complex_setf(0.25f, 0.5f); + fz = complex_mulf(&fa, &fb); + printf("(%f, %f) * (%f, %f) => (%f, %f)\n", fa.re, fa.im, fb.re, fb.im, fz.re, fz.im); + + i16a = complex_seti16(16383, 8191); + i16b = complex_seti16(8191, 16383); + i16z = complex_mul_q1_15(&i16a, &i16b); + printf("(%f, %f) * (%f, %f) => (%f, %f)\n", i16a.re/32768.0, i16a.im/32768.0, i16b.re/32768.0, i16b.im/32768.0, i16z.re/32768.0, i16z.im/32768.0); + + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/complex_vector_float_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/complex_vector_float_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,148 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * complex_vector_float_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2006,2008 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: complex_vector_float_tests.c,v 1.3 2009/04/26 07:00:39 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include + +#include "spandsp.h" + +static void cvec_mulf_dumb(complexf_t z[], const complexf_t x[], const complexf_t y[], int n) +{ + int i; + + for (i = 0; i < n; i++) + { + z[i].re = x[i].re*y[i].re - x[i].im*y[i].im; + z[i].im = x[i].re*y[i].im + x[i].im*y[i].re; + } +} +/*- End of function --------------------------------------------------------*/ + +static int test_cvec_mulf(void) +{ + int i; + complexf_t x[100]; + complexf_t y[100]; + complexf_t za[100]; + complexf_t zb[100]; + complexf_t ratio; + + for (i = 0; i < 99; i++) + { + x[i].re = rand(); + x[i].im = rand(); + y[i].re = rand(); + y[i].im = rand(); + } + cvec_mulf(za, x, y, 99); + cvec_mulf_dumb(zb, x, y, 99); + for (i = 0; i < 99; i++) + printf("(%f,%f) (%f,%f) (%f,%f)\n", za[i].re, za[i].im, x[i].re, x[i].im, y[i].re, y[i].im); + for (i = 0; i < 99; i++) + { + ratio.re = za[i].re/zb[i].re; + ratio.im = za[i].im/zb[i].im; + if ((ratio.re < 0.9999 || ratio.re > 1.0001) + || + (ratio.im < 0.9999 || ratio.im > 1.0001)) + { + printf("cvec_mulf() - (%f,%f) (%f,%f)\n", za[i].re, za[i].im, zb[i].re, zb[i].im); + printf("Tests failed\n"); + exit(2); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static complexf_t cvec_dot_prodf_dumb(const complexf_t x[], const complexf_t y[], int n) +{ + int i; + complexf_t z; + complexf_t z1; + + z = complex_setf(0.0f, 0.0f); + for (i = 0; i < n; i++) + { + z1 = complex_mulf(&x[i], &y[i]); + z = complex_addf(&z, &z1); + } + return z; +} +/*- End of function --------------------------------------------------------*/ + +static int test_cvec_dot_prodf(void) +{ + int i; + complexf_t x[100]; + complexf_t y[100]; + complexf_t zsa; + complexf_t zsb; + complexf_t ratio; + + for (i = 0; i < 99; i++) + { + x[i].re = rand(); + x[i].im = rand(); + y[i].re = rand(); + y[i].im = rand(); + } + for (i = 1; i < 99; i++) + { + zsa = cvec_dot_prodf(x, y, i); + zsb = cvec_dot_prodf_dumb(x, y, i); + ratio.re = zsa.re/zsb.re; + ratio.im = zsa.im/zsb.im; + if ((ratio.re < 0.9999 || ratio.re > 1.0001) + || + (ratio.im < 0.9999 || ratio.im > 1.0001)) + { + printf("cvec_dot_prodf() - (%f,%f) (%f,%f)\n", zsa.re, zsa.im, zsb.re, zsb.im); + printf("Tests failed\n"); + exit(2); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + test_cvec_mulf(); + test_cvec_dot_prodf(); + + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/complex_vector_int_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/complex_vector_int_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,136 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * complex_vector_int_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: complex_vector_int_tests.c,v 1.2 2009/04/26 07:00:39 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include + +#include "spandsp.h" + +static complexi32_t cvec_dot_prodi16_dumb(const complexi16_t x[], const complexi16_t y[], int n) +{ + complexi32_t z; + int i; + + z = complex_seti32(0, 0); + for (i = 0; i < n; i++) + { + z.re += ((int32_t) x[i].re*(int32_t) y[i].re - (int32_t) x[i].im*(int32_t) y[i].im); + z.im += ((int32_t) x[i].re*(int32_t) y[i].im + (int32_t) x[i].im*(int32_t) y[i].re); + } + return z; +} +/*- End of function --------------------------------------------------------*/ + +static int test_cvec_dot_prodi16(void) +{ + int i; + complexi32_t za; + complexi32_t zb; + complexi16_t x[99]; + complexi16_t y[99]; + + for (i = 0; i < 99; i++) + { + x[i].re = rand(); + x[i].im = rand(); + y[i].re = rand(); + y[i].im = rand(); + } + + for (i = 1; i < 99; i++) + { + za = cvec_dot_prodi16(x, y, i); + zb = cvec_dot_prodi16_dumb(x, y, i); + if (za.re != zb.re || za.im != zb.im) + { + printf("Tests failed\n"); + exit(2); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int test_cvec_circular_dot_prodi16(void) +{ + int i; + int j; + int pos; + int len; + complexi32_t za; + complexi32_t zb; + complexi16_t x[99]; + complexi16_t y[99]; + + /* Verify that we can do circular sample buffer "dot" linear coefficient buffer + operations properly, by doing two sub-dot products. */ + for (i = 0; i < 99; i++) + { + x[i].re = rand(); + x[i].im = rand(); + y[i].re = rand(); + y[i].im = rand(); + } + + len = 95; + for (pos = 0; pos < len; pos++) + { + za = cvec_circular_dot_prodi16(x, y, len, pos); + zb = complex_seti32(0, 0); + for (i = 0; i < len; i++) + { + j = (pos + i) % len; + zb.re += ((int32_t) x[j].re*(int32_t) y[i].re - (int32_t) x[j].im*(int32_t) y[i].im); + zb.im += ((int32_t) x[j].re*(int32_t) y[i].im + (int32_t) x[j].im*(int32_t) y[i].re); + } + + if (za.re != zb.re || za.im != zb.im) + { + printf("Tests failed\n"); + exit(2); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + test_cvec_dot_prodi16(); + test_cvec_circular_dot_prodi16(); + + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/crc_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/crc_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,111 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * crc_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: crc_tests.c,v 1.6 2008/05/13 13:17:25 steveu Exp $ + */ + +/*! \file */ + +/*! \page crc_tests_page CRC tests +\section crc_tests_page_sec_1 What does it do? +The CRC tests exercise the ITU-16 and ITU-32 CRC module, and verifies +correct operation. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include + +#include "spandsp.h" + +int ref_len; +uint8_t buf[1000]; + +/* Use a local random generator, so the results are consistent across platforms. We have hard coded + correct results for a message sequence generated by this particular PRNG. */ +static int my_rand(void) +{ + static int rndnum = 1234567; + + return (rndnum = 1664525U*rndnum + 1013904223U) >> 8; +} +/*- End of function --------------------------------------------------------*/ + +static int cook_up_msg(uint8_t *buf) +{ + int i; + int len; + + /* Use medium length messages, with some randomised length variation. */ + /* TODO: this doesn't exercise extremely short or long messages. */ + len = (my_rand() & 0x3F) + 100; + for (i = 0; i < len; i++) + buf[i] = my_rand(); + return len; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int i; + int len; + + printf("HDLC module tests\n"); + + /* TODO: This doesn't check every function in the module */ + + /* Try a few random messages through the CRC logic. */ + printf("Testing the CRC-16 routines\n"); + for (i = 0; i < 100; i++) + { + ref_len = cook_up_msg(buf); + len = crc_itu16_append(buf, ref_len); + if (!crc_itu16_check(buf, len)) + { + printf("CRC-16 failure\n"); + exit(2); + } + } + printf("Test passed.\n\n"); + + printf("Testing the CRC-32 routines\n"); + for (i = 0; i < 100; i++) + { + ref_len = cook_up_msg(buf); + len = crc_itu32_append(buf, ref_len); + if (!crc_itu32_check(buf, len)) + { + printf("CRC-32 failure\n"); + exit(2); + } + } + printf("Test passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/dc_restore_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/dc_restore_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,98 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * dc_restore_tests.c - Tests for the dc_restore functions. + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: dc_restore_tests.c,v 1.24 2008/11/30 12:38:27 steveu Exp $ + */ + +/*! \page dc_restore_tests_page DC restoration tests +\section dc_restore_tests_page_sec_1 What does it do? +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" + +int main (int argc, char *argv[]) +{ + awgn_state_t noise_source; + dc_restore_state_t dc_state; + int i; + int idum = 1234567; + int16_t dirty; + int16_t clean; + int estimate; + int min; + int max; + int dc_offset; + + dc_offset = 5000; + awgn_init_dbm0(&noise_source, idum, -10.0); + dc_restore_init(&dc_state); + for (i = 0; i < 100000; i++) + { + dirty = awgn(&noise_source) + dc_offset; + clean = dc_restore(&dc_state, dirty); + if ((i % 1000) == 0) + { + printf("Sample %6d: %d (expect %d)\n", + i, + dc_restore_estimate(&dc_state), + dc_offset); + } + } + /* We should have settled by now. Look at the variation we get */ + min = 99999; + max = -99999; + for (i = 0; i < 100000; i++) + { + dirty = awgn(&noise_source) + dc_offset; + clean = dc_restore(&dc_state, dirty); + estimate = dc_restore_estimate(&dc_state); + if (estimate < min) + min = estimate; + if (estimate > max) + max = estimate; + } + printf("Spread of DC estimate for an offset of %d was %d to %d\n", dc_offset, min, max); + if (min < dc_offset - 50 || max > dc_offset + 50) + { + printf("Test failed.\n"); + exit(2); + } + printf("Test passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/dds_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/dds_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,219 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * dds_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: dds_tests.c,v 1.26 2009/06/02 14:55:36 steveu Exp $ + */ + +/*! \file */ + +/*! \page dds_tests_page Direct digital synthesis tests +\section dds_tests_page_sec_1 What does it do? +???. + +\section dds_tests_page_sec_2 How does it work? +???. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define OUTPUT_FILE_NAME "dds.wav" +#define OUTPUT_FILE_NAME_COMPLEX "complex_dds.wav" + +#define SAMPLES_PER_CHUNK 8000 + +int main(int argc, char *argv[]) +{ + int i; + uint32_t phase; + int32_t phase_inc; + int outframes; + complexf_t camp; + int16_t buf[2*SAMPLES_PER_CHUNK]; + SNDFILE *outhandle; + power_meter_t meter; + power_meter_t meter_i; + power_meter_t meter_q; + int scale; + + power_meter_init(&meter, 10); + + printf("Non-complex DDS tests.\n"); + if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + + phase = 0; + + printf("Test with 123.456789Hz.\n"); + phase_inc = dds_phase_rate(123.456789f); + scale = dds_scaling_dbm0(-10.0f); + for (i = 0; i < SAMPLES_PER_CHUNK; i++) + { + buf[i] = alaw_to_linear(linear_to_alaw((dds(&phase, phase_inc)*scale) >> 15)); + power_meter_update(&meter, buf[i]); + } + outframes = sf_writef_short(outhandle, buf, SAMPLES_PER_CHUNK); + if (outframes != SAMPLES_PER_CHUNK) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + printf("Level is %fdBOv/%fdBm0\n", power_meter_current_dbov(&meter), power_meter_current_dbm0(&meter)); + if (fabs(power_meter_current_dbm0(&meter) + 10.0f) > 0.05f) + { + printf("Test failed.\n"); + exit(2); + } + + printf("Test with 12.3456789Hz.\n"); + phase_inc = dds_phase_rate(12.3456789f); + for (i = 0; i < SAMPLES_PER_CHUNK; i++) + { + buf[i] = alaw_to_linear(linear_to_alaw(dds(&phase, phase_inc))); + power_meter_update(&meter, buf[i]); + } + outframes = sf_writef_short(outhandle, buf, SAMPLES_PER_CHUNK); + if (outframes != SAMPLES_PER_CHUNK) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + printf("Level is %fdBOv/%fdBm0\n", power_meter_current_dbov(&meter), power_meter_current_dbm0(&meter)); + /* Use a wider tolerance for this very low frequency - the power meter will ripple */ + if (fabs(power_meter_current_dbov(&meter) + 3.02f) > 0.2f) + { + printf("Test failed.\n"); + exit(2); + } + + printf("Test with 2345.6789Hz.\n"); + phase_inc = dds_phase_rate(2345.6789f); + scale = dds_scaling_dbov(-10.0f); + for (i = 0; i < SAMPLES_PER_CHUNK; i++) + { + buf[i] = alaw_to_linear(linear_to_alaw((dds(&phase, phase_inc)*scale) >> 15)); + power_meter_update(&meter, buf[i]); + } + outframes = sf_writef_short(outhandle, buf, SAMPLES_PER_CHUNK); + if (outframes != SAMPLES_PER_CHUNK) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + printf("Level is %fdBOv/%fdBm0\n", power_meter_current_dbov(&meter), power_meter_current_dbm0(&meter)); + if (fabs(power_meter_current_dbov(&meter) + 10.0f) > 0.05f) + { + printf("Test failed.\n"); + exit(2); + } + + printf("Test with 3456.789Hz.\n"); + phase_inc = dds_phase_rate(3456.789f); + for (i = 0; i < SAMPLES_PER_CHUNK; i++) + { + buf[i] = alaw_to_linear(linear_to_alaw(dds(&phase, phase_inc))); + power_meter_update(&meter, buf[i]); + } + outframes = sf_writef_short(outhandle, buf, SAMPLES_PER_CHUNK); + if (outframes != SAMPLES_PER_CHUNK) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + printf("Level is %fdBOv/%fdBm0\n", power_meter_current_dbov(&meter), power_meter_current_dbm0(&meter)); + if (fabs(power_meter_current_dbov(&meter) + 3.02f) > 0.05f) + { + printf("Test failed.\n"); + exit(2); + } + + if (sf_close(outhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + + printf("Complex DDS tests,\n"); + if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME_COMPLEX, 2)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_FILE_NAME_COMPLEX); + exit(2); + } + + power_meter_init(&meter_i, 7); + power_meter_init(&meter_q, 7); + + phase = 0; + phase_inc = dds_phase_ratef(123.456789f); + for (i = 0; i < SAMPLES_PER_CHUNK; i++) + { + camp = dds_complexf(&phase, phase_inc); + buf[2*i] = camp.re*10000.0f; + buf[2*i + 1] = camp.im*10000.0f; + power_meter_update(&meter_i, buf[2*i]); + power_meter_update(&meter_q, buf[2*i]); + } + outframes = sf_writef_short(outhandle, buf, SAMPLES_PER_CHUNK); + if (outframes != SAMPLES_PER_CHUNK) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + printf("Level is %fdBOv/%fdBm0, %fdBOv/%fdBm0\n", + power_meter_current_dbov(&meter_i), + power_meter_current_dbm0(&meter_i), + power_meter_current_dbov(&meter_q), + power_meter_current_dbm0(&meter_q)); + if (fabs(power_meter_current_dbov(&meter_i) + 13.42f) > 0.05f + || + fabs(power_meter_current_dbov(&meter_q) + 13.42f) > 0.05f) + { + printf("Test failed.\n"); + exit(2); + } + + if (sf_close(outhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME_COMPLEX); + exit(2); + } + + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/dtmf_rx_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/dtmf_rx_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,890 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * dtmf_rx_tests.c - Test the DTMF detector against the spec., whatever the spec. + * may be :) + * + * Written by Steve Underwood + * + * Copyright (C) 2001, 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: dtmf_rx_tests.c,v 1.45 2009/05/30 15:23:13 steveu Exp $ + */ + +/* + * These tests include conversion to and from A-law. I assume the + * distortion this produces is comparable to u-law, so it should be + * a fair test. + * + * These tests mirror those on the CM7291 test tape from Mitel. + * Many of these tests are highly questionable, but they are a + * well accepted industry standard. + * + * However standard these tests might be, Mitel appears to have stopped + * selling copies of their tape. + * + * For the talk-off test the Bellcore tapes may be used. However, they are + * copyright material, so the test data files produced from the Bellcore + * tapes cannot be distributed as a part of this package. + * + */ + +/*! \page dtmf_rx_tests_page DTMF receiver tests +\section dtmf_rx_tests_page_sec_1 What does it do? + +The DTMF detection test suite performs similar tests to the Mitel test tape, +traditionally used for testing DTMF receivers. Mitel seem to have discontinued +this product, but all it not lost. + +The first side of the Mitel tape consists of a number of tone and tone+noise +based tests. The test suite synthesizes equivalent test data. Being digitally +generated, this data is rather more predictable than the test data on the nasty +old stretchy cassette tapes which Mitel sold. + +The second side of the Mitel tape contains fragments of real speech from real +phone calls captured from the North American telephone network. These are +considered troublesome for DTMF detectors. A good detector is expected to +achieve a reasonably low number of false detections on this data. Fresh clean +copies of this seem to be unobtainable. However, Bellcore produce a much more +aggressive set of three cassette tapes. All six side (about 30 minutes each) are +filled with much tougher fragments of real speech from the North American +telephone network. If you can do well in this test, nobody cares about your +results against the Mitel test tape. + +A fresh set of tapes was purchased for these tests, and digitised, producing 6 +wave files of 16 bit signed PCM data, sampled at 8kHz. They were transcribed +using a speed adjustable cassette player. The test tone at the start of the +tapes is pretty accurate, and the new tapes should not have had much opportunity +to stretch. It is believed these transcriptions are about as good as the source +material permits. + +PLEASE NOTE + +These transcriptions may be freely used by anyone who has a legitimate copy of +the original tapes. However, if you don't have a legitimate copy of those tapes, +you also have no right to use this data. The original tapes are the copyright +material of BellCore, and they charge over US$200 for a set. I doubt they sell +enough copies to consider this much of a business. However, it is their data, +and it is their right to do as they wish with it. Currently I see no indication +they wish to give it away for free. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +/* Basic DTMF specs: + * + * Minimum tone on = 40ms + * Minimum tone off = 50ms + * Maximum digit rate = 10 per second + * Normal twist <= 8dB accepted + * Reverse twist <= 4dB accepted + * S/N >= 15dB will detect OK + * Attenuation <= 26dB will detect OK + * Frequency tolerance +- 1.5% will detect, +-3.5% will reject + */ + +#define DEFAULT_DTMF_TX_LEVEL -10 +#define DEFAULT_DTMF_TX_ON_TIME 50 +#define DEFAULT_DTMF_TX_OFF_TIME 50 + +#define SAMPLES_PER_CHUNK 160 + +#define ALL_POSSIBLE_DIGITS "123A456B789C*0#D" + +#define MITEL_DIR "../test-data/mitel/" +#define BELLCORE_DIR "../test-data/bellcore/" + +const char *bellcore_files[] = +{ + MITEL_DIR "mitel-cm7291-talkoff.wav", + BELLCORE_DIR "tr-tsy-00763-1.wav", + BELLCORE_DIR "tr-tsy-00763-2.wav", + BELLCORE_DIR "tr-tsy-00763-3.wav", + BELLCORE_DIR "tr-tsy-00763-4.wav", + BELLCORE_DIR "tr-tsy-00763-5.wav", + BELLCORE_DIR "tr-tsy-00763-6.wav", + "" +}; + +static tone_gen_descriptor_t my_dtmf_digit_tones[16]; + +float dtmf_row[] = +{ + 697.0f, 770.0f, 852.0f, 941.0f +}; +float dtmf_col[] = +{ + 1209.0f, 1336.0f, 1477.0f, 1633.0f +}; + +char dtmf_positions[] = "123A" "456B" "789C" "*0#D"; + +int callback_hit; +int callback_ok; +int callback_roll; +int step; + +int use_dialtone_filter = FALSE; + +char *decode_test_file = NULL; + +static int16_t amp[1000000]; +static int16_t amp2[1000000]; + +codec_munge_state_t *munge = NULL; + +static void my_dtmf_gen_init(float low_fudge, + int low_level, + float high_fudge, + int high_level, + int duration, + int gap) +{ + int row; + int col; + + for (row = 0; row < 4; row++) + { + for (col = 0; col < 4; col++) + { + make_tone_gen_descriptor(&my_dtmf_digit_tones[row*4 + col], + dtmf_row[row]*(1.0f + low_fudge), + low_level, + dtmf_col[col]*(1.0f + high_fudge), + high_level, + duration, + gap, + 0, + 0, + FALSE); + } + } +} +/*- End of function --------------------------------------------------------*/ + +static int my_dtmf_generate(int16_t amp[], const char *digits) +{ + int len; + char *cp; + tone_gen_state_t tone; + + len = 0; + while (*digits) + { + cp = strchr(dtmf_positions, *digits); + if (cp) + { + tone_gen_init(&tone, &my_dtmf_digit_tones[cp - dtmf_positions]); + len += tone_gen(&tone, amp + len, 1000); + } + digits++; + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +static void digit_delivery(void *data, const char *digits, int len) +{ + int i; + int seg; + const char *s = ALL_POSSIBLE_DIGITS; + const char *t; + + callback_hit = TRUE; + if (data == (void *) 0x12345678) + { + t = s + callback_roll; + seg = 16 - callback_roll; + for (i = 0; i < len; i += seg, seg = 16) + { + if (i + seg > len) + seg = len - i; + if (memcmp(digits + i, t, seg)) + { + callback_ok = FALSE; + printf("Fail at %d %d\n", i, seg); + break; + } + t = s; + callback_roll = (callback_roll + seg)%16; + } + } + else + { + callback_ok = FALSE; + } +} +/*- End of function --------------------------------------------------------*/ + +static void digit_status(void *data, int signal, int level, int delay) +{ + const char *s = ALL_POSSIBLE_DIGITS; + int len; + static int last_step = 0; + static int first = TRUE; + + callback_hit = TRUE; + len = step - last_step; + if (data == (void *) 0x12345678) + { + if (len < 320 || len > 480) + { + if (first) + { + /* At the beginning the apparent duration is expected to be wrong */ + first = FALSE; + } + else + { + printf("Failed for signal %s length %d at %d\n", (callback_roll & 1) ? "on" : "off", len, step); + callback_ok = FALSE; + } + } + if (callback_roll & 1) + { + if (signal != 0) + { + printf("Failed for signal 0x%X instead of 0\n", signal); + callback_ok = FALSE; + } + } + else + { + if (signal != s[callback_roll >> 1]) + { + printf("Failed for signal 0x%X instead of 0x%X\n", signal, s[callback_roll >> 1]); + callback_ok = FALSE; + } + if (level < DEFAULT_DTMF_TX_LEVEL + 3 - 1 || level > DEFAULT_DTMF_TX_LEVEL + 3 + 1) + { + printf("Failed for level %d instead of %d\n", level, DEFAULT_DTMF_TX_LEVEL + 3); + callback_ok = FALSE; + } + } + if (++callback_roll >= 32) + callback_roll = 0; + } + else + { + callback_ok = FALSE; + } + last_step = step; +} +/*- End of function --------------------------------------------------------*/ + +static void mitel_cm7291_side_1_tests(void) +{ + int i; + int j; + int len; + int sample; + const char *s; + char digit[2]; + char buf[128 + 1]; + int actual; + int nplus; + int nminus; + float rrb; + float rcfo; + dtmf_rx_state_t *dtmf_state; + awgn_state_t noise_source; + + dtmf_state = dtmf_rx_init(NULL, NULL, NULL); + if (use_dialtone_filter) + dtmf_rx_parms(dtmf_state, TRUE, -1, -1, -99); + + /* Test 1: Mitel's test 1 isn't really a test. Its a calibration step, + which has no meaning here. */ + printf("Test 1: Calibration\n"); + printf(" Passed\n"); + + /* Test 2: Decode check + This is a sanity check, that all digits are reliably detected + under ideal conditions. Each possible digit repeated 10 times, + with 50ms bursts. The level of each tone is about 6dB down from clip. + 6dB down actually causes trouble with G.726, so we use 7dB down. */ + printf("Test 2: Decode check\n"); + my_dtmf_gen_init(0.0f, -4, 0.0f, -4, 50, 50); + s = ALL_POSSIBLE_DIGITS; + digit[1] = '\0'; + while (*s) + { + digit[0] = *s++; + for (i = 0; i < 10; i++) + { + len = my_dtmf_generate(amp, digit); + codec_munge(munge, amp, len); + dtmf_rx(dtmf_state, amp, len); + + actual = dtmf_rx_get(dtmf_state, buf, 128); + + if (actual != 1 || buf[0] != digit[0]) + { + printf(" Sent '%s'\n", digit); + printf(" Received '%s'\n", buf); + printf(" Failed\n"); + exit(2); + } + } + } + printf(" Passed\n"); + + /* Test 3: Recognition bandwidth and channel centre frequency check. + Use only the diagonal pairs of tones (digits 1, 5, 9 and D). Each + tone pair requires four test to complete the check, making 16 + sections overall. Each section contains 40 pulses of + 50ms duration, with an amplitude of -20dB from clip per + frequency. + + Four sections covering the tests for one tone (1 digit) are: + a. H frequency at 0% deviation from center, L frequency at +0.1%. + L frequency is then increments in +01.% steps up to +4%. The + number of tone bursts is noted and designated N+. + b. H frequency at 0% deviation, L frequency at -0.1%. L frequency + is then incremental in -0.1% steps, up to -4%. The number of + tone bursts is noted and designated N-. + c. The test in (a) is repeated with the L frequency at 0% and the + H frequency varied up to +4%. + d. The test in (b) is repeated with the L frequency and 0% and the + H frequency varied to -4%. + + Receiver Recognition Bandwidth (RRB) is calculated as follows: + RRB% = (N+ + N-)/10 + Receiver Center Frequency Offset (RCFO) is calculated as follows: + RCFO% = X + (N+ - N-)/20 + + Note that this test doesn't test what it says it is testing at all, + and the results are quite inaccurate, if not a downright lie! However, + it follows the Mitel procedure, so how can it be bad? :) + */ + printf("Test 3: Recognition bandwidth and channel centre frequency check\n"); + s = "159D"; + digit[1] = '\0'; + while (*s) + { + digit[0] = *s++; + for (nplus = 0, i = 1; i <= 60; i++) + { + my_dtmf_gen_init((float) i/1000.0f, -17, 0.0f, -17, 50, 50); + len = my_dtmf_generate(amp, digit); + codec_munge(munge, amp, len); + dtmf_rx(dtmf_state, amp, len); + nplus += dtmf_rx_get(dtmf_state, buf, 128); + } + for (nminus = 0, i = -1; i >= -60; i--) + { + my_dtmf_gen_init((float) i/1000.0f, -17, 0.0f, -17, 50, 50); + len = my_dtmf_generate(amp, digit); + codec_munge(munge, amp, len); + dtmf_rx(dtmf_state, amp, len); + nminus += dtmf_rx_get(dtmf_state, buf, 128); + } + rrb = (float) (nplus + nminus)/10.0f; + rcfo = (float) (nplus - nminus)/10.0f; + printf(" %c (low) rrb = %5.2f%%, rcfo = %5.2f%%, max -ve = %5.2f, max +ve = %5.2f\n", + digit[0], + rrb, + rcfo, + (float) nminus/10.0f, + (float) nplus/10.0f); + if (rrb < 3.0f + rcfo || rrb >= 15.0f + rcfo) + { + printf(" Failed\n"); + exit(2); + } + + for (nplus = 0, i = 1; i <= 60; i++) + { + my_dtmf_gen_init(0.0f, -17, (float) i/1000.0f, -17, 50, 50); + len = my_dtmf_generate(amp, digit); + codec_munge(munge, amp, len); + dtmf_rx(dtmf_state, amp, len); + nplus += dtmf_rx_get(dtmf_state, buf, 128); + } + for (nminus = 0, i = -1; i >= -60; i--) + { + my_dtmf_gen_init(0.0f, -17, (float) i/1000.0f, -17, 50, 50); + len = my_dtmf_generate(amp, digit); + codec_munge(munge, amp, len); + dtmf_rx(dtmf_state, amp, len); + nminus += dtmf_rx_get(dtmf_state, buf, 128); + } + rrb = (float) (nplus + nminus)/10.0f; + rcfo = (float) (nplus - nminus)/10.0f; + printf(" %c (high) rrb = %5.2f%%, rcfo = %5.2f%%, max -ve = %5.2f, max +ve = %5.2f\n", + digit[0], + rrb, + rcfo, + (float) nminus/10.0f, + (float) nplus/10.0f); + if (rrb < 3.0f + rcfo || rrb >= 15.0f + rcfo) + { + printf(" Failed\n"); + exit(2); + } + } + printf(" Passed\n"); + + /* Test 4: Acceptable amplitude ratio (twist). + Use only the diagonal pairs of tones (digits 1, 5, 9 and D). + There are eight sections to the test. Each section contains 200 + pulses with a 50ms duration for each pulse. Initially the amplitude + of both tones is 6dB down from clip. The two sections to test one + tone pair are: + + a. Standard Twist: H tone amplitude is maintained at -6dB from clip, + L tone amplitude is attenuated gradually until the amplitude ratio + L/H is -20dB. Note the number of responses from the receiver. + b. Reverse Twist: L tone amplitude is maintained at -6dB from clip, + H tone amplitude is attenuated gradually until the amplitude ratio + is 20dB. Note the number of responses from the receiver. + + All tone bursts are of 50ms duration. + + The Acceptable Amplitude Ratio in dB is equal to the number of + responses registered in (a) or (b), divided by 10. + + TODO: This is supposed to work in 1/10dB steps, but here I used 1dB + steps, as the current tone generator has its amplitude set in + 1dB steps. + */ + printf("Test 4: Acceptable amplitude ratio (twist)\n"); + s = "159D"; + digit[1] = '\0'; + while (*s) + { + digit[0] = *s++; + for (nplus = 0, i = -30; i >= -230; i--) + { + my_dtmf_gen_init(0.0f, -3, 0.0f, i/10, 50, 50); + + len = my_dtmf_generate(amp, digit); + codec_munge(munge, amp, len); + dtmf_rx(dtmf_state, amp, len); + nplus += dtmf_rx_get(dtmf_state, buf, 128); + } + printf(" %c normal twist = %.2fdB\n", digit[0], (float) nplus/10.0); + if (nplus < 80) + { + printf(" Failed\n"); + exit(2); + } + for (nminus = 0, i = -30; i >= -230; i--) + { + my_dtmf_gen_init(0.0f, i/10, 0.0f, -3, 50, 50); + + len = my_dtmf_generate(amp, digit); + codec_munge(munge, amp, len); + dtmf_rx(dtmf_state, amp, len); + nminus += dtmf_rx_get(dtmf_state, buf, 128); + } + printf(" %c reverse twist = %.2fdB\n", digit[0], (float) nminus/10.0); + if (nminus < 40) + { + printf(" Failed\n"); + exit(2); + } + } + printf(" Passed\n"); + + /* Test 5: Dynamic range + This test utilizes tone pair L1 H1 (digit 1). Thirty-five tone pair + pulses are transmitted, with both frequencies stating at -6dB from + clip. The amplitude of each is gradually attenuated by -35dB at a + rate of 1dB per pulse. The Dynamic Range in dB is equal to the + number of responses from the receiver during the test. + + Well not really, but that is the Mitel test. Lets sweep a bit further, + and see what the real range is */ + printf("Test 5: Dynamic range\n"); + for (nplus = 0, i = +3; i >= -50; i--) + { + my_dtmf_gen_init(0.0f, i, 0.0f, i, 50, 50); + + len = my_dtmf_generate(amp, "1"); + codec_munge(munge, amp, len); + dtmf_rx(dtmf_state, amp, len); + nplus += dtmf_rx_get(dtmf_state, buf, 128); + } + printf(" Dynamic range = %ddB\n", nplus); + /* We ought to set some pass/fail condition, even if Mitel did not. If + we don't, regression testing is weakened. */ + if (nplus < 35) + { + printf(" Failed\n"); + exit(2); + } + printf(" Passed\n"); + + /* Test 6: Guard time + This test utilizes tone pair L1 H1 (digit 1). Four hundred pulses + are transmitted at an amplitude of -6dB from clip per frequency. + Pulse duration starts at 49ms and is gradually reduced to 10ms. + Guard time in ms is equal to (500 - number of responses)/10. + + That is the Mitel test, and we will follow it. Its totally bogus, + though. Just what the heck is a pass or fail here? */ + + printf("Test 6: Guard time\n"); + for (nplus = 0, i = 490; i >= 100; i--) + { + my_dtmf_gen_init(0.0f, -3, 0.0f, -3, i/10, 50); + + len = my_dtmf_generate(amp, "1"); + codec_munge(munge, amp, len); + dtmf_rx(dtmf_state, amp, len); + nplus += dtmf_rx_get(dtmf_state, buf, 128); + } + printf(" Guard time = %dms\n", (500 - nplus)/10); + printf(" Passed\n"); + + /* Test 7: Acceptable signal to noise ratio + This test utilizes tone pair L1 H1, transmitted on a noise background. + The test consists of three sections in which the tone pair is + transmitted 1000 times at an amplitude -6dB from clip per frequency, + but with a different white noise level for each section. The first + level is -24dBV, the second -18dBV and the third -12dBV.. The + acceptable signal to noise ratio is the lowest ratio of signal + to noise in the test where the receiver responds to all 1000 pulses. + + Well, that is the Mitel test, but it doesn't tell you what the + decoder can really do. Lets do a more comprehensive test */ + + printf("Test 7: Acceptable signal to noise ratio\n"); + my_dtmf_gen_init(0.0f, -4, 0.0f, -4, 50, 50); + + for (j = -13; j > -50; j--) + { + awgn_init_dbm0(&noise_source, 1234567, (float) j); + for (i = 0; i < 1000; i++) + { + len = my_dtmf_generate(amp, "1"); + + // TODO: Clip + for (sample = 0; sample < len; sample++) + amp[sample] = saturate(amp[sample] + awgn(&noise_source)); + + codec_munge(munge, amp, len); + dtmf_rx(dtmf_state, amp, len); + + if (dtmf_rx_get(dtmf_state, buf, 128) != 1) + break; + } + if (i == 1000) + break; + } + printf(" Acceptable S/N ratio is %ddB\n", -4 - j); + if (-4 - j > 26) + { + printf(" Failed\n"); + exit(2); + } + printf(" Passed\n"); +} +/*- End of function --------------------------------------------------------*/ + +static void mitel_cm7291_side_2_and_bellcore_tests(void) +{ + int i; + int j; + int len; + int hits; + int hit_types[256]; + char buf[128 + 1]; + SNDFILE *inhandle; + int frames; + dtmf_rx_state_t *dtmf_state; + + dtmf_state = dtmf_rx_init(NULL, NULL, NULL); + if (use_dialtone_filter) + dtmf_rx_parms(dtmf_state, TRUE, -1, -1, -99); + + /* The remainder of the Mitel tape is the talk-off test */ + /* Here we use the Bellcore test tapes (much tougher), in six + files - 1 from each side of the original 3 cassette tapes */ + /* Bellcore say you should get no more than 470 false detections with + a good receiver. Dialogic claim 20. Of course, we can do better than + that, eh? */ + printf("Test 8: Talk-off test\n"); + memset(hit_types, '\0', sizeof(hit_types)); + for (j = 0; bellcore_files[j][0]; j++) + { + if ((inhandle = sf_open_telephony_read(bellcore_files[j], 1)) == NULL) + { + printf(" Cannot open speech file '%s'\n", bellcore_files[j]); + exit(2); + } + hits = 0; + while ((frames = sf_readf_short(inhandle, amp, SAMPLE_RATE))) + { + dtmf_rx(dtmf_state, amp, frames); + len = dtmf_rx_get(dtmf_state, buf, 128); + if (len > 0) + { + for (i = 0; i < len; i++) + hit_types[(int) buf[i]]++; + hits += len; + } + } + if (sf_close(inhandle) != 0) + { + printf(" Cannot close speech file '%s'\n", bellcore_files[j]); + exit(2); + } + printf(" File %d gave %d false hits.\n", j + 1, hits); + } + for (i = 0, j = 0; i < 256; i++) + { + if (hit_types[i]) + { + printf(" Digit %c had %d false hits\n", i, hit_types[i]); + j += hit_types[i]; + } + } + printf(" %d hits in total\n", j); + if (j > 470) + { + printf(" Failed\n"); + exit(2); + } + printf(" Passed\n"); +} +/*- End of function --------------------------------------------------------*/ + +static void dial_tone_tolerance_tests(void) +{ + int i; + int j; + int len; + int sample; + char buf[128 + 1]; + dtmf_rx_state_t *dtmf_state; + tone_gen_descriptor_t dial_tone_desc; + tone_gen_state_t dial_tone; + + dtmf_state = dtmf_rx_init(NULL, NULL, NULL); + if (use_dialtone_filter) + dtmf_rx_parms(dtmf_state, TRUE, -1, -1, -99); + + /* Test dial tone tolerance */ + printf("Test: Dial tone tolerance.\n"); + my_dtmf_gen_init(0.0f, -15, 0.0f, -15, DEFAULT_DTMF_TX_ON_TIME, DEFAULT_DTMF_TX_OFF_TIME); + + for (j = -30; j < -3; j++) + { + make_tone_gen_descriptor(&dial_tone_desc, 350, j, 440, j, 1, 0, 0, 0, TRUE); + tone_gen_init(&dial_tone, &dial_tone_desc); + for (i = 0; i < 10; i++) + { + len = my_dtmf_generate(amp, ALL_POSSIBLE_DIGITS); + tone_gen(&dial_tone, amp2, len); + + for (sample = 0; sample < len; sample++) + amp[sample] = saturate(amp[sample] + amp2[sample]); + codec_munge(munge, amp, len); + dtmf_rx(dtmf_state, amp, len); + + if (dtmf_rx_get(dtmf_state, buf, 128) != strlen(ALL_POSSIBLE_DIGITS)) + break; + } + if (i != 10) + break; + } + printf(" Acceptable signal to dial tone ratio is %ddB\n", -15 - j); + if ((use_dialtone_filter && (-15 - j) > -12) + || + (!use_dialtone_filter && (-15 - j) > 10)) + { + printf(" Failed\n"); + exit(2); + } + printf(" Passed\n"); +} +/*- End of function --------------------------------------------------------*/ + +static void callback_function_tests(void) +{ + int i; + int j; + int len; + int sample; + dtmf_rx_state_t *dtmf_state; + + /* Test the callback mode for delivering detected digits */ + printf("Test: Callback digit delivery mode.\n"); + callback_hit = FALSE; + callback_ok = TRUE; + callback_roll = 0; + dtmf_state = dtmf_rx_init(NULL, digit_delivery, (void *) 0x12345678); + if (use_dialtone_filter) + dtmf_rx_parms(dtmf_state, TRUE, -1, -1, -99); + my_dtmf_gen_init(0.0f, DEFAULT_DTMF_TX_LEVEL, 0.0f, DEFAULT_DTMF_TX_LEVEL, DEFAULT_DTMF_TX_ON_TIME, DEFAULT_DTMF_TX_OFF_TIME); + for (i = 1; i < 10; i++) + { + len = 0; + for (j = 0; j < i; j++) + len += my_dtmf_generate(amp + len, ALL_POSSIBLE_DIGITS); + dtmf_rx(dtmf_state, amp, len); + if (!callback_hit || !callback_ok) + break; + } + if (!callback_hit || !callback_ok) + { + printf(" Failed\n"); + exit(2); + } + printf(" Passed\n"); + + /* Test the realtime callback mode for reporting detected digits */ + printf("Test: Realtime callback digit delivery mode.\n"); + callback_hit = FALSE; + callback_ok = TRUE; + callback_roll = 0; + dtmf_rx_init(dtmf_state, NULL, NULL); + dtmf_rx_set_realtime_callback(dtmf_state, digit_status, (void *) 0x12345678); + if (use_dialtone_filter) + dtmf_rx_parms(dtmf_state, TRUE, -1, -1, -99); + my_dtmf_gen_init(0.0f, DEFAULT_DTMF_TX_LEVEL, 0.0f, DEFAULT_DTMF_TX_LEVEL, DEFAULT_DTMF_TX_ON_TIME, DEFAULT_DTMF_TX_OFF_TIME); + step = 0; + for (i = 1; i < 10; i++) + { + len = 0; + for (j = 0; j < i; j++) + len += my_dtmf_generate(amp + len, ALL_POSSIBLE_DIGITS); + for (sample = 0, j = SAMPLES_PER_CHUNK; sample < len; sample += SAMPLES_PER_CHUNK, j = ((len - sample) >= SAMPLES_PER_CHUNK) ? SAMPLES_PER_CHUNK : (len - sample)) + { + dtmf_rx(dtmf_state, &[sample], j); + if (!callback_ok) + break; + step += j; + } + if (!callback_hit || !callback_ok) + break; + } + if (!callback_hit || !callback_ok) + { + printf(" Failed\n"); + exit(2); + } +} +/*- End of function --------------------------------------------------------*/ + +static void decode_test(const char *test_file) +{ + int16_t amp[SAMPLES_PER_CHUNK]; + SNDFILE *inhandle; + dtmf_rx_state_t *dtmf_state; + char buf[128 + 1]; + int actual; + int samples; + int total; + + dtmf_state = dtmf_rx_init(NULL, NULL, NULL); + if (use_dialtone_filter) + dtmf_rx_parms(dtmf_state, TRUE, -1, -1, -99); + + /* We will decode the audio from a file. */ + + if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", decode_test_file); + exit(2); + } + + total = 0; + while ((samples = sf_readf_short(inhandle, amp, SAMPLES_PER_CHUNK)) > 0) + { + codec_munge(munge, amp, samples); + dtmf_rx(dtmf_state, amp, samples); + //printf("Status 0x%X\n", dtmf_rx_status(dtmf_state)); + if ((actual = dtmf_rx_get(dtmf_state, buf, 128)) > 0) + printf("Received '%s'\n", buf); + total += actual; + } + printf("%d digits received\n", total); +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int duration; + time_t now; + int channel_codec; + int opt; + + use_dialtone_filter = FALSE; + channel_codec = MUNGE_CODEC_NONE; + decode_test_file = NULL; + while ((opt = getopt(argc, argv, "c:d:f")) != -1) + { + switch (opt) + { + case 'c': + channel_codec = atoi(optarg); + break; + case 'd': + decode_test_file = optarg; + break; + case 'f': + use_dialtone_filter = TRUE; + break; + default: + //usage(); + exit(2); + break; + } + } + munge = codec_munge_init(channel_codec, 0); + + if (decode_test_file) + { + decode_test(decode_test_file); + } + else + { + time(&now); + mitel_cm7291_side_1_tests(); + mitel_cm7291_side_2_and_bellcore_tests(); + dial_tone_tolerance_tests(); + callback_function_tests(); + printf(" Passed\n"); + duration = time(NULL) - now; + printf("Tests passed in %ds\n", duration); + } + + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/dtmf_tx_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/dtmf_tx_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,229 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * dtmf_tx_tests.c - Test the DTMF generator. + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: dtmf_tx_tests.c,v 1.23 2009/05/30 15:23:13 steveu Exp $ + */ + +/*! \file */ + +/*! \page dtmf_tx_tests_page DTMF generation tests +\section dtmf_tx_tests_page_sec_1 What does it do? +???. + +\section dtmf_tx_tests_page_sec_2 How does it work? +???. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define OUTPUT_FILE_NAME "dtmf.wav" + +int main(int argc, char *argv[]) +{ + dtmf_tx_state_t *gen; + int16_t amp[16384]; + int len; + SNDFILE *outhandle; + int outframes; + int add_digits; + + if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + + gen = dtmf_tx_init(NULL); + len = dtmf_tx(gen, amp, 16384); + printf("Generated %d samples\n", len); + outframes = sf_writef_short(outhandle, amp, len); + if (dtmf_tx_put(gen, "123", -1)) + { + printf("Ooops\n"); + exit(2); + } + len = dtmf_tx(gen, amp, 16384); + printf("Generated %d samples\n", len); + outframes = sf_writef_short(outhandle, amp, len); + if (dtmf_tx_put(gen, "456", -1)) + { + printf("Ooops\n"); + exit(2); + } + len = dtmf_tx(gen, amp, 160); + printf("Generated %d samples\n", len); + outframes = sf_writef_short(outhandle, amp, len); + if (dtmf_tx_put(gen, "789", -1)) + { + printf("Ooops\n"); + exit(2); + } + len = dtmf_tx(gen, amp, 160); + printf("Generated %d samples\n", len); + outframes = sf_writef_short(outhandle, amp, len); + if (dtmf_tx_put(gen, "*#", -1)) + { + printf("Ooops\n"); + exit(2); + } + len = dtmf_tx(gen, amp, 160); + printf("Generated %d samples\n", len); + outframes = sf_writef_short(outhandle, amp, len); + add_digits = 1; + do + { + len = dtmf_tx(gen, amp, 160); + printf("Generated %d samples\n", len); + if (len > 0) + { + outframes = sf_writef_short(outhandle, amp, len); + } + if (add_digits) + { + if (dtmf_tx_put(gen, "1234567890", -1)) + { + printf("Digit buffer full\n"); + add_digits = 0; + } + } + } + while (len > 0); + + dtmf_tx_init(gen); + len = dtmf_tx(gen, amp, 16384); + printf("Generated %d samples\n", len); + outframes = sf_writef_short(outhandle, amp, len); + if (dtmf_tx_put(gen, "123", -1)) + { + printf("Ooops\n"); + exit(2); + } + len = dtmf_tx(gen, amp, 16384); + printf("Generated %d samples\n", len); + outframes = sf_writef_short(outhandle, amp, len); + if (dtmf_tx_put(gen, "456", -1)) + { + printf("Ooops\n"); + exit(2); + } + len = dtmf_tx(gen, amp, 160); + printf("Generated %d samples\n", len); + outframes = sf_writef_short(outhandle, amp, len); + if (dtmf_tx_put(gen, "789", -1)) + { + printf("Ooops\n"); + exit(2); + } + len = dtmf_tx(gen, amp, 160); + printf("Generated %d samples\n", len); + outframes = sf_writef_short(outhandle, amp, len); + if (dtmf_tx_put(gen, "0*#", -1)) + { + printf("Ooops\n"); + exit(2); + } + len = dtmf_tx(gen, amp, 160); + printf("Generated %d samples\n", len); + outframes = sf_writef_short(outhandle, amp, len); + if (dtmf_tx_put(gen, "ABCD", -1)) + { + printf("Ooops\n"); + exit(2); + } + len = dtmf_tx(gen, amp, 160); + printf("Generated %d samples\n", len); + outframes = sf_writef_short(outhandle, amp, len); + + /* Try modifying the level and length of the digits */ + printf("Try different levels and timing\n"); + dtmf_tx_set_level(gen, -20, 5); + dtmf_tx_set_timing(gen, 100, 200); + if (dtmf_tx_put(gen, "123", -1)) + { + printf("Ooops\n"); + exit(2); + } + do + { + len = dtmf_tx(gen, amp, 160); + printf("Generated %d samples\n", len); + if (len > 0) + outframes = sf_writef_short(outhandle, amp, len); + } + while (len > 0); + printf("Restore normal levels and timing\n"); + dtmf_tx_set_level(gen, -10, 0); + dtmf_tx_set_timing(gen, 50, 55); + if (dtmf_tx_put(gen, "A", -1)) + { + printf("Ooops\n"); + exit(2); + } + + add_digits = TRUE; + do + { + len = dtmf_tx(gen, amp, 160); + printf("Generated %d samples\n", len); + if (len > 0) + { + outframes = sf_writef_short(outhandle, amp, len); + } + if (add_digits) + { + if (dtmf_tx_put(gen, "1234567890", -1)) + { + printf("Digit buffer full\n"); + add_digits = FALSE; + } + } + } + while (len > 0); + + if (sf_close(outhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/echo_monitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/echo_monitor.cpp Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,459 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * echo_monitor.cpp - Display echo canceller status, using the FLTK toolkit. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: echo_monitor.cpp,v 1.13 2008/09/08 16:10:41 steveu Exp $ + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#if defined(HAVE_FL_FL_H) && defined(HAVE_FL_FL_CARTESIAN_H) + +#define __STDC_LIMIT_MACROS + +#include +#include +#include +#include +#include +#include +#include +#if defined(HAVE_FFTW3_H) +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include + +#include "spandsp.h" +#include "echo_monitor.h" + +struct line_model_monitor_s +{ + Fl_Double_Window *w; + + Fl_Audio_Meter *audio_meter; + Fl_Group *c_spec; + Fl_Group *c_right; + Fl_Group *c_can; + Fl_Group *c_line_model; + + Ca_Canvas *canvas_spec; + Ca_X_Axis *spec_freq; + Ca_Y_Axis *spec_amp; + Ca_Line *spec_re; + double spec_re_plot[2*512]; + + Ca_Canvas *canvas_can; + Ca_X_Axis *can_x; + Ca_Y_Axis *can_y; + Ca_Line *can_re; + double can_re_plot[512]; + + Ca_Canvas *canvas_line_model; + Ca_X_Axis *line_model_x; + Ca_Y_Axis *line_model_y; + Ca_Line *line_model_re; + double line_model_re_plot[512]; + + int in_ptr; +#if defined(HAVE_FFTW3_H) + double in[1024][2]; + double out[1024][2]; +#else + fftw_complex in[1024]; + fftw_complex out[1024]; +#endif + fftw_plan p; +}; + + +static int skip = 0; +static struct line_model_monitor_s echo; +static struct line_model_monitor_s *s = &echo; + +int echo_can_monitor_can_update(const int16_t *coeffs, int len) +{ + int i; + float min; + float max; + + if (s->can_re) + delete s->can_re; + + s->canvas_can->current(s->canvas_can); + i = 0; + min = coeffs[i]; + max = coeffs[i]; + for (i = 0; i < len; i++) + { + s->can_re_plot[2*i] = i; + s->can_re_plot[2*i + 1] = coeffs[i]; + if (min > coeffs[i]) + min = coeffs[i]; + if (max < coeffs[i]) + max = coeffs[i]; + } + s->can_y->maximum((max == min) ? max + 0.2 : max); + s->can_y->minimum(min); + s->can_re = new Ca_Line(len, s->can_re_plot, 0, 0, FL_BLUE, CA_NO_POINT); + if (++skip >= 100) + { + skip = 0; + Fl::check(); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int echo_can_monitor_line_model_update(const int32_t *coeffs, int len) +{ + int i; + float min; + float max; + + if (s->line_model_re) + delete s->line_model_re; + + s->canvas_line_model->current(s->canvas_line_model); + i = 0; + min = coeffs[i]; + max = coeffs[i]; + for (i = 0; i < len; i++) + { + s->line_model_re_plot[2*i] = i; + s->line_model_re_plot[2*i + 1] = coeffs[i]; + if (min > coeffs[i]) + min = coeffs[i]; + if (max < coeffs[i]) + max = coeffs[i]; + } + s->line_model_y->maximum((max == min) ? max + 0.2 : max); + s->line_model_y->minimum(min); + s->line_model_re = new Ca_Line(len, s->line_model_re_plot, 0, 0, FL_BLUE, CA_NO_POINT); + if (++skip >= 100) + { + skip = 0; + Fl::check(); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int echo_can_monitor_line_spectrum_update(const int16_t amp[], int len) +{ + int i; + int x; + + for (i = 0; i < len; i++) + s->audio_meter->sample(amp[i]/32768.0); + + if (s->in_ptr + len < 512) + { + /* Just add this fragment to the buffer. */ + for (i = 0; i < len; i++) +#if defined(HAVE_FFTW3_H) + s->in[s->in_ptr + i][0] = amp[i]; +#else + s->in[s->in_ptr + i].re = amp[i]; +#endif + s->in_ptr += len; + return 0; + } + if (len >= 512) + { + /* We have enough for a whole block. Use the last 512 samples + we have. */ + x = len - 512; + for (i = 0; i < 512; i++) +#if defined(HAVE_FFTW3_H) + s->in[i][0] = amp[x + i]; +#else + s->in[i].re = amp[x + i]; +#endif + } + else + { + /* We want the last 512 samples. */ + x = 512 - len; + for (i = 0; i < x; i++) +#if defined(HAVE_FFTW3_H) + s->in[i][0] = s->in[s->in_ptr - x + i][0]; +#else + s->in[i].re = s->in[s->in_ptr - x + i].re; +#endif + for (i = x; i < 512; i++) +#if defined(HAVE_FFTW3_H) + s->in[i][0] = amp[i - x]; +#else + s->in[i].re = amp[i - x]; +#endif + } + s->in_ptr = 0; +#if defined(HAVE_FFTW3_H) + fftw_execute(s->p); +#else + fftw_one(s->p, s->in, s->out); +#endif + if (s->spec_re) + delete s->spec_re; + s->canvas_spec->current(s->canvas_spec); + for (i = 0; i < 512; i++) + { + s->spec_re_plot[2*i] = i*4000.0/512.0; +#if defined(HAVE_FFTW3_H) + s->spec_re_plot[2*i + 1] = 20.0*log10(sqrt(s->out[i][0]*s->out[i][0] + s->out[i][1]*s->out[i][1])/(256.0*32768)) + 3.14; +#else + s->spec_re_plot[2*i + 1] = 20.0*log10(sqrt(s->out[i].re*s->out[i].re + s->out[i].im*s->out[i].im)/(256.0*32768)) + 3.14; +#endif + } + s->spec_re = new Ca_Line(512, s->spec_re_plot, 0, 0, FL_BLUE, CA_NO_POINT); + Fl::check(); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int start_echo_can_monitor(int len) +{ + char buf[132 + 1]; + float x; + float y; + int i; + + s->w = new Fl_Double_Window(850, 400, "Echo canceller monitor"); + + s->c_spec = new Fl_Group(0, 0, 380, 400); + s->c_spec->box(FL_DOWN_BOX); + s->c_spec->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE); + + s->canvas_spec = new Ca_Canvas(60, 30, 300, 300, "Spectrum"); + s->canvas_spec->box(FL_PLASTIC_DOWN_BOX); + s->canvas_spec->color(7); + s->canvas_spec->align(FL_ALIGN_TOP); + s->canvas_spec->border(15); + + s->spec_freq = new Ca_X_Axis(65, 330, 290, 30, "Freq (Hz)"); + s->spec_freq->align(FL_ALIGN_BOTTOM); + s->spec_freq->minimum(0); + s->spec_freq->maximum(4000); + s->spec_freq->label_format("%g"); + s->spec_freq->minor_grid_color(fl_gray_ramp(20)); + s->spec_freq->major_grid_color(fl_gray_ramp(15)); + s->spec_freq->label_grid_color(fl_gray_ramp(10)); + s->spec_freq->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->spec_freq->minor_grid_style(FL_DOT); + s->spec_freq->major_step(5); + s->spec_freq->label_step(1); + s->spec_freq->axis_color(FL_BLACK); + s->spec_freq->axis_align(CA_BOTTOM | CA_LINE); + + s->spec_amp = new Ca_Y_Axis(20, 35, 40, 290, "Amp (dBmO)"); + s->spec_amp->align(FL_ALIGN_LEFT); + s->spec_amp->minimum(-80.0); + s->spec_amp->maximum(10.0); + s->spec_amp->minor_grid_color(fl_gray_ramp(20)); + s->spec_amp->major_grid_color(fl_gray_ramp(15)); + s->spec_amp->label_grid_color(fl_gray_ramp(10)); + //s->spec_amp->grid_visible(CA_MINOR_TICK | CA_MAJOR_TICK | CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->spec_amp->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->spec_amp->minor_grid_style(FL_DOT); + s->spec_amp->major_step(5); + s->spec_amp->label_step(1); + s->spec_amp->axis_color(FL_BLACK); + + s->spec_amp->current(); + s->spec_re = NULL; + + s->c_spec->end(); + + s->c_right = new Fl_Group(440, 0, 465, 405); + + s->c_can = new Fl_Group(380, 0, 415, 200); + s->c_can->box(FL_DOWN_BOX); + s->c_can->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE); + s->c_can->current(); + + s->canvas_can = new Ca_Canvas(460, 35, 300, 100, "Canceller coefficients"); + s->canvas_can->box(FL_PLASTIC_DOWN_BOX); + s->canvas_can->color(7); + s->canvas_can->align(FL_ALIGN_TOP); + Fl_Group::current()->resizable(s->canvas_can); + s->canvas_can->border(15); + + s->can_x = new Ca_X_Axis(465, 135, 290, 30, "Tap"); + s->can_x->align(FL_ALIGN_BOTTOM); + s->can_x->minimum(0.0); + s->can_x->maximum((float) len); + s->can_x->label_format("%g"); + s->can_x->minor_grid_color(fl_gray_ramp(20)); + s->can_x->major_grid_color(fl_gray_ramp(15)); + s->can_x->label_grid_color(fl_gray_ramp(10)); + s->can_x->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->can_x->minor_grid_style(FL_DOT); + s->can_x->major_step(5); + s->can_x->label_step(1); + s->can_x->axis_align(CA_BOTTOM | CA_LINE); + s->can_x->axis_color(FL_BLACK); + s->can_x->current(); + + s->can_y = new Ca_Y_Axis(420, 40, 40, 90, "Amp"); + s->can_y->align(FL_ALIGN_LEFT); + s->can_y->minimum(-0.1); + s->can_y->maximum(0.1); + s->can_y->minor_grid_color(fl_gray_ramp(20)); + s->can_y->major_grid_color(fl_gray_ramp(15)); + s->can_y->label_grid_color(fl_gray_ramp(10)); + s->can_y->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->can_y->minor_grid_style(FL_DOT); + s->can_y->major_step(5); + s->can_y->label_step(1); + s->can_y->axis_color(FL_BLACK); + s->can_y->current(); + + s->c_can->end(); + s->can_re = NULL; + + s->c_line_model = new Fl_Group(380, 200, 415, 200); + s->c_line_model->box(FL_DOWN_BOX); + s->c_line_model->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE); + s->c_line_model->current(); + + s->canvas_line_model = new Ca_Canvas(460, 235, 300, 100, "Line impulse response model"); + s->canvas_line_model->box(FL_PLASTIC_DOWN_BOX); + s->canvas_line_model->color(7); + s->canvas_line_model->align(FL_ALIGN_TOP); + Fl_Group::current()->resizable(s->canvas_line_model); + s->canvas_line_model->border(15); + + s->line_model_x = new Ca_X_Axis(465, 335, 290, 30, "Tap"); + s->line_model_x->align(FL_ALIGN_BOTTOM); + s->line_model_x->minimum(0.0); + s->line_model_x->maximum((float) len); + s->line_model_x->label_format("%g"); + s->line_model_x->minor_grid_color(fl_gray_ramp(20)); + s->line_model_x->major_grid_color(fl_gray_ramp(15)); + s->line_model_x->label_grid_color(fl_gray_ramp(10)); + s->line_model_x->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->line_model_x->minor_grid_style(FL_DOT); + s->line_model_x->major_step(5); + s->line_model_x->label_step(1); + s->line_model_x->axis_align(CA_BOTTOM | CA_LINE); + s->line_model_x->axis_color(FL_BLACK); + s->line_model_x->current(); + + s->line_model_y = new Ca_Y_Axis(420, 240, 40, 90, "Amp"); + s->line_model_y->align(FL_ALIGN_LEFT); + s->line_model_y->minimum(-0.1); + s->line_model_y->maximum(0.1); + s->line_model_y->minor_grid_color(fl_gray_ramp(20)); + s->line_model_y->major_grid_color(fl_gray_ramp(15)); + s->line_model_y->label_grid_color(fl_gray_ramp(10)); + s->line_model_y->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->line_model_y->minor_grid_style(FL_DOT); + s->line_model_y->major_step(5); + s->line_model_y->label_step(1); + s->line_model_y->axis_color(FL_BLACK); + s->line_model_y->current(); + + s->c_line_model->end(); + s->line_model_re = NULL; + + s->audio_meter = new Fl_Audio_Meter(810, 40, 10, 250, ""); + s->audio_meter->box(FL_PLASTIC_UP_BOX); + s->audio_meter->type(FL_VERT_AUDIO_METER); + + s->c_right->end(); + + Fl_Group::current()->resizable(s->c_right); + s->w->end(); + s->w->show(); + +#if defined(HAVE_FFTW3_H) + s->p = fftw_plan_dft_1d(1024, s->in, s->out, FFTW_BACKWARD, FFTW_ESTIMATE); + for (i = 0; i < 1024; i++) + { + s->in[i][0] = 0.0; + s->in[i][1] = 0.0; + } +#else + s->p = fftw_create_plan(1024, FFTW_BACKWARD, FFTW_ESTIMATE); + for (i = 0; i < 1024; i++) + { + s->in[i].re = 0.0; + s->in[i].im = 0.0; + } +#endif + s->in_ptr = 0; + + Fl::check(); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +void echo_can_monitor_wait_to_end(void) +{ + fd_set rfds; + int res; + struct timeval tv; + + fprintf(stderr, "Processing complete. Press the key to end\n"); + do + { + usleep(100000); + Fl::check(); + FD_ZERO(&rfds); + FD_SET(0, &rfds); + tv.tv_usec = 100000; + tv.tv_sec = 0; + res = select(1, &rfds, NULL, NULL, &tv); + } + while (res <= 0); +} +/*- End of function --------------------------------------------------------*/ + +void echo_can_monitor_update_display(void) +{ + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); +} +/*- End of function --------------------------------------------------------*/ +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/echo_monitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/echo_monitor.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,62 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * echo_monitor.h - Display echo canceller status, using the FLTK toolkit. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: echo_monitor.h,v 1.12 2008/04/26 13:39:16 steveu Exp $ + */ + +/*! \page echo_monitor_page Echo canceller performance monitoring +\section echo_monitor_page_sec_1 What does it do? +This code controls a GUI window, which provides monitoring of the internal status +of a time domain echo canceller. It shows, graphically: + + - the spectrum of the received signal. + - the line model in use (when a known line model is being used). + - the adapted coefficients of the canceller. + +\section echo_monitor_page_sec_2 How does it work? +This code uses the FLTK cross platform GUI toolkit. It works on X11 and Windows platforms. +In addition to the basic FLTK toolkit, fltk_cartesian is also required. +*/ + +#if !defined(_ECHO_MONITOR_H_) +#define _ECHO_MONITOR_H_ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +int start_echo_can_monitor(int len); +int echo_can_monitor_can_update(const int16_t *coeffs, int len); +int echo_can_monitor_line_model_update(const int32_t *coeffs, int len); +int echo_can_monitor_line_spectrum_update(const int16_t amp[], int len); +void echo_can_monitor_wait_to_end(void); +void echo_can_monitor_update_display(void); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/echo_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/echo_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1732 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * echo_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * Based on a bit from here, a bit from there, eye of toad, + * ear of bat, etc - plus, of course, my own 2 cents. + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: echo_tests.c,v 1.39 2009/05/30 15:23:13 steveu Exp $ + */ + +/*! \page echo_can_tests_page Line echo cancellation for voice tests + +\section echo_can_tests_page_sec_1 What does it do? +The echo cancellation tests test the echo cancellor against the G.168 spec. Not +all the tests in G.168 are fully implemented at this time. + +\section echo_can_tests_page_sec_2 How does it work? + +\section echo_can_tests_page_sec_2 How do I use it? + +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#if defined(HAVE_FL_FL_H) && defined(HAVE_FL_FL_CARTESIAN_H) && defined(HAVE_FL_FL_AUDIO_METER_H) +#define ENABLE_GUI +#endif + +#include +#include +#include +#include +#include +#include +#include + +#define GEN_CONST +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp/g168models.h" +#include "spandsp-sim.h" +#if defined(ENABLE_GUI) +#include "echo_monitor.h" +#endif + +#if !defined(NULL) +#define NULL (void *) 0 +#endif + +#define TEST_EC_TAPS 256 + +#define RESIDUE_FILE_NAME "residue_sound.wav" + +/* + The key signal names, as defined in G.168 + + +--------------+ +------------+ + | | Sin | | +Sgen -->--| Echoey |--->---| Echo |-->-- Sout + | | | | + | World | Rout | Canceller | + --<--| |---<---| |--<-- Rin + | | | | + +--------------+ +------------+ + + Echoey world model. Munge means linear->PCM->linear distortion. + +-------------------------+ + | | Sin +Sgen -->--|-->munge--->sum-->munge--|--->--- + | +--> | + | FIR | Rout + --<--|--------+--------munge<--|---<--- + | | + +-------------------------+ +*/ + +typedef struct +{ + const char *name; + int max; + int cur; + float gain; + SNDFILE *handle; + int16_t signal[SAMPLE_RATE]; +} signal_source_t; + +/* Level measurement device, specified in G.168 section 6.4.1.2.1 */ +typedef struct +{ + int type; + fir_float_state_t *fir; + float history[35*8]; + int pos; + float factor; + float power; + float peak; +} level_measurement_device_t; + +typedef struct +{ + int model_no; + float erl; + fir32_state_t impulse; + float gain; + int munging_codec; +} channel_model_state_t; + +channel_model_state_t chan_model; + +signal_source_t local_css; +signal_source_t far_css; +awgn_state_t local_noise_source; +awgn_state_t far_noise_source; + +SNDFILE *residue_handle; +int16_t residue_sound[SAMPLE_RATE]; +int residue_cur = 0; + +level_measurement_device_t *power_meter_1; +level_measurement_device_t *power_meter_2; + +int line_model_no; +int supp_line_model_no; +int munger; + +level_measurement_device_t *rin_power_meter; /* Also known as Lrin */ +level_measurement_device_t *rout_power_meter; +level_measurement_device_t *sin_power_meter; +level_measurement_device_t *sout_power_meter; /* Also known as Lret (pre NLP value is known as Lres) */ +level_measurement_device_t *sgen_power_meter; + +#define RESULT_CHANNELS 7 +SNDFILE *result_handle; +int16_t result_sound[SAMPLE_RATE*RESULT_CHANNELS]; +int result_cur; + +const char *test_name; +int quiet; +int use_gui; + +float erl; + +/* Dump estimated echo response */ +static void dump_ec_state(echo_can_state_t *ctx) +{ + int i; + FILE *f; + + if ((f = fopen("echo_tests_state.txt", "wt")) == NULL) + return; + for (i = 0; i < TEST_EC_TAPS; i++) + fprintf(f, "%f\n", (float) ctx->fir_taps16[0][i]/(1 << 15)); + fclose(f); +} +/*- End of function --------------------------------------------------------*/ + +static inline void put_residue(int16_t amp) +{ + int outframes; + + residue_sound[residue_cur++] = amp; + if (residue_cur >= SAMPLE_RATE) + { + outframes = sf_writef_short(residue_handle, residue_sound, residue_cur); + if (outframes != residue_cur) + { + fprintf(stderr, " Error writing residue sound\n"); + exit(2); + } + residue_cur = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +static void signal_load(signal_source_t *sig, const char *name) +{ + sig->handle = sf_open_telephony_read(name, 1); + sig->name = name; + sig->max = sf_readf_short(sig->handle, sig->signal, SAMPLE_RATE); + if (sig->max < 0) + { + fprintf(stderr, " Error reading sound file '%s'\n", sig->name); + exit(2); + } +} +/*- End of function --------------------------------------------------------*/ + +static void signal_free(signal_source_t *sig) +{ + if (sf_close(sig->handle) != 0) + { + fprintf(stderr, " Cannot close sound file '%s'\n", sig->name); + exit(2); + } +} +/*- End of function --------------------------------------------------------*/ + +static void signal_restart(signal_source_t *sig, float gain) +{ + sig->cur = 0; + sig->gain = powf(10.0f, gain/20.0f); +} +/*- End of function --------------------------------------------------------*/ + +static int16_t signal_amp(signal_source_t *sig) +{ + int16_t tx; + + tx = sig->signal[sig->cur++]*sig->gain; + if (sig->cur >= sig->max) + sig->cur = 0; + return tx; +} +/*- End of function --------------------------------------------------------*/ + +static level_measurement_device_t *level_measurement_device_create(int type) +{ + level_measurement_device_t *dev; + int i; + + dev = (level_measurement_device_t *) malloc(sizeof(level_measurement_device_t)); + dev->fir = (fir_float_state_t *) malloc(sizeof(fir_float_state_t)); + fir_float_create(dev->fir, + level_measurement_bp_coeffs, + sizeof(level_measurement_bp_coeffs)/sizeof(float)); + for (i = 0; i < 35*8; i++) + dev->history[i] = 0.0f; + dev->pos = 0; + dev->factor = expf(-1.0f/((float) SAMPLE_RATE*0.035f)); + dev->power = 0; + dev->type = type; + return dev; +} +/*- End of function --------------------------------------------------------*/ + +#if 0 +static void level_measurement_device_reset(level_measurement_device_t *dev) +{ + int i; + + for (i = 0; i < 35*8; i++) + dev->history[i] = 0.0f; + dev->pos = 0; + dev->power = 0; + dev->peak = 0.0f; +} +/*- End of function --------------------------------------------------------*/ + +static int level_measurement_device_release(level_measurement_device_t *s) +{ + fir_float_free(s->fir); + free(s->fir); + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +#endif + +static float level_measurement_device_get_peak(level_measurement_device_t *dev) +{ + return dev->peak; +} +/*- End of function --------------------------------------------------------*/ + +static float level_measurement_device_reset_peak(level_measurement_device_t *dev) +{ + float power; + + power = dev->peak; + dev->peak = -99.0f; + return power; +} +/*- End of function --------------------------------------------------------*/ + +static float level_measurement_device(level_measurement_device_t *dev, int16_t amp) +{ + float signal; + float power; + + /* Level measurement device(s), specified in G.168 section 6.4.1.2.1 and 6.4.1.2.2 */ + signal = fir_float(dev->fir, amp); + signal *= signal; + if (dev->type == 0) + { + /* Level measurement device, specified in G.168 section 6.4.1.2.1 - + level measurement device. This version uses a single pole + estimator.*/ + dev->power = dev->power*dev->factor + signal*(1.0f - dev->factor); + signal = sqrtf(dev->power); + } + else + { + /* Level measurement device, specified in G.168 section 6.4.1.2.2 - + level measurement device for peaks. This version uses a sliding + window estimator. */ + dev->power += (signal - dev->history[dev->pos]); + dev->history[dev->pos++] = signal; + signal = sqrtf(dev->power/(35.8f*8.0f)); + } + if (signal <= 0.0f) + return -99.0f; + power = DBM0_MAX_POWER + 20.0f*log10f(signal/32767.0f); + if (power > dev->peak) + dev->peak = power; + return power; +} +/*- End of function --------------------------------------------------------*/ + +static void level_measurements_create(int type) +{ + rin_power_meter = level_measurement_device_create(type); + rout_power_meter = level_measurement_device_create(type); + sin_power_meter = level_measurement_device_create(type); + sout_power_meter = level_measurement_device_create(type); + sgen_power_meter = level_measurement_device_create(type); +} +/*- End of function --------------------------------------------------------*/ + +static void level_measurements_update(int16_t rin, int16_t sin, int16_t rout, int16_t sout, int16_t sgen) +{ + level_measurement_device(rin_power_meter, rin); + level_measurement_device(rout_power_meter, rout); + level_measurement_device(sin_power_meter, sin); + level_measurement_device(sout_power_meter, sout); + level_measurement_device(sgen_power_meter, sgen); +} +/*- End of function --------------------------------------------------------*/ + +static void level_measurements_reset_peaks(void) +{ + level_measurement_device_reset_peak(rin_power_meter); + level_measurement_device_reset_peak(rout_power_meter); + level_measurement_device_reset_peak(sin_power_meter); + level_measurement_device_reset_peak(sout_power_meter); + level_measurement_device_reset_peak(sgen_power_meter); +} +/*- End of function --------------------------------------------------------*/ + +static void print_results(void) +{ + if (!quiet) + printf("test model ERL time Max Rin Max Rout Max Sgen Max Sin Max Sout\n"); + printf("%-4s %-1d %-5.1f%6.2fs%9.2f%9.2f%9.2f%9.2f%9.2f\n", + test_name, + chan_model.model_no, + 20.0f*log10f(-chan_model.erl), + 0.0f, //test_clock, + level_measurement_device_get_peak(rin_power_meter), + level_measurement_device_get_peak(rout_power_meter), + level_measurement_device_get_peak(sgen_power_meter), + level_measurement_device_get_peak(sin_power_meter), + level_measurement_device_get_peak(sout_power_meter)); +} +/*- End of function --------------------------------------------------------*/ + +static int channel_model_create(channel_model_state_t *chan, int model, float erl, int codec) +{ + static const int32_t line_model_clear_coeffs[] = + { + 32768 + }; + static const int32_t *line_models[] = + { + line_model_clear_coeffs, + line_model_d2_coeffs, + line_model_d3_coeffs, + line_model_d4_coeffs, + line_model_d5_coeffs, + line_model_d6_coeffs, + line_model_d7_coeffs, + line_model_d8_coeffs, + line_model_d9_coeffs + }; + static const int line_model_sizes[] = + { + sizeof(line_model_clear_coeffs)/sizeof(line_model_clear_coeffs[0]), + sizeof(line_model_d2_coeffs)/sizeof(line_model_d2_coeffs[0]), + sizeof(line_model_d3_coeffs)/sizeof(line_model_d3_coeffs[0]), + sizeof(line_model_d4_coeffs)/sizeof(line_model_d4_coeffs[0]), + sizeof(line_model_d5_coeffs)/sizeof(line_model_d5_coeffs[0]), + sizeof(line_model_d6_coeffs)/sizeof(line_model_d6_coeffs[0]), + sizeof(line_model_d7_coeffs)/sizeof(line_model_d7_coeffs[0]), + sizeof(line_model_d8_coeffs)/sizeof(line_model_d8_coeffs[0]), + sizeof(line_model_d9_coeffs)/sizeof(line_model_d9_coeffs[0]) + }; + static const float ki[] = + { + 3.05e-5f, + LINE_MODEL_D2_GAIN, + LINE_MODEL_D3_GAIN, + LINE_MODEL_D4_GAIN, + LINE_MODEL_D5_GAIN, + LINE_MODEL_D6_GAIN, + LINE_MODEL_D7_GAIN, + LINE_MODEL_D8_GAIN, + LINE_MODEL_D9_GAIN + }; + + if (model < 0 || model >= (int) (sizeof(line_model_sizes)/sizeof(line_model_sizes[0]))) + return -1; + fir32_create(&chan->impulse, line_models[model], line_model_sizes[model]); + chan->gain = 32768.0f*powf(10.0f, erl/20.0f)*ki[model]; + chan->munging_codec = codec; + chan->model_no = model; + chan->erl = erl; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int16_t channel_model(channel_model_state_t *chan, int16_t rout, int16_t sgen) +{ + int16_t echo; + int16_t sin; + + /* Channel modelling is merely simulating the effects of A-law or u-law distortion + and using one of the echo models from G.168. Simulating the codec is very important, + as this is usually the limiting factor in how much echo reduction is achieved. */ + + /* The far end signal will have been through codec munging. */ + switch (chan->munging_codec) + { + case G711_ALAW: + sgen = alaw_to_linear(linear_to_alaw(sgen)); + break; + case G711_ULAW: + sgen = ulaw_to_linear(linear_to_ulaw(sgen)); + break; + } + + /* The local tx signal will usually have gone through codec munging before + it reached the line's analogue area, where the echo occurs. */ + switch (chan->munging_codec) + { + case G711_ALAW: + rout = alaw_to_linear(linear_to_alaw(rout)); + break; + case G711_ULAW: + rout = ulaw_to_linear(linear_to_ulaw(rout)); + break; + } + /* Now we need to model the echo. We only model a single analogue segment, as per + the G.168 spec. However, there will generally be near end and far end analogue/echoey + segments in the real world, unless an end is purely digital. */ + echo = fir32(&chan->impulse, rout*chan->gain); + sin = saturate(echo + sgen); + + /* This mixed echo and far end signal will have been through codec munging + when it came back into the digital network. */ + switch (chan->munging_codec) + { + case G711_ALAW: + sin = alaw_to_linear(linear_to_alaw(sin)); + break; + case G711_ULAW: + sin = ulaw_to_linear(linear_to_ulaw(sin)); + break; + } + return sin; +} +/*- End of function --------------------------------------------------------*/ + +static void write_log_files(int16_t rout, int16_t sin) +{ +#if 0 + fprintf(flevel, "%f\t%f\t%f\t%f\n", LRin, LSin, LSout, LSgen); + fprintf(fdump, "%d %d %d", ctx->tx, ctx->rx, ctx->clean); + fprintf(fdump, + " %d %d %d %d %d %d %d %d %d %d\n", + ctx->clean_nlp, + ctx->Ltx, + ctx->Lrx, + ctx->Lclean, + (ctx->nonupdate_dwell > 0), + ctx->adapt, + ctx->Lclean_bg, + ctx->Pstates, + ctx->Lbgn_upper, + ctx->Lbgn); +#endif +} +/*- End of function --------------------------------------------------------*/ + +static int16_t silence(void) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int16_t local_css_signal(void) +{ + return signal_amp(&local_css); +} +/*- End of function --------------------------------------------------------*/ + +static int16_t far_css_signal(void) +{ + return signal_amp(&far_css); +} +/*- End of function --------------------------------------------------------*/ + +static int16_t local_noise_signal(void) +{ + return awgn(&local_noise_source); +} +/*- End of function --------------------------------------------------------*/ + +static int16_t far_noise_signal(void) +{ + return awgn(&far_noise_source); +} +/*- End of function --------------------------------------------------------*/ + +#if 0 +static int16_t local_hoth_noise_signal(void) +{ + static float hoth_noise = 0.0; + + hoth_noise = hoth_noise*0.625 + awgn(&local_noise_source)*0.375; + return (int16_t) hoth_noise; +} +/*- End of function --------------------------------------------------------*/ +#endif + +static int16_t far_hoth_noise_signal(void) +{ + static float hoth_noise = 0.0; + + hoth_noise = hoth_noise*0.625 + awgn(&far_noise_source)*0.375; + return (int16_t) hoth_noise; +} +/*- End of function --------------------------------------------------------*/ + +static void run_test(echo_can_state_t *ctx, int16_t (*tx_source)(void), int16_t (*rx_source)(void), int period) +{ + int i; + int16_t rin; + int16_t rout; + int16_t sin; + int16_t sout; + int16_t sgen; + int outframes; + + for (i = 0; i < period*SAMPLE_RATE/1000; i++) + { + rin = tx_source(); + sgen = rx_source(); + + rout = echo_can_hpf_tx(ctx, rin); + sin = channel_model(&chan_model, rout, sgen); + sout = echo_can_update(ctx, rout, sin); + + level_measurements_update(rin, sin, rout, sout, sgen); + //residue = 100.0f*pp1/pp2; + //put_residue(residue); + + //put_residue(clean - rx); +#if defined(ENABLE_GUI) + if (use_gui) + echo_can_monitor_can_update(ctx->fir_taps16[0], TEST_EC_TAPS); +#endif + result_sound[result_cur++] = rin; + result_sound[result_cur++] = sgen; + result_sound[result_cur++] = sin; + result_sound[result_cur++] = rout; + result_sound[result_cur++] = sout; + result_sound[result_cur++] = sout - sgen; + result_sound[result_cur++] = 0; // TODO: insert the EC's internal status here + if (result_cur >= RESULT_CHANNELS*SAMPLE_RATE) + { + outframes = sf_writef_short(result_handle, result_sound, result_cur/RESULT_CHANNELS); + if (outframes != result_cur/RESULT_CHANNELS) + { + fprintf(stderr, " Error writing result sound\n"); + exit(2); + } + result_cur = 0; + } + } +#if defined(ENABLE_GUI) + if (use_gui) + echo_can_monitor_can_update(ctx->fir_taps16[0], TEST_EC_TAPS); +#endif + if (result_cur >= 0) + { + outframes = sf_writef_short(result_handle, result_sound, result_cur/RESULT_CHANNELS); + if (outframes != result_cur/RESULT_CHANNELS) + { + fprintf(stderr, " Error writing result sound\n"); + exit(2); + } + result_cur = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +static void print_test_title(const char *title) +{ + if (quiet == FALSE) + printf(title); +} +/*- End of function --------------------------------------------------------*/ + +static int perform_test_sanity(void) +{ + echo_can_state_t *ctx; + int i; + int16_t rx; + int16_t tx; + int16_t clean; + int far_tx; + int16_t far_sound[SAMPLE_RATE]; + int16_t result_sound[64000]; + int result_cur; + int outframes; + int local_cur; + int far_cur; + //int32_t coeffs[200][128]; + //int coeff_index; + + print_test_title("Performing basic sanity test\n"); + ctx = echo_can_init(TEST_EC_TAPS, 0); + + local_cur = 0; + far_cur = 0; + result_cur = 0; + + echo_can_flush(ctx); + /* Converge the canceller */ + signal_restart(&local_css, 0.0f); + run_test(ctx, silence, silence, 200); + run_test(ctx, local_css_signal, silence, 5000); + echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION | ECHO_CAN_USE_NLP | ECHO_CAN_USE_CNG); + run_test(ctx, local_css_signal, silence, 5000); + echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION); + + for (i = 0; i < SAMPLE_RATE*10; i++) + { + tx = local_css_signal(); +#if 0 + if ((i/10000)%10 == 9) + { + /* Inject a burst of far sound */ + if (far_cur >= far_max) + { + far_max = sf_readf_short(farhandle, far_sound, SAMPLE_RATE); + if (far_max < 0) + { + fprintf(stderr, " Error reading far sound\n"); + exit(2); + } + if (far_max == 0) + break; + far_cur = 0; + } + far_tx = far_sound[far_cur++]; + } + else + { + far_tx = 0; + } +#else + far_sound[0] = 0; + far_tx = 0; +#endif + rx = channel_model(&chan_model, tx, far_tx); + //rx += awgn(&far_noise_source); + //tx += awgn(&far_noise_source); + clean = echo_can_update(ctx, tx, rx); + +#if defined(XYZZY) + if (i%SAMPLE_RATE == 0) + { + if (coeff_index < 200) + { + for (j = 0; j < ctx->taps; j++) + coeffs[coeff_index][j] = ctx->fir_taps32[j]; + coeff_index++; + } + } +#endif + result_sound[result_cur++] = tx; + result_sound[result_cur++] = rx; + result_sound[result_cur++] = clean - far_tx; + //result_sound[result_cur++] = ctx->tx_power[2]; + //result_sound[result_cur++] = ctx->tx_power[1]; + ////result_sound[result_cur++] = (ctx->tx_power[1] > 64) ? SAMPLE_RATE : -SAMPLE_RATE; + //result_sound[result_cur++] = ctx->tap_set*SAMPLE_RATE; + //result_sound[result_cur++] = (ctx->nonupdate_dwell > 0) ? SAMPLE_RATE : -SAMPLE_RATE; + //result_sound[result_cur++] = ctx->latest_correction >> 8; + //result_sound[result_cur++] = level_measurement_device(tx)/(16.0*65536.0); + //result_sound[result_cur++] = level_measurement_device(tx)/4096.0; + ////result_sound[result_cur++] = (ctx->tx_power[1] > ctx->rx_power[0]) ? SAMPLE_RATE : -SAMPLE_RATE; + //result_sound[result_cur++] = (ctx->tx_power[1] > ctx->rx_power[0]) ? SAMPLE_RATE : -SAMPLE_RATE; + //result_sound[result_cur++] = (ctx->narrowband_score)*5; // ? SAMPLE_RATE : -SAMPLE_RATE; + //result_sound[result_cur++] = ctx->tap_rotate_counter*10; + ////result_sound[result_cur++] = ctx->vad; + + put_residue(clean - far_tx); + if (result_cur >= RESULT_CHANNELS*SAMPLE_RATE) + { + outframes = sf_writef_short(result_handle, result_sound, result_cur/RESULT_CHANNELS); + if (outframes != result_cur/RESULT_CHANNELS) + { + fprintf(stderr, " Error writing result sound\n"); + exit(2); + } + result_cur = 0; + } + } + if (result_cur > 0) + { + outframes = sf_writef_short(result_handle, result_sound, result_cur/RESULT_CHANNELS); + if (outframes != result_cur/RESULT_CHANNELS) + { + fprintf(stderr, " Error writing result sound\n"); + exit(2); + } + } +#if defined(XYZZY) + for (j = 0; j < ctx->taps; j++) + { + for (i = 0; i < coeff_index; i++) + fprintf(stderr, "%d ", coeffs[i][j]); + fprintf(stderr, "\n"); + } +#endif + + echo_can_free(ctx); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_test_2a(void) +{ + echo_can_state_t *ctx; + + /* Test 2 - Convergence and steady state residual and returned echo level test */ + /* Test 2A - Convergence and reconvergence test with NLP enabled */ + print_test_title("Performing test 2A - Convergence and reconvergence test with NLP enabled\n"); + ctx = echo_can_init(TEST_EC_TAPS, 0); + + echo_can_flush(ctx); + echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION | ECHO_CAN_USE_NLP); + + /* Test 2A (a) - Convergence test with NLP enabled */ + + /* Converge the canceller. */ + run_test(ctx, silence, silence, 200); + signal_restart(&local_css, 0.0f); + run_test(ctx, local_css_signal, silence, 1000); + level_measurements_reset_peaks(); + run_test(ctx, local_css_signal, silence, 9000); + print_results(); + if (level_measurement_device_get_peak(sout_power_meter) > -65.0f) + printf("Test failed\n"); + else + printf("Test passed\n"); + + /* Test 2A (b) - Reconvergence test with NLP enabled */ + + /* Make an abrupt change of channel characteristic, to another of the channel echo models. */ + if (channel_model_create(&chan_model, supp_line_model_no, erl, munger)) + { + fprintf(stderr, " Failed to create line model\n"); + exit(2); + } + signal_restart(&local_css, 0.0f); + run_test(ctx, local_css_signal, silence, 1000); + level_measurements_reset_peaks(); + run_test(ctx, local_css_signal, silence, 9000); + print_results(); + if (level_measurement_device_get_peak(sout_power_meter) > -65.0f) + printf("Test failed\n"); + else + printf("Test passed\n"); + + echo_can_free(ctx); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_test_2b(void) +{ + echo_can_state_t *ctx; + + /* Test 2 - Convergence and steady state residual and returned echo level test */ + /* Test 2B - Convergence and reconverge with NLP disabled */ + print_test_title("Performing test 2B - Convergence and reconverge with NLP disabled\n"); + ctx = echo_can_init(TEST_EC_TAPS, 0); + + echo_can_flush(ctx); + echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION); + signal_restart(&local_css, 0.0f); + + /* Test 2B (a) - Convergence test with NLP disabled */ + + /* Converge the canceller */ + run_test(ctx, silence, silence, 200); + run_test(ctx, local_css_signal, silence, 1000); + level_measurements_reset_peaks(); + run_test(ctx, local_css_signal, silence, 9000); + print_results(); + level_measurements_reset_peaks(); + run_test(ctx, local_css_signal, silence, 170000); + print_results(); + if (level_measurement_device_get_peak(sout_power_meter) > -65.0) + printf("Test failed\n"); + else + printf("Test passed\n"); + + /* Test 2B (b) - Reconvergence test with NLP disabled */ + + /* Make an abrupt change of channel characteristic, to another of the channel echo models. */ + if (channel_model_create(&chan_model, supp_line_model_no, erl, munger)) + { + fprintf(stderr, " Failed to create line model\n"); + exit(2); + } + run_test(ctx, local_css_signal, silence, 1000); + level_measurements_reset_peaks(); + run_test(ctx, local_css_signal, silence, 9000); + print_results(); + level_measurements_reset_peaks(); + run_test(ctx, local_css_signal, silence, 170000); + print_results(); + if (level_measurement_device_get_peak(sout_power_meter) > -65.0) + printf("Test failed\n"); + else + printf("Test passed\n"); + + echo_can_free(ctx); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_test_2ca(void) +{ + echo_can_state_t *ctx; + + /* Test 2 - Convergence and steady state residual and returned echo level test */ + /* Test 2C(a) - Convergence with background noise present */ + print_test_title("Performing test 2C(a) - Convergence with background noise present\n"); + ctx = echo_can_init(TEST_EC_TAPS, 0); + awgn_init_dbm0(&far_noise_source, 7162534, -50.0f); + + echo_can_flush(ctx); + echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION); + + /* Converge a canceller */ + signal_restart(&local_css, 0.0f); + run_test(ctx, silence, silence, 200); + + awgn_init_dbm0(&far_noise_source, 7162534, -40.0f); + run_test(ctx, local_css_signal, far_hoth_noise_signal, 5000); + + /* Now freeze adaption, and measure the echo. */ + echo_can_adaption_mode(ctx, 0); + level_measurements_reset_peaks(); + run_test(ctx, local_css_signal, silence, 5000); + print_results(); + if (level_measurement_device_get_peak(sout_power_meter) > level_measurement_device_get_peak(sgen_power_meter)) + printf("Test failed\n"); + else + printf("Test passed\n"); + + echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION); + echo_can_free(ctx); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_test_3a(void) +{ + echo_can_state_t *ctx; + + /* Test 3 - Performance under double talk conditions */ + /* Test 3A - Double talk test with low cancelled-end levels */ + print_test_title("Performing test 3A - Double talk test with low cancelled-end levels\n"); + ctx = echo_can_init(TEST_EC_TAPS, 0); + + echo_can_flush(ctx); + echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION); + + run_test(ctx, silence, silence, 200); + signal_restart(&local_css, 0.0f); + signal_restart(&far_css, -20.0f); + + /* Apply double talk, with a weak far end signal */ + run_test(ctx, local_css_signal, far_css_signal, 5000); + + /* Now freeze adaption. */ + echo_can_adaption_mode(ctx, 0); + run_test(ctx, local_css_signal, silence, 500); + + /* Now measure the echo */ + level_measurements_reset_peaks(); + run_test(ctx, local_css_signal, silence, 5000); + print_results(); + if (level_measurement_device_get_peak(sout_power_meter) > level_measurement_device_get_peak(sgen_power_meter)) + printf("Test failed\n"); + else + printf("Test passed\n"); + + echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION); + echo_can_free(ctx); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_test_3ba(void) +{ + echo_can_state_t *ctx; + + /* Test 3 - Performance under double talk conditions */ + /* Test 3B(a) - Double talk stability test with high cancelled-end levels */ + print_test_title("Performing test 3B(b) - Double talk stability test with high cancelled-end levels\n"); + ctx = echo_can_init(TEST_EC_TAPS, 0); + + echo_can_flush(ctx); + echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION); + + run_test(ctx, silence, silence, 200); + signal_restart(&local_css, 0.0f); + signal_restart(&far_css, 0.0f); + + /* Converge the canceller */ + run_test(ctx, local_css_signal, silence, 5000); + + /* Apply double talk */ + run_test(ctx, local_css_signal, far_css_signal, 5000); + + /* Now freeze adaption. */ + echo_can_adaption_mode(ctx, 0); + run_test(ctx, local_css_signal, far_css_signal, 1000); + + /* Turn off the double talk. */ + run_test(ctx, local_css_signal, silence, 500); + + /* Now measure the echo */ + level_measurements_reset_peaks(); + run_test(ctx, local_css_signal, silence, 5000); + print_results(); + + echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION); + echo_can_free(ctx); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_test_3bb(void) +{ + echo_can_state_t *ctx; + + /* Test 3 - Performance under double talk conditions */ + /* Test 3B(b) - Double talk stability test with low cancelled-end levels */ + print_test_title("Performing test 3B(b) - Double talk stability test with low cancelled-end levels\n"); + ctx = echo_can_init(TEST_EC_TAPS, 0); + + echo_can_flush(ctx); + echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION); + + run_test(ctx, silence, silence, 200); + signal_restart(&local_css, 0.0f); + signal_restart(&far_css, -15.0f); + + /* Converge the canceller */ + run_test(ctx, local_css_signal, silence, 5000); + + /* Apply double talk */ + run_test(ctx, local_css_signal, far_css_signal, 5000); + + /* Now freeze adaption. */ + echo_can_adaption_mode(ctx, 0); + run_test(ctx, local_css_signal, silence, 1000); + + /* Turn off the double talk. */ + run_test(ctx, local_css_signal, silence, 500); + + /* Now measure the echo */ + level_measurements_reset_peaks(); + run_test(ctx, local_css_signal, silence, 5000); + print_results(); + + echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION); + echo_can_free(ctx); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_test_3c(void) +{ + echo_can_state_t *ctx; + + /* Test 3 - Performance under double talk conditions */ + /* Test 3C - Double talk test with simulated conversation */ + print_test_title("Performing test 3C - Double talk test with simulated conversation\n"); + ctx = echo_can_init(TEST_EC_TAPS, 0); + + echo_can_flush(ctx); + echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION); + run_test(ctx, silence, silence, 200); + + signal_restart(&local_css, 0.0f); + signal_restart(&far_css, -15.0f); + + /* Apply double talk */ + run_test(ctx, local_css_signal, far_css_signal, 5600); + + /* Stop the far signal, and measure the echo. */ + level_measurements_reset_peaks(); + run_test(ctx, local_css_signal, silence, 1400); + print_results(); + + /* Continue measuring the resulting echo */ + run_test(ctx, local_css_signal, silence, 5000); + + /* Reapply double talk */ + signal_restart(&far_css, 0.0f); + run_test(ctx, local_css_signal, far_css_signal, 5600); + + /* Now the far signal only */ + run_test(ctx, silence, far_css_signal, 5600); + + echo_can_free(ctx); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_test_4(void) +{ + echo_can_state_t *ctx; + + /* Test 4 - Leak rate test */ + print_test_title("Performing test 4 - Leak rate test\n"); + ctx = echo_can_init(TEST_EC_TAPS, 0); + + echo_can_flush(ctx); + echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION); + + run_test(ctx, silence, silence, 200); + + /* Converge the canceller */ + signal_restart(&local_css, 0.0f); + run_test(ctx, local_css_signal, silence, 5000); + + /* Put 2 minutes of silence through it */ + run_test(ctx, silence, silence, 120000); + + /* Now freeze it, and check if it is still well adapted. */ + echo_can_adaption_mode(ctx, 0); + level_measurements_reset_peaks(); + run_test(ctx, local_css_signal, silence, 5000); + print_results(); + + echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION); + echo_can_free(ctx); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_test_5(void) +{ + echo_can_state_t *ctx; + + /* Test 5 - Infinite return loss convergence test */ + print_test_title("Performing test 5 - Infinite return loss convergence test\n"); + ctx = echo_can_init(TEST_EC_TAPS, 0); + + echo_can_flush(ctx); + echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION); + + /* Converge the canceller */ + signal_restart(&local_css, 0.0f); + run_test(ctx, local_css_signal, silence, 5000); + + /* Now stop echoing, and see we don't do anything unpleasant as the + echo path is open looped. */ + run_test(ctx, local_css_signal, silence, 5000); + print_results(); + + echo_can_free(ctx); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_test_6(void) +{ + echo_can_state_t *ctx; + int i; + int j; + int k; + int16_t rx; + int16_t tx; + int16_t clean; + int local_max; + tone_gen_descriptor_t tone_desc; + tone_gen_state_t tone_state; + int16_t local_sound[40000]; + + /* Test 6 - Non-divergence on narrow-band signals */ + print_test_title("Performing test 6 - Non-divergence on narrow-band signals\n"); + ctx = echo_can_init(TEST_EC_TAPS, 0); + + echo_can_flush(ctx); + echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION); + + /* Converge the canceller */ + signal_restart(&local_css, 0.0f); + run_test(ctx, local_css_signal, silence, 5000); + + /* Now put 5s bursts of a list of tones through the converged canceller, and check + that nothing unpleasant happens. */ + for (k = 0; tones_6_4_2_7[k][0]; k++) + { + make_tone_gen_descriptor(&tone_desc, + tones_6_4_2_7[k][0], + -11, + tones_6_4_2_7[k][1], + -9, + 1, + 0, + 0, + 0, + 1); + tone_gen_init(&tone_state, &tone_desc); + j = 0; + for (i = 0; i < 5; i++) + { + local_max = tone_gen(&tone_state, local_sound, SAMPLE_RATE); + for (j = 0; j < SAMPLE_RATE; j++) + { + tx = local_sound[j]; + rx = channel_model(&chan_model, tx, 0); + clean = echo_can_update(ctx, tx, rx); + put_residue(clean); + } +#if defined(ENABLE_GUI) + if (use_gui) + { + echo_can_monitor_can_update(ctx->fir_taps16[0], TEST_EC_TAPS); + echo_can_monitor_update_display(); + usleep(100000); + } +#endif + } + } +#if defined(ENABLE_GUI) + if (use_gui) + echo_can_monitor_can_update(ctx->fir_taps16[0], TEST_EC_TAPS); +#endif + echo_can_free(ctx); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_test_7(void) +{ + echo_can_state_t *ctx; + int i; + int j; + int16_t rx; + int16_t tx; + int16_t clean; + int local_max; + tone_gen_descriptor_t tone_desc; + tone_gen_state_t tone_state; + int16_t local_sound[40000]; + + /* Test 7 - Stability */ + print_test_title("Performing test 7 - Stability\n"); + ctx = echo_can_init(TEST_EC_TAPS, 0); + + /* Put tones through an unconverged canceller, and check nothing unpleasant + happens. */ + echo_can_flush(ctx); + echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION); + make_tone_gen_descriptor(&tone_desc, + tones_6_4_2_7[0][0], + -11, + tones_6_4_2_7[0][1], + -9, + 1, + 0, + 0, + 0, + 1); + tone_gen_init(&tone_state, &tone_desc); + j = 0; + for (i = 0; i < 120; i++) + { + local_max = tone_gen(&tone_state, local_sound, SAMPLE_RATE); + for (j = 0; j < SAMPLE_RATE; j++) + { + tx = local_sound[j]; + rx = channel_model(&chan_model, tx, 0); + clean = echo_can_update(ctx, tx, rx); + put_residue(clean); + } +#if defined(ENABLE_GUI) + if (use_gui) + { + echo_can_monitor_can_update(ctx->fir_taps16[0], TEST_EC_TAPS); + echo_can_monitor_update_display(); + usleep(100000); + } +#endif + } +#if defined(ENABLE_GUI) + if (use_gui) + echo_can_monitor_can_update(ctx->fir_taps16[0], TEST_EC_TAPS); +#endif + echo_can_free(ctx); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_test_8(void) +{ + echo_can_state_t *ctx; + + /* Test 8 - Non-convergence on No 5, 6, and 7 in-band signalling */ + print_test_title("Performing test 8 - Non-convergence on No 5, 6, and 7 in-band signalling\n"); + ctx = echo_can_init(TEST_EC_TAPS, 0); + + fprintf(stderr, "Test 8 not yet implemented\n"); + + echo_can_free(ctx); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_test_9(void) +{ + echo_can_state_t *ctx; + awgn_state_t local_noise_source; + awgn_state_t far_noise_source; + + /* Test 9 - Comfort noise test */ + print_test_title("Performing test 9 - Comfort noise test\n"); + ctx = echo_can_init(TEST_EC_TAPS, 0); + awgn_init_dbm0(&far_noise_source, 7162534, -50.0f); + + echo_can_flush(ctx); + echo_can_adaption_mode(ctx, + ECHO_CAN_USE_ADAPTION + | ECHO_CAN_USE_NLP + | ECHO_CAN_USE_CNG); + + /* Test 9 part 1 - matching */ + /* Converge the canceller */ + signal_restart(&local_css, 0.0f); + run_test(ctx, local_css_signal, silence, 5000); + + echo_can_adaption_mode(ctx, ECHO_CAN_USE_ADAPTION | ECHO_CAN_USE_NLP | ECHO_CAN_USE_CNG); + awgn_init_dbm0(&far_noise_source, 7162534, -45.0f); + run_test(ctx, silence, far_noise_signal, 30000); + + awgn_init_dbm0(&local_noise_source, 1234567, -10.0f); + run_test(ctx, local_noise_signal, far_noise_signal, 2000); + + /* Test 9 part 2 - adjust down */ + awgn_init_dbm0(&far_noise_source, 7162534, -55.0f); + run_test(ctx, silence, far_noise_signal, 10000); + run_test(ctx, local_noise_signal, far_noise_signal, 2000); + + echo_can_free(ctx); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_test_10a(void) +{ + echo_can_state_t *ctx; + + /* Test 10 - FAX test during call establishment phase */ + /* Test 10A - Canceller operation on the calling station side */ + print_test_title("Performing test 10A - Canceller operation on the calling station side\n"); + ctx = echo_can_init(TEST_EC_TAPS, 0); + + fprintf(stderr, "Test 10A not yet implemented\n"); + + echo_can_free(ctx); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_test_10b(void) +{ + echo_can_state_t *ctx; + + /* Test 10 - FAX test during call establishment phase */ + /* Test 10B - Canceller operation on the called station side */ + print_test_title("Performing test 10B - Canceller operation on the called station side\n"); + ctx = echo_can_init(TEST_EC_TAPS, 0); + + fprintf(stderr, "Test 10B not yet implemented\n"); + + echo_can_free(ctx); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_test_10c(void) +{ + echo_can_state_t *ctx; + + /* Test 10 - FAX test during call establishment phase */ + /* Test 10C - Canceller operation on the calling station side during page + transmission and page breaks (for further study) */ + print_test_title("Performing test 10C - Canceller operation on the calling station side during page\n" + "transmission and page breaks (for further study)\n"); + ctx = echo_can_init(TEST_EC_TAPS, 0); + + fprintf(stderr, "Test 10C not yet implemented\n"); + + echo_can_free(ctx); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_test_11(void) +{ + echo_can_state_t *ctx; + + /* Test 11 - Tandem echo canceller test (for further study) */ + print_test_title("Performing test 11 - Tandem echo canceller test (for further study)\n"); + ctx = echo_can_init(TEST_EC_TAPS, 0); + + fprintf(stderr, "Test 11 not yet implemented\n"); + + echo_can_free(ctx); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_test_12(void) +{ + echo_can_state_t *ctx; + + /* Test 12 - Residual acoustic echo test (for further study) */ + print_test_title("Performing test 12 - Residual acoustic echo test (for further study)\n"); + ctx = echo_can_init(TEST_EC_TAPS, 0); + + fprintf(stderr, "Test 12 not yet implemented\n"); + + echo_can_free(ctx); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_test_13(void) +{ + echo_can_state_t *ctx; + + /* Test 13 - Performance with ITU-T low-bit rate coders in echo path + (Optional, under study) */ + print_test_title("Performing test 13 - Performance with ITU-T low-bit rate coders in echo path (Optional, under study)\n"); + ctx = echo_can_init(TEST_EC_TAPS, 0); + + fprintf(stderr, "Test 13 not yet implemented\n"); + + echo_can_free(ctx); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_test_14(void) +{ + echo_can_state_t *ctx; + + /* Test 14 - Performance with V-series low-speed data modems */ + print_test_title("Performing test 14 - Performance with V-series low-speed data modems\n"); + ctx = echo_can_init(TEST_EC_TAPS, 0); + + fprintf(stderr, "Test 14 not yet implemented\n"); + + echo_can_free(ctx); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_test_15(void) +{ + echo_can_state_t *ctx; + + /* Test 15 - PCM offset test (Optional) */ + print_test_title("Performing test 15 - PCM offset test (Optional)\n"); + ctx = echo_can_init(TEST_EC_TAPS, 0); + + fprintf(stderr, "Test 15 not yet implemented\n"); + + echo_can_free(ctx); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int match_test_name(const char *name) +{ + const struct + { + const char *name; + int (*func)(void); + } tests[] = + { + {"sanity", perform_test_sanity}, + {"2a", perform_test_2a}, + {"2b", perform_test_2b}, + {"2ca", perform_test_2ca}, + {"3a", perform_test_3a}, + {"3ba", perform_test_3ba}, + {"3bb", perform_test_3bb}, + {"3c", perform_test_3c}, + {"4", perform_test_4}, + {"5", perform_test_5}, + {"6", perform_test_6}, + {"7", perform_test_7}, + {"8", perform_test_8}, + {"9", perform_test_9}, + {"10a", perform_test_10a}, + {"10b", perform_test_10b}, + {"10c", perform_test_10c}, + {"11", perform_test_11}, + {"12", perform_test_12}, + {"13", perform_test_13}, + {"14", perform_test_14}, + {"15", perform_test_15}, + {NULL, NULL} + }; + int i; + + for (i = 0; tests[i].name; i++) + { + if (strcasecmp(name, tests[i].name) == 0) + { + test_name = name; + tests[i].func(); + return 0; + } + } + printf("Unknown test name '%s' specified. The known test names are ", name); + for (i = 0; tests[i].name; i++) + { + printf("%s", tests[i].name); + if (tests[i + 1].name) + printf(", "); + } + printf("\n"); + return -1; +} +/*- End of function --------------------------------------------------------*/ + +static void simulate_ec(char *argv[], int two_channel_file, int mode) +{ + echo_can_state_t *ctx; + SNDFILE *txfile; + SNDFILE *rxfile; + SNDFILE *rxtxfile; + SNDFILE *ecfile; + int ntx; + int nrx; + int nec; + int16_t buf[2]; + int16_t rin; + int16_t rout; + int16_t sin; + int16_t sout; + int32_t samples; + + mode |= ECHO_CAN_USE_ADAPTION; + txfile = NULL; + rxfile = NULL; + rxtxfile = NULL; + ecfile = NULL; + if (two_channel_file) + { + txfile = sf_open_telephony_read(argv[0], 1); + rxfile = sf_open_telephony_read(argv[1], 1); + ecfile = sf_open_telephony_write(argv[2], 1); + } + else + { + rxtxfile = sf_open_telephony_read(argv[0], 2); + ecfile = sf_open_telephony_write(argv[1], 1); + } + + ctx = echo_can_init(TEST_EC_TAPS, 0); + echo_can_adaption_mode(ctx, mode); + samples = 0; + do + { + if (two_channel_file) + { + if ((ntx = sf_readf_short(rxtxfile, buf, 1)) < 0) + { + fprintf(stderr, " Error reading tx sound file\n"); + exit(2); + } + rin = buf[0]; + sin = buf[1]; + nrx = ntx; + } + else + { + if ((ntx = sf_readf_short(txfile, &rin, 1)) < 0) + { + fprintf(stderr, " Error reading tx sound file\n"); + exit(2); + } + if ((nrx = sf_readf_short(rxfile, &sin, 1)) < 0) + { + fprintf(stderr, " Error reading rx sound file\n"); + exit(2); + } + } + rout = echo_can_hpf_tx(ctx, rin); + sout = echo_can_update(ctx, rout, sin); + + if ((nec = sf_writef_short(ecfile, &sout, 1)) != 1) + { + fprintf(stderr, " Error writing ec sound file\n"); + exit(2); + } + level_measurements_update(rin, sin, rout, sout, 0); + write_log_files(rin, sin); +#if defined(ENABLE_GUI) + if (use_gui) + echo_can_monitor_can_update(ctx->fir_taps16[0], TEST_EC_TAPS); +#endif + } + while (ntx && nrx); + dump_ec_state(ctx); + + echo_can_free(ctx); + + if (two_channel_file) + { + sf_close(rxtxfile); + } + else + { + sf_close(txfile); + sf_close(rxfile); + } + sf_close(ecfile); +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int i; + time_t now; + int simulate; + int cng; + int hpf; + int two_channel_file; + int opt; + int mode; + + /* Check which tests we should run */ + if (argc < 2) + fprintf(stderr, "Usage: echo tests [-g] [-m ] [-s] \n"); + line_model_no = 0; + supp_line_model_no = 0; + cng = FALSE; + hpf = FALSE; + use_gui = FALSE; + simulate = FALSE; + munger = -1; + two_channel_file = FALSE; + erl = -12.0f; + + while ((opt = getopt(argc, argv, "2ace:ghm:M:su")) != -1) + { + switch (opt) + { + case '2': + two_channel_file = TRUE; + break; + case 'a': + munger = G711_ALAW; + break; + case 'c': + cng = TRUE; + break; + case 'e': + /* Allow for ERL being entered as x or -x */ + erl = -fabs(atof(optarg)); + break; + case 'g': +#if defined(ENABLE_GUI) + use_gui = TRUE; +#else + fprintf(stderr, "Graphical monitoring not available\n"); + exit(2); +#endif + break; + case 'h': + hpf = TRUE; + break; + case 'm': + line_model_no = atoi(optarg); + break; + case 'M': + supp_line_model_no = atoi(optarg); + break; + case 's': + simulate = TRUE; + break; + case 'u': + munger = G711_ULAW; + break; + default: + //usage(); + exit(2); + break; + } + } + argc -= optind; + argv += optind; + +#if defined(ENABLE_GUI) + if (use_gui) + start_echo_can_monitor(TEST_EC_TAPS); +#endif + if (simulate) + { + /* Process a pair of transmitted and received audio files, and produce + an echo cancelled audio file. */ + if (argc < ((two_channel_file) ? 2 : 3)) + { + printf("not enough arguments for a simulation\n"); + exit(2); + } + mode = ECHO_CAN_USE_NLP; + mode |= ((cng) ? ECHO_CAN_USE_CNG : ECHO_CAN_USE_CLIP); + if (hpf) + { + mode |= ECHO_CAN_USE_TX_HPF; + mode |= ECHO_CAN_USE_RX_HPF; + } + simulate_ec(argv, two_channel_file, mode); + } + else + { + /* Run some G.168 tests */ +#if defined(ENABLE_GUI) + if (use_gui) + echo_can_monitor_line_model_update(chan_model.impulse.coeffs, chan_model.impulse.taps); +#endif + signal_load(&local_css, "sound_c1_8k.wav"); + signal_load(&far_css, "sound_c3_8k.wav"); + + if ((residue_handle = sf_open_telephony_write(RESIDUE_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Failed to open '%s'\n", RESIDUE_FILE_NAME); + exit(2); + } + if (argc <= 0) + { + printf("No tests specified\n"); + } + else + { + time(&now); + if ((result_handle = sf_open_telephony_write("echo_tests_result.wav", RESULT_CHANNELS)) == NULL) + { + fprintf(stderr, " Failed to open result file\n"); + exit(2); + } + result_cur = 0; + level_measurements_create(0); + for (i = 0; i < argc; i++) + { + if (channel_model_create(&chan_model, line_model_no, erl, munger)) + { + fprintf(stderr, " Failed to create line model\n"); + exit(2); + } + match_test_name(argv[i]); + } + if (sf_close(result_handle) != 0) + { + fprintf(stderr, " Cannot close speech file '%s'\n", "result_sound.wav"); + exit(2); + } + printf("Run time %lds\n", time(NULL) - now); + } + signal_free(&local_css); + signal_free(&far_css); + if (sf_close(residue_handle) != 0) + { + fprintf(stderr, " Cannot close speech file '%s'\n", RESIDUE_FILE_NAME); + exit(2); + } + } +#if defined(ENABLE_GUI) + if (use_gui) + echo_can_monitor_wait_to_end(); +#endif + + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/fax_decode.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/fax_decode.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,535 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * fax_decode.c - a simple FAX audio decoder + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: fax_decode.c,v 1.58 2009/11/02 13:25:20 steveu Exp $ + */ + +/*! \page fax_decode_page FAX decoder +\section fax_decode_page_sec_1 What does it do? +???. + +\section fax_decode_tests_page_sec_2 How does it work? +???. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" + +#define SAMPLES_PER_CHUNK 160 + +#define DISBIT1 0x01 +#define DISBIT2 0x02 +#define DISBIT3 0x04 +#define DISBIT4 0x08 +#define DISBIT5 0x10 +#define DISBIT6 0x20 +#define DISBIT7 0x40 +#define DISBIT8 0x80 + +enum +{ + FAX_NONE, + FAX_V27TER_RX, + FAX_V29_RX, + FAX_V17_RX +}; + +static const struct +{ + int bit_rate; + int modem_type; + int which; + uint8_t dcs_code; +} fallback_sequence[] = +{ + {14400, T30_MODEM_V17, T30_SUPPORT_V17, DISBIT6}, + {12000, T30_MODEM_V17, T30_SUPPORT_V17, (DISBIT6 | DISBIT4)}, + { 9600, T30_MODEM_V17, T30_SUPPORT_V17, (DISBIT6 | DISBIT3)}, + { 9600, T30_MODEM_V29, T30_SUPPORT_V29, DISBIT3}, + { 7200, T30_MODEM_V17, T30_SUPPORT_V17, (DISBIT6 | DISBIT4 | DISBIT3)}, + { 7200, T30_MODEM_V29, T30_SUPPORT_V29, (DISBIT4 | DISBIT3)}, + { 4800, T30_MODEM_V27TER, T30_SUPPORT_V27TER, DISBIT4}, + { 2400, T30_MODEM_V27TER, T30_SUPPORT_V27TER, 0}, + { 0, 0, 0, 0} +}; + +int decode_test = FALSE; +int rx_bits = 0; + +t30_state_t t30_dummy; +t4_state_t t4_state; +int t4_up = FALSE; + +hdlc_rx_state_t hdlcrx; + +int fast_trained = FAX_NONE; + +uint8_t ecm_data[256][260]; +int16_t ecm_len[256]; + +int line_encoding = T4_COMPRESSION_ITU_T4_1D; +int x_resolution = T4_X_RESOLUTION_R8; +int y_resolution = T4_Y_RESOLUTION_STANDARD; +int image_width = 1728; +int octets_per_ecm_frame = 256; +int error_correcting_mode = FALSE; +int current_fallback = 0; + +static void print_frame(const char *io, const uint8_t *fr, int frlen) +{ + int i; + int type; + const char *country; + const char *vendor; + const char *model; + + fprintf(stderr, "%s %s:", io, t30_frametype(fr[2])); + for (i = 2; i < frlen; i++) + fprintf(stderr, " %02x", fr[i]); + fprintf(stderr, "\n"); + type = fr[2] & 0xFE; + if (type == T30_DIS || type == T30_DTC || type == T30_DCS) + t30_decode_dis_dtc_dcs(&t30_dummy, fr, frlen); + if (type == T30_NSF || type == T30_NSS || type == T30_NSC) + { + if (t35_decode(&fr[3], frlen - 3, &country, &vendor, &model)) + { + if (country) + fprintf(stderr, "The remote was made in '%s'\n", country); + if (vendor) + fprintf(stderr, "The remote was made by '%s'\n", vendor); + if (model) + fprintf(stderr, "The remote is a '%s'\n", model); + } + } +} +/*- End of function --------------------------------------------------------*/ + +static int find_fallback_entry(int dcs_code) +{ + int i; + + /* The table is short, and not searched often, so a brain-dead linear scan seems OK */ + for (i = 0; fallback_sequence[i].bit_rate; i++) + { + if (fallback_sequence[i].dcs_code == dcs_code) + break; + } + if (fallback_sequence[i].bit_rate == 0) + return -1; + return i; +} +/*- End of function --------------------------------------------------------*/ + +static int check_rx_dcs(const uint8_t *msg, int len) +{ + static const int widths[3][4] = + { + { 864, 1024, 1216, -1}, /* R4 resolution - no longer used in recent versions of T.30 */ + {1728, 2048, 2432, -1}, /* R8 resolution */ + {3456, 4096, 4864, -1} /* R16 resolution */ + }; + uint8_t dcs_frame[T30_MAX_DIS_DTC_DCS_LEN]; + + /* Check DCS frame from remote */ + if (len < 6) + { + printf("Short DCS frame\n"); + return -1; + } + + /* Make a local copy of the message, padded to the maximum possible length with zeros. This allows + us to simply pick out the bits, without worrying about whether they were set from the remote side. */ + if (len > T30_MAX_DIS_DTC_DCS_LEN) + { + memcpy(dcs_frame, msg, T30_MAX_DIS_DTC_DCS_LEN); + } + else + { + memcpy(dcs_frame, msg, len); + if (len < T30_MAX_DIS_DTC_DCS_LEN) + memset(dcs_frame + len, 0, T30_MAX_DIS_DTC_DCS_LEN - len); + } + + octets_per_ecm_frame = (dcs_frame[6] & DISBIT4) ? 256 : 64; + if ((dcs_frame[8] & DISBIT1)) + y_resolution = T4_Y_RESOLUTION_SUPERFINE; + else if (dcs_frame[4] & DISBIT7) + y_resolution = T4_Y_RESOLUTION_FINE; + else + y_resolution = T4_Y_RESOLUTION_STANDARD; + image_width = widths[(dcs_frame[8] & DISBIT3) ? 2 : 1][dcs_frame[5] & (DISBIT2 | DISBIT1)]; + + /* Check which compression we will use. */ + if ((dcs_frame[6] & DISBIT7)) + line_encoding = T4_COMPRESSION_ITU_T6; + else if ((dcs_frame[4] & DISBIT8)) + line_encoding = T4_COMPRESSION_ITU_T4_2D; + else + line_encoding = T4_COMPRESSION_ITU_T4_1D; + fprintf(stderr, "Selected compression %d\n", line_encoding); + + if ((current_fallback = find_fallback_entry(dcs_frame[4] & (DISBIT6 | DISBIT5 | DISBIT4 | DISBIT3))) < 0) + printf("Remote asked for a modem standard we do not support\n"); + error_correcting_mode = ((dcs_frame[6] & DISBIT3) != 0); + + //v17_rx_restart(&v17, fallback_sequence[fallback_entry].bit_rate, FALSE); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok) +{ + int type; + int frame_no; + int i; + + if (len < 0) + { + /* Special conditions */ + fprintf(stderr, "HDLC status is %s (%d)\n", signal_status_to_str(len), len); + return; + } + + if (ok) + { + if (msg[0] != 0xFF || !(msg[1] == 0x03 || msg[1] == 0x13)) + { + fprintf(stderr, "Bad frame header - %02x %02x\n", msg[0], msg[1]); + return; + } + print_frame("HDLC: ", msg, len); + type = msg[2] & 0xFE; + switch (type) + { + case T4_FCD: + if (len <= 4 + 256) + { + frame_no = msg[3]; + /* Just store the actual image data, and record its length */ + memcpy(&ecm_data[frame_no][0], &msg[4], len - 4); + ecm_len[frame_no] = (int16_t) (len - 4); + } + break; + case T30_DCS: + check_rx_dcs(msg, len); + break; + } + } + else + { + fprintf(stderr, "Bad HDLC frame "); + for (i = 0; i < len; i++) + fprintf(stderr, " %02x", msg[i]); + fprintf(stderr, "\n"); + } +} +/*- End of function --------------------------------------------------------*/ + +static void t4_begin(void) +{ + int i; + + //printf("Begin T.4 - %d %d %d %d\n", line_encoding, x_resolution, y_resolution, image_width); + t4_rx_set_rx_encoding(&t4_state, line_encoding); + t4_rx_set_x_resolution(&t4_state, x_resolution); + t4_rx_set_y_resolution(&t4_state, y_resolution); + t4_rx_set_image_width(&t4_state, image_width); + + t4_rx_start_page(&t4_state); + t4_up = TRUE; + + for (i = 0; i < 256; i++) + ecm_len[i] = -1; +} +/*- End of function --------------------------------------------------------*/ + +static void t4_end(void) +{ + t4_stats_t stats; + int i; + int j; + int k; + + if (!t4_up) + return; + if (error_correcting_mode) + { + for (i = 0; i < 256; i++) + { + for (j = 0; j < ecm_len[i]; j++) + { + for (k = 0; k < 8; k++) + t4_rx_put_bit(&t4_state, (ecm_data[i][j] >> k) & 1); + } + fprintf(stderr, "%d", (ecm_len[i] < 0) ? 0 : 1); + } + fprintf(stderr, "\n"); + } + t4_rx_end_page(&t4_state); + t4_get_transfer_statistics(&t4_state, &stats); + fprintf(stderr, "Pages = %d\n", stats.pages_transferred); + fprintf(stderr, "Image size = %dx%d\n", stats.width, stats.length); + fprintf(stderr, "Image resolution = %dx%d\n", stats.x_resolution, stats.y_resolution); + fprintf(stderr, "Bad rows = %d\n", stats.bad_rows); + fprintf(stderr, "Longest bad row run = %d\n", stats.longest_bad_row_run); + t4_up = FALSE; +} +/*- End of function --------------------------------------------------------*/ + +static void v21_put_bit(void *user_data, int bit) +{ + if (bit < 0) + { + /* Special conditions */ + fprintf(stderr, "V.21 rx status is %s (%d)\n", signal_status_to_str(bit), bit); + switch (bit) + { + case SIG_STATUS_CARRIER_DOWN: + //t4_end(); + break; + } + return; + } + if (fast_trained == FAX_NONE) + hdlc_rx_put_bit(&hdlcrx, bit); + //printf("V.21 Rx bit %d - %d\n", rx_bits++, bit); +} +/*- End of function --------------------------------------------------------*/ + +static void v17_put_bit(void *user_data, int bit) +{ + if (bit < 0) + { + /* Special conditions */ + fprintf(stderr, "V.17 rx status is %s (%d)\n", signal_status_to_str(bit), bit); + switch (bit) + { + case SIG_STATUS_TRAINING_SUCCEEDED: + fast_trained = FAX_V17_RX; + t4_begin(); + break; + case SIG_STATUS_CARRIER_DOWN: + t4_end(); + if (fast_trained == FAX_V17_RX) + fast_trained = FAX_NONE; + break; + } + return; + } + if (error_correcting_mode) + { + hdlc_rx_put_bit(&hdlcrx, bit); + } + else + { + if (t4_rx_put_bit(&t4_state, bit)) + { + t4_end(); + fprintf(stderr, "End of page detected\n"); + } + } + //printf("V.17 Rx bit %d - %d\n", rx_bits++, bit); +} +/*- End of function --------------------------------------------------------*/ + +static void v29_put_bit(void *user_data, int bit) +{ + if (bit < 0) + { + /* Special conditions */ + fprintf(stderr, "V.29 rx status is %s (%d)\n", signal_status_to_str(bit), bit); + switch (bit) + { + case SIG_STATUS_TRAINING_SUCCEEDED: + fast_trained = FAX_V29_RX; + t4_begin(); + break; + case SIG_STATUS_CARRIER_DOWN: + t4_end(); + if (fast_trained == FAX_V29_RX) + fast_trained = FAX_NONE; + break; + } + return; + } + if (error_correcting_mode) + { + hdlc_rx_put_bit(&hdlcrx, bit); + } + else + { + if (t4_rx_put_bit(&t4_state, bit)) + { + t4_end(); + fprintf(stderr, "End of page detected\n"); + } + } + //printf("V.29 Rx bit %d - %d\n", rx_bits++, bit); +} +/*- End of function --------------------------------------------------------*/ + +static void v27ter_put_bit(void *user_data, int bit) +{ + if (bit < 0) + { + /* Special conditions */ + fprintf(stderr, "V.27ter rx status is %s (%d)\n", signal_status_to_str(bit), bit); + switch (bit) + { + case SIG_STATUS_TRAINING_SUCCEEDED: + fast_trained = FAX_V27TER_RX; + t4_begin(); + break; + case SIG_STATUS_CARRIER_DOWN: + t4_end(); + if (fast_trained == FAX_V27TER_RX) + fast_trained = FAX_NONE; + break; + } + return; + } + if (error_correcting_mode) + { + hdlc_rx_put_bit(&hdlcrx, bit); + } + else + { + if (t4_rx_put_bit(&t4_state, bit)) + { + t4_end(); + fprintf(stderr, "End of page detected\n"); + } + } + //printf("V.27ter Rx bit %d - %d\n", rx_bits++, bit); +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + fsk_rx_state_t *fsk; + v17_rx_state_t *v17; + v29_rx_state_t *v29; + v27ter_rx_state_t *v27ter; + int16_t amp[SAMPLES_PER_CHUNK]; + SNDFILE *inhandle; + SF_INFO info; + int len; + const char *filename; + logging_state_t *logging; + + filename = "fax_samp.wav"; + + if (argc > 1) + filename = argv[1]; + + memset(&info, 0, sizeof(info)); + if ((inhandle = sf_open(filename, SFM_READ, &info)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s' for reading\n", filename); + exit(2); + } + if (info.samplerate != SAMPLE_RATE) + { + printf(" Unexpected sample rate in audio file '%s'\n", filename); + exit(2); + } + if (info.channels != 1) + { + printf(" Unexpected number of channels in audio file '%s'\n", filename); + exit(2); + } + + memset(&t30_dummy, 0, sizeof(t30_dummy)); + span_log_init(&t30_dummy.logging, SPAN_LOG_FLOW, NULL); + span_log_set_protocol(&t30_dummy.logging, "T.30"); + + hdlc_rx_init(&hdlcrx, FALSE, TRUE, 5, hdlc_accept, NULL); + fsk = fsk_rx_init(NULL, &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, v21_put_bit, NULL); + v17 = v17_rx_init(NULL, 14400, v17_put_bit, NULL); + v29 = v29_rx_init(NULL, 9600, v29_put_bit, NULL); + //v29 = v29_rx_init(NULL, 7200, v29_put_bit, NULL); + v27ter = v27ter_rx_init(NULL, 4800, v27ter_put_bit, NULL); + fsk_rx_signal_cutoff(fsk, -45.5); + v17_rx_signal_cutoff(v17, -45.5); + v29_rx_signal_cutoff(v29, -45.5); + v27ter_rx_signal_cutoff(v27ter, -40.0); + +#if 1 + logging = v17_rx_get_logging_state(v17); + span_log_init(logging, SPAN_LOG_FLOW, NULL); + span_log_set_protocol(logging, "V.17"); + span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW); + + logging = v29_rx_get_logging_state(v29); + span_log_init(logging, SPAN_LOG_FLOW, NULL); + span_log_set_protocol(logging, "V.29"); + span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW); + + logging = v27ter_rx_get_logging_state(v27ter); + span_log_init(logging, SPAN_LOG_FLOW, NULL); + span_log_set_protocol(logging, "V.27ter"); + span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW); +#endif + + if (t4_rx_init(&t4_state, "fax_decode.tif", T4_COMPRESSION_ITU_T4_2D) == NULL) + { + fprintf(stderr, "Failed to init\n"); + exit(0); + } + + for (;;) + { + len = sf_readf_short(inhandle, amp, SAMPLES_PER_CHUNK); + if (len < SAMPLES_PER_CHUNK) + break; + fsk_rx(fsk, amp, len); + v17_rx(v17, amp, len); + v29_rx(v29, amp, len); + //v27ter_rx(v27ter, amp, len); + } + t4_rx_release(&t4_state); + + if (sf_close(inhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", filename); + exit(2); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/fax_tester.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/fax_tester.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,741 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * faxtester_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2008 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: fax_tester.c,v 1.23 2009/11/02 13:25:20 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include +#include +#include +#include + +#if defined(HAVE_LIBXML_XMLMEMORY_H) +#include +#endif +#if defined(HAVE_LIBXML_PARSER_H) +#include +#endif +#if defined(HAVE_LIBXML_XINCLUDE_H) +#include +#endif + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" + +#include "fax_tester.h" + +#define HDLC_FRAMING_OK_THRESHOLD 5 + +static void timer_update(faxtester_state_t *s, int len) +{ + s->timer += len; + if (s->timer > s->timeout) + { + s->timeout = 0x7FFFFFFFFFFFFFFFLL; + if (s->front_end_step_timeout_handler) + s->front_end_step_timeout_handler(s, s->front_end_step_timeout_user_data); + } +} +/*- End of function --------------------------------------------------------*/ + +static void front_end_step_complete(faxtester_state_t *s) +{ + if (s->front_end_step_complete_handler) + s->front_end_step_complete_handler(s, s->front_end_step_complete_user_data); +} +/*- End of function --------------------------------------------------------*/ + +void faxtester_send_hdlc_flags(faxtester_state_t *s, int flags) +{ + hdlc_tx_flags(&(s->modems.hdlc_tx), flags); +} +/*- End of function --------------------------------------------------------*/ + +void faxtester_send_hdlc_msg(faxtester_state_t *s, const uint8_t *msg, int len, int crc_ok) +{ + hdlc_tx_frame(&(s->modems.hdlc_tx), msg, len); + if (!crc_ok) + hdlc_tx_corrupt_frame(&(s->modems.hdlc_tx)); +} +/*- End of function --------------------------------------------------------*/ + +static void hdlc_underflow_handler(void *user_data) +{ + faxtester_state_t *s; + uint8_t buf[400]; + + s = (faxtester_state_t *) user_data; + + if (s->image_buffer) + { + /* We are sending an ECM image */ + if (s->image_ptr < s->image_len) + { + buf[0] = 0xFF; + buf[1] = 0x03; + buf[2] = 0x06; + buf[3] = s->image_ptr/s->ecm_frame_size; + memcpy(buf + 4, &s->image_buffer[s->image_ptr], s->ecm_frame_size); + hdlc_tx_frame(&(s->modems.hdlc_tx), buf, 4 + s->ecm_frame_size); + if (s->corrupt_crc >= 0 && s->corrupt_crc == s->image_ptr/s->ecm_frame_size) + hdlc_tx_corrupt_frame(&(s->modems.hdlc_tx)); + s->image_ptr += s->ecm_frame_size; + return; + } + else + { + /* The actual image is over. We are sending the final RCP frames. */ + if (s->image_bit_ptr > 2) + { + s->image_bit_ptr--; + buf[0] = 0xFF; + buf[1] = 0x03; + buf[2] = 0x86; + hdlc_tx_frame(&(s->modems.hdlc_tx), buf, 3); + return; + } + else + { + /* All done. */ + s->image_buffer = NULL; + } + } + } + front_end_step_complete(s); +} +/*- End of function --------------------------------------------------------*/ + +static void modem_tx_status(void *user_data, int status) +{ + faxtester_state_t *s; + + s = (faxtester_state_t *) user_data; + printf("Tx status is %s (%d)\n", signal_status_to_str(status), status); + switch (status) + { + case SIG_STATUS_SHUTDOWN_COMPLETE: + front_end_step_complete(s); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void tone_detected(void *user_data, int tone, int level, int delay) +{ + faxtester_state_t *s; + + s = (faxtester_state_t *) user_data; + span_log(&s->logging, + SPAN_LOG_FLOW, + "%s (%d) declared (%ddBm0)\n", + modem_connect_tone_to_str(tone), + tone, + level); + if (tone != MODEM_CONNECT_TONES_NONE) + { + s->tone_on_time = s->timer; + } + else + { + span_log(&s->logging, + SPAN_LOG_FLOW, + "Tone was on for %fs\n", + (float) (s->timer - s->tone_on_time)/SAMPLE_RATE + 0.55); + } + s->tone_state = tone; + if (tone == MODEM_CONNECT_TONES_NONE) + front_end_step_complete(s); +} +/*- End of function --------------------------------------------------------*/ + +static int non_ecm_get_bit(void *user_data) +{ + faxtester_state_t *s; + int bit; + + s = (faxtester_state_t *) user_data; + if (s->image_bit_ptr == 0) + { + if (s->image_ptr >= s->image_len) + { + s->image_buffer = NULL; + return SIG_STATUS_END_OF_DATA; + } + s->image_bit_ptr = 8; + s->image_ptr++; + } + s->image_bit_ptr--; + bit = (s->image_buffer[s->image_ptr] >> (7 - s->image_bit_ptr)) & 0x01; + //printf("Rx bit - %d\n", bit); + return bit; +} +/*- End of function --------------------------------------------------------*/ + +void faxtester_set_non_ecm_image_buffer(faxtester_state_t *s, const uint8_t *buf, int len) +{ + s->image_ptr = 0; + s->image_bit_ptr = 8; + s->image_len = len; + s->image_buffer = buf; +} +/*- End of function --------------------------------------------------------*/ + +void faxtester_set_ecm_image_buffer(faxtester_state_t *s, const uint8_t *buf, int len, int block, int frame_size, int crc_hit) +{ + int start; + + start = 256*frame_size*block; + if (len > start + 256*frame_size) + len = start + 256*frame_size; + + s->ecm_frame_size = frame_size; + s->image_ptr = start; + s->image_bit_ptr = 8; + s->image_len = len; + s->image_buffer = buf; + s->corrupt_crc = crc_hit; + /* Send the first frame */ + hdlc_underflow_handler(s); +} +/*- End of function --------------------------------------------------------*/ + +static void non_ecm_rx_status(void *user_data, int status) +{ + faxtester_state_t *s; + + s = (faxtester_state_t *) user_data; + span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM carrier status is %s (%d)\n", signal_status_to_str(status), status); + switch (status) + { + case SIG_STATUS_TRAINING_FAILED: + s->modems.rx_trained = FALSE; + break; + case SIG_STATUS_TRAINING_SUCCEEDED: + /* The modem is now trained */ + s->modems.rx_trained = TRUE; + break; + case SIG_STATUS_CARRIER_UP: + s->modems.rx_signal_present = TRUE; + break; + case SIG_STATUS_CARRIER_DOWN: + if (s->modems.rx_trained) + { + if (s->real_time_frame_handler) + s->real_time_frame_handler(s, s->real_time_frame_user_data, TRUE, NULL, 0); + } + s->modems.rx_signal_present = FALSE; + s->modems.rx_trained = FALSE; + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void non_ecm_put_bit(void *user_data, int bit) +{ + faxtester_state_t *s; + + if (bit < 0) + { + non_ecm_rx_status(user_data, bit); + return; + } + s = (faxtester_state_t *) user_data; +} +/*- End of function --------------------------------------------------------*/ + +static void hdlc_rx_status(void *user_data, int status) +{ + faxtester_state_t *s; + + s = (faxtester_state_t *) user_data; + fprintf(stderr, "HDLC carrier status is %s (%d)\n", signal_status_to_str(status), status); + switch (status) + { + case SIG_STATUS_TRAINING_FAILED: + s->modems.rx_trained = FALSE; + break; + case SIG_STATUS_TRAINING_SUCCEEDED: + /* The modem is now trained */ + s->modems.rx_trained = TRUE; + break; + case SIG_STATUS_CARRIER_UP: + s->modems.rx_signal_present = TRUE; + break; + case SIG_STATUS_CARRIER_DOWN: + s->modems.rx_signal_present = FALSE; + s->modems.rx_trained = FALSE; + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok) +{ + faxtester_state_t *s; + + if (len < 0) + { + hdlc_rx_status(user_data, len); + return; + } + s = (faxtester_state_t *) user_data; + if (s->real_time_frame_handler) + s->real_time_frame_handler(s, s->real_time_frame_user_data, TRUE, msg, len); +} +/*- End of function --------------------------------------------------------*/ + +static int v17_v21_rx(void *user_data, const int16_t amp[], int len) +{ + faxtester_state_t *t; + fax_modems_state_t *s; + + t = (faxtester_state_t *) user_data; + s = &t->modems; + v17_rx(&s->v17_rx, amp, len); + fsk_rx(&s->v21_rx, amp, len); + if (s->rx_trained) + { + /* The fast modem has trained, so we no longer need to run the slow + one in parallel. */ + span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.17 (%.2fdBm0)\n", v17_rx_signal_power(&s->v17_rx)); + s->rx_handler = (span_rx_handler_t *) &v17_rx; + s->rx_user_data = &s->v17_rx; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len) +{ + faxtester_state_t *t; + fax_modems_state_t *s; + + t = (faxtester_state_t *) user_data; + s = &t->modems; + v27ter_rx(&s->v27ter_rx, amp, len); + fsk_rx(&s->v21_rx, amp, len); + if (s->rx_trained) + { + /* The fast modem has trained, so we no longer need to run the slow + one in parallel. */ + span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.27ter (%.2fdBm0)\n", v27ter_rx_signal_power(&s->v27ter_rx)); + s->rx_handler = (span_rx_handler_t *) &v27ter_rx; + s->rx_user_data = &s->v27ter_rx; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int v29_v21_rx(void *user_data, const int16_t amp[], int len) +{ + faxtester_state_t *t; + fax_modems_state_t *s; + + t = (faxtester_state_t *) user_data; + s = &t->modems; + v29_rx(&s->v29_rx, amp, len); + fsk_rx(&s->v21_rx, amp, len); + if (s->rx_trained) + { + /* The fast modem has trained, so we no longer need to run the slow + one in parallel. */ + span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.29 (%.2fdBm0)\n", v29_rx_signal_power(&s->v29_rx)); + s->rx_handler = (span_rx_handler_t *) &v29_rx; + s->rx_user_data = &s->v29_rx; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int faxtester_rx(faxtester_state_t *s, int16_t *amp, int len) +{ + int i; + + for (i = 0; i < len; i++) + amp[i] = dc_restore(&(s->modems.dc_restore), amp[i]); + s->modems.rx_handler(s->modems.rx_user_data, amp, len); + timer_update(s, len); + if (s->wait_for_silence) + { + if (!s->modems.rx_signal_present) + { + s->wait_for_silence = FALSE; + front_end_step_complete(s); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int faxtester_tx(faxtester_state_t *s, int16_t *amp, int max_len) +{ + int len; + int required_len; + + required_len = max_len; + len = 0; + if (s->transmit) + { + while ((len += s->modems.tx_handler(s->modems.tx_user_data, amp + len, max_len - len)) < max_len) + { + /* Allow for a change of tx handler within a block */ + front_end_step_complete(s); + if (!s->transmit) + { + if (s->modems.transmit_on_idle) + { + /* Pad to the requested length with silence */ + memset(amp + len, 0, (max_len - len)*sizeof(int16_t)); + len = max_len; + } + break; + } + } + } + else + { + if (s->modems.transmit_on_idle) + { + /* Pad to the requested length with silence */ + memset(amp, 0, max_len*sizeof(int16_t)); + len = max_len; + } + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +void faxtest_set_rx_silence(faxtester_state_t *s) +{ + s->wait_for_silence = TRUE; +} +/*- End of function --------------------------------------------------------*/ + +void faxtester_set_rx_type(void *user_data, int type, int bit_rate, int short_train, int use_hdlc) +{ + faxtester_state_t *s; + put_bit_func_t put_bit_func; + void *put_bit_user_data; + fax_modems_state_t *t; + int tone; + + s = (faxtester_state_t *) user_data; + t = &s->modems; + span_log(&s->logging, SPAN_LOG_FLOW, "Set rx type %d\n", type); + if (s->current_rx_type == type) + return; + s->current_rx_type = type; + if (use_hdlc) + { + put_bit_func = (put_bit_func_t) hdlc_rx_put_bit; + put_bit_user_data = (void *) &t->hdlc_rx; + hdlc_rx_init(&t->hdlc_rx, FALSE, FALSE, HDLC_FRAMING_OK_THRESHOLD, hdlc_accept, s); + } + else + { + put_bit_func = non_ecm_put_bit; + put_bit_user_data = (void *) s; + } + switch (type) + { + case T30_MODEM_CED: + case T30_MODEM_CNG: + if (type == T30_MODEM_CED) + tone = MODEM_CONNECT_TONES_FAX_CED; + else + tone = MODEM_CONNECT_TONES_FAX_CNG; + modem_connect_tones_rx_init(&t->connect_rx, + tone, + tone_detected, + (void *) s); + t->rx_handler = (span_rx_handler_t *) &modem_connect_tones_rx; + t->rx_user_data = &t->connect_rx; + s->tone_state = MODEM_CONNECT_TONES_NONE; + break; + case T30_MODEM_V21: + if (s->flush_handler) + s->flush_handler(s, s->flush_user_data, 3); + fsk_rx_init(&t->v21_rx, &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) hdlc_rx_put_bit, put_bit_user_data); + fsk_rx_signal_cutoff(&t->v21_rx, -45.5); + t->rx_handler = (span_rx_handler_t *) &fsk_rx; + t->rx_user_data = &t->v21_rx; + break; + case T30_MODEM_V27TER: + v27ter_rx_restart(&t->v27ter_rx, bit_rate, FALSE); + v27ter_rx_set_put_bit(&t->v27ter_rx, put_bit_func, put_bit_user_data); + t->rx_handler = (span_rx_handler_t *) &v27ter_v21_rx; + t->rx_user_data = s; + break; + case T30_MODEM_V29: + v29_rx_restart(&t->v29_rx, bit_rate, FALSE); + v29_rx_set_put_bit(&t->v29_rx, put_bit_func, put_bit_user_data); + t->rx_handler = (span_rx_handler_t *) &v29_v21_rx; + t->rx_user_data = s; + break; + case T30_MODEM_V17: + v17_rx_restart(&t->v17_rx, bit_rate, short_train); + v17_rx_set_put_bit(&t->v17_rx, put_bit_func, put_bit_user_data); + t->rx_handler = (span_rx_handler_t *) &v17_v21_rx; + t->rx_user_data = s; + break; + case T30_MODEM_DONE: + span_log(&s->logging, SPAN_LOG_FLOW, "FAX exchange complete\n"); + default: + t->rx_handler = (span_rx_handler_t *) &span_dummy_rx; + t->rx_user_data = s; + break; + } +} +/*- End of function --------------------------------------------------------*/ + +void faxtester_set_tx_type(void *user_data, int type, int bit_rate, int short_train, int use_hdlc) +{ + faxtester_state_t *s; + get_bit_func_t get_bit_func; + void *get_bit_user_data; + fax_modems_state_t *t; + int tone; + + s = (faxtester_state_t *) user_data; + t = &s->modems; + span_log(&s->logging, SPAN_LOG_FLOW, "Set tx type %d\n", type); + if (s->current_tx_type == type) + return; + if (use_hdlc) + { + get_bit_func = (get_bit_func_t) hdlc_tx_get_bit; + get_bit_user_data = (void *) &t->hdlc_tx; + } + else + { + get_bit_func = non_ecm_get_bit; + get_bit_user_data = (void *) s; + } + switch (type) + { + case T30_MODEM_PAUSE: + silence_gen_alter(&t->silence_gen, ms_to_samples(short_train)); + t->tx_handler = (span_tx_handler_t *) &silence_gen; + t->tx_user_data = &t->silence_gen; + s->transmit = TRUE; + break; + case T30_MODEM_CED: + case T30_MODEM_CNG: + if (type == T30_MODEM_CED) + tone = MODEM_CONNECT_TONES_FAX_CED; + else + tone = MODEM_CONNECT_TONES_FAX_CNG; + modem_connect_tones_tx_init(&t->connect_tx, tone); + t->tx_handler = (span_tx_handler_t *) &modem_connect_tones_tx; + t->tx_user_data = &t->connect_tx; + s->transmit = TRUE; + break; + case T30_MODEM_V21: + fsk_tx_init(&t->v21_tx, &preset_fsk_specs[FSK_V21CH2], get_bit_func, get_bit_user_data); + fsk_tx_set_modem_status_handler(&t->v21_tx, modem_tx_status, (void *) s); + t->tx_handler = (span_tx_handler_t *) &fsk_tx; + t->tx_user_data = &t->v21_tx; + s->transmit = TRUE; + break; + case T30_MODEM_V27TER: + v27ter_tx_restart(&t->v27ter_tx, bit_rate, t->use_tep); + v27ter_tx_set_get_bit(&t->v27ter_tx, get_bit_func, get_bit_user_data); + v27ter_tx_set_modem_status_handler(&t->v27ter_tx, modem_tx_status, (void *) s); + t->tx_handler = (span_tx_handler_t *) &v27ter_tx; + t->tx_user_data = &t->v27ter_tx; + /* For any fast modem, set 200ms of preamble flags */ + hdlc_tx_flags(&t->hdlc_tx, bit_rate/(8*5)); + s->transmit = TRUE; + break; + case T30_MODEM_V29: + v29_tx_restart(&t->v29_tx, bit_rate, t->use_tep); + v29_tx_set_get_bit(&t->v29_tx, get_bit_func, get_bit_user_data); + v29_tx_set_modem_status_handler(&t->v29_tx, modem_tx_status, (void *) s); + t->tx_handler = (span_tx_handler_t *) &v29_tx; + t->tx_user_data = &t->v29_tx; + /* For any fast modem, set 200ms of preamble flags */ + hdlc_tx_flags(&t->hdlc_tx, bit_rate/(8*5)); + s->transmit = TRUE; + break; + case T30_MODEM_V17: + v17_tx_restart(&t->v17_tx, bit_rate, t->use_tep, short_train); + v17_tx_set_get_bit(&t->v17_tx, get_bit_func, get_bit_user_data); + v17_tx_set_modem_status_handler(&t->v17_tx, modem_tx_status, (void *) s); + t->tx_handler = (span_tx_handler_t *) &v17_tx; + t->tx_user_data = &t->v17_tx; + /* For any fast modem, set 200ms of preamble flags */ + hdlc_tx_flags(&t->hdlc_tx, bit_rate/(8*5)); + s->transmit = TRUE; + break; + case T30_MODEM_DONE: + span_log(&s->logging, SPAN_LOG_FLOW, "FAX exchange complete\n"); + /* Fall through */ + default: + silence_gen_alter(&t->silence_gen, 0); + t->tx_handler = (span_tx_handler_t *) &silence_gen; + t->tx_user_data = &t->silence_gen; + s->transmit = FALSE; + break; + } + s->current_tx_type = type; +} +/*- End of function --------------------------------------------------------*/ + +void faxtester_set_timeout(faxtester_state_t *s, int timeout) +{ + if (timeout >= 0) + s->timeout = s->timer + timeout*SAMPLE_RATE/1000; + else + s->timeout = 0x7FFFFFFFFFFFFFFFLL; +} +/*- End of function --------------------------------------------------------*/ + +void faxtester_set_transmit_on_idle(faxtester_state_t *s, int transmit_on_idle) +{ + s->modems.transmit_on_idle = transmit_on_idle; +} +/*- End of function --------------------------------------------------------*/ + +void faxtester_set_tep_mode(faxtester_state_t *s, int use_tep) +{ + s->modems.use_tep = use_tep; +} +/*- End of function --------------------------------------------------------*/ + +void faxtester_set_real_time_frame_handler(faxtester_state_t *s, faxtester_real_time_frame_handler_t *handler, void *user_data) +{ + s->real_time_frame_handler = handler; + s->real_time_frame_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +void faxtester_set_front_end_step_complete_handler(faxtester_state_t *s, faxtester_front_end_step_complete_handler_t *handler, void *user_data) +{ + s->front_end_step_complete_handler = handler; + s->front_end_step_complete_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +void faxtester_set_front_end_step_timeout_handler(faxtester_state_t *s, faxtester_front_end_step_complete_handler_t *handler, void *user_data) +{ + s->front_end_step_timeout_handler = handler; + s->front_end_step_timeout_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +static void faxtester_fax_modems_init(fax_modems_state_t *s, int use_tep, void *user_data) +{ + s->use_tep = use_tep; + + hdlc_rx_init(&s->hdlc_rx, FALSE, FALSE, HDLC_FRAMING_OK_THRESHOLD, hdlc_accept, user_data); + hdlc_tx_init(&s->hdlc_tx, FALSE, 2, FALSE, hdlc_underflow_handler, user_data); + fsk_rx_init(&s->v21_rx, &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) hdlc_rx_put_bit, &s->hdlc_rx); + fsk_rx_signal_cutoff(&s->v21_rx, -45.5); + fsk_tx_init(&s->v21_tx, &preset_fsk_specs[FSK_V21CH2], (get_bit_func_t) hdlc_tx_get_bit, &s->hdlc_tx); + fsk_tx_set_modem_status_handler(&s->v21_tx, modem_tx_status, user_data); + v17_rx_init(&s->v17_rx, 14400, non_ecm_put_bit, user_data); + v17_tx_init(&s->v17_tx, 14400, s->use_tep, non_ecm_get_bit, user_data); + v17_tx_set_modem_status_handler(&s->v17_tx, modem_tx_status, user_data); + v29_rx_init(&s->v29_rx, 9600, non_ecm_put_bit, user_data); + v29_rx_signal_cutoff(&s->v29_rx, -45.5); + v29_tx_init(&s->v29_tx, 9600, s->use_tep, non_ecm_get_bit, user_data); + v29_tx_set_modem_status_handler(&s->v29_tx, modem_tx_status, user_data); + v27ter_rx_init(&s->v27ter_rx, 4800, non_ecm_put_bit, user_data); + v27ter_tx_init(&s->v27ter_tx, 4800, s->use_tep, non_ecm_get_bit, user_data); + v27ter_tx_set_modem_status_handler(&s->v27ter_tx, modem_tx_status, user_data); + silence_gen_init(&s->silence_gen, 0); + modem_connect_tones_tx_init(&s->connect_tx, MODEM_CONNECT_TONES_FAX_CNG); + modem_connect_tones_rx_init(&s->connect_rx, + MODEM_CONNECT_TONES_FAX_CNG, + tone_detected, + user_data); + dc_restore_init(&s->dc_restore); + + s->rx_signal_present = FALSE; + s->rx_handler = (span_rx_handler_t *) &span_dummy_rx; + s->rx_user_data = NULL; + s->tx_handler = (span_tx_handler_t *) &silence_gen; + s->tx_user_data = &s->silence_gen; +} +/*- End of function --------------------------------------------------------*/ + +faxtester_state_t *faxtester_init(faxtester_state_t *s, int calling_party) +{ + if (s == NULL) + { + if ((s = (faxtester_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "TST"); + faxtester_fax_modems_init(&s->modems, FALSE, s); + faxtester_set_timeout(s, -1); + faxtester_set_tx_type(s, T30_MODEM_NONE, 0, FALSE, FALSE); + + return s; +} +/*- End of function --------------------------------------------------------*/ + +int faxtester_release(faxtester_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int faxtester_free(faxtester_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +void faxtester_set_flush_handler(faxtester_state_t *s, faxtester_flush_handler_t *handler, void *user_data) +{ + s->flush_handler = handler; + s->flush_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/fax_tester.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/fax_tester.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,210 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * fax_tester.h + * + * Written by Steve Underwood + * + * Copyright (C) 2008 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: fax_tester.h,v 1.9 2008/09/12 14:41:55 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_FAX_TESTER_H_) +#define _SPANDSP_FAX_TESTER_H_ + +/*! \page fax_tester_page FAX over analogue modem handling + +\section fax_tester_page_sec_1 What does it do? + +\section fax_tester_page_sec_2 How does it work? +*/ + +typedef struct faxtester_state_s faxtester_state_t; + +typedef void (faxtester_flush_handler_t)(faxtester_state_t *s, void *user_data, int which); + +/*! + FAX tester real time frame handler. + \brief FAX tester real time frame handler. + \param s The FAX tester context. + \param user_data An opaque pointer. + \param direction TRUE for incoming, FALSE for outgoing. + \param msg The HDLC message. + \param len The length of the message. +*/ +typedef void (faxtester_real_time_frame_handler_t)(faxtester_state_t *s, + void *user_data, + int direction, + const uint8_t *msg, + int len); + +typedef void (faxtester_front_end_step_complete_handler_t)(faxtester_state_t *s, void *user_data); + +/*! + FAX tester descriptor. +*/ +struct faxtester_state_s +{ + /*! \brief Pointer to our current step in the test. */ + xmlNodePtr cur; + + faxtester_flush_handler_t *flush_handler; + void *flush_user_data; + + /*! \brief A pointer to a callback routine to be called when frames are + exchanged. */ + faxtester_real_time_frame_handler_t *real_time_frame_handler; + /*! \brief An opaque pointer supplied in real time frame callbacks. */ + void *real_time_frame_user_data; + + faxtester_front_end_step_complete_handler_t *front_end_step_complete_handler; + void *front_end_step_complete_user_data; + + faxtester_front_end_step_complete_handler_t *front_end_step_timeout_handler; + void *front_end_step_timeout_user_data; + + const uint8_t *image_buffer; + int image_len; + int image_ptr; + int image_bit_ptr; + + int ecm_frame_size; + int corrupt_crc; + + int final_delayed; + + fax_modems_state_t modems; + + /*! If TRUE, transmission is in progress */ + int transmit; + + /*! \brief TRUE is the short training sequence should be used. */ + int short_train; + + /*! \brief The currently select receiver type */ + int current_rx_type; + /*! \brief The currently select transmitter type */ + int current_tx_type; + + int wait_for_silence; + + int tone_state; + int64_t tone_on_time; + + int64_t timer; + int64_t timeout; + + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! Apply T.30 receive processing to a block of audio samples. + \brief Apply T.30 receive processing to a block of audio samples. + \param s The FAX tester context. + \param amp The audio sample buffer. + \param len The number of samples in the buffer. + \return The number of samples unprocessed. This should only be non-zero if + the software has reached the end of the FAX call. +*/ +int faxtester_rx(faxtester_state_t *s, int16_t *amp, int len); + +/*! Apply T.30 transmit processing to generate a block of audio samples. + \brief Apply T.30 transmit processing to generate a block of audio samples. + \param s The FAX tester context. + \param amp The audio sample buffer. + \param max_len The number of samples to be generated. + \return The number of samples actually generated. This will be zero when + there is nothing to send. +*/ +int faxtester_tx(faxtester_state_t *s, int16_t *amp, int max_len); + +void faxtester_set_tx_type(void *user_data, int type, int bit_rate, int short_train, int use_hdlc); + +void faxtester_set_rx_type(void *user_data, int type, int bit_rate, int short_train, int use_hdlc); + +void faxtest_set_rx_silence(faxtester_state_t *s); + +void faxtester_send_hdlc_flags(faxtester_state_t *s, int flags); + +void faxtester_send_hdlc_msg(faxtester_state_t *s, const uint8_t *msg, int len, int crc_ok); + +void faxtester_set_flush_handler(faxtester_state_t *s, faxtester_flush_handler_t *handler, void *user_data); + +/*! Select whether silent audio will be sent when FAX transmit is idle. + \brief Select whether silent audio will be sent when FAX transmit is idle. + \param s The FAX tester context. + \param transmit_on_idle TRUE if silent audio should be output when the FAX transmitter is + idle. FALSE to transmit zero length audio when the FAX transmitter is idle. The default + behaviour is FALSE. +*/ +void faxtester_set_transmit_on_idle(faxtester_state_t *s, int transmit_on_idle); + +/*! Select whether talker echo protection tone will be sent for the image modems. + \brief Select whether TEP will be sent for the image modems. + \param s The FAX tester context. + \param use_tep TRUE if TEP should be sent. +*/ +void faxtester_set_tep_mode(faxtester_state_t *s, int use_tep); + +void faxtester_set_real_time_frame_handler(faxtester_state_t *s, faxtester_real_time_frame_handler_t *handler, void *user_data); + +void faxtester_set_front_end_step_complete_handler(faxtester_state_t *s, faxtester_front_end_step_complete_handler_t *handler, void *user_data); + +void faxtester_set_front_end_step_timeout_handler(faxtester_state_t *s, faxtester_front_end_step_complete_handler_t *handler, void *user_data); + +void faxtester_set_timeout(faxtester_state_t *s, int timeout); + +void faxtester_set_non_ecm_image_buffer(faxtester_state_t *s, const uint8_t *buf, int len); + +void faxtester_set_ecm_image_buffer(faxtester_state_t *s, const uint8_t *buf, int len, int block, int frame_size, int crc_hit); + +/*! Initialise a FAX context. + \brief Initialise a FAX context. + \param s The FAX tester context. + \param calling_party TRUE if the context is for a calling party. FALSE if the + context is for an answering party. + \return A pointer to the FAX context, or NULL if there was a problem. +*/ +faxtester_state_t *faxtester_init(faxtester_state_t *s, int calling_party); + +/*! Release a FAX context. + \brief Release a FAX context. + \param s The FAX tester context. + \return 0 for OK, else -1. */ +int faxtester_release(faxtester_state_t *s); + +/*! Free a FAX context. + \brief Free a FAX context. + \param s The FAX tester context. + \return 0 for OK, else -1. */ +int faxtester_free(faxtester_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/fax_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/fax_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,529 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * fax_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: fax_tests.c,v 1.102 2009/05/30 15:23:13 steveu Exp $ + */ + +/*! \page fax_tests_page FAX tests +\section fax_tests_page_sec_1 What does it do? +\section fax_tests_page_sec_2 How does it work? +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#include "fax_utils.h" + +#define SAMPLES_PER_CHUNK 160 + +#define INPUT_TIFF_FILE_NAME "../test-data/itu/fax/itutests.tif" + +#define OUTPUT_FILE_NAME_WAVE "fax_tests.wav" + +#define FAX_MACHINES 2 + +struct machine_s +{ + int chan; + int16_t amp[SAMPLES_PER_CHUNK]; + int len; + fax_state_t *fax; + awgn_state_t *awgn; + int done; + int succeeded; + char tag[50]; + int error_delay; + int total_audio_time; +} machines[FAX_MACHINES]; + +int use_receiver_not_ready = FALSE; +int test_local_interrupt = FALSE; +int t30_state_to_wreck = -1; + +static int phase_b_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + char tag[20]; + + i = (int) (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase B:", i); + printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result)); + log_rx_parameters(s, tag); + return T30_ERR_OK; +} +/*- End of function --------------------------------------------------------*/ + +static int phase_d_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + char tag[20]; + + i = (int) (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase D:", i); + printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result)); + log_transfer_statistics(s, tag); + log_tx_parameters(s, tag); + log_rx_parameters(s, tag); + + if (use_receiver_not_ready) + t30_set_receiver_not_ready(s, 3); + + if (test_local_interrupt) + { + if (i == 0) + { + printf("%d: Initiating interrupt request\n", i); + t30_local_interrupt_request(s, TRUE); + } + else + { + switch (result) + { + case T30_PIP: + case T30_PRI_MPS: + case T30_PRI_EOM: + case T30_PRI_EOP: + printf("%d: Accepting interrupt request\n", i); + t30_local_interrupt_request(s, TRUE); + break; + case T30_PIN: + break; + } + } + } + return T30_ERR_OK; +} +/*- End of function --------------------------------------------------------*/ + +static void phase_e_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + t30_stats_t t; + char tag[20]; + + i = (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase E:", i); + printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result)); + log_transfer_statistics(s, tag); + log_tx_parameters(s, tag); + log_rx_parameters(s, tag); + t30_get_transfer_statistics(s, &t); + machines[i - 'A'].succeeded = (result == T30_ERR_OK) && (t.pages_tx == 12 || t.pages_rx == 12); + machines[i - 'A'].done = TRUE; +} +/*- End of function --------------------------------------------------------*/ + +static void real_time_frame_handler(t30_state_t *s, + void *user_data, + int direction, + const uint8_t *msg, + int len) +{ + int i; + + i = (intptr_t) user_data; + printf("%c: Real time frame handler on channel %c - %s, %s, length = %d\n", + i, + i, + (direction) ? "line->T.30" : "T.30->line", + t30_frametype(msg[2]), + len); +} +/*- End of function --------------------------------------------------------*/ + +static int document_handler(t30_state_t *s, void *user_data, int event) +{ + int i; + + i = (intptr_t) user_data; + printf("%c: Document handler on channel %c - event %d\n", i, i, event); + return FALSE; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + SNDFILE *wave_handle; + SNDFILE *input_wave_handle; + int i; + int j; + int k; + struct machine_s *mc; + int outframes; + char buf[128 + 1]; + int16_t silence[SAMPLES_PER_CHUNK]; + int16_t out_amp[2*SAMPLES_PER_CHUNK]; + int alldone; + const char *input_tiff_file_name; + const char *input_audio_file_name; + int log_audio; + int use_ecm; + int use_tep; + int use_transmit_on_idle; + int use_line_hits; + int polled_mode; + int reverse_flow; + int use_page_limits; + int supported_modems; + int signal_level; + int noise_level; + float signal_scaling; + time_t start_time; + time_t end_time; + char *page_header_info; + int opt; + t30_state_t *t30; + logging_state_t *logging; + + log_audio = FALSE; + input_tiff_file_name = INPUT_TIFF_FILE_NAME; + input_audio_file_name = NULL; + use_ecm = FALSE; + use_line_hits = FALSE; + use_tep = FALSE; + polled_mode = FALSE; + page_header_info = NULL; + reverse_flow = FALSE; + use_transmit_on_idle = TRUE; + use_receiver_not_ready = FALSE; + use_page_limits = FALSE; + signal_level = 0; + noise_level = -99; + supported_modems = T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17; + while ((opt = getopt(argc, argv, "ehH:i:I:lm:n:prRs:tTw:")) != -1) + { + switch (opt) + { + case 'e': + use_ecm = TRUE; + break; + case 'h': + use_line_hits = TRUE; + break; + case 'H': + page_header_info = optarg; + break; + case 'i': + input_tiff_file_name = optarg; + break; + case 'I': + input_audio_file_name = optarg; + break; + case 'l': + log_audio = TRUE; + break; + case 'm': + supported_modems = atoi(optarg); + break; + case 'n': + noise_level = atoi(optarg); + break; + case 'p': + polled_mode = TRUE; + break; + case 'r': + reverse_flow = TRUE; + break; + case 'R': + use_receiver_not_ready = TRUE; + break; + case 's': + signal_level = atoi(optarg); + break; + case 't': + use_tep = TRUE; + break; + case 'T': + use_page_limits = TRUE; + break; + case 'w': + t30_state_to_wreck = atoi(optarg); + break; + default: + //usage(); + exit(2); + break; + } + } + + input_wave_handle = NULL; + if (input_audio_file_name) + { + if ((input_wave_handle = sf_open_telephony_read(input_audio_file_name, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", input_audio_file_name); + exit(2); + } + } + + wave_handle = NULL; + if (log_audio) + { + if ((wave_handle = sf_open_telephony_write(OUTPUT_FILE_NAME_WAVE, 2)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_FILE_NAME_WAVE); + exit(2); + } + } + + memset(silence, 0, sizeof(silence)); + for (j = 0; j < FAX_MACHINES; j++) + { + machines[j].chan = j; + mc = &machines[j]; + + i = mc->chan + 1; + sprintf(buf, "%d%d%d%d%d%d%d%d", i, i, i, i, i, i, i, i); + if (reverse_flow) + mc->fax = fax_init(NULL, (mc->chan & 1) ? TRUE : FALSE); + else + mc->fax = fax_init(NULL, (mc->chan & 1) ? FALSE : TRUE); + mc->awgn = NULL; + signal_scaling = 1.0f; + if (noise_level > -99) + { + mc->awgn = awgn_init_dbm0(NULL, 1234567, noise_level); + signal_scaling = powf(10.0f, signal_level/20.0f); + printf("Signal scaling %f\n", signal_scaling); + } + fax_set_transmit_on_idle(mc->fax, use_transmit_on_idle); + fax_set_tep_mode(mc->fax, use_tep); + t30 = fax_get_t30_state(mc->fax); + t30_set_tx_ident(t30, buf); + t30_set_tx_sub_address(t30, "Sub-address"); + t30_set_tx_sender_ident(t30, "Sender ID"); + t30_set_tx_password(t30, "Password"); + t30_set_tx_polled_sub_address(t30, "Polled sub-address"); + t30_set_tx_selective_polling_address(t30, "Selective polling address"); + t30_set_tx_page_header_info(t30, page_header_info); + t30_set_tx_nsf(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp\x00", 12); + t30_set_ecm_capability(t30, use_ecm); + t30_set_supported_t30_features(t30, + T30_SUPPORT_IDENTIFICATION + | T30_SUPPORT_SELECTIVE_POLLING + | T30_SUPPORT_SUB_ADDRESSING); + + if ((mc->chan & 1)) + t30_set_minimum_scan_line_time(t30, 40); + t30_set_supported_image_sizes(t30, + T30_SUPPORT_US_LETTER_LENGTH + | T30_SUPPORT_US_LEGAL_LENGTH + | T30_SUPPORT_UNLIMITED_LENGTH + | T30_SUPPORT_215MM_WIDTH + | T30_SUPPORT_255MM_WIDTH + | T30_SUPPORT_303MM_WIDTH); + t30_set_supported_resolutions(t30, + T30_SUPPORT_STANDARD_RESOLUTION + | T30_SUPPORT_FINE_RESOLUTION + | T30_SUPPORT_SUPERFINE_RESOLUTION + | T30_SUPPORT_R8_RESOLUTION + | T30_SUPPORT_R16_RESOLUTION + | T30_SUPPORT_300_300_RESOLUTION + | T30_SUPPORT_400_400_RESOLUTION + | T30_SUPPORT_600_600_RESOLUTION + | T30_SUPPORT_1200_1200_RESOLUTION + | T30_SUPPORT_300_600_RESOLUTION + | T30_SUPPORT_400_800_RESOLUTION + | T30_SUPPORT_600_1200_RESOLUTION); + t30_set_supported_modems(t30, supported_modems); + if (use_ecm) + t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION); + if ((mc->chan & 1)) + { + if (polled_mode) + { + if (use_page_limits) + t30_set_tx_file(t30, input_tiff_file_name, 3, 6); + else + t30_set_tx_file(t30, input_tiff_file_name, -1, -1); + } + else + { + sprintf(buf, "fax_tests_%d.tif", (mc->chan + 1)/2); + t30_set_rx_file(t30, buf, -1); + t30_set_rx_encoding(t30, T4_COMPRESSION_ITU_T6); + } + } + else + { + if (polled_mode) + { + sprintf(buf, "fax_tests_%d.tif", (mc->chan + 1)/2); + t30_set_rx_file(t30, buf, -1); + t30_set_rx_encoding(t30, T4_COMPRESSION_ITU_T6); + } + else + { + if (use_page_limits) + t30_set_tx_file(t30, input_tiff_file_name, 3, 6); + else + t30_set_tx_file(t30, input_tiff_file_name, -1, -1); + } + } + t30_set_phase_b_handler(t30, phase_b_handler, (void *) (intptr_t) mc->chan + 'A'); + t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) mc->chan + 'A'); + t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) mc->chan + 'A'); + t30_set_real_time_frame_handler(t30, real_time_frame_handler, (void *) (intptr_t) mc->chan + 'A'); + t30_set_document_handler(t30, document_handler, (void *) (intptr_t) mc->chan + 'A'); + sprintf(mc->tag, "FAX-%d", j + 1); + + logging = t30_get_logging_state(t30); + span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + span_log_set_tag(logging, mc->tag); + span_log_set_level(&t30->t4.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + span_log_set_tag(&t30->t4.logging, mc->tag); + + logging = fax_get_logging_state(mc->fax); + span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + span_log_set_tag(logging, mc->tag); + + memset(mc->amp, 0, sizeof(mc->amp)); + mc->total_audio_time = 0; + mc->done = FALSE; + } + time(&start_time); + for (;;) + { + alldone = TRUE; + for (j = 0; j < FAX_MACHINES; j++) + { + mc = &machines[j]; + + if ((j & 1) == 0 && input_audio_file_name) + { + mc->len = sf_readf_short(input_wave_handle, mc->amp, SAMPLES_PER_CHUNK); + if (mc->len == 0) + break; + } + else + { + mc->len = fax_tx(mc->fax, mc->amp, SAMPLES_PER_CHUNK); + if (mc->awgn) + { + for (k = 0; k < mc->len; k++) + mc->amp[k] = ((int16_t) (mc->amp[k]*signal_scaling)) + awgn(mc->awgn); + } + } + mc->total_audio_time += SAMPLES_PER_CHUNK; + if (!use_transmit_on_idle) + { + /* The receive side always expects a full block of samples, but the + transmit side may not be sending any when it doesn't need to. We + may need to pad with some silence. */ + if (mc->len < SAMPLES_PER_CHUNK) + { + memset(mc->amp + mc->len, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - mc->len)); + mc->len = SAMPLES_PER_CHUNK; + } + } + t30 = fax_get_t30_state(mc->fax); + logging = t30_get_logging_state(t30); + span_log_bump_samples(logging, mc->len); + logging = fax_get_logging_state(mc->fax); + span_log_bump_samples(logging, mc->len); + + if (log_audio) + { + for (k = 0; k < mc->len; k++) + out_amp[2*k + j] = mc->amp[k]; + } + if (machines[j ^ 1].len < SAMPLES_PER_CHUNK) + memset(machines[j ^ 1].amp + machines[j ^ 1].len, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - machines[j ^ 1].len)); + t30 = fax_get_t30_state(mc->fax); +#if defined(WITH_SPANDSP_INTERNALS) + if (use_line_hits) + { + /* TODO: This applies very crude line hits. improve it */ + if (t30->state == 22) + { + if (++mc->error_delay == 100) + { + fprintf(stderr, "HIT %d!\n", j); + mc->error_delay = 0; + for (k = 0; k < 5; k++) + mc->amp[k] = 0; + } + } + } + if (t30->state == t30_state_to_wreck) + memset(machines[j ^ 1].amp, 0, sizeof(int16_t)*SAMPLES_PER_CHUNK); +#endif + if (fax_rx(mc->fax, machines[j ^ 1].amp, SAMPLES_PER_CHUNK)) + break; + if (!mc->done) + alldone = FALSE; + } + + if (log_audio) + { + outframes = sf_writef_short(wave_handle, out_amp, SAMPLES_PER_CHUNK); + if (outframes != SAMPLES_PER_CHUNK) + break; + } + + if (alldone || j < FAX_MACHINES) + break; + } + time(&end_time); + for (j = 0; j < FAX_MACHINES; j++) + { + mc = &machines[j]; + fax_release(mc->fax); + } + if (log_audio) + { + if (sf_close(wave_handle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME_WAVE); + exit(2); + } + } + if (input_audio_file_name) + { + if (sf_close(input_wave_handle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", input_audio_file_name); + exit(2); + } + } + printf("Total audio time = %ds (wall time %ds)\n", machines[0].total_audio_time/8000, (int) (end_time - start_time)); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/fax_tests.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/fax_tests.sh Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,206 @@ +#!/bin/bash +# +# spandsp fax tests +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 2.1, +# as published by the Free Software Foundation. +# +# 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 Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# $Id: fax_tests.sh,v 1.5 2008/03/30 18:33:31 steveu Exp $ +# + +run_fax_test() +{ + rm -f fax_tests_1.tif + echo -i ${FILE} ${OPTS} + ./fax_tests -i ${FILE} ${OPTS} >xyzzy 2>xyzzy2 + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo fax_tests failed! + exit $RETVAL + fi + # Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t + # option means the normal differences in tags will be ignored. + tiffcmp -t ${FILE} fax_tests_1.tif #>/dev/null + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo fax_tests failed! + exit $RETVAL + fi + rm -f fax_tests_1.tif + echo tested ${FILE} +} + +OPTS="-e" + +FILE="../itutests/fax/R8_385_A4.tif" +run_fax_test + +FILE="../itutests/fax/R8_385_B4.tif" +run_fax_test + +FILE="../itutests/fax/R8_385_A3.tif" +run_fax_test + + +FILE="../itutests/fax/R8_77_A4.tif" +run_fax_test + +FILE="../itutests/fax/R8_77_B4.tif" +run_fax_test + +FILE="../itutests/fax/R8_77_A3.tif" +run_fax_test + + +FILE="../itutests/fax/R8_154_A4.tif" +run_fax_test + +FILE="../itutests/fax/R8_154_B4.tif" +run_fax_test + +FILE="../itutests/fax/R8_154_A3.tif" +run_fax_test + + +FILE="../itutests/fax/R300_300_A4.tif" +run_fax_test + +FILE="../itutests/fax/R300_300_B4.tif" +run_fax_test + +FILE="../itutests/fax/R300_300_A3.tif" +run_fax_test + + +FILE="../itutests/fax/R300_600_A4.tif" +run_fax_test + +FILE="../itutests/fax/R300_600_B4.tif" +run_fax_test + +FILE="../itutests/fax/R300_600_A3.tif" +run_fax_test + + +FILE="../itutests/fax/R16_154_A4.tif" +run_fax_test + +FILE="../itutests/fax/R16_154_B4.tif" +run_fax_test + +FILE="../itutests/fax/R16_154_A3.tif" +run_fax_test + + +FILE="../itutests/fax/R16_800_A4.tif" +run_fax_test + +FILE="../itutests/fax/R16_800_B4.tif" +run_fax_test + +FILE="../itutests/fax/R16_800_A3.tif" +run_fax_test + + +FILE="../itutests/fax/R600_600_A4.tif" +run_fax_test + +FILE="../itutests/fax/R600_600_B4.tif" +run_fax_test + +FILE="../itutests/fax/R600_600_A3.tif" +run_fax_test + + +FILE="../itutests/fax/R600_1200_A4.tif" +run_fax_test + +FILE="../itutests/fax/R600_1200_B4.tif" +run_fax_test + +FILE="../itutests/fax/R600_1200_A3.tif" +run_fax_test + + +FILE="../itutests/fax/R1200_1200_A4.tif" +run_fax_test + +FILE="../itutests/fax/R1200_1200_B4.tif" +run_fax_test + +FILE="../itutests/fax/R1200_1200_A3.tif" +run_fax_test + + +OPTS="" + +FILE="../itutests/fax/R8_385_A4.tif" +run_fax_test + +FILE="../itutests/fax/R8_385_B4.tif" +run_fax_test + +FILE="../itutests/fax/R8_385_A3.tif" +run_fax_test + + +FILE="../itutests/fax/R8_77_A4.tif" +run_fax_test + +FILE="../itutests/fax/R8_77_B4.tif" +run_fax_test + +FILE="../itutests/fax/R8_77_A3.tif" +run_fax_test + + +FILE="../itutests/fax/R8_154_A4.tif" +run_fax_test + +FILE="../itutests/fax/R8_154_B4.tif" +run_fax_test + +FILE="../itutests/fax/R8_154_A3.tif" +run_fax_test + + +FILE="../itutests/fax/R16_385_A4.tif" +#run_fax_test + +FILE="../itutests/fax/R16_385_B4.tif" +#run_fax_test + +FILE="../itutests/fax/R16_385_A3.tif" +#run_fax_test + + +FILE="../itutests/fax/R16_77_A4.tif" +#run_fax_test + +FILE="../itutests/fax/R16_77_B4.tif" +#run_fax_test + +FILE="../itutests/fax/R16_77_A3.tif" +#run_fax_test + + +FILE="../itutests/fax/R16_154_A4.tif" +run_fax_test + +FILE="../itutests/fax/R16_154_B4.tif" +run_fax_test + +FILE="../itutests/fax/R16_154_A3.tif" +run_fax_test diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/fax_utils.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/fax_utils.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,109 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * fax_utils.c + * + * Written by Steve Underwood + * + * Copyright (C) 2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: fax_utils.c,v 1.3.4.1 2009/12/19 09:47:57 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" +#include "fax_utils.h" + +void log_tx_parameters(t30_state_t *s, const char *tag) +{ + const char *u; + + if ((u = t30_get_tx_ident(s))) + printf("%s: Local ident '%s'\n", tag, u); + if ((u = t30_get_tx_sub_address(s))) + printf("%s: Local sub-address '%s'\n", tag, u); + if ((u = t30_get_tx_polled_sub_address(s))) + printf("%s: Local polled sub-address '%s'\n", tag, u); + if ((u = t30_get_tx_selective_polling_address(s))) + printf("%s: Local selective polling address '%s'\n", tag, u); + if ((u = t30_get_tx_sender_ident(s))) + printf("%s: Local sender ident '%s'\n", tag, u); + if ((u = t30_get_tx_password(s))) + printf("%s: Local password '%s'\n", tag, u); +} +/*- End of function --------------------------------------------------------*/ + +void log_rx_parameters(t30_state_t *s, const char *tag) +{ + const char *u; + + if ((u = t30_get_rx_ident(s))) + printf("%s: Remote ident '%s'\n", tag, u); + if ((u = t30_get_rx_sub_address(s))) + printf("%s: Remote sub-address '%s'\n", tag, u); + if ((u = t30_get_rx_polled_sub_address(s))) + printf("%s: Remote polled sub-address '%s'\n", tag, u); + if ((u = t30_get_rx_selective_polling_address(s))) + printf("%s: Remote selective polling address '%s'\n", tag, u); + if ((u = t30_get_rx_sender_ident(s))) + printf("%s: Remote sender ident '%s'\n", tag, u); + if ((u = t30_get_rx_password(s))) + printf("%s: Remote password '%s'\n", tag, u); + if ((u = t30_get_rx_country(s))) + printf("%s: Remote was made in '%s'\n", tag, u); + if ((u = t30_get_rx_vendor(s))) + printf("%s: Remote was made by '%s'\n", tag, u); + if ((u = t30_get_rx_model(s))) + printf("%s: Remote is model '%s'\n", tag, u); +} +/*- End of function --------------------------------------------------------*/ + +void log_transfer_statistics(t30_state_t *s, const char *tag) +{ + t30_stats_t t; + + t30_get_transfer_statistics(s, &t); + printf("%s: bit rate %d\n", tag, t.bit_rate); + printf("%s: ECM %s\n", tag, (t.error_correcting_mode) ? "on" : "off"); + printf("%s: tx pages %d, rx pages %d\n", tag, t.pages_tx, t.pages_rx); + printf("%s: pages in the file %d\n", tag, t.pages_in_file); + printf("%s: image size %d pels x %d pels\n", tag, t.width, t.length); + printf("%s: image resolution %d pels/m x %d pels/m\n", tag, t.x_resolution, t.y_resolution); + printf("%s: bad rows %d, longest bad row run %d\n", tag, t.bad_rows, t.longest_bad_row_run); + printf("%s: bad ECM frames %d\n", tag, t.error_correcting_mode_retries); + printf("%s: compression type %d\n", tag, t.encoding); + printf("%s: image size %d bytes\n", tag, t.image_size); +#if defined(WITH_SPANDSP_INTERNALS) + printf("%s: bits per row - min %d, max %d\n", tag, s->t4.min_row_bits, s->t4.max_row_bits); +#endif +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/fax_utils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/fax_utils.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,49 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * fax_utils.h + * + * Written by Steve Underwood + * + * Copyright (C) 2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: fax_utils.h,v 1.1 2009/02/20 12:34:20 steveu Exp $ + */ + +/*! \file */ + +#if !defined(_SPANDSP_FAX_UTILS_H_) +#define _SPANDSP_FAX_UTILS_H_ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +void log_tx_parameters(t30_state_t *s, const char *tag); + +void log_rx_parameters(t30_state_t *s, const char *tag); + +void log_transfer_statistics(t30_state_t *s, const char *tag); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/fsk_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/fsk_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,515 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * fsk_tests.c - Tests for the low speed FSK modem code (V.21, V.23, etc.). + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: fsk_tests.c,v 1.59 2009/11/02 13:25:20 steveu Exp $ + */ + +/*! \page fsk_tests_page FSK modem tests +\section fsk_tests_page_sec_1 What does it do? +These tests allow either: + + - An FSK transmit modem to feed an FSK receive modem, of the same type, + through a telephone line model. BER testing is then used to evaluate + performance under various line conditions. This is effective for testing + the basic performance of the receive modem. It is also the only test mode + provided for evaluating the transmit modem. + + - An FSK receive modem is used to decode FSK audio, stored in a file. + This is good way to evaluate performance with audio recorded from other + models of modem, and with real world problematic telephone lines. + +\section fsk_tests_page_sec_2 How does it work? +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define BLOCK_LEN 160 + +#define OUTPUT_FILE_NAME "fsk.wav" + +char *decode_test_file = NULL; +both_ways_line_model_state_t *model; +int rx_bits = 0; +int cutoff_test_carrier = FALSE; + +static void rx_status(void *user_data, int status) +{ + printf("FSK rx status is %s (%d)\n", signal_status_to_str(status), status); +} +/*- End of function --------------------------------------------------------*/ + +static void tx_status(void *user_data, int status) +{ + printf("FSK tx status is %s (%d)\n", signal_status_to_str(status), status); +} +/*- End of function --------------------------------------------------------*/ + +static void put_bit(void *user_data, int bit) +{ + if (bit < 0) + { + rx_status(user_data, bit); + return; + } + + printf("Rx bit %d - %d\n", rx_bits++, bit); +} +/*- End of function --------------------------------------------------------*/ + +static void cutoff_test_rx_status(void *user_data, int status) +{ + printf("FSK rx status is %s (%d)\n", signal_status_to_str(status), status); + switch (status) + { + case SIG_STATUS_CARRIER_UP: + cutoff_test_carrier = TRUE; + break; + case SIG_STATUS_CARRIER_DOWN: + cutoff_test_carrier = FALSE; + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void cutoff_test_put_bit(void *user_data, int bit) +{ + if (bit < 0) + { + cutoff_test_rx_status(user_data, bit); + return; + } +} +/*- End of function --------------------------------------------------------*/ + +static void reporter(void *user_data, int reason, bert_results_t *results) +{ + int channel; + + channel = (int) (intptr_t) user_data; + switch (reason) + { + case BERT_REPORT_SYNCED: + fprintf(stderr, "%d: BERT report synced\n", channel); + break; + case BERT_REPORT_UNSYNCED: + fprintf(stderr, "%d: BERT report unsync'ed\n", channel); + break; + case BERT_REPORT_REGULAR: + fprintf(stderr, "%d: BERT report regular - %d bits, %d bad bits, %d resyncs\n", channel, results->total_bits, results->bad_bits, results->resyncs); + break; + case BERT_REPORT_GT_10_2: + fprintf(stderr, "%d: BERT report > 1 in 10^2\n", channel); + break; + case BERT_REPORT_LT_10_2: + fprintf(stderr, "%d: BERT report < 1 in 10^2\n", channel); + break; + case BERT_REPORT_LT_10_3: + fprintf(stderr, "%d: BERT report < 1 in 10^3\n", channel); + break; + case BERT_REPORT_LT_10_4: + fprintf(stderr, "%d: BERT report < 1 in 10^4\n", channel); + break; + case BERT_REPORT_LT_10_5: + fprintf(stderr, "%d: BERT report < 1 in 10^5\n", channel); + break; + case BERT_REPORT_LT_10_6: + fprintf(stderr, "%d: BERT report < 1 in 10^6\n", channel); + break; + case BERT_REPORT_LT_10_7: + fprintf(stderr, "%d: BERT report < 1 in 10^7\n", channel); + break; + default: + fprintf(stderr, "%d: BERT report reason %d\n", channel, reason); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + fsk_tx_state_t *caller_tx; + fsk_rx_state_t *caller_rx; + fsk_tx_state_t *answerer_tx; + fsk_rx_state_t *answerer_rx; + bert_state_t caller_bert; + bert_state_t answerer_bert; + bert_results_t bert_results; + power_meter_t caller_meter; + power_meter_t answerer_meter; + int16_t caller_amp[BLOCK_LEN]; + int16_t answerer_amp[BLOCK_LEN]; + int16_t caller_model_amp[BLOCK_LEN]; + int16_t answerer_model_amp[BLOCK_LEN]; + int16_t out_amp[2*BLOCK_LEN]; + SNDFILE *inhandle; + SNDFILE *outhandle; + int outframes; + int i; + int j; + int samples; + int test_bps; + int noise_level; + int noise_sweep; + int bits_per_test; + int line_model_no; + int modem_under_test_1; + int modem_under_test_2; + int modems_set; + int log_audio; + int channel_codec; + int rbs_pattern; + int on_at; + int off_at; + tone_gen_descriptor_t tone_desc; + tone_gen_state_t tone_tx; + int opt; + + channel_codec = MUNGE_CODEC_NONE; + rbs_pattern = 0; + line_model_no = 0; + decode_test_file = NULL; + noise_sweep = FALSE; + modem_under_test_1 = FSK_V21CH1; + modem_under_test_2 = FSK_V21CH2; + log_audio = FALSE; + modems_set = 0; + while ((opt = getopt(argc, argv, "c:dlm:nr:s:")) != -1) + { + switch (opt) + { + case 'c': + channel_codec = atoi(optarg); + break; + case 'd': + decode_test_file = optarg; + break; + case 'l': + log_audio = TRUE; + break; + case 'm': + line_model_no = atoi(optarg); + break; + case 'n': + noise_sweep = TRUE; + break; + case 'r': + rbs_pattern = atoi(optarg); + break; + case 's': + switch (modems_set++) + { + case 0: + modem_under_test_1 = atoi(optarg); + break; + case 1: + modem_under_test_2 = atoi(optarg); + break; + } + break; + default: + //usage(); + exit(2); + break; + } + } + + if (modem_under_test_1 >= 0) + printf("Modem channel 1 is '%s'\n", preset_fsk_specs[modem_under_test_1].name); + if (modem_under_test_2 >= 0) + printf("Modem channel 2 is '%s'\n", preset_fsk_specs[modem_under_test_2].name); + + outhandle = NULL; + + if (log_audio) + { + if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 2)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + } + noise_level = -200; + bits_per_test = 0; + inhandle = NULL; + + memset(caller_amp, 0, sizeof(*caller_amp)); + memset(answerer_amp, 0, sizeof(*answerer_amp)); + memset(caller_model_amp, 0, sizeof(*caller_model_amp)); + memset(answerer_model_amp, 0, sizeof(*answerer_model_amp)); + power_meter_init(&caller_meter, 7); + power_meter_init(&answerer_meter, 7); + + if (decode_test_file) + { + if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", decode_test_file); + exit(2); + } + caller_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_1], FSK_FRAME_MODE_SYNC, put_bit, NULL); + fsk_rx_set_modem_status_handler(caller_rx, rx_status, (void *) &caller_rx); + test_bps = preset_fsk_specs[modem_under_test_1].baud_rate; + + for (;;) + { + samples = sf_readf_short(inhandle, caller_model_amp, BLOCK_LEN); + if (samples < BLOCK_LEN) + break; + for (i = 0; i < samples; i++) + power_meter_update(&caller_meter, caller_model_amp[i]); + fsk_rx(caller_rx, caller_model_amp, samples); + } + + if (sf_close(inhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", decode_test_file); + exit(2); + } + } + else + { + printf("Test cutoff level\n"); + caller_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_1], FSK_FRAME_MODE_SYNC, cutoff_test_put_bit, NULL); + fsk_rx_signal_cutoff(caller_rx, -30.0f); + fsk_rx_set_modem_status_handler(caller_rx, cutoff_test_rx_status, (void *) &caller_rx); + on_at = 0; + for (i = -40; i < -25; i++) + { + make_tone_gen_descriptor(&tone_desc, + 1500, + i, + 0, + 0, + 1, + 0, + 0, + 0, + TRUE); + tone_gen_init(&tone_tx, &tone_desc); + for (j = 0; j < 10; j++) + { + samples = tone_gen(&tone_tx, caller_model_amp, 160); + fsk_rx(caller_rx, caller_model_amp, samples); + } + if (cutoff_test_carrier) + break; + } + on_at = i; + off_at = 0; + for ( ; i > -40; i--) + { + make_tone_gen_descriptor(&tone_desc, + 1500, + i, + 0, + 0, + 1, + 0, + 0, + 0, + TRUE); + tone_gen_init(&tone_tx, &tone_desc); + for (j = 0; j < 10; j++) + { + samples = tone_gen(&tone_tx, caller_model_amp, 160); + fsk_rx(caller_rx, caller_model_amp, samples); + } + if (!cutoff_test_carrier) + break; + } + off_at = i; + printf("Carrier on at %d, off at %d\n", on_at, off_at); + if (on_at < -29 || on_at > -26 + || + off_at < -35 || off_at > -31) + { + printf("Tests failed.\n"); + exit(2); + } + + printf("Test with BERT\n"); + test_bps = preset_fsk_specs[modem_under_test_1].baud_rate; + if (modem_under_test_1 >= 0) + { + caller_tx = fsk_tx_init(NULL, &preset_fsk_specs[modem_under_test_1], (get_bit_func_t) bert_get_bit, &caller_bert); + fsk_tx_set_modem_status_handler(caller_tx, tx_status, (void *) &caller_tx); + answerer_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_1], FSK_FRAME_MODE_SYNC, (put_bit_func_t) bert_put_bit, &answerer_bert); + fsk_rx_set_modem_status_handler(answerer_rx, rx_status, (void *) &answerer_rx); + } + if (modem_under_test_2 >= 0) + { + answerer_tx = fsk_tx_init(NULL, &preset_fsk_specs[modem_under_test_2], (get_bit_func_t) bert_get_bit, &answerer_bert); + fsk_tx_set_modem_status_handler(answerer_tx, tx_status, (void *) &answerer_tx); + caller_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) bert_put_bit, &caller_bert); + fsk_rx_set_modem_status_handler(caller_rx, rx_status, (void *) &caller_rx); + } + test_bps = preset_fsk_specs[modem_under_test_1].baud_rate; + + bits_per_test = 500000; + noise_level = -24; + + bert_init(&caller_bert, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20); + bert_set_report(&caller_bert, 100000, reporter, (void *) (intptr_t) 1); + bert_init(&answerer_bert, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20); + bert_set_report(&answerer_bert, 100000, reporter, (void *) (intptr_t) 2); + if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, line_model_no, (float) noise_level, channel_codec, rbs_pattern)) == NULL) + { + fprintf(stderr, " Failed to create line model\n"); + exit(2); + } + + for (;;) + { + samples = fsk_tx(caller_tx, caller_amp, BLOCK_LEN); + for (i = 0; i < samples; i++) + power_meter_update(&caller_meter, caller_amp[i]); + samples = fsk_tx(answerer_tx, answerer_amp, BLOCK_LEN); + for (i = 0; i < samples; i++) + power_meter_update(&answerer_meter, answerer_amp[i]); + both_ways_line_model(model, + caller_model_amp, + caller_amp, + answerer_model_amp, + answerer_amp, + samples); + + //printf("Powers %10.5fdBm0 %10.5fdBm0\n", power_meter_current_dbm0(&caller_meter), power_meter_current_dbm0(&answerer_meter)); + + fsk_rx(answerer_rx, caller_model_amp, samples); + for (i = 0; i < samples; i++) + out_amp[2*i] = caller_model_amp[i]; + for ( ; i < BLOCK_LEN; i++) + out_amp[2*i] = 0; + + fsk_rx(caller_rx, answerer_model_amp, samples); + for (i = 0; i < samples; i++) + out_amp[2*i + 1] = answerer_model_amp[i]; + for ( ; i < BLOCK_LEN; i++) + out_amp[2*i + 1] = 0; + + if (log_audio) + { + outframes = sf_writef_short(outhandle, out_amp, BLOCK_LEN); + if (outframes != BLOCK_LEN) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + } + + if (samples < BLOCK_LEN) + { + bert_result(&caller_bert, &bert_results); + fprintf(stderr, "%ddB AWGN, %d bits, %d bad bits, %d resyncs\n", noise_level, bert_results.total_bits, bert_results.bad_bits, bert_results.resyncs); + if (!noise_sweep) + { + if (bert_results.total_bits != bits_per_test - 43 + || + bert_results.bad_bits != 0 + || + bert_results.resyncs != 0) + { + printf("Tests failed.\n"); + exit(2); + } + } + bert_result(&answerer_bert, &bert_results); + fprintf(stderr, "%ddB AWGN, %d bits, %d bad bits, %d resyncs\n", noise_level, bert_results.total_bits, bert_results.bad_bits, bert_results.resyncs); + if (!noise_sweep) + { + if (bert_results.total_bits != bits_per_test - 43 + || + bert_results.bad_bits != 0 + || + bert_results.resyncs != 0) + { + printf("Tests failed.\n"); + exit(2); + } + break; + } + + /* Put a little silence between the chunks in the file. */ + memset(out_amp, 0, sizeof(out_amp)); + if (log_audio) + { + for (i = 0; i < 200; i++) + outframes = sf_writef_short(outhandle, out_amp, BLOCK_LEN); + } + if (modem_under_test_1 >= 0) + { + caller_tx = fsk_tx_init(NULL, &preset_fsk_specs[modem_under_test_1], (get_bit_func_t) bert_get_bit, &caller_bert); + fsk_tx_set_modem_status_handler(caller_tx, tx_status, (void *) &caller_tx); + answerer_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_1], FSK_FRAME_MODE_SYNC, (put_bit_func_t) bert_put_bit, &answerer_bert); + fsk_rx_set_modem_status_handler(answerer_rx, rx_status, (void *) &answerer_rx); + } + if (modem_under_test_2 >= 0) + { + answerer_tx = fsk_tx_init(NULL, &preset_fsk_specs[modem_under_test_2], (get_bit_func_t) bert_get_bit, &answerer_bert); + fsk_tx_set_modem_status_handler(answerer_tx, tx_status, (void *) &answerer_tx); + caller_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) bert_put_bit, &caller_bert); + fsk_rx_set_modem_status_handler(caller_rx, rx_status, (void *) &caller_rx); + } + noise_level++; + if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, line_model_no, noise_level, channel_codec, 0)) == NULL) + { + fprintf(stderr, " Failed to create line model\n"); + exit(2); + } + bert_init(&caller_bert, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20); + bert_set_report(&caller_bert, 100000, reporter, (void *) (intptr_t) 1); + bert_init(&answerer_bert, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20); + bert_set_report(&answerer_bert, 100000, reporter, (void *) (intptr_t) 2); + } + } + printf("Tests passed.\n"); + } + if (log_audio) + { + if (sf_close(outhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/g1050_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/g1050_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,241 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * g1050_tests.c - Tests for the G.1050/TIA-921 model. + * + * Written by Steve Underwood + * + * Copyright (C) 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: g1050_tests.c,v 1.18 2009/05/30 15:23:13 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#if defined(HAVE_FL_FL_H) && defined(HAVE_FL_FL_CARTESIAN_H) && defined(HAVE_FL_FL_AUDIO_METER_H) +#define ENABLE_GUI +#endif + +#include +#include +#include +#include +#include +#include +#include +#if defined(HAVE_MATH_H) +#define GEN_CONST +#endif + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#if defined(ENABLE_GUI) +#include "media_monitor.h" +#endif + +#define PACKET_SIZE 256 +#define PACKET_INTERVAL 20 +#define SIMULATION_TIME 300 + +#define MODEL_NO 8 +#define SPEED_PATTERN_NO 133 + +int main(int argc, char *argv[]) +{ + g1050_state_t *s; + double *packet_arrival_times; + int packets_per_sec; + int num_packets; + int model_no; + int speed_pattern_no; + int use_gui; + int simulation_time; + int i; + int len; + uint8_t put_pkt[256]; + uint8_t get_pkt[256]; + int put_pkt_len; + int get_pkt_len; + int get_seq_no; + double get_departure_time; + double get_arrival_time; + int packets_put; + int packets_really_put; + int packets_got; + int oos_packets_got; + int missing_packets_got; + int highest_seq_no_got; + int opt; + FILE *out_file; + + model_no = MODEL_NO; + speed_pattern_no = SPEED_PATTERN_NO; + simulation_time = SIMULATION_TIME; + use_gui = FALSE; + while ((opt = getopt(argc, argv, "gm:s:t:")) != -1) + { + switch (opt) + { + case 'g': +#if defined(ENABLE_GUI) + use_gui = TRUE; +#else + fprintf(stderr, "Graphical monitoring not available\n"); + exit(2); +#endif + break; + case 'm': + model_no = optarg[0] - 'A' + 1; + if (model_no < 0 || model_no > 8) + { + fprintf(stderr, "Bad model ID '%s'\n", optarg); + exit(2); + } + break; + case 's': + speed_pattern_no = atoi(optarg); + if (speed_pattern_no < 1 || speed_pattern_no > 133) + { + fprintf(stderr, "Bad link speed pattern %s\n", optarg); + exit(2); + } + break; + case 't': + simulation_time = atoi(optarg); + break; + default: + //usage(); + exit(2); + break; + } + } + argc -= optind; + argv += optind; + + if ((out_file = fopen("g1050_tests.txt", "w")) == NULL) + { + fprintf(stderr, "Can't open %s\n", "g1050_tests.txt"); + return 2; + } + packets_per_sec = 1000/PACKET_INTERVAL; + num_packets = packets_per_sec*simulation_time; + + if ((packet_arrival_times = calloc(num_packets, sizeof(double))) == NULL) + { + fprintf(stderr, "Can't allocate the data buffers\n"); + return 2; + } + for (i = 0; i < num_packets; i++) + packet_arrival_times[i] = 0.0; + + /* If we don't initialise this random number generator it gives endless zeros on some systems. */ + /* Use a fixed seed to produce identical results in successive runs of the simulation, for debug purposes. */ + srand48(0x1234567); + + if ((s = g1050_init(model_no, speed_pattern_no, PACKET_SIZE, packets_per_sec)) == NULL) + { + fprintf(stderr, "Failed to start the G.1050 model\n"); + exit(2); + } + g1050_dump_parms(model_no, speed_pattern_no); + +#if defined(ENABLE_GUI) + if (use_gui) + start_media_monitor(); +#endif + + for (i = 0; i < 256; i++) + put_pkt[i] = i; + put_pkt_len = 256; + get_pkt_len = -1; + get_seq_no = -1; + get_arrival_time = -1; + packets_put = 0; + packets_really_put = 0; + packets_got = 0; + oos_packets_got = 0; + missing_packets_got = 0; + highest_seq_no_got = -1; + for (i = 0; i < num_packets; i++) + { + if ((len = g1050_put(s, put_pkt, put_pkt_len, i, (double) i*0.001*PACKET_INTERVAL)) > 0) + packets_really_put++; + packets_put++; + if (i == 5) + g1050_queue_dump(s); + if (i >= 5) + { + do + { + get_pkt_len = g1050_get(s, get_pkt, 256, (double) i*0.001*PACKET_INTERVAL, &get_seq_no, &get_departure_time, &get_arrival_time); + if (get_pkt_len >= 0) + { +#if defined(ENABLE_GUI) + if (use_gui) + media_monitor_rx(get_seq_no, get_departure_time, get_arrival_time); +#endif + packets_got++; + if (get_seq_no < highest_seq_no_got) + oos_packets_got++; + else if (get_seq_no > highest_seq_no_got + 1) + missing_packets_got += (get_seq_no - highest_seq_no_got - 1); + if (get_seq_no > highest_seq_no_got) + highest_seq_no_got = get_seq_no; + fprintf(out_file, "%d, %.3f, %.8f\n", get_seq_no, get_seq_no*0.001*PACKET_INTERVAL, get_arrival_time); + } + } + while (get_pkt_len >= 0); + } +#if defined(ENABLE_GUI) + if (use_gui) + media_monitor_update_display(); +#endif + } + /* Clear out anything remaining in the queue, by jumping forwards in time */ + do + { + get_pkt_len = g1050_get(s, get_pkt, 256, (double) i*0.001*PACKET_INTERVAL + 5.0, &get_seq_no, &get_departure_time, &get_arrival_time); + if (get_pkt_len >= 0) + { + packets_got++; + fprintf(out_file, "%d, %.3f, %.8f\n", get_seq_no, get_seq_no*0.001*PACKET_INTERVAL, get_arrival_time); + } + } + while (get_pkt_len >= 0); + + fclose(out_file); + + printf("Put %d packets. Really put %d packets. Got %d packets.\n", packets_put, packets_really_put, packets_got); + printf("%d OOS packets, %d missing packets\n", oos_packets_got, missing_packets_got - oos_packets_got); + if (packets_really_put != packets_got) + { + printf("%d packets queued, but only %d received\n", packets_really_put, packets_got); + exit(2); + } + printf("%.3f%% of packets lost\n", 100.0*(packets_put - packets_really_put)/packets_put); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/g168_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/g168_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,324 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * g168tests.c - Tests of the "test equipment" (filters, etc.) specified + * in G.168. This code is only for checking out the tools, + * not for testing an echo cancellor. + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: g168_tests.c,v 1.20 2009/05/30 15:23:13 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp/g168models.h" +#include "spandsp-sim.h" + +#define FALSE 0 +#define TRUE (!FALSE) + +typedef struct +{ + const char *name; + int max; + int cur; + float gain; + SNDFILE *handle; + int16_t signal[SAMPLE_RATE]; +} signal_source_t; + +signal_source_t local_css; +signal_source_t far_css; + +static void signal_load(signal_source_t *sig, const char *name) +{ + sig->handle = sf_open_telephony_read(name, 1); + sig->name = name; + sig->max = sf_readf_short(sig->handle, sig->signal, SAMPLE_RATE); + if (sig->max < 0) + { + fprintf(stderr, " Error reading sound file '%s'\n", sig->name); + exit(2); + } +} +/*- End of function --------------------------------------------------------*/ + +static void signal_free(signal_source_t *sig) +{ + if (sf_close(sig->handle) != 0) + { + fprintf(stderr, " Cannot close sound file '%s'\n", sig->name); + exit(2); + } +} +/*- End of function --------------------------------------------------------*/ + +static void signal_restart(signal_source_t *sig, float gain) +{ + sig->cur = 0; + sig->gain = powf(10.0f, gain/20.0f); +} +/*- End of function --------------------------------------------------------*/ + +static int16_t signal_amp(signal_source_t *sig) +{ + int16_t tx; + + tx = sig->signal[sig->cur++]*sig->gain; + if (sig->cur >= sig->max) + sig->cur = 0; + return tx; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int f; + int i; + int16_t amp[8000]; + int16_t value; + int signal; + float power[10]; + tone_gen_descriptor_t tone_desc; + tone_gen_state_t tone_state; + awgn_state_t noise_source; + fir32_state_t line_model_d2; + fir32_state_t line_model_d3; + fir32_state_t line_model_d4; + fir32_state_t line_model_d5; + fir32_state_t line_model_d6; + fir32_state_t line_model_d7; + fir32_state_t line_model_d8; + fir32_state_t line_model_d9; + fir_float_state_t level_measurement_bp; + + signal_load(&local_css, "sound_c1_8k.wav"); + signal_load(&far_css, "sound_c3_8k.wav"); + + fir32_create(&line_model_d2, + line_model_d2_coeffs, + sizeof(line_model_d2_coeffs)/sizeof(int32_t)); + fir32_create(&line_model_d3, + line_model_d3_coeffs, + sizeof(line_model_d3_coeffs)/sizeof(int32_t)); + fir32_create(&line_model_d4, + line_model_d4_coeffs, + sizeof(line_model_d4_coeffs)/sizeof(int32_t)); + fir32_create(&line_model_d5, + line_model_d5_coeffs, + sizeof(line_model_d5_coeffs)/sizeof(int32_t)); + fir32_create(&line_model_d6, + line_model_d6_coeffs, + sizeof(line_model_d6_coeffs)/sizeof(int32_t)); + fir32_create(&line_model_d7, + line_model_d7_coeffs, + sizeof(line_model_d7_coeffs)/sizeof(int32_t)); + fir32_create(&line_model_d8, + line_model_d8_coeffs, + sizeof(line_model_d8_coeffs)/sizeof(int32_t)); + fir32_create(&line_model_d9, + line_model_d9_coeffs, + sizeof(line_model_d9_coeffs)/sizeof(int32_t)); + fir_float_create(&level_measurement_bp, + level_measurement_bp_coeffs, + sizeof(level_measurement_bp_coeffs)/sizeof(float)); + + for (f = 10; f < 4000; f++) + { + make_tone_gen_descriptor(&tone_desc, + f, + -10, + 0, + 0, + 1, + 0, + 0, + 0, + TRUE); + tone_gen_init(&tone_state, &tone_desc); + tone_gen(&tone_state, amp, 8000); + for (i = 0; i < 10; i++) + power[i] = 0.0f; + for (i = 0; i < 800; i++) + { + signal = fir32(&line_model_d2, amp[i]); + power[0] += ((signal*signal - power[0])/32.0f); + signal = fir32(&line_model_d3, amp[i]); + power[1] += ((signal*signal - power[1])/32.0f); + signal = fir32(&line_model_d4, amp[i]); + power[2] += ((signal*signal - power[2])/32.0f); + signal = fir32(&line_model_d5, amp[i]); + power[3] += ((signal*signal - power[3])/32.0f); + signal = fir32(&line_model_d6, amp[i]); + power[4] += ((signal*signal - power[4])/32.0f); + signal = fir32(&line_model_d7, amp[i]); + power[5] += ((signal*signal - power[5])/32.0f); + signal = fir32(&line_model_d8, amp[i]); + power[6] += ((signal*signal - power[6])/32.0f); + signal = fir32(&line_model_d9, amp[i]); + power[7] += ((signal*signal - power[7])/32.0f); + signal = fir_float(&level_measurement_bp, amp[i]); + power[8] += ((signal*signal - power[8])/32.0f); + signal = amp[i]; + power[9] += ((signal*signal - power[9])/32.0f); + } + printf("%d %f %f %f %f %f %f %f %f %f %f\n", + f, + sqrt(power[0])*LINE_MODEL_D2_GAIN, + sqrt(power[1])*LINE_MODEL_D3_GAIN, + sqrt(power[2])*LINE_MODEL_D4_GAIN, + sqrt(power[3])*LINE_MODEL_D5_GAIN, + sqrt(power[4])*LINE_MODEL_D6_GAIN, + sqrt(power[5])*LINE_MODEL_D7_GAIN, + sqrt(power[6])*LINE_MODEL_D8_GAIN, + sqrt(power[7])*LINE_MODEL_D9_GAIN, + sqrt(power[8]), + sqrt(power[9])); + } + awgn_init_dbm0(&noise_source, 1234567, -20.0f); + for (i = 0; i < 10; i++) + power[i] = 0.0f; + signal_restart(&local_css, 0.0f); + signal_restart(&far_css, 0.0f); + for (i = 0; i < SAMPLE_RATE; i++) + { + value = signal_amp(&local_css); + //value = awgn(&noise_source); + signal = fir32(&line_model_d2, value); + power[0] += ((signal*signal - power[0])/32.0f); + signal = fir32(&line_model_d3, value); + power[1] += ((signal*signal - power[1])/32.0f); + signal = fir32(&line_model_d4, value); + power[2] += ((signal*signal - power[2])/32.0f); + signal = fir32(&line_model_d5, value); + power[3] += ((signal*signal - power[3])/32.0f); + signal = fir32(&line_model_d6, value); + power[4] += ((signal*signal - power[4])/32.0f); + signal = fir32(&line_model_d7, value); + power[5] += ((signal*signal - power[5])/32.0f); + signal = fir32(&line_model_d8, value); + power[6] += ((signal*signal - power[6])/32.0f); + signal = fir32(&line_model_d9, value); + power[7] += ((signal*signal - power[7])/32.0f); + signal = fir_float(&level_measurement_bp, value); + power[8] += ((signal*signal - power[8])/32.0f); + signal = value; + power[9] += ((signal*signal - power[9])/32.0f); + } + for (i = 0; i < 10; i++) + power[i] = 0.0f; + for (i = 0; i < SAMPLE_RATE; i++) + { + value = signal_amp(&local_css); + //value = awgn(&noise_source); + signal = fir32(&line_model_d2, value); + power[0] += ((signal*signal - power[0])/32.0f); + signal = fir32(&line_model_d3, value); + power[1] += ((signal*signal - power[1])/32.0f); + signal = fir32(&line_model_d4, value); + power[2] += ((signal*signal - power[2])/32.0f); + signal = fir32(&line_model_d5, value); + power[3] += ((signal*signal - power[3])/32.0f); + signal = fir32(&line_model_d6, value); + power[4] += ((signal*signal - power[4])/32.0f); + signal = fir32(&line_model_d7, value); + power[5] += ((signal*signal - power[5])/32.0f); + signal = fir32(&line_model_d8, value); + power[6] += ((signal*signal - power[6])/32.0f); + signal = fir32(&line_model_d9, value); + power[7] += ((signal*signal - power[7])/32.0f); + signal = fir_float(&level_measurement_bp, value); + power[8] += ((signal*signal - power[8])/32.0f); + signal = value; + power[9] += ((signal*signal - power[9])/32.0f); + } + printf("%d %f %f %f %f %f %f %f %f %f %f\n", + 0, + sqrt(power[0])*LINE_MODEL_D2_GAIN, + sqrt(power[1])*LINE_MODEL_D3_GAIN, + sqrt(power[2])*LINE_MODEL_D4_GAIN, + sqrt(power[3])*LINE_MODEL_D5_GAIN, + sqrt(power[4])*LINE_MODEL_D6_GAIN, + sqrt(power[5])*LINE_MODEL_D7_GAIN, + sqrt(power[6])*LINE_MODEL_D8_GAIN, + sqrt(power[7])*LINE_MODEL_D9_GAIN, + sqrt(power[8]), + sqrt(power[9])); + printf("%d %f %f %f %f %f %f %f %f %f %f\n", + 0, + sqrt(power[0]), + sqrt(power[1]), + sqrt(power[2]), + sqrt(power[3]), + sqrt(power[4]), + sqrt(power[5]), + sqrt(power[6]), + sqrt(power[7]), + sqrt(power[8]), + sqrt(power[9])); + printf("%d %f %f %f %f %f %f %f %f %f %f\n", + 0, + sqrt(power[0])/sqrt(power[9]), + sqrt(power[1])/sqrt(power[9]), + sqrt(power[2])/sqrt(power[9]), + sqrt(power[3])/sqrt(power[9]), + sqrt(power[4])/sqrt(power[9]), + sqrt(power[5])/sqrt(power[9]), + sqrt(power[6])/sqrt(power[9]), + sqrt(power[7])/sqrt(power[9]), + sqrt(power[8]), + sqrt(power[9])); + printf("%d %f %f %f %f %f %f %f %f %f %f\n", + 0, + sqrt(power[0])*LINE_MODEL_D2_GAIN/sqrt(power[9]), + sqrt(power[1])*LINE_MODEL_D3_GAIN/sqrt(power[9]), + sqrt(power[2])*LINE_MODEL_D4_GAIN/sqrt(power[9]), + sqrt(power[3])*LINE_MODEL_D5_GAIN/sqrt(power[9]), + sqrt(power[4])*LINE_MODEL_D6_GAIN/sqrt(power[9]), + sqrt(power[5])*LINE_MODEL_D7_GAIN/sqrt(power[9]), + sqrt(power[6])*LINE_MODEL_D8_GAIN/sqrt(power[9]), + sqrt(power[7])*LINE_MODEL_D9_GAIN/sqrt(power[9]), + sqrt(power[8]), + sqrt(power[9])); + + for (i = 0; i < (int) (sizeof(css_c1)/sizeof(css_c1[0])); i++) + printf("%d\n", css_c1[i]); + printf("\n"); + for (i = 0; i < (int) (sizeof(css_c1)/sizeof(css_c3[0])); i++) + printf("%d\n", css_c3[i]); + signal_free(&local_css); + signal_free(&far_css); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/g711_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/g711_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,518 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * g711_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: g711_tests.c,v 1.17 2009/05/30 15:23:13 steveu Exp $ + */ + +/*! \page g711_tests_page A-law and u-law conversion tests +\section g711_tests_page_sec_1 What does it do? + +\section g711_tests_page_sec_2 How is it used? +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define BLOCK_LEN 160 + +#define IN_FILE_NAME "../test-data/local/short_nb_voice.wav" +#define ENCODED_FILE_NAME "g711.g711" +#define OUT_FILE_NAME "post_g711.wav" + +int16_t amp[65536]; +uint8_t ulaw_data[65536]; +uint8_t alaw_data[65536]; + +const uint8_t alaw_1khz_sine[] = {0x34, 0x21, 0x21, 0x34, 0xB4, 0xA1, 0xA1, 0xB4}; +const uint8_t ulaw_1khz_sine[] = {0x1E, 0x0B, 0x0B, 0x1E, 0x9E, 0x8B, 0x8B, 0x9E}; + +static void compliance_tests(int log_audio) +{ + SNDFILE *outhandle; + power_meter_t power_meter; + int outframes; + int i; + int block; + int pre; + int post; + int post_post; + int alaw_failures; + int ulaw_failures; + float worst_alaw; + float worst_ulaw; + float tmp; + int len; + g711_state_t *enc_state; + g711_state_t *transcode; + g711_state_t *dec_state; + + outhandle = NULL; + if (log_audio) + { + if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + } + + printf("Conversion accuracy tests.\n"); + alaw_failures = 0; + ulaw_failures = 0; + worst_alaw = 0.0; + worst_ulaw = 0.0; + for (block = 0; block < 1; block++) + { + for (i = 0; i < 65536; i++) + { + pre = i - 32768; + post = alaw_to_linear(linear_to_alaw(pre)); + if (abs(pre) > 140) + { + tmp = (float) abs(post - pre)/(float) abs(pre); + if (tmp > 0.10) + { + printf("A-law: Excessive error at %d (%d)\n", pre, post); + alaw_failures++; + } + if (tmp > worst_alaw) + worst_alaw = tmp; + } + else + { + /* Small values need different handling for sensible measurement */ + if (abs(post - pre) > 15) + { + printf("A-law: Excessive error at %d (%d)\n", pre, post); + alaw_failures++; + } + } + amp[i] = post; + } + if (log_audio) + { + outframes = sf_writef_short(outhandle, amp, 65536); + if (outframes != 65536) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + } + for (i = 0; i < 65536; i++) + { + pre = i - 32768; + post = ulaw_to_linear(linear_to_ulaw(pre)); + if (abs(pre) > 40) + { + tmp = (float) abs(post - pre)/(float) abs(pre); + if (tmp > 0.10) + { + printf("u-law: Excessive error at %d (%d)\n", pre, post); + ulaw_failures++; + } + if (tmp > worst_ulaw) + worst_ulaw = tmp; + } + else + { + /* Small values need different handling for sensible measurement */ + if (abs(post - pre) > 4) + { + printf("u-law: Excessive error at %d (%d)\n", pre, post); + ulaw_failures++; + } + } + amp[i] = post; + } + if (log_audio) + { + outframes = sf_writef_short(outhandle, amp, 65536); + if (outframes != 65536) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + } + } + printf("Worst A-law error (ignoring small values) %f%%\n", worst_alaw*100.0); + printf("Worst u-law error (ignoring small values) %f%%\n", worst_ulaw*100.0); + if (alaw_failures || ulaw_failures) + { + printf("%d A-law values with excessive error\n", alaw_failures); + printf("%d u-law values with excessive error\n", ulaw_failures); + printf("Tests failed\n"); + exit(2); + } + + printf("Cyclic conversion repeatability tests.\n"); + /* Find what happens to every possible linear value after a round trip. */ + for (i = 0; i < 65536; i++) + { + pre = i - 32768; + /* Make a round trip */ + post = alaw_to_linear(linear_to_alaw(pre)); + /* A second round trip should cause no further change */ + post_post = alaw_to_linear(linear_to_alaw(post)); + if (post_post != post) + { + printf("A-law second round trip mismatch - at %d, %d != %d\n", pre, post, post_post); + printf("Tests failed\n"); + exit(2); + } + /* Make a round trip */ + post = ulaw_to_linear(linear_to_ulaw(pre)); + /* A second round trip should cause no further change */ + post_post = ulaw_to_linear(linear_to_ulaw(post)); + if (post_post != post) + { + printf("u-law round trip mismatch - at %d, %d != %d\n", pre, post, post_post); + printf("Tests failed\n"); + exit(2); + } + } + + printf("Reference power level tests.\n"); + power_meter_init(&power_meter, 7); + + for (i = 0; i < 8000; i++) + { + amp[i] = ulaw_to_linear(ulaw_1khz_sine[i & 7]); + power_meter_update(&power_meter, amp[i]); + } + printf("Reference u-law 1kHz tone is %fdBm0\n", power_meter_current_dbm0(&power_meter)); + if (log_audio) + { + outframes = sf_writef_short(outhandle, amp, 8000); + if (outframes != 8000) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + } + if (0.1f < fabs(power_meter_current_dbm0(&power_meter))) + { + printf("Test failed.\n"); + exit(2); + } + + for (i = 0; i < 8000; i++) + { + amp[i] = alaw_to_linear(alaw_1khz_sine[i & 7]); + power_meter_update(&power_meter, amp[i]); + } + printf("Reference A-law 1kHz tone is %fdBm0\n", power_meter_current_dbm0(&power_meter)); + if (log_audio) + { + outframes = sf_writef_short(outhandle, amp, 8000); + if (outframes != 8000) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + } + if (0.1f < fabs(power_meter_current_dbm0(&power_meter))) + { + printf("Test failed.\n"); + exit(2); + } + + /* Check the transcoding functions. */ + printf("Testing transcoding A-law -> u-law -> A-law\n"); + for (i = 0; i < 256; i++) + { + if (alaw_to_ulaw(ulaw_to_alaw(i)) != i) + { + if (abs(alaw_to_ulaw(ulaw_to_alaw(i)) - i) > 1) + { + printf("u-law -> A-law -> u-law gave %d -> %d\n", i, alaw_to_ulaw(ulaw_to_alaw(i))); + printf("Test failed\n"); + exit(2); + } + } + } + + printf("Testing transcoding u-law -> A-law -> u-law\n"); + for (i = 0; i < 256; i++) + { + if (ulaw_to_alaw(alaw_to_ulaw(i)) != i) + { + if (abs(alaw_to_ulaw(ulaw_to_alaw(i)) - i) > 1) + { + printf("A-law -> u-law -> A-law gave %d -> %d\n", i, ulaw_to_alaw(alaw_to_ulaw(i))); + printf("Test failed\n"); + exit(2); + } + } + } + + enc_state = g711_init(NULL, G711_ALAW); + transcode = g711_init(NULL, G711_ALAW); + dec_state = g711_init(NULL, G711_ULAW); + + len = 65536; + for (i = 0; i < len; i++) + amp[i] = i - 32768; + len = g711_encode(enc_state, alaw_data, amp, len); + len = g711_transcode(transcode, ulaw_data, alaw_data, len); + len = g711_decode(dec_state, amp, ulaw_data, len); + if (len != 65536) + { + printf("Block coding gave the wrong length - %d instead of %d\n", len, 65536); + printf("Test failed\n"); + exit(2); + } + for (i = 0; i < len; i++) + { + pre = i - 32768; + post = amp[i]; + if (abs(pre) > 140) + { + tmp = (float) abs(post - pre)/(float) abs(pre); + if (tmp > 0.10) + { + printf("Block: Excessive error at %d (%d)\n", pre, post); + exit(2); + } + } + else + { + /* Small values need different handling for sensible measurement */ + if (abs(post - pre) > 15) + { + printf("Block: Excessive error at %d (%d)\n", pre, post); + exit(2); + } + } + } + g711_release(enc_state); + g711_release(transcode); + g711_release(dec_state); + + if (log_audio) + { + if (sf_close(outhandle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + } + + printf("Tests passed.\n"); +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + SNDFILE *inhandle; + SNDFILE *outhandle; + int outframes; + int opt; + int samples; + int len2; + int len3; + int basic_tests; + int law; + int encode; + int decode; + int file; + const char *in_file; + const char *out_file; + g711_state_t *enc_state; + g711_state_t *dec_state; + int16_t indata[BLOCK_LEN]; + int16_t outdata[BLOCK_LEN]; + uint8_t g711data[BLOCK_LEN]; + + basic_tests = TRUE; + law = G711_ALAW; + encode = FALSE; + decode = FALSE; + in_file = NULL; + out_file = NULL; + while ((opt = getopt(argc, argv, "ad:e:l:u")) != -1) + { + switch (opt) + { + case 'a': + law = G711_ALAW; + basic_tests = FALSE; + break; + case 'd': + in_file = optarg; + basic_tests = FALSE; + decode = TRUE; + break; + case 'e': + in_file = optarg; + basic_tests = FALSE; + encode = TRUE; + break; + case 'l': + out_file = optarg; + break; + case 'u': + law = G711_ULAW; + basic_tests = FALSE; + break; + default: + //usage(); + exit(2); + } + } + + if (basic_tests) + { + compliance_tests(TRUE); + } + else + { + if (!decode && !encode) + { + decode = + encode = TRUE; + } + if (in_file == NULL) + { + in_file = (encode) ? IN_FILE_NAME : ENCODED_FILE_NAME; + } + if (out_file == NULL) + { + out_file = (decode) ? OUT_FILE_NAME : ENCODED_FILE_NAME; + } + inhandle = NULL; + outhandle = NULL; + file = -1; + enc_state = NULL; + dec_state = NULL; + if (encode) + { + if ((inhandle = sf_open_telephony_read(in_file, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", in_file); + exit(2); + } + enc_state = g711_init(NULL, law); + } + else + { + if ((file = open(in_file, O_RDONLY)) < 0) + { + fprintf(stderr, " Failed to open '%s'\n", in_file); + exit(2); + } + } + if (decode) + { + if ((outhandle = sf_open_telephony_write(out_file, 1)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", out_file); + exit(2); + } + dec_state = g711_init(NULL, law); + } + else + { + if ((file = open(out_file, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) + { + fprintf(stderr, " Failed to open '%s'\n", out_file); + exit(2); + } + } + for (;;) + { + if (encode) + { + samples = sf_readf_short(inhandle, indata, BLOCK_LEN); + if (samples <= 0) + break; + len2 = g711_encode(enc_state, g711data, indata, samples); + } + else + { + len2 = read(file, g711data, BLOCK_LEN); + if (len2 <= 0) + break; + } + if (decode) + { + len3 = g711_decode(dec_state, outdata, g711data, len2); + outframes = sf_writef_short(outhandle, outdata, len3); + if (outframes != len3) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + } + else + { + len3 = write(file, g711data, len2); + if (len3 <= 0) + break; + } + } + if (encode) + { + if (sf_close(inhandle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME); + exit(2); + } + } + else + { + close(file); + } + if (decode) + { + if (sf_close(outhandle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + } + else + { + close(file); + } + printf("'%s' translated to '%s' using %s.\n", in_file, out_file, (law == G711_ALAW) ? "A-law" : "u-law"); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/g722_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/g722_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,626 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * g722_tests.c - Test G.722 encode and decode. + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: g722_tests.c,v 1.32 2009/06/02 14:55:36 steveu Exp $ + */ + +/*! \file */ + +/*! \page g722_tests_page G.722 tests +\section g722_tests_page_sec_1 What does it do? +This modules implements two sets of tests: + - The tests defined in the G.722 specification, using the test data files supplied + with the specification. + - A generally audio quality test, consisting of compressing and decompressing a speeech + file for audible comparison. + +The speech file should be recorded at 16 bits/sample, 16000 samples/second, and named +"pre_g722.wav". + +The ITU tests use the codec in a special mode, in which the QMFs, which split and recombine the +sub-bands, are disabled. This means they do not test 100% of the codec. This is the reason for +including the additional listening test. + +\section g722_tests_page_sec_2 How is it used? +To perform the tests in the G.722 specification you need to obtain the test data files from the +specification. These are copyright material, and so cannot be distributed with this test software. + +The files, containing test vectors, which are supplied with the G.722 specification, should be +copied to itutests/g722. The ITU tests can then be run by executing g722_tests without +any parameters. + +To perform a general audio quality test, g722_tests should be run with a parameter specifying +the required bit rate for compression. The valid parameters are "-48", "-56", and "-64". +The file ../test-data/local/short_wb_voice.wav will be compressed to the specified bit rate, decompressed, +and the resulting audio stored in post_g722.wav. +*/ + +/* Enable the following definition to enable direct probing into the FAX structures */ +//#define WITH_SPANDSP_INTERNALS + +#if defined(HAVE_CONFIG_H) +#include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "spandsp.h" + +#if 1 //defined(WITH_SPANDSP_INTERNALS) +#include "spandsp/private/g722.h" +#endif + +#define G722_SAMPLE_RATE 16000 + +#define BLOCK_LEN 320 + +#define MAX_TEST_VECTOR_LEN 40000 + +#define TESTDATA_DIR "../test-data/itu/g722/" + +#define EIGHTK_IN_FILE_NAME "../test-data/local/short_nb_voice.wav" +#define IN_FILE_NAME "../test-data/local/short_wb_voice.wav" +#define ENCODED_FILE_NAME "g722.g722" +#define OUT_FILE_NAME "post_g722.wav" + +#if 0 +static const char *itu_test_files[] = +{ + TESTDATA_DIR "T1C1.XMT", /* 69973 bytes */ + TESTDATA_DIR "T1C2.XMT", /* 3605 bytes */ + TESTDATA_DIR "T1D3.COD", /* 69973 bytes */ + + TESTDATA_DIR "T2R1.COD", /* 69973 bytes */ + TESTDATA_DIR "T2R2.COD", /* 3605 bytes */ + + TESTDATA_DIR "T3L1.RC1", /* 69973 bytes */ + TESTDATA_DIR "T3L1.RC2", /* 69973 bytes */ + TESTDATA_DIR "T3L1.RC3", /* 69973 bytes */ + TESTDATA_DIR "T3H1.RC0", /* 69973 bytes */ + TESTDATA_DIR "T3L2.RC1", /* 3605 bytes */ + TESTDATA_DIR "T3L2.RC2", /* 3605 bytes */ + TESTDATA_DIR "T3L2.RC3", /* 3605 bytes */ + TESTDATA_DIR "T3H2.RC0", /* 3605 bytes */ + TESTDATA_DIR "T3L3.RC1", /* 69973 bytes */ + TESTDATA_DIR "T3L3.RC2", /* 69973 bytes */ + TESTDATA_DIR "T3L3.RC3", /* 69973 bytes */ + TESTDATA_DIR "T3H3.RC0" /* 69973 bytes */ +}; +#endif + +static const char *encode_test_files[] = +{ + TESTDATA_DIR "T1C1.XMT", + TESTDATA_DIR "T2R1.COD", + TESTDATA_DIR "T1C2.XMT", + TESTDATA_DIR "T2R2.COD", + NULL +}; + +static const char *decode_test_files[] = +{ + TESTDATA_DIR "T2R1.COD", + TESTDATA_DIR "T3L1.RC1", + TESTDATA_DIR "T3L1.RC2", + TESTDATA_DIR "T3L1.RC3", + TESTDATA_DIR "T3H1.RC0", + + TESTDATA_DIR "T2R2.COD", + TESTDATA_DIR "T3L2.RC1", + TESTDATA_DIR "T3L2.RC2", + TESTDATA_DIR "T3L2.RC3", + TESTDATA_DIR "T3H2.RC0", + + TESTDATA_DIR "T1D3.COD", + TESTDATA_DIR "T3L3.RC1", + TESTDATA_DIR "T3L3.RC2", + TESTDATA_DIR "T3L3.RC3", + TESTDATA_DIR "T3H3.RC0", + + NULL +}; + +int16_t itu_data[MAX_TEST_VECTOR_LEN]; +uint16_t itu_ref[MAX_TEST_VECTOR_LEN]; +uint16_t itu_ref_upper[MAX_TEST_VECTOR_LEN]; +uint8_t compressed[MAX_TEST_VECTOR_LEN]; +int16_t decompressed[MAX_TEST_VECTOR_LEN]; + +static int hex_get(char *s) +{ + int i; + int value; + int x; + + for (value = i = 0; i < 4; i++) + { + x = *s++ - 0x30; + if (x > 9) + x -= 0x07; + if (x > 15) + x -= 0x20; + if (x < 0 || x > 15) + return -1; + value <<= 4; + value |= x; + } + return value; +} +/*- End of function --------------------------------------------------------*/ + +static int get_vector(FILE *file, uint16_t vec[]) +{ + char buf[132 + 1]; + char *s; + int i; + int value; + + while (fgets(buf, 133, file)) + { + if (buf[0] == '/' && buf[1] == '*') + continue; + s = buf; + i = 0; + while ((value = hex_get(s)) >= 0) + { + vec[i++] = value; + s += 4; + } + return i; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int get_test_vector(const char *file, uint16_t buf[], int max_len) +{ + int octets; + int i; + FILE *infile; + + if ((infile = fopen(file, "r")) == NULL) + { + fprintf(stderr, " Failed to open '%s'\n", file); + exit(2); + } + octets = 0; + while ((i = get_vector(infile, buf + octets)) > 0) + octets += i; + fclose(infile); + return octets; +} +/*- End of function --------------------------------------------------------*/ + +static void itu_compliance_tests(void) +{ + g722_encode_state_t enc_state; + g722_decode_state_t dec_state; + int i; + int j; + int k; + int len_comp; + int len_comp_upper; + int len_data; + int len; + int len2; + int mode; + int file; + +#if 1 + /* ITU G.722 encode tests, using configuration 1. The QMF is bypassed */ + for (file = 0; encode_test_files[file]; file += 2) + { + printf("Testing %s -> %s\n", encode_test_files[file], encode_test_files[file + 1]); + + /* Get the input data */ + len_data = get_test_vector(encode_test_files[file], (uint16_t *) itu_data, MAX_TEST_VECTOR_LEN); + + /* Get the reference output data */ + len_comp = get_test_vector(encode_test_files[file + 1], itu_ref, MAX_TEST_VECTOR_LEN); + + /* Process the input data */ + /* Skip the reset stuff at each end of the data */ + for (i = 0; i < len_data; i++) + { + if ((itu_data[i] & 1) == 0) + break; + } + for (j = i; j < len_data; j++) + { + if ((itu_data[j] & 1)) + break; + } + len = j - i; + g722_encode_init(&enc_state, 64000, 0); + enc_state.itu_test_mode = TRUE; + len2 = g722_encode(&enc_state, compressed, itu_data + i, len); + + /* Check the result against the ITU's reference output data */ + j = 0; + for (k = 0; k < len2; k++) + { + if ((compressed[k] & 0xFF) != ((itu_ref[k + i] >> 8) & 0xFF)) + { + printf(">>> %6d %4x %4x\n", k, compressed[k] & 0xFF, itu_ref[k + i] & 0xFFFF); + j++; + } + } + printf("%d bad samples, out of %d/%d samples\n", j, len, len_data); + if (j) + { + printf("Test failed\n"); + exit(2); + } + printf("Test passed\n"); + } +#endif +#if 1 + /* ITU G.722 decode tests, using configuration 2. The QMF is bypassed */ + /* Run each of the tests for each of the modes - 48kbps, 56kbps and 64kbps. */ + for (mode = 1; mode <= 3; mode++) + { + for (file = 0; decode_test_files[file]; file += 5) + { + printf("Testing mode %d, %s -> %s + %s\n", + mode, + decode_test_files[file], + decode_test_files[file + mode], + decode_test_files[file + 4]); + + /* Get the input data */ + len_data = get_test_vector(decode_test_files[file], (uint16_t *) itu_data, MAX_TEST_VECTOR_LEN); + + /* Get the lower reference output data */ + len_comp = get_test_vector(decode_test_files[file + mode], itu_ref, MAX_TEST_VECTOR_LEN); + + /* Get the upper reference output data */ + len_comp_upper = get_test_vector(decode_test_files[file + 4], itu_ref_upper, MAX_TEST_VECTOR_LEN); + + /* Process the input data */ + /* Skip the reset stuff at each end of the data */ + for (i = 0; i < len_data; i++) + { + if ((itu_data[i] & 1) == 0) + break; + } + for (j = i; j < len_data; j++) + { + if ((itu_data[j] & 1)) + break; + } + len = j - i; + for (k = 0; k < len; k++) + compressed[k] = itu_data[k + i] >> ((mode == 3) ? 10 : (mode == 2) ? 9 : 8); + + g722_decode_init(&dec_state, (mode == 3) ? 48000 : (mode == 2) ? 56000 : 64000, 0); + dec_state.itu_test_mode = TRUE; + len2 = g722_decode(&dec_state, decompressed, compressed, len); + + /* Check the result against the ITU's reference output data */ + j = 0; + for (k = 0; k < len2; k += 2) + { + if ((decompressed[k] & 0xFFFF) != (itu_ref[(k >> 1) + i] & 0xFFFF) + || + (decompressed[k + 1] & 0xFFFF) != (itu_ref_upper[(k >> 1) + i] & 0xFFFF)) + { + printf(">>> %6d %4x %4x %4x %4x\n", k >> 1, decompressed[k] & 0xFFFF, decompressed[k + 1] & 0xFFFF, itu_ref[(k >> 1) + i] & 0xFFFF, itu_ref_upper[(k >> 1) + i] & 0xFFFF); + j++; + } + } + printf("%d bad samples, out of %d/%d samples\n", j, len, len_data); + if (j) + { + printf("Test failed\n"); + exit(2); + } + printf("Test passed\n"); + } + } +#endif + printf("Tests passed.\n"); +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + g722_encode_state_t enc_state; + g722_decode_state_t dec_state; + int len2; + int len3; + int i; + int file; + SNDFILE *inhandle; + SNDFILE *outhandle; + SF_INFO info; + int outframes; + int samples; + int opt; + int itutests; + int bit_rate; + int eight_k_in; + int eight_k_out; + int encode; + int decode; + int tone_test; + const char *in_file; + const char *out_file; + int16_t indata[BLOCK_LEN]; + int16_t outdata[BLOCK_LEN]; + uint8_t adpcmdata[BLOCK_LEN]; + float tone_level; + uint32_t tone_phase; + int32_t tone_phase_rate; + + bit_rate = 64000; + eight_k_in = FALSE; + eight_k_out = FALSE; + itutests = TRUE; + encode = FALSE; + decode = FALSE; + tone_test = FALSE; + in_file = NULL; + out_file = NULL; + while ((opt = getopt(argc, argv, "b:d:e:i:l:o:t")) != -1) + { + switch (opt) + { + case 'b': + bit_rate = atoi(optarg); + if (bit_rate != 48000 && bit_rate != 56000 && bit_rate != 64000) + { + fprintf(stderr, "Invalid bit rate selected. Only 48000, 56000 and 64000 are valid.\n"); + exit(2); + } + itutests = FALSE; + break; + case 'd': + in_file = optarg; + decode = TRUE; + itutests = FALSE; + break; + case 'e': + in_file = optarg; + encode = TRUE; + itutests = FALSE; + break; + case 'i': + i = atoi(optarg); + if (i != 8000 && i != 16000) + { + fprintf(stderr, "Invalid incoming sample rate. Only 8000 and 16000 are valid.\n"); + exit(2); + } + eight_k_in = (i == 8000); + if (eight_k_in) + in_file = EIGHTK_IN_FILE_NAME; + break; + case 'l': + out_file = optarg; + break; + case 'o': + i = atoi(optarg); + if (i != 8000 && i != 16000) + { + fprintf(stderr, "Invalid outgoing sample rate. Only 8000 and 16000 are valid.\n"); + exit(2); + } + eight_k_out = (i == 8000); + break; + case 't': + tone_test = TRUE; + itutests = FALSE; + break; + default: + //usage(); + exit(2); + } + } + + if (itutests) + { + itu_compliance_tests(); + } + else + { + tone_level = dds_scaling_dbm0f(2.5f); + tone_phase = 0; + tone_phase_rate = dds_phase_ratef(1500.0f/2.0f); + if (!decode && !encode) + { + decode = + encode = TRUE; + } + if (in_file == NULL) + { + if (encode) + { + if (eight_k_in) + in_file = EIGHTK_IN_FILE_NAME; + else + in_file = IN_FILE_NAME; + } + else + { + in_file = ENCODED_FILE_NAME; + } + } + if (out_file == NULL) + { + out_file = (decode) ? OUT_FILE_NAME : ENCODED_FILE_NAME; + } + inhandle = NULL; + outhandle = NULL; + file = -1; + if (encode) + { + if (eight_k_in) + { + if ((inhandle = sf_open(in_file, SFM_READ, &info)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", in_file); + exit(2); + } + if (info.samplerate != SAMPLE_RATE) + { + fprintf(stderr, " Unexpected sample rate %d in audio file '%s'\n", info.samplerate, in_file); + exit(2); + } + if (info.channels != 1) + { + fprintf(stderr, " Unexpected number of channels in audio file '%s'\n", in_file); + exit(2); + } + } + else + { + if ((inhandle = sf_open(in_file, SFM_READ, &info)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", in_file); + exit(2); + } + if (info.samplerate != G722_SAMPLE_RATE) + { + fprintf(stderr, " Unexpected sample rate %d in audio file '%s'\n", info.samplerate, in_file); + exit(2); + } + if (info.channels != 1) + { + fprintf(stderr, " Unexpected number of channels in audio file '%s'\n", in_file); + exit(2); + } + } + if (eight_k_in) + g722_encode_init(&enc_state, bit_rate, G722_PACKED | G722_SAMPLE_RATE_8000); + else + g722_encode_init(&enc_state, bit_rate, G722_PACKED); + } + else + { + if ((file = open(in_file, O_RDONLY)) < 0) + { + fprintf(stderr, " Failed to open '%s'\n", in_file); + exit(2); + } + } + if (decode) + { + memset(&info, 0, sizeof(info)); + info.frames = 0; + info.samplerate = (eight_k_out) ? SAMPLE_RATE : G722_SAMPLE_RATE; + info.channels = 1; + info.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16; + info.sections = 1; + info.seekable = 1; + if ((outhandle = sf_open(out_file, SFM_WRITE, &info)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", out_file); + exit(2); + } + if (eight_k_out) + g722_decode_init(&dec_state, bit_rate, G722_PACKED | G722_SAMPLE_RATE_8000); + else + g722_decode_init(&dec_state, bit_rate, G722_PACKED); + } + else + { + if ((file = open(out_file, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) + { + fprintf(stderr, " Failed to open '%s'\n", out_file); + exit(2); + } + } + for (;;) + { + if (encode) + { + samples = sf_readf_short(inhandle, indata, BLOCK_LEN); + if (samples <= 0) + break; + if (tone_test) + { + for (i = 0; i < samples; i++) + indata[i] = dds_modf(&tone_phase, tone_phase_rate, tone_level, 0); + } + len2 = g722_encode(&enc_state, adpcmdata, indata, samples); + } + else + { + len2 = read(file, adpcmdata, BLOCK_LEN); + if (len2 <= 0) + break; + } + if (decode) + { + len3 = g722_decode(&dec_state, outdata, adpcmdata, len2); + outframes = sf_writef_short(outhandle, outdata, len3); + if (outframes != len3) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + } + else + { + len3 = write(file, adpcmdata, len2); + if (len3 <= 0) + break; + } + } + if (encode) + { + if (sf_close(inhandle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME); + exit(2); + } + } + else + { + close(file); + } + if (decode) + { + if (sf_close(outhandle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + } + else + { + close(file); + } + printf("'%s' translated to '%s' at %dbps.\n", in_file, out_file, bit_rate); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/g726_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/g726_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1305 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * g726_tests.c - Test G.726 encode and decode. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: g726_tests.c,v 1.33 2009/05/30 15:23:13 steveu Exp $ + */ + +/*! \file */ + +/*! \page g726_tests_page G.726 tests +\section g726_tests_page_sec_1 What does it do? +Two sets of tests are performed: + - The tests defined in the G.726 specification, using the test data files supplied with + the specification. + - A generally audio quality test, consisting of compressing and decompressing a speeech + file for audible comparison. + +The speech file should be recorded at 16 bits/sample, 8000 samples/second, and named +"pre_g726.wav". + +\section g726_tests_page_sec_2 How is it used? +To perform the tests in the G.726 specification you need to obtain the test data files from the +specification. These are copyright material, and so cannot be distributed with this test software. + +The files, containing test vectors, which are supplied with the G.726 specification, should be +copied to itutests/g726 so the files are arranged in the same directory heirarchy in which they +are supplied. That is, you should have file names like + + - itutests/g726/DISK1/INPUT/NRM.M + - itutests/g726/DISK1/INPUT/OVR.M + - itutests/g726/DISK2/INPUT/NRM.A + - itutests/g726/DISK2/INPUT/OVR.A + +in your source tree. The ITU tests can then be run by executing g726_tests without +any parameters. + +To perform a general audio quality test, g726_tests should be run with a parameter specifying +the required bit rate for compression. The valid parameters are "-16", "-24", "-32", and "-40". +The test file ../test-data/local/short_nb_voice.wav will be compressed to the specified bit rate, +decompressed, and the resulting audio stored in post_g726.wav. +*/ + +/* Enable the following definition to enable direct probing into the FAX structures */ +//#define WITH_SPANDSP_INTERNALS + +#if defined(HAVE_CONFIG_H) +#include +#endif + +#include +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define BLOCK_LEN 320 +#define MAX_TEST_VECTOR_LEN 40000 + +#define TESTDATA_DIR "../test-data/itu/g726/" + +#define IN_FILE_NAME "../test-data/local/short_nb_voice.wav" +#define OUT_FILE_NAME "post_g726.wav" + +int16_t outdata[MAX_TEST_VECTOR_LEN]; +uint8_t adpcmdata[MAX_TEST_VECTOR_LEN]; + +int16_t itudata[MAX_TEST_VECTOR_LEN]; +uint8_t itu_ref[MAX_TEST_VECTOR_LEN]; +uint8_t unpacked[MAX_TEST_VECTOR_LEN]; +uint8_t xlaw[MAX_TEST_VECTOR_LEN]; + +/* +Table 4 - V Reset and homing sequences for u-law + Normal I-input Overload +Algorithm Input Intermediate Output Input Output Input Intermediate Output + (PCM) (ADPCM) (PCM) (ADPCM) (PCM) (PCM) (ADPCM) (PCM) + +16F NRM.M RN16FM.I RN16FM.O I16 RI16FM.O OVR.M RV16FM.I RV16FM.O + HN16FM.I HN16FM.O HI16FM.O HV16FM.I HV16FM.O + +24F NRM.M RN24FM.I RN24FM.O I24 RI24FM.O OVR.M RV24FM.I RV24FM.O + HN24FM.I HN24FM.O HI24FM.O HV24FM.I HV24FM.O + +32F NRM.M RN32FM.I RN32FM.O I32 RI32FM.O OVR.M RV32FM.I RV32FM.O + HN32FM.I HN32FM.O HI32FM.O HV32FM.I HV32FM.O + +40F NRM.M RN40FM.I RN40FM.O I40 RI40FM.O OVR.M RV40FM.I RV40FM.O + HN40FM.I HN40FM.O HI40FM.O HV40FM.I HV40FM.O + + +Table 5 - V Reset and homing sequences for A-law + Normal I-input Overload +Algorithm Input Intermediate Output Input Output Input Intermediate Output + (PCM) (ADPCM) (PCM) (ADPCM) (PCM) (PCM) (ADPCM) (PCM) +16F NRM.A RN16FA.I RN16FA.O I16 RI16FA.O OVR.A RV16FA.I RV16FA.O + HN16FA.I HN16FA.O HI16FA.O HV16FA.I HV16FA.O + +24F NRM.A RN24FA.I RN24FA.O I24 RI24FA.O OVR.A RV24FA.I RV24FA.O + HN24FA.I HN24FA.O HI24FA.O HV24FA.I HV24FA.O + +32F NRM.A RN32FA.I RN32FA.O I32 RI32FA.O OVR.A RV32FA.I RV32FA.O + HN32FA.I HN32FA.O HI32FA.O HV32FA.I HV32FA.O + +40F NRM.A RN40FA.I RN40FA.O I40 RI40FA.O OVR.A RV40FA.I RV40FA.O + HN40FA.I HN40FA.O HI40FA.O HV40FA.I HV40FA.O + +Table 6 ¡V Reset and homing cross sequences for u-law -> A-law + Normal Overload +Algorithm Input Intermediate Output Input Intermediate Output + (PCM) (ADPCM) (PCM) (PCM) (ADPCM) (PCM) +16F NRM.M RN16FM.I RN16FC.O OVR.M RV16FM.I RV16FC.O + HN16FM.I HN16FC.O HV16FM.I HV16FC.O + +24F NRM.M RN24FM.I RN24FC.O OVR.M RV24FM.I RV24FC.O + HN24FM.I HN24FC.O HV24FM.I HV24FC.O + +32F NRM.M RN32FM.I RN32FC.O OVR.M RV32FM.I RV32FC.O + HN32FM.I HN32FC.O HV32FM.I HV32FC.O + +40F NRM.M RN40FM.I RN40FC.O OVR.M RV40FM.I RV40FC.O + HN40FM.I HN40FC.O HV40FM.I HV40FC.O + +Table 7 ¡V Reset and homing cross sequences for A-law -> u-law + Normal Overload +Algorithm Input Intermediate Output Input Intermediate Output + (PCM) (ADPCM) (PCM) (PCM) (ADPCM) (PCM) +16F NRM.A RN16FA.I RN16FX.O OVR.A RV16FA.I RV16FX.O + HN16FA.I HN16FX.O HV16FA.I HV16FX.O + +24F NRM.A RN24FA.I RN24FX.O OVR.A RV24FA.I RV24FX.O + HN24FA.I HN24FX.O HV24FA.I HV24FX.O + +32F NRM.A RN32FA.I RN32FX.O OVR.A RV32FA.I RV32FX.O + HN32FA.I HN32FX.O HV32FA.I HV32FX.O + +40F NRM.A RN40FA.I RN40FX.O OVR.A RV40FA.I RV40FX.O + HN40FA.I HN40FX.O HV40FA.I HV40FX.O +*/ + +#define G726_ENCODING_NONE 9999 + +typedef struct +{ + const char *conditioning_pcm_file; + const char *pcm_file; + const char *conditioning_adpcm_file; + const char *adpcm_file; + const char *output_file; + int rate; + int compression_law; + int decompression_law; +} test_set_t; + +static test_set_t itu_test_sets[] = +{ + /* u-law to u-law tests */ + { + "", + TESTDATA_DIR "DISK1/INPUT/NRM.M", + "", + TESTDATA_DIR "DISK1/RESET/16/RN16FM.I", + TESTDATA_DIR "DISK1/RESET/16/RN16FM.O", + 16000, + G726_ENCODING_ULAW, + G726_ENCODING_ULAW + }, + { + "", + "", + "", + TESTDATA_DIR "DISK1/INPUT/I16", + TESTDATA_DIR "DISK1/RESET/16/RI16FM.O", + 16000, + G726_ENCODING_NONE, + G726_ENCODING_ULAW + }, + { + "", + TESTDATA_DIR "DISK1/INPUT/OVR.M", + "", + TESTDATA_DIR "DISK1/RESET/16/RV16FM.I", + TESTDATA_DIR "DISK1/RESET/16/RV16FM.O", + 16000, + G726_ENCODING_ULAW, + G726_ENCODING_ULAW + }, + { + "", + TESTDATA_DIR "DISK1/INPUT/NRM.M", + "", + TESTDATA_DIR "DISK1/RESET/24/RN24FM.I", + TESTDATA_DIR "DISK1/RESET/24/RN24FM.O", + 24000, + G726_ENCODING_ULAW, + G726_ENCODING_ULAW + }, + { + "", + "", + "", + TESTDATA_DIR "DISK1/INPUT/I24", + TESTDATA_DIR "DISK1/RESET/24/RI24FM.O", + 24000, + G726_ENCODING_NONE, + G726_ENCODING_ULAW + }, + { + "", + TESTDATA_DIR "DISK1/INPUT/OVR.M", + "", + TESTDATA_DIR "DISK1/RESET/24/RV24FM.I", + TESTDATA_DIR "DISK1/RESET/24/RV24FM.O", + 24000, + G726_ENCODING_ULAW, + G726_ENCODING_ULAW + }, + { + "", + TESTDATA_DIR "DISK1/INPUT/NRM.M", + "", + TESTDATA_DIR "DISK1/RESET/32/RN32FM.I", + TESTDATA_DIR "DISK1/RESET/32/RN32FM.O", + 32000, + G726_ENCODING_ULAW, + G726_ENCODING_ULAW + }, + { + "", + "", + "", + TESTDATA_DIR "DISK1/INPUT/I32", + TESTDATA_DIR "DISK1/RESET/32/RI32FM.O", + 32000, + G726_ENCODING_NONE, + G726_ENCODING_ULAW + }, + { + "", + TESTDATA_DIR "DISK1/INPUT/OVR.M", + "", + TESTDATA_DIR "DISK1/RESET/32/RV32FM.I", + TESTDATA_DIR "DISK1/RESET/32/RV32FM.O", + 32000, + G726_ENCODING_ULAW, + G726_ENCODING_ULAW + }, + { + "", + TESTDATA_DIR "DISK1/INPUT/NRM.M", + "", + TESTDATA_DIR "DISK1/RESET/40/RN40FM.I", + TESTDATA_DIR "DISK1/RESET/40/RN40FM.O", + 40000, + G726_ENCODING_ULAW, + G726_ENCODING_ULAW + }, + { + "", + "", + "", + TESTDATA_DIR "DISK1/INPUT/I40", + TESTDATA_DIR "DISK1/RESET/40/RI40FM.O", + 40000, + G726_ENCODING_NONE, + G726_ENCODING_ULAW + }, + { + "", + TESTDATA_DIR "DISK1/INPUT/OVR.M", + "", + TESTDATA_DIR "DISK1/RESET/40/RV40FM.I", + TESTDATA_DIR "DISK1/RESET/40/RV40FM.O", + 40000, + G726_ENCODING_ULAW, + G726_ENCODING_ULAW + }, + /* A-law to A-law tests */ + { + "", + TESTDATA_DIR "DISK2/INPUT/NRM.A", + "", + TESTDATA_DIR "DISK2/RESET/16/RN16FA.I", + TESTDATA_DIR "DISK2/RESET/16/RN16FA.O", + 16000, + G726_ENCODING_ALAW, + G726_ENCODING_ALAW + }, + { + "", + "", + "", + TESTDATA_DIR "DISK2/INPUT/I16", + TESTDATA_DIR "DISK2/RESET/16/RI16FA.O", + 16000, + G726_ENCODING_NONE, + G726_ENCODING_ALAW + }, + { + "", + TESTDATA_DIR "DISK2/INPUT/OVR.A", + "", + TESTDATA_DIR "DISK2/RESET/16/RV16FA.I", + TESTDATA_DIR "DISK2/RESET/16/RV16FA.O", + 16000, + G726_ENCODING_ALAW, + G726_ENCODING_ALAW + }, + { + "", + TESTDATA_DIR "DISK2/INPUT/NRM.A", + "", + TESTDATA_DIR "DISK2/RESET/24/RN24FA.I", + TESTDATA_DIR "DISK2/RESET/24/RN24FA.O", + 24000, + G726_ENCODING_ALAW, + G726_ENCODING_ALAW + }, + { + "", + "", + "", + TESTDATA_DIR "DISK2/INPUT/I24", + TESTDATA_DIR "DISK2/RESET/24/RI24FA.O", + 24000, + G726_ENCODING_NONE, + G726_ENCODING_ALAW + }, + { + "", + TESTDATA_DIR "DISK2/INPUT/OVR.A", + "", + TESTDATA_DIR "DISK2/RESET/24/RV24FA.I", + TESTDATA_DIR "DISK2/RESET/24/RV24FA.O", + 24000, + G726_ENCODING_ALAW, + G726_ENCODING_ALAW + }, + { + "", + TESTDATA_DIR "DISK2/INPUT/NRM.A", + "", + TESTDATA_DIR "DISK2/RESET/32/RN32FA.I", + TESTDATA_DIR "DISK2/RESET/32/RN32FA.O", + 32000, + G726_ENCODING_ALAW, + G726_ENCODING_ALAW + }, + { + "", + "", + "", + TESTDATA_DIR "DISK2/INPUT/I32", + TESTDATA_DIR "DISK2/RESET/32/RI32FA.O", + 32000, + G726_ENCODING_NONE, + G726_ENCODING_ALAW + }, + { + "", + TESTDATA_DIR "DISK2/INPUT/OVR.A", + "", + TESTDATA_DIR "DISK2/RESET/32/RV32FA.I", + TESTDATA_DIR "DISK2/RESET/32/RV32FA.O", + 32000, + G726_ENCODING_ALAW, + G726_ENCODING_ALAW + }, + { + "", + TESTDATA_DIR "DISK2/INPUT/NRM.A", + "", + TESTDATA_DIR "DISK2/RESET/40/RN40FA.I", + TESTDATA_DIR "DISK2/RESET/40/RN40FA.O", + 40000, + G726_ENCODING_ALAW, + G726_ENCODING_ALAW + }, + { + "", + "", + "", + TESTDATA_DIR "DISK2/INPUT/I40", + TESTDATA_DIR "DISK2/RESET/40/RI40FA.O", + 40000, + G726_ENCODING_NONE, + G726_ENCODING_ALAW + }, + { + "", + TESTDATA_DIR "DISK2/INPUT/OVR.A", + "", + TESTDATA_DIR "DISK2/RESET/40/RV40FA.I", + TESTDATA_DIR "DISK2/RESET/40/RV40FA.O", + 40000, + G726_ENCODING_ALAW, + G726_ENCODING_ALAW + }, + /* u-law to A-law tests */ + { + "", + TESTDATA_DIR "DISK1/INPUT/NRM.M", + "", + TESTDATA_DIR "DISK1/RESET/16/RN16FM.I", + TESTDATA_DIR "DISK1/RESET/16/RN16FC.O", + 16000, + G726_ENCODING_ULAW, + G726_ENCODING_ALAW + }, + { + "", + TESTDATA_DIR "DISK1/INPUT/OVR.M", + "", + TESTDATA_DIR "DISK1/RESET/16/RV16FM.I", + TESTDATA_DIR "DISK1/RESET/16/RV16FC.O", + 16000, + G726_ENCODING_ULAW, + G726_ENCODING_ALAW + }, + { + "", + TESTDATA_DIR "DISK1/INPUT/NRM.M", + "", + TESTDATA_DIR "DISK1/RESET/24/RN24FM.I", + TESTDATA_DIR "DISK1/RESET/24/RN24FC.O", + 24000, + G726_ENCODING_ULAW, + G726_ENCODING_ALAW + }, + { + "", + TESTDATA_DIR "DISK1/INPUT/OVR.M", + "", + TESTDATA_DIR "DISK1/RESET/24/RV24FM.I", + TESTDATA_DIR "DISK1/RESET/24/RV24FC.O", + 24000, + G726_ENCODING_ULAW, + G726_ENCODING_ALAW + }, + { + "", + TESTDATA_DIR "DISK1/INPUT/NRM.M", + "", + TESTDATA_DIR "DISK1/RESET/32/RN32FM.I", + TESTDATA_DIR "DISK1/RESET/32/RN32FC.O", + 32000, + G726_ENCODING_ULAW, + G726_ENCODING_ALAW + }, + { + "", + TESTDATA_DIR "DISK1/INPUT/OVR.M", + "", + TESTDATA_DIR "DISK1/RESET/32/RV32FM.I", + TESTDATA_DIR "DISK1/RESET/32/RV32FC.O", + 32000, + G726_ENCODING_ULAW, + G726_ENCODING_ALAW + }, + { + "", + TESTDATA_DIR "DISK1/INPUT/NRM.M", + "", + TESTDATA_DIR "DISK1/RESET/40/RN40FM.I", + TESTDATA_DIR "DISK1/RESET/40/RN40FC.O", + 40000, + G726_ENCODING_ULAW, + G726_ENCODING_ALAW + }, + { + "", + TESTDATA_DIR "DISK1/INPUT/OVR.M", + "", + TESTDATA_DIR "DISK1/RESET/40/RV40FM.I", + TESTDATA_DIR "DISK1/RESET/40/RV40FC.O", + 40000, + G726_ENCODING_ULAW, + G726_ENCODING_ALAW + }, + /* A-law to u-law tests */ + { + "", + TESTDATA_DIR "DISK2/INPUT/NRM.A", + "", + TESTDATA_DIR "DISK2/RESET/16/RN16FA.I", + TESTDATA_DIR "DISK2/RESET/16/RN16FX.O", + 16000, + G726_ENCODING_ALAW, + G726_ENCODING_ULAW + }, + { + "", + TESTDATA_DIR "DISK2/INPUT/OVR.A", + "", + TESTDATA_DIR "DISK2/RESET/16/RV16FA.I", + TESTDATA_DIR "DISK2/RESET/16/RV16FX.O", + 16000, + G726_ENCODING_ALAW, + G726_ENCODING_ULAW + }, + { + "", + TESTDATA_DIR "DISK2/INPUT/NRM.A", + "", + TESTDATA_DIR "DISK2/RESET/24/RN24FA.I", + TESTDATA_DIR "DISK2/RESET/24/RN24FX.O", + 24000, + G726_ENCODING_ALAW, + G726_ENCODING_ULAW + }, + { + "", + TESTDATA_DIR "DISK2/INPUT/OVR.A", + "", + TESTDATA_DIR "DISK2/RESET/24/RV24FA.I", + TESTDATA_DIR "DISK2/RESET/24/RV24FX.O", + 24000, + G726_ENCODING_ALAW, + G726_ENCODING_ULAW + }, + { + "", + TESTDATA_DIR "DISK2/INPUT/NRM.A", + "", + TESTDATA_DIR "DISK2/RESET/32/RN32FA.I", + TESTDATA_DIR "DISK2/RESET/32/RN32FX.O", + 32000, + G726_ENCODING_ALAW, + G726_ENCODING_ULAW + }, + { + "", + TESTDATA_DIR "DISK2/INPUT/OVR.A", + "", + TESTDATA_DIR "DISK2/RESET/32/RV32FA.I", + TESTDATA_DIR "DISK2/RESET/32/RV32FX.O", + 32000, + G726_ENCODING_ALAW, + G726_ENCODING_ULAW + }, + { + "", + TESTDATA_DIR "DISK2/INPUT/NRM.A", + "", + TESTDATA_DIR "DISK2/RESET/40/RN40FA.I", + TESTDATA_DIR "DISK2/RESET/40/RN40FX.O", + 40000, + G726_ENCODING_ALAW, + G726_ENCODING_ULAW + }, + { + "", + TESTDATA_DIR "DISK2/INPUT/OVR.A", + "", + TESTDATA_DIR "DISK2/RESET/40/RV40FA.I", + TESTDATA_DIR "DISK2/RESET/40/RV40FX.O", + 40000, + G726_ENCODING_ALAW, + G726_ENCODING_ULAW + }, + /* u-law to u-law tests */ + { + TESTDATA_DIR "DISK1/PCM_INIT.M", + TESTDATA_DIR "DISK1/INPUT/NRM.M", + TESTDATA_DIR "DISK1/HOMING/16/I_INI_16.M", + TESTDATA_DIR "DISK1/HOMING/16/HN16FM.I", + TESTDATA_DIR "DISK1/HOMING/16/HN16FM.O", + 16000, + G726_ENCODING_ULAW, + G726_ENCODING_ULAW + }, + { + "", + "", + TESTDATA_DIR "DISK1/HOMING/16/I_INI_16.M", + TESTDATA_DIR "DISK1/INPUT/I16", + TESTDATA_DIR "DISK1/HOMING/16/HI16FM.O", + 16000, + G726_ENCODING_NONE, + G726_ENCODING_ULAW + }, + { + TESTDATA_DIR "DISK1/PCM_INIT.M", + TESTDATA_DIR "DISK1/INPUT/OVR.M", + TESTDATA_DIR "DISK1/HOMING/16/I_INI_16.M", + TESTDATA_DIR "DISK1/HOMING/16/HV16FM.I", + TESTDATA_DIR "DISK1/HOMING/16/HV16FM.O", + 16000, + G726_ENCODING_ULAW, + G726_ENCODING_ULAW + }, + { + TESTDATA_DIR "DISK1/PCM_INIT.M", + TESTDATA_DIR "DISK1/INPUT/NRM.M", + TESTDATA_DIR "DISK1/HOMING/24/I_INI_24.M", + TESTDATA_DIR "DISK1/HOMING/24/HN24FM.I", + TESTDATA_DIR "DISK1/HOMING/24/HN24FM.O", + 24000, + G726_ENCODING_ULAW, + G726_ENCODING_ULAW + }, + { + "", + "", + TESTDATA_DIR "DISK1/HOMING/24/I_INI_24.M", + TESTDATA_DIR "DISK1/INPUT/I24", + TESTDATA_DIR "DISK1/HOMING/24/HI24FM.O", + 24000, + G726_ENCODING_NONE, + G726_ENCODING_ULAW + }, + { + TESTDATA_DIR "DISK1/PCM_INIT.M", + TESTDATA_DIR "DISK1/INPUT/OVR.M", + TESTDATA_DIR "DISK1/HOMING/24/I_INI_24.M", + TESTDATA_DIR "DISK1/HOMING/24/HV24FM.I", + TESTDATA_DIR "DISK1/HOMING/24/HV24FM.O", + 24000, + G726_ENCODING_ULAW, + G726_ENCODING_ULAW + }, + { + TESTDATA_DIR "DISK1/PCM_INIT.M", + TESTDATA_DIR "DISK1/INPUT/NRM.M", + TESTDATA_DIR "DISK1/HOMING/32/I_INI_32.M", + TESTDATA_DIR "DISK1/HOMING/32/HN32FM.I", + TESTDATA_DIR "DISK1/HOMING/32/HN32FM.O", + 32000, + G726_ENCODING_ULAW, + G726_ENCODING_ULAW + }, + { + "", + "", + TESTDATA_DIR "DISK1/HOMING/32/I_INI_32.M", + TESTDATA_DIR "DISK1/INPUT/I32", + TESTDATA_DIR "DISK1/HOMING/32/HI32FM.O", + 32000, + G726_ENCODING_NONE, + G726_ENCODING_ULAW + }, + { + TESTDATA_DIR "DISK1/PCM_INIT.M", + TESTDATA_DIR "DISK1/INPUT/OVR.M", + TESTDATA_DIR "DISK1/HOMING/32/I_INI_32.M", + TESTDATA_DIR "DISK1/HOMING/32/HV32FM.I", + TESTDATA_DIR "DISK1/HOMING/32/HV32FM.O", + 32000, + G726_ENCODING_ULAW, + G726_ENCODING_ULAW + }, + { + TESTDATA_DIR "DISK1/PCM_INIT.M", + TESTDATA_DIR "DISK1/INPUT/NRM.M", + TESTDATA_DIR "DISK1/HOMING/40/I_INI_40.M", + TESTDATA_DIR "DISK1/HOMING/40/HN40FM.I", + TESTDATA_DIR "DISK1/HOMING/40/HN40FM.O", + 40000, + G726_ENCODING_ULAW, + G726_ENCODING_ULAW + }, + { + "", + "", + TESTDATA_DIR "DISK1/HOMING/40/I_INI_40.M", + TESTDATA_DIR "DISK1/INPUT/I40", + TESTDATA_DIR "DISK1/HOMING/40/HI40FM.O", + 40000, + G726_ENCODING_NONE, + G726_ENCODING_ULAW + }, + { + TESTDATA_DIR "DISK1/PCM_INIT.M", + TESTDATA_DIR "DISK1/INPUT/OVR.M", + TESTDATA_DIR "DISK1/HOMING/40/I_INI_40.M", + TESTDATA_DIR "DISK1/HOMING/40/HV40FM.I", + TESTDATA_DIR "DISK1/HOMING/40/HV40FM.O", + 40000, + G726_ENCODING_ULAW, + G726_ENCODING_ULAW + }, + /* A-law to A-law tests */ + { + TESTDATA_DIR "DISK2/PCM_INIT.A", + TESTDATA_DIR "DISK2/INPUT/NRM.A", + TESTDATA_DIR "DISK2/HOMING/16/I_INI_16.A", + TESTDATA_DIR "DISK2/HOMING/16/HN16FA.I", + TESTDATA_DIR "DISK2/HOMING/16/HN16FA.O", + 16000, + G726_ENCODING_ALAW, + G726_ENCODING_ALAW + }, + { + "", + "", + TESTDATA_DIR "DISK2/HOMING/16/I_INI_16.A", + TESTDATA_DIR "DISK2/INPUT/I16", + TESTDATA_DIR "DISK2/HOMING/16/HI16FA.O", + 16000, + G726_ENCODING_NONE, + G726_ENCODING_ALAW + }, + { + TESTDATA_DIR "DISK2/PCM_INIT.A", + TESTDATA_DIR "DISK2/INPUT/OVR.A", + TESTDATA_DIR "DISK2/HOMING/16/I_INI_16.A", + TESTDATA_DIR "DISK2/HOMING/16/HV16FA.I", + TESTDATA_DIR "DISK2/HOMING/16/HV16FA.O", + 16000, + G726_ENCODING_ALAW, + G726_ENCODING_ALAW + }, + { + TESTDATA_DIR "DISK2/PCM_INIT.A", + TESTDATA_DIR "DISK2/INPUT/NRM.A", + TESTDATA_DIR "DISK2/HOMING/24/I_INI_24.A", + TESTDATA_DIR "DISK2/HOMING/24/HN24FA.I", + TESTDATA_DIR "DISK2/HOMING/24/HN24FA.O", + 24000, + G726_ENCODING_ALAW, + G726_ENCODING_ALAW + }, + { + "", + "", + TESTDATA_DIR "DISK2/HOMING/24/I_INI_24.A", + TESTDATA_DIR "DISK2/INPUT/I24", + TESTDATA_DIR "DISK2/HOMING/24/HI24FA.O", + 24000, + G726_ENCODING_NONE, + G726_ENCODING_ALAW + }, + { + TESTDATA_DIR "DISK2/PCM_INIT.A", + TESTDATA_DIR "DISK2/INPUT/OVR.A", + TESTDATA_DIR "DISK2/HOMING/24/I_INI_24.A", + TESTDATA_DIR "DISK2/HOMING/24/HV24FA.I", + TESTDATA_DIR "DISK2/HOMING/24/HV24FA.O", + 24000, + G726_ENCODING_ALAW, + G726_ENCODING_ALAW + }, + { + TESTDATA_DIR "DISK2/PCM_INIT.A", + TESTDATA_DIR "DISK2/INPUT/NRM.A", + TESTDATA_DIR "DISK2/HOMING/32/I_INI_32.A", + TESTDATA_DIR "DISK2/HOMING/32/HN32FA.I", + TESTDATA_DIR "DISK2/HOMING/32/HN32FA.O", + 32000, + G726_ENCODING_ALAW, + G726_ENCODING_ALAW + }, + { + "", + "", + TESTDATA_DIR "DISK2/HOMING/32/I_INI_32.A", + TESTDATA_DIR "DISK2/INPUT/I32", + TESTDATA_DIR "DISK2/HOMING/32/HI32FA.O", + 32000, + G726_ENCODING_NONE, + G726_ENCODING_ALAW + }, + { + TESTDATA_DIR "DISK2/PCM_INIT.A", + TESTDATA_DIR "DISK2/INPUT/OVR.A", + TESTDATA_DIR "DISK2/HOMING/32/I_INI_32.A", + TESTDATA_DIR "DISK2/HOMING/32/HV32FA.I", + TESTDATA_DIR "DISK2/HOMING/32/HV32FA.O", + 32000, + G726_ENCODING_ALAW, + G726_ENCODING_ALAW + }, + { + TESTDATA_DIR "DISK2/PCM_INIT.A", + TESTDATA_DIR "DISK2/INPUT/NRM.A", + TESTDATA_DIR "DISK2/HOMING/40/I_INI_40.A", + TESTDATA_DIR "DISK2/HOMING/40/HN40FA.I", + TESTDATA_DIR "DISK2/HOMING/40/HN40FA.O", + 40000, + G726_ENCODING_ALAW, + G726_ENCODING_ALAW + }, + { + "", + "", + TESTDATA_DIR "DISK2/HOMING/40/I_INI_40.A", + TESTDATA_DIR "DISK2/INPUT/I40", + TESTDATA_DIR "DISK2/HOMING/40/HI40FA.O", + 40000, + G726_ENCODING_NONE, + G726_ENCODING_ALAW + }, + { + TESTDATA_DIR "DISK2/PCM_INIT.A", + TESTDATA_DIR "DISK2/INPUT/OVR.A", + TESTDATA_DIR "DISK2/HOMING/40/I_INI_40.A", + TESTDATA_DIR "DISK2/HOMING/40/HV40FA.I", + TESTDATA_DIR "DISK2/HOMING/40/HV40FA.O", + 40000, + G726_ENCODING_ALAW, + G726_ENCODING_ALAW + }, + /* u-law to A-law tests */ + { + TESTDATA_DIR "DISK1/PCM_INIT.M", + TESTDATA_DIR "DISK1/INPUT/NRM.M", + TESTDATA_DIR "DISK2/HOMING/16/I_INI_16.A", + TESTDATA_DIR "DISK1/HOMING/16/HN16FM.I", + TESTDATA_DIR "DISK1/HOMING/16/HN16FC.O", + 16000, + G726_ENCODING_ULAW, + G726_ENCODING_ALAW + }, + { + TESTDATA_DIR "DISK1/PCM_INIT.M", + TESTDATA_DIR "DISK1/INPUT/OVR.M", + TESTDATA_DIR "DISK2/HOMING/16/I_INI_16.A", + TESTDATA_DIR "DISK1/HOMING/16/HV16FM.I", + TESTDATA_DIR "DISK1/HOMING/16/HV16FC.O", + 16000, + G726_ENCODING_ULAW, + G726_ENCODING_ALAW + }, + { + TESTDATA_DIR "DISK1/PCM_INIT.M", + TESTDATA_DIR "DISK1/INPUT/NRM.M", + TESTDATA_DIR "DISK2/HOMING/24/I_INI_24.A", + TESTDATA_DIR "DISK1/HOMING/24/HN24FM.I", + TESTDATA_DIR "DISK1/HOMING/24/HN24FC.O", + 24000, + G726_ENCODING_ULAW, + G726_ENCODING_ALAW + }, + { + TESTDATA_DIR "DISK1/PCM_INIT.M", + TESTDATA_DIR "DISK1/INPUT/OVR.M", + TESTDATA_DIR "DISK2/HOMING/24/I_INI_24.A", + TESTDATA_DIR "DISK1/HOMING/24/HV24FM.I", + TESTDATA_DIR "DISK1/HOMING/24/HV24FC.O", + 24000, + G726_ENCODING_ULAW, + G726_ENCODING_ALAW + }, + { + TESTDATA_DIR "DISK1/PCM_INIT.M", + TESTDATA_DIR "DISK1/INPUT/NRM.M", + TESTDATA_DIR "DISK2/HOMING/32/I_INI_32.A", + TESTDATA_DIR "DISK1/HOMING/32/HN32FM.I", + TESTDATA_DIR "DISK1/HOMING/32/HN32FC.O", + 32000, + G726_ENCODING_ULAW, + G726_ENCODING_ALAW + }, + { + TESTDATA_DIR "DISK1/PCM_INIT.M", + TESTDATA_DIR "DISK1/INPUT/OVR.M", + TESTDATA_DIR "DISK2/HOMING/32/I_INI_32.A", + TESTDATA_DIR "DISK1/HOMING/32/HV32FM.I", + TESTDATA_DIR "DISK1/HOMING/32/HV32FC.O", + 32000, + G726_ENCODING_ULAW, + G726_ENCODING_ALAW + }, + { + TESTDATA_DIR "DISK1/PCM_INIT.M", + TESTDATA_DIR "DISK1/INPUT/NRM.M", + TESTDATA_DIR "DISK2/HOMING/40/I_INI_40.A", + TESTDATA_DIR "DISK1/HOMING/40/HN40FM.I", + TESTDATA_DIR "DISK1/HOMING/40/HN40FC.O", + 40000, + G726_ENCODING_ULAW, + G726_ENCODING_ALAW + }, + { + TESTDATA_DIR "DISK1/PCM_INIT.M", + TESTDATA_DIR "DISK1/INPUT/OVR.M", + TESTDATA_DIR "DISK2/HOMING/40/I_INI_40.A", + TESTDATA_DIR "DISK1/HOMING/40/HV40FM.I", + TESTDATA_DIR "DISK1/HOMING/40/HV40FC.O", + 40000, + G726_ENCODING_ULAW, + G726_ENCODING_ALAW + }, + /* A-law to u-law tests */ + { + TESTDATA_DIR "DISK2/PCM_INIT.A", + TESTDATA_DIR "DISK2/INPUT/NRM.A", + TESTDATA_DIR "DISK1/HOMING/16/I_INI_16.M", + TESTDATA_DIR "DISK2/HOMING/16/HN16FA.I", + TESTDATA_DIR "DISK2/HOMING/16/HN16FX.O", + 16000, + G726_ENCODING_ALAW, + G726_ENCODING_ULAW + }, + { + TESTDATA_DIR "DISK2/PCM_INIT.A", + TESTDATA_DIR "DISK2/INPUT/OVR.A", + TESTDATA_DIR "DISK1/HOMING/16/I_INI_16.M", + TESTDATA_DIR "DISK2/HOMING/16/HV16FA.I", + TESTDATA_DIR "DISK2/HOMING/16/HV16FX.O", + 16000, + G726_ENCODING_ALAW, + G726_ENCODING_ULAW + }, + { + TESTDATA_DIR "DISK2/PCM_INIT.A", + TESTDATA_DIR "DISK2/INPUT/NRM.A", + TESTDATA_DIR "DISK1/HOMING/24/I_INI_24.M", + TESTDATA_DIR "DISK2/HOMING/24/HN24FA.I", + TESTDATA_DIR "DISK2/HOMING/24/HN24FX.O", + 24000, + G726_ENCODING_ALAW, + G726_ENCODING_ULAW + }, + { + TESTDATA_DIR "DISK2/PCM_INIT.A", + TESTDATA_DIR "DISK2/INPUT/OVR.A", + TESTDATA_DIR "DISK1/HOMING/24/I_INI_24.M", + TESTDATA_DIR "DISK2/HOMING/24/HV24FA.I", + TESTDATA_DIR "DISK2/HOMING/24/HV24FX.O", + 24000, + G726_ENCODING_ALAW, + G726_ENCODING_ULAW + }, + { + TESTDATA_DIR "DISK2/PCM_INIT.A", + TESTDATA_DIR "DISK2/INPUT/NRM.A", + TESTDATA_DIR "DISK1/HOMING/32/I_INI_32.M", + TESTDATA_DIR "DISK2/HOMING/32/HN32FA.I", + TESTDATA_DIR "DISK2/HOMING/32/HN32FX.O", + 32000, + G726_ENCODING_ALAW, + G726_ENCODING_ULAW + }, + { + TESTDATA_DIR "DISK2/PCM_INIT.A", + TESTDATA_DIR "DISK2/INPUT/OVR.A", + TESTDATA_DIR "DISK1/HOMING/32/I_INI_32.M", + TESTDATA_DIR "DISK2/HOMING/32/HV32FA.I", + TESTDATA_DIR "DISK2/HOMING/32/HV32FX.O", + 32000, + G726_ENCODING_ALAW, + G726_ENCODING_ULAW + }, + { + TESTDATA_DIR "DISK2/PCM_INIT.A", + TESTDATA_DIR "DISK2/INPUT/NRM.A", + TESTDATA_DIR "DISK1/HOMING/40/I_INI_40.M", + TESTDATA_DIR "DISK2/HOMING/40/HN40FA.I", + TESTDATA_DIR "DISK2/HOMING/40/HN40FX.O", + 40000, + G726_ENCODING_ALAW, + G726_ENCODING_ULAW + }, + { + TESTDATA_DIR "DISK2/PCM_INIT.A", + TESTDATA_DIR "DISK2/INPUT/OVR.A", + TESTDATA_DIR "DISK1/HOMING/40/I_INI_40.M", + TESTDATA_DIR "DISK2/HOMING/40/HV40FA.I", + TESTDATA_DIR "DISK2/HOMING/40/HV40FX.O", + 40000, + G726_ENCODING_ALAW, + G726_ENCODING_ULAW + }, + { + NULL, + NULL, + NULL, + NULL, + NULL, + 0, + 0, + 0 + } +}; + +static int hex_get(char *s) +{ + int i; + int value; + int x; + + for (value = i = 0; i < 2; i++) + { + x = *s++ - 0x30; + if (x > 9) + x -= 0x07; + if (x > 15) + x -= 0x20; + if (x < 0 || x > 15) + return -1; + value <<= 4; + value |= x; + } + return value; +} +/*- End of function --------------------------------------------------------*/ + +static int get_vector(FILE *file, uint8_t vec[]) +{ + char buf[132 + 1]; + char *s; + int i; + int value; + + while (fgets(buf, 133, file)) + { + s = buf; + i = 0; + while ((value = hex_get(s)) >= 0) + { + vec[i++] = value; + s += 2; + } + return i; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int get_test_vector(const char *file, uint8_t buf[], int max_len) +{ + int octets; + int i; + int sum; + FILE *infile; + + if ((infile = fopen(file, "r")) == NULL) + { + fprintf(stderr, " Failed to open '%s'\n", file); + exit(2); + } + octets = 0; + while ((i = get_vector(infile, buf + octets)) > 0) + octets += i; + fclose(infile); + /* The last octet is a sumcheck, so the real data octets are one less than + the total we have */ + octets--; + /* Test the checksum */ + for (sum = i = 0; i < octets; i++) + sum += buf[i]; + if (sum%255 != (int) buf[i]) + { + fprintf(stderr, " Sumcheck failed in '%s' - %x %x\n", file, sum%255, buf[i]); + exit(2); + } + return octets; +} +/*- End of function --------------------------------------------------------*/ + +static void itu_compliance_tests(void) +{ + g726_state_t enc_state; + g726_state_t dec_state; + int len2; + int len3; + int i; + int test; + int bits_per_code; + int bad_samples; + int conditioning_samples; + int samples; + int conditioning_adpcm; + int adpcm; + + len2 = 0; + conditioning_samples = 0; + for (test = 0; itu_test_sets[test].rate; test++) + { + printf("Test %2d: '%s' + '%s'\n" + " -> '%s' + '%s'\n" + " -> '%s' [%d, %d, %d]\n", + test, + itu_test_sets[test].conditioning_pcm_file, + itu_test_sets[test].pcm_file, + itu_test_sets[test].conditioning_adpcm_file, + itu_test_sets[test].adpcm_file, + itu_test_sets[test].output_file, + itu_test_sets[test].rate, + itu_test_sets[test].compression_law, + itu_test_sets[test].decompression_law); + switch (itu_test_sets[test].rate) + { + case 16000: + bits_per_code = 2; + break; + case 24000: + bits_per_code = 3; + break; + case 32000: + default: + bits_per_code = 4; + break; + case 40000: + bits_per_code = 5; + break; + } + if (itu_test_sets[test].compression_law != G726_ENCODING_NONE) + { + /* Test the encode side */ + g726_init(&enc_state, itu_test_sets[test].rate, itu_test_sets[test].compression_law, G726_PACKING_NONE); + if (itu_test_sets[test].conditioning_pcm_file[0]) + { + conditioning_samples = get_test_vector(itu_test_sets[test].conditioning_pcm_file, xlaw, MAX_TEST_VECTOR_LEN); + printf("Test %d: Homing %d samples at %dbps\n", test, conditioning_samples, itu_test_sets[test].rate); + } + else + { + conditioning_samples = 0; + } + samples = get_test_vector(itu_test_sets[test].pcm_file, xlaw + conditioning_samples, MAX_TEST_VECTOR_LEN); + memcpy(itudata, xlaw, samples + conditioning_samples); + printf("Test %d: Compressing %d samples at %dbps\n", test, samples, itu_test_sets[test].rate); + len2 = g726_encode(&enc_state, adpcmdata, itudata, conditioning_samples + samples); + } + /* Test the decode side */ + g726_init(&dec_state, itu_test_sets[test].rate, itu_test_sets[test].decompression_law, G726_PACKING_NONE); + if (itu_test_sets[test].conditioning_adpcm_file[0]) + { + conditioning_adpcm = get_test_vector(itu_test_sets[test].conditioning_adpcm_file, unpacked, MAX_TEST_VECTOR_LEN); + printf("Test %d: Homing %d octets at %dbps\n", test, conditioning_adpcm, itu_test_sets[test].rate); + } + else + { + conditioning_adpcm = 0; + } + adpcm = get_test_vector(itu_test_sets[test].adpcm_file, unpacked + conditioning_adpcm, MAX_TEST_VECTOR_LEN); + if (itu_test_sets[test].compression_law != G726_ENCODING_NONE) + { + /* Test our compressed version against the reference compressed version */ + printf("Test %d: Compressed data check - %d/%d octets\n", test, conditioning_adpcm + adpcm, len2); + if (conditioning_adpcm + adpcm == len2) + { + for (bad_samples = 0, i = conditioning_samples; i < len2; i++) + { + if (adpcmdata[i] != unpacked[i]) + { + bad_samples++; + printf("Test %d: Compressed mismatch %d %x %x\n", test, i, adpcmdata[i], unpacked[i]); + } + } + if (bad_samples > 0) + { + printf("Test failed\n"); + exit(2); + } + printf("Test passed\n"); + } + else + { + printf("Test %d: Length mismatch - ref = %d, processed = %d\n", test, conditioning_adpcm + adpcm, len2); + exit(2); + } + } + + len3 = g726_decode(&dec_state, outdata, unpacked, conditioning_adpcm + adpcm); + + /* Get the output reference data */ + samples = get_test_vector(itu_test_sets[test].output_file, xlaw, MAX_TEST_VECTOR_LEN); + memcpy(itu_ref, xlaw, samples); + /* Test our decompressed version against the reference decompressed version */ + printf("Test %d: Decompressed data check - %d/%d samples\n", test, samples, len3 - conditioning_adpcm); + if (samples == len3 - conditioning_adpcm) + { + for (bad_samples = 0, i = 0; i < len3; i++) + { + if (itu_ref[i] != ((uint8_t *) outdata)[i + conditioning_adpcm]) + { + bad_samples++; + printf("Test %d: Decompressed mismatch %d %x %x\n", test, i, itu_ref[i], ((uint8_t *) outdata)[i + conditioning_adpcm]); + } + } + if (bad_samples > 0) + { + printf("Test failed\n"); + exit(2); + } + printf("Test passed\n"); + } + else + { + printf("Test %d: Length mismatch - ref = %d, processed = %d\n", test, samples, len3 - conditioning_adpcm); + exit(2); + } + } + + printf("Tests passed.\n"); +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + g726_state_t enc_state; + g726_state_t dec_state; + int opt; + int itutests; + int bit_rate; + SNDFILE *inhandle; + SNDFILE *outhandle; + int16_t amp[1024]; + int frames; + int outframes; + int adpcm; + int packing; + + bit_rate = 32000; + itutests = TRUE; + packing = G726_PACKING_NONE; + while ((opt = getopt(argc, argv, "b:LR")) != -1) + { + switch (opt) + { + case 'b': + bit_rate = atoi(optarg); + if (bit_rate != 16000 && bit_rate != 24000 && bit_rate != 32000 && bit_rate != 40000) + { + fprintf(stderr, "Invalid bit rate selected. Only 16000, 24000, 32000 and 40000 are valid.\n"); + exit(2); + } + itutests = FALSE; + break; + case 'L': + packing = G726_PACKING_LEFT; + break; + case 'R': + packing = G726_PACKING_RIGHT; + break; + default: + //usage(); + exit(2); + } + } + + if (itutests) + { + itu_compliance_tests(); + } + else + { + if ((inhandle = sf_open_telephony_read(IN_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", IN_FILE_NAME); + exit(2); + } + if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + + printf("ADPCM packing is %d\n", packing); + g726_init(&enc_state, bit_rate, G726_ENCODING_LINEAR, packing); + g726_init(&dec_state, bit_rate, G726_ENCODING_LINEAR, packing); + + while ((frames = sf_readf_short(inhandle, amp, 159))) + { + adpcm = g726_encode(&enc_state, adpcmdata, amp, frames); + frames = g726_decode(&dec_state, amp, adpcmdata, adpcm); + outframes = sf_writef_short(outhandle, amp, frames); + } + if (sf_close(inhandle) != 0) + { + printf(" Cannot close audio file '%s'\n", IN_FILE_NAME); + exit(2); + } + if (sf_close(outhandle) != 0) + { + printf(" Cannot close audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + printf("'%s' transcoded to '%s' at %dbps.\n", IN_FILE_NAME, OUT_FILE_NAME, bit_rate); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/gsm0610_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/gsm0610_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,629 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * gsm0610_tests.c - Test the GSM 06.10 FR codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: gsm0610_tests.c,v 1.25 2009/05/30 15:23:13 steveu Exp $ + */ + +/*! \file */ + +/*! \page gsm0610_tests_page GSM 06.10 full rate codec tests +\section gsm0610_tests_page_sec_1 What does it do? +Two sets of tests are performed: + - The tests defined in the GSM 06.10 specification, using the test data files supplied with + the specification. + - A generally audio quality test, consisting of compressing and decompressing a speeech + file for audible comparison. + +\section gsm0610_tests_page_sec_2 How is it used? +To perform the tests in the GSM 06.10 specification you need to obtain the test data files from the +specification. These are copyright material, and so cannot be distributed with this test software. +They can, however, be freely downloaded from the ETSI web site. + +The files, containing test vectors, which are supplied with the GSM 06.10 specification, should be +copied to etsitests/gsm0610/unpacked so the files are arranged in the following directories. + +./fr_A: + Seq01-A.cod Seq01-A.inp Seq01-A.out + Seq02-A.cod Seq02-A.inp Seq02-A.out + Seq03-A.cod Seq03-A.inp Seq03-A.out + Seq04-A.cod Seq04-A.inp Seq04-A.out + Seq05-A.out + +./fr_L: + Seq01.cod Seq01.inp Seq01.out + Seq02.cod Seq02.inp Seq02.out + Seq03.cod Seq03.inp Seq03.out + Seq04.cod Seq04.inp Seq04.out + Seq05.cod Seq05.out + +./fr_U: + Seq01-U.cod Seq01-U.inp Seq01-U.out + Seq02-U.cod Seq02-U.inp Seq02-U.out + Seq03-U.cod Seq03-U.inp Seq03-U.out + Seq04-U.cod Seq04-U.inp Seq04-U.out + Seq05-U.out + +./fr_homing_A: + Homing01_A.out + Seq01H_A.cod Seq01H_A.inp Seq01H_A.out + Seq02H_A.cod Seq02H_A.inp Seq02H_A.out + Seq03H_A.cod Seq03H_A.inp Seq03H_A.out + Seq04H_A.cod Seq04H_A.inp Seq04H_A.out + Seq05H_A.out + Seq06H_A.cod Seq06H_A.inp + +./fr_homing_L: + Homing01.cod Homing01.out + Seq01h.cod Seq01h.inp Seq01h.out + Seq02h.cod Seq02h.inp Seq02h.out + Seq03h.cod Seq03h.inp Seq03h.out + Seq04h.cod Seq04h.inp Seq04h.out + Seq05h.cod Seq05h.out + Seq06h.cod Seq06h.inp + +./fr_homing_U: + Homing01_U.out + Seq01H_U.cod Seq01H_U.inp Seq01H_U.out + Seq02H_U.cod Seq02H_U.inp Seq02H_U.out + Seq03H_U.cod Seq03H_U.inp Seq03H_U.out + Seq04H_U.cod Seq04H_U.inp Seq04H_U.out + Seq05H_U.out + Seq06H_U.cod Seq06H_U.inp + +./fr_sync_A: + Seqsync_A.inp + Sync000_A.cod --to-- Sync159_A.cod + +./fr_sync_L: + Bitsync.inp + Seqsync.inp + Sync000.cod --to-- Sync159.cod + +./fr_sync_U: + Seqsync_U.inp + Sync000_U.cod --to-- Sync159_U.cod + +This is different from the directory structure in which they are supplied. Also, the files names are a little +different. The supplied names are messy, and inconsistent across the sets. The names required by these tests +just clean up these inconsistencies. Note that you will need a Windows machine to unpack some of the supplied +files. + +To perform a general audio quality test, gsm0610_tests should be run. The file ../test-data/local/short_nb_voice.wav +will be compressed to GSM 06.10 data, decompressed, and the resulting audio stored in post_gsm0610.wav. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define BLOCK_LEN 160 + +#define TESTDATA_DIR "../test-data/etsi/gsm0610/unpacked/fr_" + +#define IN_FILE_NAME "../test-data/local/short_nb_voice.wav" +#define OUT_FILE_NAME "post_gsm0610.wav" + +#define HIST_LEN 1000 + +uint8_t law_in_vector[1000000]; +int16_t in_vector[1000000]; +uint16_t code_vector_buf[1000000]; +uint8_t code_vector[1000000]; +uint8_t ref_code_vector[1000000]; +uint8_t decoder_code_vector[1000000]; +uint8_t law_out_vector[1000000]; +int16_t out_vector[1000000]; +int16_t ref_out_vector[1000000]; +uint8_t ref_law_out_vector[1000000]; +int vector_len; + +static int get_test_vector(int full, int disk, const char *name) +{ + char buf[500]; + int in; + int len; + int i; + + if (full) + { + sprintf(buf, "%s%c/%s.inp", TESTDATA_DIR, 'L', name); + if ((in = open(buf, O_RDONLY)) < 0) + { + fprintf(stderr, "Cannot open %s\n", buf); + exit(2); + } + len = read(in, in_vector, 1000000); + close(in); + len /= sizeof(int16_t); + vector_len = len; + } + + sprintf(buf, "%s%c/%s.out", TESTDATA_DIR, 'L', name); + if ((in = open(buf, O_RDONLY)) < 0) + { + fprintf(stderr, "Cannot open %s\n", buf); + exit(2); + } + len = read(in, ref_out_vector, 1000000); + close(in); + len /= sizeof(int16_t); + if (full) + { + if (len != vector_len) + { + fprintf(stderr, "Input and reference vector lengths do not match - %d %d\n", vector_len, len); + exit(2); + } + } + else + { + vector_len = len; + } + + sprintf(buf, "%s%c/%s.cod", TESTDATA_DIR, 'L', name); + if ((in = open(buf, O_RDONLY)) < 0) + { + fprintf(stderr, "Cannot open %s\n", buf); + exit(2); + } + len = read(in, code_vector_buf, 1000000); + close(in); + len /= sizeof(int16_t); + for (i = 0; i < len; i++) + { + ref_code_vector[i] = code_vector_buf[i]; + decoder_code_vector[i] = code_vector_buf[i]; + } + if (len*BLOCK_LEN != vector_len*76) + { + fprintf(stderr, "Input and code vector lengths do not match - %d %d\n", vector_len, len); + exit(2); + } + + return len; +} +/*- End of function --------------------------------------------------------*/ + +static int get_law_test_vector(int full, int law, const char *name) +{ + char buf[500]; + int in; + int len; + int i; + int law_uc; + + law_uc = toupper(law); + + if (full) + { + sprintf(buf, "%s%c/%s-%c.inp", TESTDATA_DIR, law_uc, name, law_uc); + if ((in = open(buf, O_RDONLY)) < 0) + { + fprintf(stderr, "Cannot open %s\n", buf); + exit(2); + } + len = read(in, law_in_vector, 1000000); + close(in); + vector_len = len; + + sprintf(buf, "%s%c/%s-%c.cod", TESTDATA_DIR, law_uc, name, law_uc); + if ((in = open(buf, O_RDONLY)) < 0) + { + fprintf(stderr, "Cannot open %s\n", buf); + exit(2); + } + len = read(in, code_vector_buf, 1000000); + close(in); + len /= sizeof(int16_t); + for (i = 0; i < len; i++) + ref_code_vector[i] = code_vector_buf[i]; + if (len*BLOCK_LEN != vector_len*76) + { + fprintf(stderr, "Input and code vector lengths do not match - %d %d\n", vector_len, len); + exit(2); + } + } + + sprintf(buf, "%s%c/%s-%c.out", TESTDATA_DIR, law_uc, name, law_uc); + if ((in = open(buf, O_RDONLY)) < 0) + { + fprintf(stderr, "Cannot open %s\n", buf); + exit(2); + } + len = read(in, ref_law_out_vector, 1000000); + close(in); + if (full) + { + if (len != vector_len) + { + fprintf(stderr, "Input and reference vector lengths do not match - %d %d\n", vector_len, len); + exit(2); + } + } + else + { + vector_len = len; + } + + sprintf(buf, "%s%c/%s.cod", TESTDATA_DIR, 'L', name); + if ((in = open(buf, O_RDONLY)) < 0) + { + fprintf(stderr, "Cannot open %s\n", buf); + exit(2); + } + len = read(in, code_vector_buf, 1000000); + close(in); + len /= sizeof(int16_t); + for (i = 0; i < len; i++) + decoder_code_vector[i] = code_vector_buf[i]; + + return len; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_linear_test(int full, int disk, const char *name) +{ + gsm0610_state_t *gsm0610_enc_state; + gsm0610_state_t *gsm0610_dec_state; + int i; + int xxx; + int mismatches; + + printf("Performing linear test '%s' from disk %d\n", name, disk); + + get_test_vector(full, disk, name); + + if (full) + { + if ((gsm0610_enc_state = gsm0610_init(NULL, GSM0610_PACKING_NONE)) == NULL) + { + fprintf(stderr, " Cannot create encoder\n"); + exit(2); + } + xxx = gsm0610_encode(gsm0610_enc_state, code_vector, in_vector, vector_len); + + printf("Check code vector of length %d\n", xxx); + for (i = 0, mismatches = 0; i < xxx; i++) + { + if (code_vector[i] != ref_code_vector[i]) + { + printf("%8d/%3d: %6d %6d\n", i/76, i%76, code_vector[i], ref_code_vector[i]); + mismatches++; + } + } + gsm0610_release(gsm0610_enc_state); + if (mismatches) + { + printf("Test failed: %d of %d samples mismatch\n", mismatches, xxx); + exit(2); + } + printf("Test passed\n"); + } + + if ((gsm0610_dec_state = gsm0610_init(NULL, GSM0610_PACKING_NONE)) == NULL) + { + fprintf(stderr, " Cannot create decoder\n"); + exit(2); + } + xxx = gsm0610_decode(gsm0610_dec_state, out_vector, decoder_code_vector, vector_len); + printf("Check output vector of length %d\n", vector_len); + for (i = 0, mismatches = 0; i < vector_len; i++) + { + if (out_vector[i] != ref_out_vector[i]) + { + printf("%8d: %6d %6d\n", i, out_vector[i], ref_out_vector[i]); + mismatches++; + } + } + if (mismatches) + { + printf("Test failed: %d of %d samples mismatch\n", mismatches, vector_len); + exit(2); + } + gsm0610_release(gsm0610_dec_state); + printf("Test passed\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_law_test(int full, int law, const char *name) +{ + gsm0610_state_t *gsm0610_enc_state; + gsm0610_state_t *gsm0610_dec_state; + int i; + int xxx; + int mismatches; + + if (law == 'a') + printf("Performing A-law test '%s'\n", name); + else + printf("Performing u-law test '%s'\n", name); + + get_law_test_vector(full, law, name); + + if (full) + { + if ((gsm0610_enc_state = gsm0610_init(NULL, GSM0610_PACKING_NONE)) == NULL) + { + fprintf(stderr, " Cannot create encoder\n"); + exit(2); + } + if (law == 'a') + { + for (i = 0; i < vector_len; i++) + in_vector[i] = alaw_to_linear(law_in_vector[i]); + } + else + { + for (i = 0; i < vector_len; i++) + in_vector[i] = ulaw_to_linear(law_in_vector[i]); + } + xxx = gsm0610_encode(gsm0610_enc_state, code_vector, in_vector, vector_len); + + printf("Check code vector of length %d\n", xxx); + for (i = 0, mismatches = 0; i < xxx; i++) + { + if (code_vector[i] != ref_code_vector[i]) + { + printf("%8d/%3d: %6d %6d %6d\n", i/76, i%76, code_vector[i], ref_code_vector[i], decoder_code_vector[i]); + mismatches++; + } + } + if (mismatches) + { + printf("Test failed: %d of %d samples mismatch\n", mismatches, xxx); + exit(2); + } + printf("Test passed\n"); + gsm0610_release(gsm0610_enc_state); + } + + if ((gsm0610_dec_state = gsm0610_init(NULL, GSM0610_PACKING_NONE)) == NULL) + { + fprintf(stderr, " Cannot create decoder\n"); + exit(2); + } + xxx = gsm0610_decode(gsm0610_dec_state, out_vector, decoder_code_vector, vector_len); + if (law == 'a') + { + for (i = 0; i < vector_len; i++) + law_out_vector[i] = linear_to_alaw(out_vector[i]); + } + else + { + for (i = 0; i < vector_len; i++) + law_out_vector[i] = linear_to_ulaw(out_vector[i]); + } + printf("Check output vector of length %d\n", vector_len); + for (i = 0, mismatches = 0; i < vector_len; i++) + { + if (law_out_vector[i] != ref_law_out_vector[i]) + { + printf("%8d: %6d %6d\n", i, law_out_vector[i], ref_law_out_vector[i]); + mismatches++; + } + } + if (mismatches) + { + printf("Test failed: %d of %d samples mismatch\n", mismatches, vector_len); + exit(2); + } + gsm0610_release(gsm0610_dec_state); + printf("Test passed\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int repack_gsm0610_voip_to_wav49(uint8_t c[], const uint8_t d[]) +{ + gsm0610_frame_t frame[2]; + int n; + + n = gsm0610_unpack_voip(&frame[0], d); + gsm0610_unpack_voip(&frame[1], d + n); + n = gsm0610_pack_wav49(c, frame); + return n; +} +/*- End of function --------------------------------------------------------*/ + +static int repack_gsm0610_wav49_to_voip(uint8_t d[], const uint8_t c[]) +{ + gsm0610_frame_t frame[2]; + int n[2]; + + gsm0610_unpack_wav49(frame, c); + n[0] = gsm0610_pack_voip(d, &frame[0]); + n[1] = gsm0610_pack_voip(d + n[0], &frame[1]); + return n[0] + n[1]; +} +/*- End of function --------------------------------------------------------*/ + +static int perform_pack_unpack_test(void) +{ + uint8_t a[66]; + uint8_t b[66]; + uint8_t c[66]; + int i; + int j; + + printf("Performing packing/unpacking tests (not part of the ETSI conformance tests).\n"); + /* Try trans-packing a lot of random data looking for before/after mismatch. */ + for (j = 0; j < 1000; j++) + { + for (i = 0; i < 65; i++) + a[i] = rand(); + repack_gsm0610_wav49_to_voip(b, a); + repack_gsm0610_voip_to_wav49(c, b); + if (memcmp(a, c, 65)) + { + printf("Test failed: data mismatch\n"); + exit(2); + } + + for (i = 0; i < 66; i++) + a[i] = rand(); + /* Insert the magic code */ + a[0] = (a[0] & 0xF) | 0xD0; + a[33] = (a[33] & 0xF) | 0xD0; + repack_gsm0610_voip_to_wav49(b, a); + repack_gsm0610_wav49_to_voip(c, b); + //for (i = 0; i < 66; i++) + // printf("%2d: 0x%02X 0x%02X\n", i, a[i], c[i]); + if (memcmp(a, c, 66)) + { + printf("Test failed: data mismatch\n"); + exit(2); + } + } + printf("Test passed\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void etsi_compliance_tests(void) +{ + perform_linear_test(TRUE, 1, "Seq01"); + perform_linear_test(TRUE, 1, "Seq02"); + perform_linear_test(TRUE, 1, "Seq03"); + perform_linear_test(TRUE, 1, "Seq04"); + perform_linear_test(FALSE, 1, "Seq05"); + perform_law_test(TRUE, 'a', "Seq01"); + perform_law_test(TRUE, 'a', "Seq02"); + perform_law_test(TRUE, 'a', "Seq03"); + perform_law_test(TRUE, 'a', "Seq04"); + perform_law_test(FALSE, 'a', "Seq05"); + perform_law_test(TRUE, 'u', "Seq01"); + perform_law_test(TRUE, 'u', "Seq02"); + perform_law_test(TRUE, 'u', "Seq03"); + perform_law_test(TRUE, 'u', "Seq04"); + perform_law_test(FALSE, 'u', "Seq05"); + /* This is not actually an ETSI test */ + perform_pack_unpack_test(); + + printf("Tests passed.\n"); +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + SNDFILE *inhandle; + SNDFILE *outhandle; + int frames; + int outframes; + int bytes; + int16_t pre_amp[HIST_LEN]; + int16_t post_amp[HIST_LEN]; + uint8_t gsm0610_data[HIST_LEN]; + gsm0610_state_t *gsm0610_enc_state; + gsm0610_state_t *gsm0610_dec_state; + int opt; + int etsitests; + int packing; + + etsitests = TRUE; + packing = GSM0610_PACKING_NONE; + while ((opt = getopt(argc, argv, "lp:")) != -1) + { + switch (opt) + { + case 'l': + etsitests = FALSE; + break; + case 'p': + packing = atoi(optarg); + break; + default: + //usage(); + exit(2); + } + } + + if (etsitests) + { + etsi_compliance_tests(); + } + else + { + if ((inhandle = sf_open_telephony_read(IN_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", IN_FILE_NAME); + exit(2); + } + if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + + if ((gsm0610_enc_state = gsm0610_init(NULL, packing)) == NULL) + { + fprintf(stderr, " Cannot create encoder\n"); + exit(2); + } + + if ((gsm0610_dec_state = gsm0610_init(NULL, packing)) == NULL) + { + fprintf(stderr, " Cannot create decoder\n"); + exit(2); + } + + while ((frames = sf_readf_short(inhandle, pre_amp, 2*BLOCK_LEN))) + { + bytes = gsm0610_encode(gsm0610_enc_state, gsm0610_data, pre_amp, frames); + gsm0610_decode(gsm0610_dec_state, post_amp, gsm0610_data, bytes); + outframes = sf_writef_short(outhandle, post_amp, frames); + } + + if (sf_close(inhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME); + exit(2); + } + if (sf_close(outhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + gsm0610_release(gsm0610_enc_state); + gsm0610_release(gsm0610_dec_state); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/hdlc_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/hdlc_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,867 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * hdlc_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: hdlc_tests.c,v 1.48 2008/11/30 05:43:37 steveu Exp $ + */ + +/*! \file */ + +/*! \page hdlc_tests_page HDLC tests +\section hdlc_tests_page_sec_1 What does it do? +The HDLC tests exercise the HDLC module, and verifies correct operation +using both 16 and 32 bit CRCs. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include + +#include "spandsp.h" +#include "spandsp/private/hdlc.h" + +int ref_len; +uint8_t buf[1000]; + +int abort_reported; +int frame_handled; +int frame_failed; +int frame_len_errors; +int frame_data_errors; +int underflow_reported; +int framing_ok_reported; +int framing_ok_reports; + +hdlc_rx_state_t rx; +hdlc_tx_state_t tx; + +int frames_sent; +int bytes_sent; +uint64_t start; +uint64_t end; + +/* Use a local random generator, so the results are consistent across platforms. We have hard coded + correct results for a message sequence generated by this particular PRNG. */ +static int my_rand(void) +{ + static int rndnum = 1234567; + + return (rndnum = 1664525U*rndnum + 1013904223U) >> 8; +} +/*- End of function --------------------------------------------------------*/ + +static int cook_up_msg(uint8_t *buf) +{ + int i; + int len; + + /* Use medium length messages, with some randomised length variation. */ + /* TODO: this doesn't exercise extremely short or long messages. */ + len = (my_rand() & 0x3F) + 100; + for (i = 0; i < len; i++) + buf[i] = my_rand(); + return len; +} +/*- End of function --------------------------------------------------------*/ + +static void frame_handler(void *user_data, const uint8_t *pkt, int len, int ok) +{ + if (len < 0) + { + /* Special conditions */ + printf("HDLC rx status is %s (%d)\n", signal_status_to_str(len), len); + switch (len) + { + case SIG_STATUS_FRAMING_OK: + framing_ok_reported = TRUE; + framing_ok_reports++; + break; + case SIG_STATUS_ABORT: + abort_reported = TRUE; + break; + } + return; + } + if (ok) + { + if (len != ref_len) + { + printf("Len error - %d %d\n", len, ref_len); + frame_len_errors++; + return; + } + if (memcmp(pkt, buf, len)) + { + printf("Frame data error\n"); + frame_data_errors++; + return; + } + frame_handled = TRUE; + } + else + { + frame_failed = TRUE; + } +} +/*- End of function --------------------------------------------------------*/ + +static void underflow_handler(void *user_data) +{ + //printf("Underflow reported\n"); + underflow_reported = TRUE; +} +/*- End of function --------------------------------------------------------*/ + +static void check_result(void) +{ + hdlc_rx_stats_t rx_stats; + + hdlc_rx_get_stats(&rx, &rx_stats); + printf("%lu bytes\n", rx_stats.bytes); + printf("%lu good frames\n", rx_stats.good_frames); + printf("%lu CRC errors\n", rx_stats.crc_errors); + printf("%lu length errors\n", rx_stats.length_errors); + printf("%lu aborts\n", rx_stats.aborts); + printf("%d frame length errors\n", frame_len_errors); + printf("%d frame data errors\n", frame_data_errors); + printf("Test duration %" PRIu64 " ticks\n", end - start); + if (rx_stats.bytes != bytes_sent + || + rx_stats.good_frames != frames_sent + || + rx_stats.crc_errors != 0 + || + rx_stats.length_errors != 0 + || + rx_stats.aborts != 0 + || + frame_len_errors != 0 + || + frame_data_errors != 0) + { + printf("Tests failed.\n"); + exit(2); + } + printf("Test passed.\n\n"); +} +/*- End of function --------------------------------------------------------*/ + +static int test_hdlc_modes(void) +{ + int i; + int j; + int len; + int nextbyte; + int progress; + int progress_delay; + uint8_t bufx[100]; + + /* Try sending HDLC messages with CRC-16 */ + printf("Testing with CRC-16 (byte by byte)\n"); + frame_len_errors = 0; + frame_data_errors = 0; + hdlc_tx_init(&tx, FALSE, 1, FALSE, underflow_handler, NULL); + hdlc_rx_init(&rx, FALSE, FALSE, 5, frame_handler, NULL); + underflow_reported = FALSE; + + start = rdtscll(); + hdlc_tx_flags(&tx, 40); + /* Push an initial message so we should NOT get an underflow after the preamble. */ + ref_len = cook_up_msg(buf); + hdlc_tx_frame(&tx, buf, ref_len); + frame_handled = FALSE; + frame_failed = FALSE; + frames_sent = 0; + bytes_sent = 0; + for (i = 0; i < 1000000; i++) + { + nextbyte = hdlc_tx_get_byte(&tx); + hdlc_rx_put_byte(&rx, nextbyte); + if (underflow_reported) + { + underflow_reported = FALSE; + nextbyte = hdlc_tx_get_byte(&tx); + hdlc_rx_put_byte(&rx, nextbyte); + frames_sent++; + bytes_sent += ref_len; + if (!frame_handled) + { + printf("Frame not received.\n"); + return -1; + } + ref_len = cook_up_msg(buf); + hdlc_tx_frame(&tx, buf, ref_len); + frame_handled = FALSE; + } + } + end = rdtscll(); + check_result(); + + /* Now try sending HDLC messages with CRC-16 */ + printf("Testing with CRC-16 (chunk by chunk)\n"); + frame_len_errors = 0; + frame_data_errors = 0; + hdlc_tx_init(&tx, FALSE, 1, FALSE, underflow_handler, NULL); + hdlc_rx_init(&rx, FALSE, FALSE, 5, frame_handler, NULL); + underflow_reported = FALSE; + + start = rdtscll(); + hdlc_tx_flags(&tx, 40); + /* Push an initial message so we should NOT get an underflow after the preamble. */ + ref_len = cook_up_msg(buf); + hdlc_tx_frame(&tx, buf, ref_len); + frame_handled = FALSE; + frame_failed = FALSE; + frames_sent = 0; + bytes_sent = 0; + for (i = 0; i < 10000; i++) + { + len = hdlc_tx_get(&tx, bufx, 100); + hdlc_rx_put(&rx, bufx, len); + if (underflow_reported) + { + underflow_reported = FALSE; + len = hdlc_tx_get(&tx, bufx, 100); + hdlc_rx_put(&rx, bufx, len); + frames_sent++; + bytes_sent += ref_len; + if (!frame_handled) + { + printf("Frame not received.\n"); + return -1; + } + ref_len = cook_up_msg(buf); + hdlc_tx_frame(&tx, buf, ref_len); + frame_handled = FALSE; + } + } + end = rdtscll(); + check_result(); + + /* Now try sending HDLC messages with CRC-16 bit by bit */ + printf("Testing with CRC-16 (bit by bit)\n"); + frame_len_errors = 0; + frame_data_errors = 0; + hdlc_tx_init(&tx, FALSE, 2, FALSE, underflow_handler, NULL); + hdlc_rx_init(&rx, FALSE, FALSE, 5, frame_handler, NULL); + underflow_reported = FALSE; + + start = rdtscll(); + hdlc_tx_flags(&tx, 40); + /* Don't push an initial message so we should get an underflow after the preamble. */ + /* Lie for the first message, as there isn't really one */ + frame_handled = TRUE; + frame_failed = FALSE; + frames_sent = 0; + bytes_sent = 0; + ref_len = 0; + for (i = 0; i < 8*1000000; i++) + { + nextbyte = hdlc_tx_get_bit(&tx); + hdlc_rx_put_bit(&rx, nextbyte); + if (underflow_reported) + { + underflow_reported = FALSE; + for (j = 0; j < 20; j++) + { + nextbyte = hdlc_tx_get_bit(&tx); + hdlc_rx_put_bit(&rx, nextbyte); + } + if (ref_len) + { + frames_sent++; + bytes_sent += ref_len; + } + if (!frame_handled) + { + printf("Frame not received.\n"); + return -1; + } + ref_len = cook_up_msg(buf); + hdlc_tx_frame(&tx, buf, ref_len); + frame_handled = FALSE; + } + } + end = rdtscll(); + check_result(); + + /* Now try sending HDLC messages with CRC-32 */ + printf("Testing with CRC-32 (byte by byte)\n"); + frame_len_errors = 0; + frame_data_errors = 0; + hdlc_tx_init(&tx, TRUE, 1, FALSE, underflow_handler, NULL); + hdlc_rx_init(&rx, TRUE, FALSE, 1, frame_handler, NULL); + underflow_reported = FALSE; + + start = rdtscll(); + hdlc_tx_flags(&tx, 40); + /* Don't push an initial message so we should get an underflow after the preamble. */ + /* Lie for the first message, as there isn't really one */ + frame_handled = TRUE; + frame_failed = FALSE; + frames_sent = 0; + bytes_sent = 0; + ref_len = 0; + for (i = 0; i < 1000000; i++) + { + nextbyte = hdlc_tx_get_byte(&tx); + hdlc_rx_put_byte(&rx, nextbyte); + if (underflow_reported) + { + underflow_reported = FALSE; + nextbyte = hdlc_tx_get_byte(&tx); + hdlc_rx_put_byte(&rx, nextbyte); + if (ref_len) + { + frames_sent++; + bytes_sent += ref_len; + } + if (!frame_handled) + { + printf("Frame not received.\n"); + return -1; + } + ref_len = cook_up_msg(buf); + hdlc_tx_frame(&tx, buf, ref_len); + frame_handled = FALSE; + } + } + end = rdtscll(); + check_result(); + + /* Now try progressive mode with CRC-16 */ + printf("Testing progressive mode with CRC-16 (byte by byte)\n"); + frame_len_errors = 0; + frame_data_errors = 0; + hdlc_tx_init(&tx, TRUE, 1, TRUE, underflow_handler, NULL); + hdlc_rx_init(&rx, TRUE, FALSE, 1, frame_handler, NULL); + underflow_reported = FALSE; + + start = rdtscll(); + hdlc_tx_flags(&tx, 40); + /* Don't push an initial message so we should get an underflow after the preamble. */ + /* Lie for the first message, as there isn't really one */ + frame_handled = TRUE; + frame_failed = FALSE; + progress = 9999; + progress_delay = 9999; + frames_sent = 0; + bytes_sent = 0; + ref_len = 0; + for (i = 0; i < 1000000; i++) + { + nextbyte = hdlc_tx_get_byte(&tx); + hdlc_rx_put_byte(&rx, nextbyte); + if (underflow_reported) + { + underflow_reported = FALSE; + nextbyte = hdlc_tx_get_byte(&tx); + hdlc_rx_put_byte(&rx, nextbyte); + if (ref_len) + { + frames_sent++; + bytes_sent += ref_len; + } + if (!frame_handled) + { + printf("Frame not received.\n"); + return -1; + } + ref_len = cook_up_msg(buf); + hdlc_tx_frame(&tx, buf, 10); + progress = 10; + progress_delay = 8; + frame_handled = FALSE; + } + if (progress < ref_len && progress_delay-- <= 0) + { + if (hdlc_tx_frame(&tx, buf + progress, (progress + 10 <= ref_len) ? 10 : ref_len - progress) < 0) + { + printf("Failed to add progressively\n"); + return -1; + } + progress += 10; + progress_delay = 8; + } + } + end = rdtscll(); + check_result(); + + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int test_hdlc_frame_length_error_handling(void) +{ + int i; + int j; + int nextbyte; + + printf("Testing frame length error handling using CRC-16 (bit by bit)\n"); + frame_len_errors = 0; + frame_data_errors = 0; + hdlc_tx_init(&tx, FALSE, 2, FALSE, underflow_handler, NULL); + hdlc_rx_init(&rx, FALSE, TRUE, 5, frame_handler, NULL); + hdlc_rx_set_max_frame_len(&rx, 100); + underflow_reported = FALSE; + framing_ok_reported = FALSE; + framing_ok_reports = 0; + + hdlc_tx_flags(&tx, 10); + /* Don't push an initial message so we should get an underflow after the preamble. */ + /* Lie for the first message, as there isn't really one */ + frame_handled = TRUE; + frame_failed = FALSE; + frames_sent = 0; + bytes_sent = 0; + ref_len = 0; + for (i = 0; i < 8*1000000; i++) + { + nextbyte = hdlc_tx_get_bit(&tx); + hdlc_rx_put_bit(&rx, nextbyte); + if (framing_ok_reported) + { + printf("Framing OK reported at bit %d (%d)\n", i, framing_ok_reports); + framing_ok_reported = FALSE; + } + if (underflow_reported) + { + underflow_reported = FALSE; + for (j = 0; j < 20; j++) + { + nextbyte = hdlc_tx_get_bit(&tx); + hdlc_rx_put_bit(&rx, nextbyte); + if (framing_ok_reported) + { + printf("Framing OK reported at bit %d (%d) - %d\n", i, framing_ok_reports, frame_handled); + framing_ok_reported = FALSE; + } + } + if (ref_len) + { + frames_sent++; + bytes_sent += ref_len; + } + if (!frame_handled) + { + /* We should get a failure when the length reaches 101 */ + if (ref_len == 101) + { + printf("Tests passed.\n"); + return 0; + } + if (frame_failed) + printf("Frame failed.\n"); + printf("Frame not received at length %d.\n", ref_len); + return -1; + } + else + { + /* We should get a failure when the length reaches 101 */ + if (ref_len > 100) + { + printf("Tests failed.\n"); + return -1; + } + } + ref_len++; + hdlc_tx_frame(&tx, buf, ref_len); + frame_handled = FALSE; + } + } + /* We shouldn't reach here */ + printf("Tests failed.\n"); + return -1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_hdlc_crc_error_handling(void) +{ + int i; + int j; + int nextbyte; + int corrupt; + + printf("Testing CRC error handling using CRC-16 (bit by bit)\n"); + frame_len_errors = 0; + frame_data_errors = 0; + hdlc_tx_init(&tx, FALSE, 2, FALSE, underflow_handler, NULL); + hdlc_rx_init(&rx, FALSE, TRUE, 5, frame_handler, NULL); + underflow_reported = FALSE; + framing_ok_reported = FALSE; + framing_ok_reports = 0; + + hdlc_tx_flags(&tx, 10); + /* Don't push an initial message so we should get an underflow after the preamble. */ + /* Lie for the first message, as there isn't really one */ + frame_handled = TRUE; + frame_failed = FALSE; + frames_sent = 0; + bytes_sent = 0; + ref_len = 100; + corrupt = FALSE; + for (i = 0; i < 8*1000000; i++) + { + nextbyte = hdlc_tx_get_bit(&tx); + hdlc_rx_put_bit(&rx, nextbyte); + if (framing_ok_reported) + { + printf("Framing OK reported at bit %d (%d)\n", i, framing_ok_reports); + framing_ok_reported = FALSE; + } + if (underflow_reported) + { + underflow_reported = FALSE; + for (j = 0; j < 20; j++) + { + nextbyte = hdlc_tx_get_bit(&tx); + hdlc_rx_put_bit(&rx, nextbyte); + if (framing_ok_reported) + { + printf("Framing OK reported at bit %d (%d) - %d\n", i, framing_ok_reports, frame_handled); + framing_ok_reported = FALSE; + } + } + if (ref_len) + { + frames_sent++; + bytes_sent += ref_len; + } + if (!frame_handled) + { + if (!corrupt) + { + printf("Frame not received when it should be correct.\n"); + return -1; + } + } + else + { + if (corrupt) + { + printf("Frame received when it should be corrupt.\n"); + return -1; + } + } + ref_len = cook_up_msg(buf); + hdlc_tx_frame(&tx, buf, ref_len); + if ((corrupt = rand() & 1)) + hdlc_tx_corrupt_frame(&tx); + frame_handled = FALSE; + } + } + + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int test_hdlc_abort_handling(void) +{ + int i; + int j; + int nextbyte; + int abort; + + printf("Testing abort handling using CRC-16 (bit by bit)\n"); + frame_len_errors = 0; + frame_data_errors = 0; + hdlc_tx_init(&tx, FALSE, 2, FALSE, underflow_handler, NULL); + hdlc_rx_init(&rx, FALSE, TRUE, 0, frame_handler, NULL); + underflow_reported = FALSE; + framing_ok_reported = FALSE; + framing_ok_reports = 0; + + hdlc_tx_flags(&tx, 10); + /* Don't push an initial message so we should get an underflow after the preamble. */ + /* Lie for the first message, as there isn't really one */ + frame_handled = TRUE; + frame_failed = FALSE; + frames_sent = 0; + bytes_sent = 0; + ref_len = 0; + abort = FALSE; + abort_reported = FALSE; + for (i = 0; i < 8*1000000; i++) + { + nextbyte = hdlc_tx_get_bit(&tx); + hdlc_rx_put_bit(&rx, nextbyte); + if (framing_ok_reported) + { + printf("Framing OK reported at bit %d (%d)\n", i, framing_ok_reports); + framing_ok_reported = FALSE; + } + if (underflow_reported) + { + underflow_reported = FALSE; + for (j = 0; j < 20; j++) + { + nextbyte = hdlc_tx_get_bit(&tx); + hdlc_rx_put_bit(&rx, nextbyte); + if (framing_ok_reported) + { + printf("Framing OK reported at bit %d (%d) - %d\n", i, framing_ok_reports, frame_handled); + framing_ok_reported = FALSE; + } + } + if (ref_len) + { + frames_sent++; + bytes_sent += ref_len; + } + if (abort) + { + if (abort && !abort_reported) + { + printf("Abort not received when sent\n"); + return -1; + } + if (frame_handled) + { + if (frame_failed) + printf("Frame failed.\n"); + printf("Frame received when abort sent.\n"); + return -1; + } + } + else + { + if (abort_reported) + { + printf("Abort received when not sent\n"); + return -1; + } + if (!frame_handled) + { + if (frame_failed) + printf("Frame failed.\n"); + printf("Frame not received.\n"); + return -1; + } + } + ref_len = cook_up_msg(buf); + hdlc_tx_frame(&tx, buf, ref_len); + if ((abort = rand() & 1)) + hdlc_tx_abort(&tx); + frame_handled = FALSE; + abort_reported = FALSE; + } + } + + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +#if 0 +static int test_hdlc_octet_count_handling(void) +{ + int i; + int j; + int nextbyte; + + printf("Testing the octet_counting handling using CRC-16 (bit by bit)\n"); + frame_len_errors = 0; + frame_data_errors = 0; + hdlc_tx_init(&tx, FALSE, 2, FALSE, underflow_handler, NULL); + hdlc_rx_init(&rx, FALSE, TRUE, 0, frame_handler, NULL); + //hdlc_rx_set_max_frame_len(&rx, 50); + hdlc_rx_set_octet_counting_report_interval(&rx, 16); + underflow_reported = FALSE; + framing_ok_reported = FALSE; + framing_ok_reports = 0; + + hdlc_tx_flags(&tx, 10); + /* Don't push an initial message so we should get an underflow after the preamble. */ + /* Lie for the first message, as there isn't really one */ + frame_handled = TRUE; + frame_failed = FALSE; + frames_sent = 0; + bytes_sent = 0; + ref_len = 0; + for (i = 0; i < 8*1000000; i++) + { + nextbyte = hdlc_tx_get_bit(&tx); + hdlc_rx_put_bit(&rx, nextbyte); + if (framing_ok_reported) + { + printf("Framing OK reported at bit %d (%d)\n", i, framing_ok_reports); + framing_ok_reported = FALSE; + } + if (underflow_reported) + { + underflow_reported = FALSE; + for (j = 0; j < 20; j++) + { + nextbyte = hdlc_tx_get_bit(&tx); + hdlc_rx_put_bit(&rx, nextbyte); + if (framing_ok_reported) + { + printf("Framing OK reported at bit %d (%d) - %d\n", i, framing_ok_reports, frame_handled); + framing_ok_reported = FALSE; + } + } + if (ref_len) + { + frames_sent++; + bytes_sent += ref_len; + } + if (!frame_handled) + { + if (frame_failed) + printf("Frame failed.\n"); + printf("Frame not received.\n"); + return -1; + } + ref_len = cook_up_msg(buf); + hdlc_tx_frame(&tx, buf, ref_len); + hdlc_tx_abort(&tx); + //hdlc_tx_corrupt_frame(&tx); + frame_handled = FALSE; + } + } + + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +#endif + +static void hdlc_tests(void) +{ + printf("HDLC module tests\n"); + + if (test_hdlc_modes()) + { + printf("Tests failed\n"); + exit(2); + } + if (test_hdlc_frame_length_error_handling()) + { + printf("Tests failed\n"); + exit(2); + } + if (test_hdlc_crc_error_handling()) + { + printf("Tests failed\n"); + exit(2); + } + if (test_hdlc_abort_handling()) + { + printf("Tests failed\n"); + exit(2); + } +#if 0 + if (test_hdlc_octet_count_handling()) + { + printf("Tests failed\n"); + exit(2); + } +#endif + printf("Tests passed.\n"); +} +/*- End of function --------------------------------------------------------*/ + +static void decode_handler(void *user_data, const uint8_t *pkt, int len, int ok) +{ + int i; + + if (len < 0) + { + /* Special conditions */ + printf("HDLC rx status is %s (%d)\n", signal_status_to_str(len), len); + return; + } + if (ok) + { + printf("Good frame, len = %d\n", len); + printf("HDLC: "); + for (i = 0; i < len; i++) + printf("%02X ", pkt[i]); + printf("\n"); + } + else + { + printf("Bad frame, len = %d\n", len); + } +} +/*- End of function --------------------------------------------------------*/ + +static void decode_bitstream(const char *in_file_name) +{ + char buf[1024]; + int bit; + hdlc_rx_state_t rx; + FILE *in; + + if ((in = fopen(in_file_name, "r")) == NULL) + { + fprintf(stderr, "Failed to open '%s'\n", in_file_name); + exit(2); + } + + hdlc_rx_init(&rx, FALSE, TRUE, 2, decode_handler, NULL); + while (fgets(buf, 1024, in)) + { + if (sscanf(buf, "Rx bit %*d - %d", &bit) == 1) + { + hdlc_rx_put_bit(&rx, bit); + } + } + fclose(in); +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int opt; + const char *in_file_name; + + in_file_name = NULL; + while ((opt = getopt(argc, argv, "d:")) != -1) + { + switch (opt) + { + case 'd': + in_file_name = optarg; + break; + default: + //usage(); + exit(2); + break; + } + } + if (in_file_name) + decode_bitstream(in_file_name); + else + hdlc_tests(); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/ima_adpcm_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/ima_adpcm_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,218 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * ima_adpcm_tests.c - Test the IMA/DVI/Intel ADPCM encode and decode + * software. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: ima_adpcm_tests.c,v 1.36 2009/05/30 15:23:14 steveu Exp $ + */ + +/*! \file */ + +/*! \page ima_adpcm_tests_page IMA ADPCM tests +\section ima_adpcm_tests_page_sec_1 What does it do? +To perform a general audio quality test, ima_adpcm_tests should be run. The test file +../test-data/local/short_nb_voice.wav will be compressed to the specified bit rate, +decompressed, and the resulting audio stored in post_ima_adpcm.wav. A simple SNR test +is automatically performed. Listening tests may be used for a more detailed evaluation +of the degradation in quality caused by the compression. + +\section ima_adpcm_tests_page_sec_2 How is it used? +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define IN_FILE_NAME "../test-data/local/short_nb_voice.wav" +#define OUT_FILE_NAME "post_ima_adpcm.wav" + +#define HIST_LEN 2000 + +int main(int argc, char *argv[]) +{ + int i; + SNDFILE *inhandle; + SNDFILE *outhandle; + int frames; + int dec_frames; + int outframes; + int ima_bytes; + double pre_energy; + double post_energy; + double diff_energy; + int16_t pre_amp[HIST_LEN]; + int16_t post_amp[HIST_LEN]; + uint8_t ima_data[HIST_LEN]; + int16_t history[HIST_LEN]; + int hist_in; + int hist_out; + ima_adpcm_state_t *ima_enc_state; + ima_adpcm_state_t *ima_dec_state; + int xx; + int total_pre_samples; + int total_compressed_bytes; + int total_post_samples; + const char *in_file_name; + int variant; + int chunk_size; + int enc_chunk_size; + int log_encoded_data; + int opt; + + variant = IMA_ADPCM_DVI4; + in_file_name = IN_FILE_NAME; + chunk_size = 160; + enc_chunk_size = 0; + log_encoded_data = FALSE; + while ((opt = getopt(argc, argv, "ac:i:lv")) != -1) + { + switch (opt) + { + case 'a': + variant = IMA_ADPCM_IMA4; + chunk_size = 505; + break; + case 'c': + enc_chunk_size = atoi(optarg); + break; + case 'i': + in_file_name = optarg; + break; + case 'l': + log_encoded_data = TRUE; + break; + case 'v': + variant = IMA_ADPCM_VDVI; + break; + default: + //usage(); + exit(2); + break; + } + } + + if ((inhandle = sf_open_telephony_read(in_file_name, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", in_file_name); + exit(2); + } + + if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + + if ((ima_enc_state = ima_adpcm_init(NULL, variant, enc_chunk_size)) == NULL) + { + fprintf(stderr, " Cannot create encoder\n"); + exit(2); + } + + if ((ima_dec_state = ima_adpcm_init(NULL, variant, enc_chunk_size)) == NULL) + { + fprintf(stderr, " Cannot create decoder\n"); + exit(2); + } + + hist_in = 0; + hist_out = 0; + pre_energy = 0.0; + post_energy = 0.0; + diff_energy = 0.0; + total_pre_samples = 0; + total_compressed_bytes = 0; + total_post_samples = 0; + while ((frames = sf_readf_short(inhandle, pre_amp, chunk_size))) + { + total_pre_samples += frames; + ima_bytes = ima_adpcm_encode(ima_enc_state, ima_data, pre_amp, frames); + if (log_encoded_data) + write(1, ima_data, ima_bytes); + total_compressed_bytes += ima_bytes; + dec_frames = ima_adpcm_decode(ima_dec_state, post_amp, ima_data, ima_bytes); + total_post_samples += dec_frames; + for (i = 0; i < frames; i++) + { + history[hist_in++] = pre_amp[i]; + if (hist_in >= HIST_LEN) + hist_in = 0; + pre_energy += (double) pre_amp[i] * (double) pre_amp[i]; + } + for (i = 0; i < dec_frames; i++) + { + post_energy += (double) post_amp[i] * (double) post_amp[i]; + xx = post_amp[i] - history[hist_out++]; + if (hist_out >= HIST_LEN) + hist_out = 0; + diff_energy += (double) xx * (double) xx; + } + outframes = sf_writef_short(outhandle, post_amp, dec_frames); + } + if (sf_close(inhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", in_file_name); + exit(2); + } + if (sf_close(outhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + ima_adpcm_release(ima_enc_state); + ima_adpcm_release(ima_dec_state); + + printf("Pre samples: %d\n", total_pre_samples); + printf("Compressed bytes: %d\n", total_compressed_bytes); + printf("Post samples: %d\n", total_post_samples); + + printf("Output energy is %f%% of input energy.\n", 100.0*post_energy/pre_energy); + printf("Residual energy is %f%% of the total.\n", 100.0*diff_energy/post_energy); + if (fabs(1.0 - post_energy/pre_energy) > 0.05 + || + fabs(diff_energy/post_energy) > 0.03) + { + printf("Tests failed.\n"); + exit(2); + } + + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/line_model_monitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/line_model_monitor.cpp Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,460 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * line_model_monitor.cpp - Model activity in a telephone line model, using the FLTK toolkit. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: line_model_monitor.cpp,v 1.5 2008/09/08 16:10:41 steveu Exp $ + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#if defined(HAVE_FL_FL_H) && defined(HAVE_FL_FL_CARTESIAN_H) + +#define __STDC_LIMIT_MACROS + +#include +#include +#include +#include +#include +#include +#include +#if defined(HAVE_FFTW3_H) +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include + +#include "spandsp.h" +#include "line_model_monitor.h" + +struct line_model_monitor_s +{ + Fl_Double_Window *w; + + Fl_Audio_Meter *audio_meter; + + Fl_Group *c_spec; + Fl_Group *c_right; + Fl_Group *c_can; + Fl_Group *c_line_model; + + Ca_Canvas *canvas_spec; + Ca_X_Axis *spec_freq; + Ca_Y_Axis *spec_amp; + Ca_Line *spec_re; + double spec_re_plot[2*512]; + + Ca_Canvas *canvas_can; + Ca_X_Axis *can_x; + Ca_Y_Axis *can_y; + Ca_Line *can_re; + double can_re_plot[512]; + + Ca_Canvas *canvas_line_model; + Ca_X_Axis *line_model_x; + Ca_Y_Axis *line_model_y; + Ca_Line *line_model_re; + double line_model_re_plot[512]; + + int in_ptr; +#if defined(HAVE_FFTW3_H) + double in[1024][2]; + double out[1024][2]; +#else + fftw_complex in[1024]; + fftw_complex out[1024]; +#endif + fftw_plan p; +}; + +static int skip = 0; +static struct line_model_monitor_s model; +static struct line_model_monitor_s *s = &model; + +int line_model_monitor_can_update(const float *coeffs, int len) +{ + int i; + float min; + float max; + + if (s->can_re) + delete s->can_re; + + s->canvas_can->current(s->canvas_can); + i = 0; + min = coeffs[i]; + max = coeffs[i]; + for (i = 0; i < len; i++) + { + s->can_re_plot[2*i] = i; + s->can_re_plot[2*i + 1] = coeffs[i]; + if (min > coeffs[i]) + min = coeffs[i]; + if (max < coeffs[i]) + max = coeffs[i]; + } + s->can_y->maximum((max == min) ? max + 0.2 : max); + s->can_y->minimum(min); + s->can_re = new Ca_Line(len, s->can_re_plot, 0, 0, FL_BLUE, CA_NO_POINT); + if (++skip >= 100) + { + skip = 0; + Fl::check(); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int line_model_monitor_line_model_update(const float *coeffs, int len) +{ + int i; + float min; + float max; + + if (s->line_model_re) + delete s->line_model_re; + + s->canvas_line_model->current(s->canvas_line_model); + i = 0; + min = coeffs[i]; + max = coeffs[i]; + for (i = 0; i < len; i++) + { + s->line_model_re_plot[2*i] = i; + s->line_model_re_plot[2*i + 1] = coeffs[i]; + if (min > coeffs[i]) + min = coeffs[i]; + if (max < coeffs[i]) + max = coeffs[i]; + } + s->line_model_y->maximum((max == min) ? max + 0.2 : max); + s->line_model_y->minimum(min); + s->line_model_re = new Ca_Line(len, s->line_model_re_plot, 0, 0, FL_BLUE, CA_NO_POINT); + if (++skip >= 100) + { + skip = 0; + Fl::check(); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int line_model_monitor_line_spectrum_update(const int16_t amp[], int len) +{ + int i; + int x; + + for (i = 0; i < len; i++) + s->audio_meter->sample(amp[i]/32768.0); + + if (s->in_ptr + len < 512) + { + /* Just add this fragment to the buffer. */ + for (i = 0; i < len; i++) +#if defined(HAVE_FFTW3_H) + s->in[s->in_ptr + i][0] = amp[i]; +#else + s->in[s->in_ptr + i].re = amp[i]; +#endif + s->in_ptr += len; + return 0; + } + if (len >= 512) + { + /* We have enough for a whole block. Use the last 512 samples + we have. */ + x = len - 512; + for (i = 0; i < 512; i++) +#if defined(HAVE_FFTW3_H) + s->in[i][0] = amp[x + i]; +#else + s->in[i].re = amp[x + i]; +#endif + } + else + { + /* We want the last 512 samples. */ + x = 512 - len; + for (i = 0; i < x; i++) +#if defined(HAVE_FFTW3_H) + s->in[i][0] = s->in[s->in_ptr - x + i][0]; +#else + s->in[i].re = s->in[s->in_ptr - x + i].re; +#endif + for (i = x; i < 512; i++) +#if defined(HAVE_FFTW3_H) + s->in[i][0] = amp[i - x]; +#else + s->in[i].re = amp[i - x]; +#endif + } + s->in_ptr = 0; +#if defined(HAVE_FFTW3_H) + fftw_execute(s->p); +#else + fftw_one(s->p, s->in, s->out); +#endif + if (s->spec_re) + delete s->spec_re; + s->canvas_spec->current(s->canvas_spec); + for (i = 0; i < 512; i++) + { + s->spec_re_plot[2*i] = i*4000.0/512.0; +#if defined(HAVE_FFTW3_H) + s->spec_re_plot[2*i + 1] = 20.0*log10(sqrt(s->out[i][0]*s->out[i][0] + s->out[i][1]*s->out[i][1])/(256.0*32768)) + 3.14; +#else + s->spec_re_plot[2*i + 1] = 20.0*log10(sqrt(s->out[i].re*s->out[i].re + s->out[i].im*s->out[i].im)/(256.0*32768)) + 3.14; +#endif + } + s->spec_re = new Ca_Line(512, s->spec_re_plot, 0, 0, FL_BLUE, CA_NO_POINT); + Fl::check(); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int start_line_model_monitor(int len) +{ + char buf[132 + 1]; + float x; + float y; + int i; + + s->w = new Fl_Double_Window(850, 400, "Telephone line model monitor"); + + s->c_spec = new Fl_Group(0, 0, 380, 400); + s->c_spec->box(FL_DOWN_BOX); + s->c_spec->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE); + + s->canvas_spec = new Ca_Canvas(60, 30, 300, 300, "Spectrum"); + s->canvas_spec->box(FL_PLASTIC_DOWN_BOX); + s->canvas_spec->color(7); + s->canvas_spec->align(FL_ALIGN_TOP); + s->canvas_spec->border(15); + + s->spec_freq = new Ca_X_Axis(65, 330, 290, 30, "Freq (Hz)"); + s->spec_freq->align(FL_ALIGN_BOTTOM); + s->spec_freq->minimum(0); + s->spec_freq->maximum(4000); + s->spec_freq->label_format("%g"); + s->spec_freq->minor_grid_color(fl_gray_ramp(20)); + s->spec_freq->major_grid_color(fl_gray_ramp(15)); + s->spec_freq->label_grid_color(fl_gray_ramp(10)); + s->spec_freq->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->spec_freq->minor_grid_style(FL_DOT); + s->spec_freq->major_step(5); + s->spec_freq->label_step(1); + s->spec_freq->axis_color(FL_BLACK); + s->spec_freq->axis_align(CA_BOTTOM | CA_LINE); + + s->spec_amp = new Ca_Y_Axis(20, 35, 40, 290, "Amp (dBmO)"); + s->spec_amp->align(FL_ALIGN_LEFT); + s->spec_amp->minimum(-80.0); + s->spec_amp->maximum(10.0); + s->spec_amp->minor_grid_color(fl_gray_ramp(20)); + s->spec_amp->major_grid_color(fl_gray_ramp(15)); + s->spec_amp->label_grid_color(fl_gray_ramp(10)); + //s->spec_amp->grid_visible(CA_MINOR_TICK | CA_MAJOR_TICK | CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->spec_amp->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->spec_amp->minor_grid_style(FL_DOT); + s->spec_amp->major_step(5); + s->spec_amp->label_step(1); + s->spec_amp->axis_color(FL_BLACK); + + s->spec_amp->current(); + s->spec_re = NULL; + + s->c_spec->end(); + + s->c_right = new Fl_Group(440, 0, 465, 405); + + s->c_can = new Fl_Group(380, 0, 415, 200); + s->c_can->box(FL_DOWN_BOX); + s->c_can->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE); + s->c_can->current(); + + s->canvas_can = new Ca_Canvas(460, 35, 300, 100, "??? coefficients"); + s->canvas_can->box(FL_PLASTIC_DOWN_BOX); + s->canvas_can->color(7); + s->canvas_can->align(FL_ALIGN_TOP); + Fl_Group::current()->resizable(s->canvas_can); + s->canvas_can->border(15); + + s->can_x = new Ca_X_Axis(465, 135, 290, 30, "Tap"); + s->can_x->align(FL_ALIGN_BOTTOM); + s->can_x->minimum(0.0); + s->can_x->maximum((float) len); + s->can_x->label_format("%g"); + s->can_x->minor_grid_color(fl_gray_ramp(20)); + s->can_x->major_grid_color(fl_gray_ramp(15)); + s->can_x->label_grid_color(fl_gray_ramp(10)); + s->can_x->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->can_x->minor_grid_style(FL_DOT); + s->can_x->major_step(5); + s->can_x->label_step(1); + s->can_x->axis_align(CA_BOTTOM | CA_LINE); + s->can_x->axis_color(FL_BLACK); + s->can_x->current(); + + s->can_y = new Ca_Y_Axis(420, 40, 40, 90, "Amp"); + s->can_y->align(FL_ALIGN_LEFT); + s->can_y->minimum(-0.1); + s->can_y->maximum(0.1); + s->can_y->minor_grid_color(fl_gray_ramp(20)); + s->can_y->major_grid_color(fl_gray_ramp(15)); + s->can_y->label_grid_color(fl_gray_ramp(10)); + s->can_y->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->can_y->minor_grid_style(FL_DOT); + s->can_y->major_step(5); + s->can_y->label_step(1); + s->can_y->axis_color(FL_BLACK); + s->can_y->current(); + + s->c_can->end(); + + s->can_re = NULL; + + s->c_line_model = new Fl_Group(380, 200, 415, 200); + s->c_line_model->box(FL_DOWN_BOX); + s->c_line_model->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE); + s->c_line_model->current(); + + s->canvas_line_model = new Ca_Canvas(460, 235, 300, 100, "Line impulse response model"); + s->canvas_line_model->box(FL_PLASTIC_DOWN_BOX); + s->canvas_line_model->color(7); + s->canvas_line_model->align(FL_ALIGN_TOP); + Fl_Group::current()->resizable(s->canvas_line_model); + s->canvas_line_model->border(15); + + s->line_model_x = new Ca_X_Axis(465, 335, 290, 30, "Tap"); + s->line_model_x->align(FL_ALIGN_BOTTOM); + s->line_model_x->minimum(0.0); + s->line_model_x->maximum((float) len); + s->line_model_x->label_format("%g"); + s->line_model_x->minor_grid_color(fl_gray_ramp(20)); + s->line_model_x->major_grid_color(fl_gray_ramp(15)); + s->line_model_x->label_grid_color(fl_gray_ramp(10)); + s->line_model_x->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->line_model_x->minor_grid_style(FL_DOT); + s->line_model_x->major_step(5); + s->line_model_x->label_step(1); + s->line_model_x->axis_align(CA_BOTTOM | CA_LINE); + s->line_model_x->axis_color(FL_BLACK); + s->line_model_x->current(); + + s->line_model_y = new Ca_Y_Axis(420, 240, 40, 90, "Amp"); + s->line_model_y->align(FL_ALIGN_LEFT); + s->line_model_y->minimum(-0.1); + s->line_model_y->maximum(0.1); + s->line_model_y->minor_grid_color(fl_gray_ramp(20)); + s->line_model_y->major_grid_color(fl_gray_ramp(15)); + s->line_model_y->label_grid_color(fl_gray_ramp(10)); + s->line_model_y->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->line_model_y->minor_grid_style(FL_DOT); + s->line_model_y->major_step(5); + s->line_model_y->label_step(1); + s->line_model_y->axis_color(FL_BLACK); + s->line_model_y->current(); + s->line_model_re = NULL; + + s->c_line_model->end(); + + s->audio_meter = new Fl_Audio_Meter(810, 40, 10, 250, ""); + s->audio_meter->box(FL_PLASTIC_UP_BOX); + s->audio_meter->type(FL_VERT_AUDIO_METER); + + s->c_right->end(); + + Fl_Group::current()->resizable(s->c_right); + s->w->end(); + s->w->show(); + +#if defined(HAVE_FFTW3_H) + s->p = fftw_plan_dft_1d(1024, s->in, s->out, FFTW_BACKWARD, FFTW_ESTIMATE); + for (i = 0; i < 1024; i++) + { + s->in[i][0] = 0.0; + s->in[i][1] = 0.0; + } +#else + s->p = fftw_create_plan(1024, FFTW_BACKWARD, FFTW_ESTIMATE); + for (i = 0; i < 1024; i++) + { + s->in[i].re = 0.0; + s->in[i].im = 0.0; + } +#endif + s->in_ptr = 0; + + Fl::check(); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +void line_model_monitor_wait_to_end(void) +{ + fd_set rfds; + int res; + struct timeval tv; + + fprintf(stderr, "Processing complete. Press the key to end\n"); + do + { + usleep(100000); + Fl::check(); + FD_ZERO(&rfds); + FD_SET(0, &rfds); + tv.tv_usec = 100000; + tv.tv_sec = 0; + res = select(1, &rfds, NULL, NULL, &tv); + } + while (res <= 0); +} +/*- End of function --------------------------------------------------------*/ + +void line_model_monitor_update_display(void) +{ + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); +} +/*- End of function --------------------------------------------------------*/ +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/line_model_monitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/line_model_monitor.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,62 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * line_model_monitor.h - Model activity in a telephone line model, using the FLTK toolkit. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: line_model_monitor.h,v 1.7 2008/04/26 13:39:17 steveu Exp $ + */ + +/*! \page line_model_monitor_page Telephone line model monitoring +\section line_model_monitor_page_sec_1 What does it do? +This code controls a GUI window, which provides monitoring of the internal status +of a telephone line modem. It shows, graphically: + + - the spectrum of the received signal. + - the line model in use (when a known line model is being used). + - the adapted coefficients of the canceller. + +\section line_model_monitor_page_sec_2 How does it work? +This code uses the FLTK cross platform GUI toolkit. It works on X11 and Windows platforms. +In addition to the basic FLTK toolkit, fltk_cartesian is also required. +*/ + +#if !defined(_LINE_MODEL_MONITOR_H_) +#define _LINE_MODEL_MONITOR_H_ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +int start_line_model_monitor(int len); +int line_model_monitor_can_update(const float *coeffs, int len); +int line_model_monitor_line_model_update(const float *coeffs, int len); +int line_model_monitor_line_spectrum_update(const int16_t amp[], int len); +void line_model_monitor_wait_to_end(void); +void line_model_monitor_update_display(void); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/line_model_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/line_model_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,398 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * line_model_tests.c - Tests for the telephone line model. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: line_model_tests.c,v 1.28 2009/09/23 16:02:59 steveu Exp $ + */ + +/*! \page line_model_tests_page Telephony line model tests +\section line_model_tests_page_sec_1 What does it do? +???. + +\section line_model_tests_page_sec_2 How does it work? +???. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#if !defined(NULL) +#define NULL (void *) 0 +#endif + +#define BLOCK_LEN 160 + +#define OUT_FILE_COMPLEXIFY "complexify.wav" +#define IN_FILE_NAME1 "line_model_test_in1.wav" +#define IN_FILE_NAME2 "line_model_test_in2.wav" +#define OUT_FILE_NAME1 "line_model_one_way_test_out.wav" +#define OUT_FILE_NAME2 "line_model_two_way_test_out.wav" + +int channel_codec; +int rbs_pattern; + +static void complexify_tests(void) +{ + complexify_state_t *s; + complexf_t cc; + int16_t amp; + int i; + SNDFILE *outhandle; + int outframes; + int16_t out[40000]; + awgn_state_t noise1; + + if ((outhandle = sf_open_telephony_write(OUT_FILE_COMPLEXIFY, 2)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_COMPLEXIFY); + exit(2); + } + awgn_init_dbm0(&noise1, 1234567, -10.0f); + s = complexify_init(); + for (i = 0; i < 20000; i++) + { + amp = awgn(&noise1); + cc = complexify(s, amp); + out[2*i] = cc.re; + out[2*i + 1] = cc.im; + } + outframes = sf_writef_short(outhandle, out, 20000); + if (outframes != 20000) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + if (sf_close(outhandle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_COMPLEXIFY); + exit(2); + } +} +/*- End of function --------------------------------------------------------*/ + +static void test_one_way_model(int line_model_no, int speech_test) +{ + one_way_line_model_state_t *model; + int16_t input1[BLOCK_LEN]; + int16_t output1[BLOCK_LEN]; + int16_t amp[2*BLOCK_LEN]; + SNDFILE *inhandle1; + SNDFILE *outhandle; + int outframes; + int samples; + int i; + int j; + awgn_state_t noise1; + + if ((model = one_way_line_model_init(line_model_no, -50, channel_codec, rbs_pattern)) == NULL) + { + fprintf(stderr, " Failed to create line model\n"); + exit(2); + } + + awgn_init_dbm0(&noise1, 1234567, -10.0f); + + if (speech_test) + { + if ((inhandle1 = sf_open_telephony_read(IN_FILE_NAME1, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", IN_FILE_NAME1); + exit(2); + } + } + else + { + inhandle1 = NULL; + } + if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME1, 1)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME1); + exit(2); + } + for (i = 0; i < 10000; i++) + { + if (speech_test) + { + samples = sf_readf_short(inhandle1, input1, BLOCK_LEN); + if (samples == 0) + break; + } + else + { + for (j = 0; j < BLOCK_LEN; j++) + input1[j] = awgn(&noise1); + samples = BLOCK_LEN; + } + for (j = 0; j < samples; j++) + { + one_way_line_model(model, + &output1[j], + &input1[j], + 1); + amp[j] = output1[j]; + } + outframes = sf_writef_short(outhandle, amp, samples); + if (outframes != samples) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + } + if (speech_test) + { + if (sf_close(inhandle1)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME1); + exit(2); + } + } + if (sf_close(outhandle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME1); + exit(2); + } + one_way_line_model_release(model); +} +/*- End of function --------------------------------------------------------*/ + +static void test_both_ways_model(int line_model_no, int speech_test) +{ + both_ways_line_model_state_t *model; + int16_t input1[BLOCK_LEN]; + int16_t input2[BLOCK_LEN]; + int16_t output1[BLOCK_LEN]; + int16_t output2[BLOCK_LEN]; + int16_t amp[2*BLOCK_LEN]; + SNDFILE *inhandle1; + SNDFILE *inhandle2; + SNDFILE *outhandle; + int outframes; + int samples; + int i; + int j; + awgn_state_t noise1; + awgn_state_t noise2; + + if ((model = both_ways_line_model_init(line_model_no, -50, line_model_no + 1, -35, channel_codec, rbs_pattern)) == NULL) + { + fprintf(stderr, " Failed to create line model\n"); + exit(2); + } + + awgn_init_dbm0(&noise1, 1234567, -10.0f); + awgn_init_dbm0(&noise2, 1234567, -10.0f); + + if (speech_test) + { + if ((inhandle1 = sf_open_telephony_read(IN_FILE_NAME1, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", IN_FILE_NAME1); + exit(2); + } + if ((inhandle2 = sf_open_telephony_read(IN_FILE_NAME2, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", IN_FILE_NAME2); + exit(2); + } + } + else + { + inhandle1 = + inhandle2 = NULL; + } + if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME2, 2)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME2); + exit(2); + } + for (i = 0; i < 10000; i++) + { + if (speech_test) + { + samples = sf_readf_short(inhandle1, input1, BLOCK_LEN); + if (samples == 0) + break; + samples = sf_readf_short(inhandle2, input2, samples); + if (samples == 0) + break; + } + else + { + for (j = 0; j < BLOCK_LEN; j++) + { + input1[j] = awgn(&noise1); + input2[j] = awgn(&noise2); + } + samples = BLOCK_LEN; + } + for (j = 0; j < samples; j++) + { + both_ways_line_model(model, + &output1[j], + &input1[j], + &output2[j], + &input2[j], + 1); + amp[2*j] = output1[j]; + amp[2*j + 1] = output2[j]; + } + outframes = sf_writef_short(outhandle, amp, samples); + if (outframes != samples) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + } + if (speech_test) + { + if (sf_close(inhandle1)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME1); + exit(2); + } + if (sf_close(inhandle2)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME2); + exit(2); + } + } + if (sf_close(outhandle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME2); + exit(2); + } + both_ways_line_model_release(model); +} +/*- End of function --------------------------------------------------------*/ + +static void test_line_filter(int line_model_no) +{ + float out; + double sumin; + double sumout; + int i; + int j; + int p; + int ptr; + int len; + swept_tone_state_t *s; + float filter[129]; + int16_t buf[BLOCK_LEN]; + + s = swept_tone_init(NULL, 200.0f, 3900.0f, -10.0f, 120*SAMPLE_RATE, 0); + for (j = 0; j < 129; j++) + filter[j] = 0.0f; + ptr = 0; + for (;;) + { + if ((len = swept_tone(s, buf, BLOCK_LEN)) <= 0) + break; + sumin = 0.0; + sumout = 0.0; + for (i = 0; i < len; i++) + { + /* Add the sample in the filter buffer */ + p = ptr; + filter[p] = buf[i]; + if (++p == 129) + p = 0; + ptr = p; + + /* Apply the filter */ + out = 0.0f; + for (j = 0; j < 129; j++) + { + out += line_models[line_model_no][128 - j]*filter[p]; + if (++p >= 129) + p = 0; + } + sumin += buf[i]*buf[i]; + sumout += out*out; + } + /*endfor*/ + printf("%7.1f %f\n", swept_tone_current_frequency(s), 10.0*log10(sumout/sumin)); + } + /*endfor*/ + swept_tone_free(s); +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int line_model_no; + int speech_test; + int log_audio; + int opt; + + channel_codec = MUNGE_CODEC_NONE; + log_audio = FALSE; + line_model_no = 0; + rbs_pattern = 0; + speech_test = FALSE; + while ((opt = getopt(argc, argv, "c:lm:r:s:")) != -1) + { + switch (opt) + { + case 'c': + channel_codec = atoi(optarg); + break; + case 'l': + log_audio = TRUE; + break; + case 'm': + line_model_no = atoi(optarg); + break; + case 'r': + rbs_pattern = atoi(optarg); + break; + case 's': + speech_test = atoi(optarg); + break; + default: + //usage(); + exit(2); + } + } + complexify_tests(); + test_one_way_model(line_model_no, speech_test); + test_both_ways_model(line_model_no, speech_test); + test_line_filter(line_model_no); +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/logging_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/logging_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,235 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * logging_tests.c - Tests for the logging functions. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: logging_tests.c,v 1.16 2009/02/12 12:38:39 steveu Exp $ + */ + +/*! \page logging_tests_page Logging tests +\section logging_tests_page_sec_1 What does it do? +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#define _POSIX_SOURCE +#define _POSIX_C_SOURCE 200112L + +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" + +static int tests_failed = FALSE; + +static int msg_step = 0; +static int msg2_step = 0; +static int error_step = 0; +static int msg_done = FALSE; +static int msg2_done = FALSE; +static int error_done = FALSE; + +static void message_handler(int level, const char *text) +{ + const char *ref[] = + { + "TAG Log with tag 1 2 3\n", + "Log with protocol 1 2 3\n", + "FLOW NewTag Log with new tag 1 2 3\n", + "FLOW Protocol NewTag Log with protocol 1 2 3\n", + "FLOW Protocol NewTag Buf 00 01 02 03 04 05 06 07 08 09\n", + "FLOW Protocol NewTag Buf 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff 00 01 02 03 04 05 06 07 08 09\n", + "00:00:00.000 FLOW Protocol NewTag Time tagged log 1 2 3\n", + "00:00:00.020 FLOW Protocol NewTag Time tagged log 1 2 3\n", + "00:00:00.040 FLOW Protocol NewTag Time tagged log 1 2 3\n", + "00:00:00.060 FLOW Protocol NewTag Time tagged log 1 2 3\n", + "00:00:00.080 FLOW Protocol NewTag Time tagged log 1 2 3\n", + "00:00:00.100 FLOW Protocol NewTag Time tagged log 1 2 3\n", + "00:00:00.120 FLOW Protocol NewTag Time tagged log 1 2 3\n", + "00:00:00.140 FLOW Protocol NewTag Time tagged log 1 2 3\n", + "00:00:00.160 FLOW Protocol NewTag Time tagged log 1 2 3\n", + "00:00:00.180 FLOW Protocol NewTag Time tagged log 1 2 3\n", + "" + }; + + if (strcmp(ref[msg_step], text)) + { + printf(">>>: %s", ref[msg_step]); + tests_failed = TRUE; + } + if (ref[++msg_step][0] == '\0') + msg_done = TRUE; + printf("MSG: %s", text); +} +/*- End of function --------------------------------------------------------*/ + +static void message_handler2(int level, const char *text) +{ + /* TODO: This doesn't check if the date/time field makes sense */ + if (strcmp(" FLOW Protocol NewTag Date/time tagged log 1 2 3\n", text + 23)) + { + printf(">>>: %s", text + 23); + tests_failed = TRUE; + } + if (++msg2_step == 10) + msg2_done = TRUE; + printf("MSG: %s", text); +} +/*- End of function --------------------------------------------------------*/ + +static void error_handler(const char *text) +{ + const char *ref[] = + { + "ERROR Log with severity log 1 2 3\n", + "" + }; + + if (strcmp(ref[error_step], text)) + { + printf(">>>: %s", ref[error_step]); + tests_failed = TRUE; + } + if (ref[++error_step][0] == '\0') + error_done = TRUE; + printf("ERR: %s", text); +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + logging_state_t log; + int i; + uint8_t buf[1000]; + struct timespec delay; + + /* Set up a logger */ + if (span_log_init(&log, 123, "TAG") == NULL) + { + fprintf(stderr, "Failed to initialise log.\n"); + exit(2); + } + /* Try it */ + span_log_set_level(&log, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW); + if (span_log(&log, SPAN_LOG_FLOW, "Logging to fprintf, as simple as %d %d %d\n", 1, 2, 3)) + fprintf(stderr, "Logged.\n"); + else + fprintf(stderr, "Not logged.\n"); + + /* Now set a custom log handler */ + span_log_set_message_handler(&log, &message_handler); + span_log_set_error_handler(&log, &error_handler); + span_log_set_sample_rate(&log, 44100); + + /* Try the different logging elements */ + span_log_set_level(&log, SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW); + if (span_log(&log, SPAN_LOG_FLOW, "Log with tag %d %d %d\n", 1, 2, 3)) + fprintf(stderr, "Logged.\n"); + else + fprintf(stderr, "Not logged.\n"); + span_log_set_level(&log, SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + if (span_log(&log, SPAN_LOG_FLOW, "Log with protocol %d %d %d\n", 1, 2, 3)) + fprintf(stderr, "Logged.\n"); + else + fprintf(stderr, "Not logged.\n"); + span_log_set_level(&log, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_FLOW); + if (span_log(&log, SPAN_LOG_ERROR, "Log with severity log %d %d %d\n", 1, 2, 3)) + fprintf(stderr, "Logged.\n"); + else + fprintf(stderr, "Not logged.\n"); + + span_log_set_level(&log, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW); + span_log_set_tag(&log, "NewTag"); + if (span_log(&log, SPAN_LOG_FLOW, "Log with new tag %d %d %d\n", 1, 2, 3)) + fprintf(stderr, "Logged.\n"); + else + fprintf(stderr, "Not logged.\n"); + + span_log_set_protocol(&log, "Protocol"); + if (span_log(&log, SPAN_LOG_FLOW, "Log with protocol %d %d %d\n", 1, 2, 3)) + fprintf(stderr, "Logged.\n"); + else + fprintf(stderr, "Not logged.\n"); + + /* Test logging of buffer contents */ + for (i = 0; i < 1000; i++) + buf[i] = i; + if (span_log_buf(&log, SPAN_LOG_FLOW, "Buf", buf, 10)) + fprintf(stderr, "Logged.\n"); + else + fprintf(stderr, "Not logged.\n"); + if (span_log_buf(&log, SPAN_LOG_FLOW, "Buf", buf, 1000)) + fprintf(stderr, "Logged.\n"); + else + fprintf(stderr, "Not logged.\n"); + + /* Test the correct severities will be logged */ + for (i = 0; i < 10; i++) + { + if (!span_log_test(&log, i)) + { + if (i != 6) + tests_failed = TRUE; + break; + } + } + + /* Check timestamping by samples */ + span_log_set_level(&log, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW | SPAN_LOG_SHOW_SAMPLE_TIME); + for (i = 0; i < 10; i++) + { + span_log(&log, SPAN_LOG_FLOW, "Time tagged log %d %d %d\n", 1, 2, 3); + span_log_bump_samples(&log, 441*2); + } + + /* Check timestamping by current date and time */ + span_log_set_message_handler(&log, &message_handler2); + span_log_set_level(&log, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW | SPAN_LOG_SHOW_DATE); + for (i = 0; i < 10; i++) + { + span_log(&log, SPAN_LOG_FLOW, "Date/time tagged log %d %d %d\n", 1, 2, 3); + delay.tv_sec = 0; + delay.tv_nsec = 20000000; + nanosleep(&delay, NULL); + } + if (tests_failed || !msg_done || !error_done) + { + printf("Tests failed - %d %d %d.\n", tests_failed, msg_done, error_done); + return 2; + } + + span_log_set_message_handler(&log, &message_handler); + + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/lpc10_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/lpc10_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,265 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * lpc10_tests.c - Test the LPC10 low bit rate speech codec. + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: lpc10_tests.c,v 1.24 2009/05/30 15:23:14 steveu Exp $ + */ + +/*! \file */ + +/*! \page lpc10_tests_page LPC10 codec tests +\section lpc10_tests_page_sec_1 What does it do? + +\section lpc10_tests_page_sec_2 How is it used? +To perform a general audio quality test, lpc10 should be run. The file ../test-data/local/short_nb_voice.wav +will be compressed to LPC10 data, decompressed, and the resulting audio stored in post_lpc10.wav. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define BLOCK_LEN 180 + +#define BLOCKS_PER_READ 5 + +#define IN_FILE_NAME "../test-data/local/dam9.wav" +#define REF_FILE_NAME "../test-data/local/dam9_lpc55.wav" +#define COMPRESS_FILE_NAME "lpc10_out.lpc10" +#define DECOMPRESS_FILE_NAME "lpc10_in.lpc10" +#define OUT_FILE_NAME "post_lpc10.wav" + +int main(int argc, char *argv[]) +{ + SNDFILE *inhandle; + SNDFILE *refhandle; + SNDFILE *outhandle; + int frames; + int outframes; + double pre_energy; + double post_energy; + double ref_energy; + double diff_energy; + int16_t pre_amp[BLOCKS_PER_READ*BLOCK_LEN]; + int16_t post_amp[BLOCKS_PER_READ*BLOCK_LEN]; + int16_t ref_amp[BLOCKS_PER_READ*BLOCK_LEN]; + int16_t log_amp[BLOCKS_PER_READ*BLOCK_LEN*3]; + uint8_t lpc10_data[BLOCKS_PER_READ*7]; + double xx; + lpc10_encode_state_t *lpc10_enc_state; + lpc10_decode_state_t *lpc10_dec_state; + int i; + int block_no; + int log_error; + int compress; + int decompress; + const char *in_file_name; + int compress_file; + int decompress_file; + int len; + int opt; + int enc_len; + int dec_len; + + compress = FALSE; + decompress = FALSE; + log_error = TRUE; + in_file_name = IN_FILE_NAME; + while ((opt = getopt(argc, argv, "cdi:l")) != -1) + { + switch (opt) + { + case 'c': + compress = TRUE; + break; + case 'd': + decompress = TRUE; + break; + case 'i': + in_file_name = optarg; + break; + case 'l': + log_error = FALSE; + break; + default: + //usage(); + exit(2); + } + } + + compress_file = -1; + decompress_file = -1; + inhandle = NULL; + refhandle = NULL; + outhandle = NULL; + if (!decompress) + { + if ((inhandle = sf_open_telephony_read(in_file_name, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", in_file_name); + exit(2); + } + + if ((refhandle = sf_open_telephony_read(REF_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", REF_FILE_NAME); + exit(2); + } + } + else + { + if ((decompress_file = open(DECOMPRESS_FILE_NAME, O_RDONLY)) < 0) + { + fprintf(stderr, " Cannot open decompressed data file '%s'\n", DECOMPRESS_FILE_NAME); + exit(2); + } + } + + if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + + if ((lpc10_enc_state = lpc10_encode_init(NULL, TRUE)) == NULL) + { + fprintf(stderr, " Cannot create encoder\n"); + exit(2); + } + + if ((lpc10_dec_state = lpc10_decode_init(NULL, TRUE)) == NULL) + { + fprintf(stderr, " Cannot create decoder\n"); + exit(2); + } + + if (compress) + { + if ((compress_file = open(COMPRESS_FILE_NAME, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) + { + fprintf(stderr, " Cannot create compressed data file '%s'\n", COMPRESS_FILE_NAME); + exit(2); + } + } + + pre_energy = 0.0; + post_energy = 0.0; + ref_energy = 0.0; + diff_energy = 0.0; + + if (decompress) + { + while ((len = read(decompress_file, lpc10_data, BLOCKS_PER_READ*7)) > 0) + { + lpc10_decode(lpc10_dec_state, post_amp, lpc10_data, len/7); + outframes = sf_writef_short(outhandle, post_amp, BLOCK_LEN*len/7); + } + } + else + { + block_no = 0; + while ((frames = sf_readf_short(inhandle, pre_amp, BLOCKS_PER_READ*BLOCK_LEN)) == BLOCKS_PER_READ*BLOCK_LEN + && + (frames = sf_readf_short(refhandle, ref_amp, BLOCKS_PER_READ*BLOCK_LEN)) == BLOCKS_PER_READ*BLOCK_LEN) + { + enc_len = lpc10_encode(lpc10_enc_state, lpc10_data, pre_amp, BLOCKS_PER_READ*BLOCK_LEN); + if (compress) + write(compress_file, lpc10_data, enc_len); + dec_len = lpc10_decode(lpc10_dec_state, post_amp, lpc10_data, enc_len); + for (i = 0; i < dec_len; i++) + { + pre_energy += (double) pre_amp[i]*(double) pre_amp[i]; + post_energy += (double) post_amp[i]*(double) post_amp[i]; + ref_energy += (double) ref_amp[i]*(double) ref_amp[i]; + /* The reference file has some odd clipping, so eliminate this from the + energy measurement. */ + if (ref_amp[i] == 32767 || ref_amp[i] == -32768) + xx = 0.0; + else + xx = post_amp[i] - ref_amp[i]; + diff_energy += (double) xx*(double) xx; + log_amp[i] = xx; + } + block_no++; + if (log_error) + outframes = sf_writef_short(outhandle, log_amp, dec_len); + else + outframes = sf_writef_short(outhandle, post_amp, dec_len); + } + if (sf_close(inhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", in_file_name); + exit(2); + } + if (sf_close(refhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", REF_FILE_NAME); + exit(2); + } + } + + if (sf_close(outhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + if (compress) + close(compress_file); + if (decompress) + close(decompress_file); + lpc10_encode_release(lpc10_enc_state); + lpc10_decode_release(lpc10_dec_state); + + if (!decompress) + { + printf("Output energy is %f%% of input energy.\n", 100.0*post_energy/pre_energy); + printf("Difference energy is %f%% of the total.\n", 100.0*diff_energy/ref_energy); + if (fabs(1.0 - post_energy/pre_energy) > 0.05 + || + fabs(diff_energy/post_energy) > 0.03) + { + printf("Tests failed.\n"); + exit(2); + } + printf("Tests passed.\n"); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/make_g168_css.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/make_g168_css.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,348 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * makecss.c - Create the composite source signal (CSS) for G.168 testing. + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: make_g168_css.c,v 1.18 2009/05/30 15:23:14 steveu Exp $ + */ + +/*! \page makecss_page CSS construction for G.168 testing +\section makecss_page_sec_1 What does it do? +???. + +\section makecss_page_sec_2 How does it work? +???. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#if defined(HAVE_FFTW3_H) +#include +#else +#include +#endif + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp/g168models.h" + +#if !defined(NULL) +#define NULL (void *) 0 +#endif + +#define FAST_SAMPLE_RATE 44100.0 + +#define C1_VOICED_SAMPLES 2144 /* 48.62ms at 44100 samples/second => 2144.142 */ +#define C1_NOISE_SAMPLES 8820 /* 200ms at 44100 samples/second => 8820.0 */ +#define C1_SILENCE_SAMPLES 4471 /* 101.38ms at 44100 samples/second => 4470.858 */ + +#define C3_VOICED_SAMPLES 3206 /* 72.69ms at 44100 samples/second => 3205.629 */ +#define C3_NOISE_SAMPLES 8820 /* 200ms at 44100 samples/second => 8820.0 */ +#define C3_SILENCE_SAMPLES 5614 /* 127.31ms at 44100 samples/second => 5614.371 */ + +static double scaling(double f, double start, double end, double start_gain, double end_gain) +{ + double scale; + + scale = start_gain + (f - start)*(end_gain - start_gain)/(end - start); + return scale; +} +/*- End of function --------------------------------------------------------*/ + +static double peak(const int16_t amp[], int len) +{ + int16_t peak; + int i; + + peak = 0; + for (i = 0; i < len; i++) + { + if (abs(amp[i]) > peak) + peak = abs(amp[i]); + } + return peak/32767.0; +} +/*- End of function --------------------------------------------------------*/ + +static double rms(const int16_t amp[], int len) +{ + double ms; + int i; + + ms = 0.0; + for (i = 0; i < len; i++) + ms += amp[i]*amp[i]; + return sqrt(ms/len)/32767.0; +} +/*- End of function --------------------------------------------------------*/ + +static double rms_to_dbm0(double rms) +{ + return 20.0*log10(rms) + DBM0_MAX_POWER; +} +/*- End of function --------------------------------------------------------*/ + +static double rms_to_db(double rms) +{ + return 20.0*log10(rms); +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ +#if defined(HAVE_FFTW3_H) + double in[8192][2]; + double out[8192][2]; +#else + fftw_complex in[8192]; + fftw_complex out[8192]; +#endif + fftw_plan p; + int16_t voiced_sound[8192]; + int16_t noise_sound[8830]; + int16_t silence_sound[8192]; + int i; + int outframes; + int voiced_length; + double f; + double pk; + double ms; + double scale; + SNDFILE *filehandle; + SF_INFO info; + awgn_state_t noise_source; + + memset(&info, 0, sizeof(info)); + info.frames = 0; + info.samplerate = FAST_SAMPLE_RATE; + info.channels = 1; + info.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16; + info.sections = 1; + info.seekable = 1; + if ((filehandle = sf_open("sound_c1.wav", SFM_WRITE, &info)) == NULL) + { + fprintf(stderr, " Failed to open result file\n"); + exit(2); + } + + printf("Generate C1\n"); + /* The set of C1 voice samples is ready for use in the output file. */ + voiced_length = sizeof(css_c1)/sizeof(css_c1[0]); + for (i = 0; i < voiced_length; i++) + voiced_sound[i] = css_c1[i]; + pk = peak(voiced_sound, voiced_length); + ms = rms(voiced_sound, voiced_length); + printf("Voiced level = %.2fdB, crest factor = %.2fdB\n", rms_to_dbm0(ms), rms_to_db(pk/ms)); + +#if defined(HAVE_FFTW3_H) + p = fftw_plan_dft_1d(8192, in, out, FFTW_BACKWARD, FFTW_ESTIMATE); +#else + p = fftw_create_plan(8192, FFTW_BACKWARD, FFTW_ESTIMATE); +#endif + for (i = 0; i < 8192; i++) + { +#if defined(HAVE_FFTW3_H) + in[i][0] = 0.0; + in[i][1] = 0.0; +#else + in[i].re = 0.0; + in[i].im = 0.0; +#endif + } + for (i = 1; i <= 3715; i++) + { + f = FAST_SAMPLE_RATE*i/8192.0; + +#if 1 + if (f < 50.0) + scale = -60.0; + else if (f < 100.0) + scale = scaling(f, 50.0, 100.0, -25.8, -12.8); + else if (f < 200.0) + scale = scaling(f, 100.0, 200.0, -12.8, 17.4); + else if (f < 215.0) + scale = scaling(f, 200.0, 215.0, 17.4, 17.8); + else if (f < 500.0) + scale = scaling(f, 215.0, 500.0, 17.8, 12.2); + else if (f < 1000.0) + scale = scaling(f, 500.0, 1000.0, 12.2, 7.2); + else if (f < 2850.0) + scale = scaling(f, 1000.0, 2850.0, 7.2, 0.0); + else if (f < 3600.0) + scale = scaling(f, 2850.0, 3600.0, 0.0, -2.0); + else if (f < 3660.0) + scale = scaling(f, 3600.0, 3660.0, -2.0, -20.0); + else if (f < 3680.0) + scale = scaling(f, 3600.0, 3680.0, -20.0, -30.0); + else + scale = -60.0; +#else + scale = 0.0; +#endif +#if defined(HAVE_FFTW3_H) + in[i][0] = ((rand() >> 10) & 0x1) ? 1.0 : -1.0; + in[i][0] *= pow(10.0, scale/20.0)*35.0; //305360 + in[8192 - i][0] = -in[i][0]; +#else + in[i].re = ((rand() >> 10) & 0x1) ? 1.0 : -1.0; + in[i].re *= pow(10.0, scale/20.0)*35.0; //305360 + in[8192 - i].re = -in[i].re; +#endif + } +#if defined(HAVE_FFTW3_H) + fftw_execute(p); +#else + fftw_one(p, in, out); +#endif + for (i = 0; i < 8192; i++) + { +#if defined(HAVE_FFTW3_H) + noise_sound[i] = out[i][1]; +#else + noise_sound[i] = out[i].im; +#endif + } + pk = peak(noise_sound, 8192); + ms = rms(noise_sound, 8192); + printf("Noise level = %.2fdB, crest factor = %.2fdB\n", rms_to_dbm0(ms), rms_to_db(pk/ms)); + + for (i = 0; i < 8192; i++) + silence_sound[i] = 0.0; + + for (i = 0; i < 16; i++) + outframes = sf_writef_short(filehandle, voiced_sound, voiced_length); + printf("%d samples of voice\n", 16*voiced_length); + outframes = sf_writef_short(filehandle, noise_sound, 8192); + outframes = sf_writef_short(filehandle, noise_sound, C1_NOISE_SAMPLES - 8192); + printf("%d samples of noise\n", C1_NOISE_SAMPLES); + outframes = sf_writef_short(filehandle, silence_sound, C1_SILENCE_SAMPLES); + printf("%d samples of silence\n", C1_SILENCE_SAMPLES); + + /* Now phase invert the C1 set of voice samples. */ + voiced_length = sizeof(css_c1)/sizeof(css_c1[0]); + for (i = 0; i < voiced_length; i++) + voiced_sound[i] = -css_c1[i]; + pk = peak(voiced_sound, voiced_length); + ms = rms(voiced_sound, voiced_length); + printf("Voiced level = %.2fdB, crest factor = %.2fdB\n", rms_to_dbm0(ms), rms_to_db(pk/ms)); + + for (i = 0; i < 8192; i++) + noise_sound[i] = -noise_sound[i]; + + for (i = 0; i < 16; i++) + outframes = sf_writef_short(filehandle, voiced_sound, voiced_length); + printf("%d samples of voice\n", 16*voiced_length); + outframes = sf_writef_short(filehandle, noise_sound, 8192); + outframes = sf_writef_short(filehandle, noise_sound, C1_NOISE_SAMPLES - 8192); + printf("%d samples of noise\n", C1_NOISE_SAMPLES); + outframes = sf_writef_short(filehandle, silence_sound, C1_SILENCE_SAMPLES); + printf("%d samples of silence\n", C1_SILENCE_SAMPLES); + + if (sf_close(filehandle) != 0) + { + fprintf(stderr, " Cannot close speech file '%s'\n", "sound_c1.wav"); + exit(2); + } + + memset(&info, 0, sizeof(info)); + info.frames = 0; + info.samplerate = FAST_SAMPLE_RATE; + info.channels = 1; + info.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16; + info.sections = 1; + info.seekable = 1; + if ((filehandle = sf_open("sound_c3.wav", SFM_WRITE, &info)) == NULL) + { + fprintf(stderr, " Failed to open result file\n"); + exit(2); + } + + printf("Generate C3\n"); + /* Take the supplied set of C3 voice samples. */ + voiced_length = (sizeof(css_c3)/sizeof(css_c3[0])); + for (i = 0; i < voiced_length; i++) + voiced_sound[i] = css_c3[i]; + pk = peak(voiced_sound, voiced_length); + ms = rms(voiced_sound, voiced_length); + printf("Voiced level = %.2fdB, crest factor = %.2fdB\n", rms_to_dbm0(ms), rms_to_db(pk/ms)); + + awgn_init_dbm0(&noise_source, 7162534, rms_to_dbm0(ms)); + for (i = 0; i < 8192; i++) + noise_sound[i] = awgn(&noise_source); + pk = peak(noise_sound, 8192); + ms = rms(noise_sound, 8192); + printf("Noise level = %.2fdB, crest factor = %.2fdB\n", rms_to_dbm0(ms), rms_to_db(pk/ms)); + + for (i = 0; i < 14; i++) + outframes = sf_writef_short(filehandle, voiced_sound, voiced_length); + printf("%d samples of voice\n", 14*voiced_length); + + outframes = sf_writef_short(filehandle, noise_sound, 8192); + outframes = sf_writef_short(filehandle, noise_sound, C3_NOISE_SAMPLES - 8192); + printf("%d samples of noise\n", C3_NOISE_SAMPLES); + outframes = sf_writef_short(filehandle, silence_sound, C3_SILENCE_SAMPLES); + printf("%d samples of silence\n", C3_SILENCE_SAMPLES); + + /* Now phase invert the set of voice samples. */ + voiced_length = (sizeof(css_c3)/sizeof(css_c3[0])); + for (i = 0; i < voiced_length; i++) + voiced_sound[i] = -css_c3[i]; + pk = peak(voiced_sound, voiced_length); + ms = rms(voiced_sound, voiced_length); + printf("Voiced level = %.2fdB, crest factor = %.2fdB\n", rms_to_dbm0(ms), rms_to_db(pk/ms)); + + /* Now phase invert the set of noise samples. */ + for (i = 0; i < 8192; i++) + noise_sound[i] = -noise_sound[i]; + + for (i = 0; i < 14; i++) + outframes = sf_writef_short(filehandle, voiced_sound, voiced_length); + printf("%d samples of voice\n", 14*i); + outframes = sf_writef_short(filehandle, noise_sound, 8192); + outframes = sf_writef_short(filehandle, noise_sound, C3_NOISE_SAMPLES - 8192); + printf("%d samples of noise\n", C3_NOISE_SAMPLES); + outframes = sf_writef_short(filehandle, silence_sound, C3_SILENCE_SAMPLES); + printf("%d samples of silence\n", C3_SILENCE_SAMPLES); + + if (sf_close(filehandle) != 0) + { + fprintf(stderr, " Cannot close speech file '%s'\n", "sound_c3.wav"); + exit(2); + } + + fftw_destroy_plan(p); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/media_monitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/media_monitor.cpp Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,321 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * media_monitor.cpp - Display IP streaming media status, using the FLTK toolkit. + * + * Written by Steve Underwood + * + * Copyright (C) 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: media_monitor.cpp,v 1.5 2008/09/08 16:10:41 steveu Exp $ + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#if defined(HAVE_FL_FL_H) && defined(HAVE_FL_FL_CARTESIAN_H) + +#define __STDC_LIMIT_MACROS + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "spandsp.h" +#include "media_monitor.h" + +struct line_model_monitor_s +{ + Fl_Double_Window *w; + + Fl_Group *c_right; + Fl_Group *c_sent; + Fl_Group *c_received; + + Ca_Canvas *canvas_sent; + Ca_X_Axis *sent_x; + Ca_Y_Axis *sent_y; + Ca_Line *sent_re; + double sent_re_plot[1000]; + double sent_re_plot_min; + double sent_re_plot_max; + + Ca_Canvas *canvas_received; + Ca_X_Axis *received_x; + Ca_Y_Axis *received_y; + Ca_Line *received_delays; + double received_delays_plot[4000]; + double received_delays_plot_max; + int min_diff; + int max_diff; + + int highest_seq_no_seen; +}; + +static int skip = 0; +static struct line_model_monitor_s media; +static struct line_model_monitor_s *s = &media; + +void media_monitor_rx(int seq_no, double departure_time, double arrival_time) +{ + double fdiff; + int diff; + int i; + + if (s->received_delays) + delete s->received_delays; + + s->canvas_received->current(s->canvas_received); + fdiff = (arrival_time - departure_time)*1000.0; + diff = (int) fdiff; + if (diff < 0) + diff = 0; + else if (diff > 1999) + diff = 1999; + s->received_delays_plot[2*diff + 1]++; + if (s->received_delays_plot[2*diff + 1] > s->received_delays_plot_max) + { + s->received_delays_plot_max = s->received_delays_plot[2*diff + 1]; + s->received_y->maximum(s->received_delays_plot_max); + } + if (diff > s->max_diff) + { + s->max_diff = diff; + s->received_x->maximum((double) s->max_diff); + } + if (diff < s->min_diff) + { + s->min_diff = diff - 1; + s->received_x->minimum((double) s->min_diff); + } + + s->received_delays = new Ca_Line(2000, s->received_delays_plot, 0, 0, FL_BLUE, CA_NO_POINT); + + if (s->sent_re) + delete s->sent_re; + + s->canvas_sent->current(s->canvas_sent); + + if (seq_no > s->highest_seq_no_seen + 1) + { + for (i = s->highest_seq_no_seen + 1; i < seq_no; i++) + s->sent_re_plot[2*(i%500) + 1] = 0.0; + } + s->sent_re_plot[2*(seq_no%500) + 1] = fdiff; + + if (fdiff > s->sent_re_plot_max) + { + s->sent_re_plot_max = fdiff; + s->sent_y->maximum(s->sent_re_plot_max); + } + if (fdiff < s->sent_re_plot_min) + { + s->sent_re_plot_min = fdiff - 1.0; + s->sent_y->minimum(s->sent_re_plot_min); + } + s->sent_re = new Ca_Line(500, s->sent_re_plot, 0, 0, FL_BLUE, CA_NO_POINT); + + if (seq_no > s->highest_seq_no_seen) + s->highest_seq_no_seen = seq_no; + + if (++skip >= 100) + { + skip = 0; + Fl::check(); + } +} +/*- End of function --------------------------------------------------------*/ + +int start_media_monitor(void) +{ + char buf[132 + 1]; + float x; + float y; + int i; + int len; + + len = 128; + + s->w = new Fl_Double_Window(465, 400, "IP streaming media monitor"); + + s->c_right = new Fl_Group(0, 0, 465, 405); + + s->c_sent = new Fl_Group(0, 0, 465, 200); + s->c_sent->box(FL_DOWN_BOX); + s->c_sent->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE); + s->c_sent->current(); + + s->canvas_sent = new Ca_Canvas(110, 35, 300, 100, "Packet delays"); + s->canvas_sent->box(FL_PLASTIC_DOWN_BOX); + s->canvas_sent->color(7); + s->canvas_sent->align(FL_ALIGN_TOP); + Fl_Group::current()->resizable(s->canvas_sent); + s->canvas_sent->border(15); + + s->sent_x = new Ca_X_Axis(115, 135, 290, 30, "Packet"); + s->sent_x->align(FL_ALIGN_BOTTOM); + s->sent_x->minimum(0.0); + s->sent_x->maximum(500.0); + s->sent_x->label_format("%g"); + s->sent_x->minor_grid_color(fl_gray_ramp(20)); + s->sent_x->major_grid_color(fl_gray_ramp(15)); + s->sent_x->label_grid_color(fl_gray_ramp(10)); + s->sent_x->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->sent_x->minor_grid_style(FL_DOT); + s->sent_x->major_step(5); + s->sent_x->label_step(1); + s->sent_x->axis_align(CA_BOTTOM | CA_LINE); + s->sent_x->axis_color(FL_BLACK); + s->sent_x->current(); + + s->sent_y = new Ca_Y_Axis(60, 40, 50, 90, "Delay\n(ms)"); + s->sent_y->align(FL_ALIGN_LEFT); + s->sent_y->minimum(0.0); + s->sent_y->maximum(2000.0); + s->sent_y->minor_grid_color(fl_gray_ramp(20)); + s->sent_y->major_grid_color(fl_gray_ramp(15)); + s->sent_y->label_grid_color(fl_gray_ramp(10)); + s->sent_y->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->sent_y->minor_grid_style(FL_DOT); + s->sent_y->major_step(5); + s->sent_y->label_step(1); + s->sent_y->axis_color(FL_BLACK); + s->sent_y->current(); + + s->c_sent->end(); + + s->c_received = new Fl_Group(0, 200, 465, 200); + s->c_received->box(FL_DOWN_BOX); + s->c_received->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE); + s->c_received->current(); + + s->canvas_received = new Ca_Canvas(110, 235, 300, 100, "Delay spread"); + s->canvas_received->box(FL_PLASTIC_DOWN_BOX); + s->canvas_received->color(7); + s->canvas_received->align(FL_ALIGN_TOP); + Fl_Group::current()->resizable(s->canvas_received); + s->canvas_received->border(15); + + s->received_x = new Ca_X_Axis(115, 335, 290, 30, "Delay (ms)"); + s->received_x->align(FL_ALIGN_BOTTOM); + s->received_x->minimum(0.0); + s->received_x->maximum(2000.0); + s->received_x->label_format("%g"); + s->received_x->minor_grid_color(fl_gray_ramp(20)); + s->received_x->major_grid_color(fl_gray_ramp(15)); + s->received_x->label_grid_color(fl_gray_ramp(10)); + s->received_x->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->received_x->minor_grid_style(FL_DOT); + s->received_x->major_step(5); + s->received_x->label_step(1); + s->received_x->axis_align(CA_BOTTOM | CA_LINE); + s->received_x->axis_color(FL_BLACK); + s->received_x->current(); + + s->received_y = new Ca_Y_Axis(60, 240, 50, 90, "Freq"); + s->received_y->align(FL_ALIGN_LEFT); + s->received_y->minimum(0.0); + s->received_y->maximum(50.0); + s->received_y->minor_grid_color(fl_gray_ramp(20)); + s->received_y->major_grid_color(fl_gray_ramp(15)); + s->received_y->label_grid_color(fl_gray_ramp(10)); + s->received_y->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->received_y->minor_grid_style(FL_DOT); + s->received_y->major_step(5); + s->received_y->label_step(1); + s->received_y->axis_color(FL_BLACK); + s->received_y->current(); + + for (i = 0; i < 2000; i++) + s->received_delays_plot[2*i] = i; + s->received_delays_plot_max = 0.0; + s->min_diff = 2000; + s->max_diff = 0; + + s->received_delays = NULL; + s->highest_seq_no_seen = -1; + + for (i = 0; i < 500; i++) + s->sent_re_plot[2*i] = i; + s->sent_re_plot_min = 99999.0; + s->sent_re_plot_max = 0.0; + s->sent_re = NULL; + + s->c_received->end(); + + s->c_right->end(); + + Fl_Group::current()->resizable(s->c_right); + s->w->end(); + s->w->show(); + + Fl::check(); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +void media_monitor_wait_to_end(void) +{ + fd_set rfds; + int res; + struct timeval tv; + + fprintf(stderr, "Processing complete. Press the key to end\n"); + do + { + usleep(100000); + Fl::check(); + FD_ZERO(&rfds); + FD_SET(0, &rfds); + tv.tv_usec = 100000; + tv.tv_sec = 0; + res = select(1, &rfds, NULL, NULL, &tv); + } + while (res <= 0); +} +/*- End of function --------------------------------------------------------*/ + +void media_monitor_update_display(void) +{ + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); + Fl::check(); +} +/*- End of function --------------------------------------------------------*/ +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/media_monitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/media_monitor.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,56 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * media_monitor.h - Display IP streaming media status, using the FLTK toolkit. + * + * Written by Steve Underwood + * + * Copyright (C) 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: media_monitor.h,v 1.6 2008/04/26 13:39:17 steveu Exp $ + */ + +/*! \page media_monitor_page IP streaming media performance monitoring +\section media_monitor_page_sec_1 What does it do? +This code controls a GUI window, which provides monitoring of the status +of an IP media stream. It shows, graphically: + +\section media_monitor_page_sec_2 How does it work? +This code uses the FLTK cross platform GUI toolkit. It works on X11 and Windows platforms. +In addition to the basic FLTK toolkit, fltk_cartesian is also required. +*/ + +#if !defined(_MEDIA_MONITOR_H_) +#define _MEDIA_MONITOR_H_ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +int start_media_monitor(void); +void media_monitor_rx(int seq_no, double departure_time, double arrival_time); +void media_monitor_wait_to_end(void); +void media_monitor_update_display(void); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/modem_connect_tones_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/modem_connect_tones_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1434 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * modem_connect_tones_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: modem_connect_tones_tests.c,v 1.32 2009/11/02 15:04:15 steveu Exp $ + */ + +/*! \page modem_connect_tones_tests_page Modem connect tones tests +\section modem_connect_tones_rx_tests_page_sec_1 What does it do? +These tests... +*/ + +/* Enable the following definition to enable direct probing into the FAX structures */ +//#define WITH_SPANDSP_INTERNALS + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define SAMPLES_PER_CHUNK 160 + +#define OUTPUT_FILE_NAME "modem_connect_tones.wav" + +#define MITEL_DIR "../test-data/mitel/" +#define BELLCORE_DIR "../test-data/bellcore/" + +#define FALSE 0 +#define TRUE (!FALSE) + +#define LEVEL_MAX -5 +#define LEVEL_MIN -48 +#define LEVEL_MIN_ACCEPT -43 +#define LEVEL_MIN_REJECT -44 + +/* The 1100Hz tone is supposed to be within 38Hz, according to T.30. Allow another 8Hz for FDM, even though + you rarely see that used today. */ +#define CED_FREQ_TOLERANCE (38 + 8) +#define CED_FREQ_BLACKOUT (80) +/* The 2100Hz tone is supposed to be within 15Hz, according to T.30. Allow another 8Hz for FDM, even though + you rarely see that used today. */ +#define CNG_FREQ_TOLERANCE (15 + 8) +#define CNG_FREQ_BLACKOUT (80) +#define AM_FREQ_TOLERANCE (1) + +const char *bellcore_files[] = +{ + MITEL_DIR "mitel-cm7291-talkoff.wav", + BELLCORE_DIR "tr-tsy-00763-1.wav", + BELLCORE_DIR "tr-tsy-00763-2.wav", + BELLCORE_DIR "tr-tsy-00763-3.wav", + BELLCORE_DIR "tr-tsy-00763-4.wav", + BELLCORE_DIR "tr-tsy-00763-5.wav", + BELLCORE_DIR "tr-tsy-00763-6.wav", + "" +}; + +enum +{ + PERFORM_TEST_1A = (1 << 1), + PERFORM_TEST_1B = (1 << 2), + PERFORM_TEST_1C = (1 << 3), + PERFORM_TEST_1D = (1 << 4), + PERFORM_TEST_1E = (1 << 5), + PERFORM_TEST_2A = (1 << 6), + PERFORM_TEST_2B = (1 << 7), + PERFORM_TEST_2C = (1 << 8), + PERFORM_TEST_2D = (1 << 9), + PERFORM_TEST_2E = (1 << 10), + PERFORM_TEST_3A = (1 << 11), + PERFORM_TEST_3B = (1 << 12), + PERFORM_TEST_3C = (1 << 13), + PERFORM_TEST_3D = (1 << 14), + PERFORM_TEST_3E = (1 << 15), + PERFORM_TEST_4 = (1 << 16), + PERFORM_TEST_5A = (1 << 17), + PERFORM_TEST_5B = (1 << 18), + PERFORM_TEST_6A = (1 << 19), + PERFORM_TEST_6B = (1 << 20), + PERFORM_TEST_7A = (1 << 21), + PERFORM_TEST_7B = (1 << 22), + PERFORM_TEST_8 = (1 << 23) +}; + +int preamble_count = 0; +int preamble_on_at = -1; +int preamble_off_at = -1; +int hits = 0; +int when = 0; + +static int preamble_get_bit(void *user_data) +{ + static int bit_no = 0; + int bit; + + /* Generate a section of HDLC flag octet preamble. Then generate some random + bits, which should not look like preamble. */ + if (++preamble_count < 255) + { + bit = (bit_no < 2) ? 0 : 1; + if (++bit_no >= 8) + bit_no = 0; +#if 0 + /* Inject some bad bits */ + if (rand()%15 == 0) + return bit ^ 1; +#endif + } + else + { + bit = rand() & 1; + } + return bit; +} +/*- End of function --------------------------------------------------------*/ + +static void cng_detected(void *user_data, int tone, int level, int delay) +{ + printf("%s (%d) declared at %fs, delay %d (%ddBm0)\n", modem_connect_tone_to_str(tone), tone, (float) when/SAMPLE_RATE, delay, level); + if (tone == MODEM_CONNECT_TONES_FAX_CNG) + hits++; +} +/*- End of function --------------------------------------------------------*/ + +static void preamble_detected(void *user_data, int tone, int level, int delay) +{ + printf("%s (%d) declared at bit %d (%ddBm0)\n", modem_connect_tone_to_str(tone), tone, preamble_count, level); + if (tone == MODEM_CONNECT_TONES_FAX_PREAMBLE) + preamble_on_at = preamble_count; + else + preamble_off_at = preamble_count; + /*endif*/ +} +/*- End of function --------------------------------------------------------*/ + +static void ced_detected(void *user_data, int tone, int level, int delay) +{ + printf("%s (%d) declared at %fs, delay %d (%ddBm0)\n", modem_connect_tone_to_str(tone), tone, (float) when/SAMPLE_RATE, delay, level); + if (tone == MODEM_CONNECT_TONES_FAX_PREAMBLE + || + tone == MODEM_CONNECT_TONES_ANS) + { + hits++; + } +} +/*- End of function --------------------------------------------------------*/ + +static void ans_pr_detected(void *user_data, int tone, int level, int delay) +{ + printf("%s (%d) declared at %fs, delay %d (%ddBm0)\n", modem_connect_tone_to_str(tone), tone, (float) when/SAMPLE_RATE, delay, level); + if (tone == MODEM_CONNECT_TONES_ANS_PR) + hits++; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int i; + int j; + int pitch; + int depth; + int level; + int interval; + int cycle; + int16_t amp[8000]; + modem_connect_tones_rx_state_t cng_rx; + modem_connect_tones_rx_state_t ced_rx; + modem_connect_tones_rx_state_t ans_pr_rx; + modem_connect_tones_tx_state_t modem_tone_tx; + awgn_state_t chan_noise_source; + SNDFILE *inhandle; + SNDFILE *outhandle; + int outframes; + int frames; + int samples; + int hit; + int false_hit; + int false_miss; + power_meter_t power_state; + int power; + int max_power; + int level2; + int max_level2; + int tone_type; + int test_list; + int opt; + char *decode_test_file; + fsk_tx_state_t preamble_tx; + + test_list = 0; + decode_test_file = NULL; + while ((opt = getopt(argc, argv, "d:")) != -1) + { + switch (opt) + { + case 'd': + decode_test_file = optarg; + break; + default: + //usage(); + exit(2); + break; + } + } + argc -= optind; + argv += optind; + for (i = 0; i < argc; i++) + { + if (strcasecmp(argv[i], "1a") == 0) + test_list |= PERFORM_TEST_1A; + else if (strcasecmp(argv[i], "1b") == 0) + test_list |= PERFORM_TEST_1B; + else if (strcasecmp(argv[i], "1c") == 0) + test_list |= PERFORM_TEST_1C; + else if (strcasecmp(argv[i], "1d") == 0) + test_list |= PERFORM_TEST_1D; + else if (strcasecmp(argv[i], "1e") == 0) + test_list |= PERFORM_TEST_1E; + else if (strcasecmp(argv[i], "2a") == 0) + test_list |= PERFORM_TEST_2A; + else if (strcasecmp(argv[i], "2b") == 0) + test_list |= PERFORM_TEST_2B; + else if (strcasecmp(argv[i], "2c") == 0) + test_list |= PERFORM_TEST_2C; + else if (strcasecmp(argv[i], "2d") == 0) + test_list |= PERFORM_TEST_2D; + else if (strcasecmp(argv[i], "2e") == 0) + test_list |= PERFORM_TEST_2E; + else if (strcasecmp(argv[i], "3a") == 0) + test_list |= PERFORM_TEST_3A; + else if (strcasecmp(argv[i], "3b") == 0) + test_list |= PERFORM_TEST_3B; + else if (strcasecmp(argv[i], "3c") == 0) + test_list |= PERFORM_TEST_3C; + else if (strcasecmp(argv[i], "3d") == 0) + test_list |= PERFORM_TEST_3D; + else if (strcasecmp(argv[i], "3e") == 0) + test_list |= PERFORM_TEST_3E; + else if (strcasecmp(argv[i], "4") == 0) + test_list |= PERFORM_TEST_4; + else if (strcasecmp(argv[i], "5a") == 0) + test_list |= PERFORM_TEST_5A; + else if (strcasecmp(argv[i], "5b") == 0) + test_list |= PERFORM_TEST_5B; + else if (strcasecmp(argv[i], "6a") == 0) + test_list |= PERFORM_TEST_6A; + else if (strcasecmp(argv[i], "6b") == 0) + test_list |= PERFORM_TEST_6B; + else if (strcasecmp(argv[i], "7a") == 0) + test_list |= PERFORM_TEST_7A; + else if (strcasecmp(argv[i], "7b") == 0) + test_list |= PERFORM_TEST_7B; + else if (strcasecmp(argv[i], "8") == 0) + test_list |= PERFORM_TEST_8; + else + { + fprintf(stderr, "Unknown test '%s' specified\n", argv[i]); + exit(2); + } + } + if (decode_test_file == NULL && test_list == 0) + test_list = 0xFFFFFFFF; + + if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + + if ((test_list & PERFORM_TEST_1A)) + { + printf("Test 1a: CNG generation to a file\n"); + modem_connect_tones_tx_init(&modem_tone_tx, MODEM_CONNECT_TONES_FAX_CNG); + for (i = 0; i < 20*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + outframes = sf_writef_short(outhandle, amp, samples); + if (outframes != samples) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + /*endif*/ + } + /*endfor*/ + } + /*endif*/ + + if ((test_list & PERFORM_TEST_1B)) + { + printf("Test 1b: CED/ANS generation to a file\n"); + modem_connect_tones_tx_init(&modem_tone_tx, MODEM_CONNECT_TONES_FAX_CED); + for (i = 0; i < 20*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + outframes = sf_writef_short(outhandle, amp, samples); + if (outframes != samples) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + /*endif*/ + } + /*endfor*/ + } + /*endif*/ + + if ((test_list & PERFORM_TEST_1C)) + { + printf("Test 1c: ANSam (Modulated ANS) generation to a file\n"); + /* Some with modulation */ + modem_connect_tones_tx_init(&modem_tone_tx, MODEM_CONNECT_TONES_ANSAM); + for (i = 0; i < 20*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + outframes = sf_writef_short(outhandle, amp, samples); + if (outframes != samples) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + /*endif*/ + } + /*endfor*/ + } + /*endif*/ + + if ((test_list & PERFORM_TEST_1D)) + { + printf("Test 1d: ANS/ (EC-disable) generation to a file\n"); + /* Some without modulation, but with phase reversals */ + modem_connect_tones_tx_init(&modem_tone_tx, MODEM_CONNECT_TONES_ANS_PR); + for (i = 0; i < 20*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + outframes = sf_writef_short(outhandle, amp, samples); + if (outframes != samples) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + /*endif*/ + } + /*endfor*/ + } + /*endif*/ + + if ((test_list & PERFORM_TEST_1E)) + { + printf("Test 1e: ANSam/ (Modulated EC-disable) generation to a file\n"); + /* Some with modulation and phase reversals */ + modem_connect_tones_tx_init(&modem_tone_tx, MODEM_CONNECT_TONES_ANSAM_PR); + for (i = 0; i < 20*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + outframes = sf_writef_short(outhandle, amp, samples); + if (outframes != samples) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + /*endif*/ + } + /*endfor*/ + } + /*endif*/ + + if (sf_close(outhandle) != 0) + { + printf(" Cannot close audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + /*endif*/ + + if ((test_list & PERFORM_TEST_2A)) + { + printf("Test 2a: CNG detection with frequency\n"); + tone_type = MODEM_CONNECT_TONES_FAX_CNG; + awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f); + false_hit = FALSE; + false_miss = FALSE; + for (pitch = 600; pitch <= 1600; pitch++) + { + /* Use the transmitter to test the receiver */ + modem_connect_tones_tx_init(&modem_tone_tx, tone_type); + /* Fudge things for the test */ + modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch); + modem_connect_tones_rx_init(&cng_rx, tone_type, NULL, NULL); + power_meter_init(&power_state, 5); + power = 0; + max_power = 0; + level2 = 0; + max_level2 = 0; + for (i = 0; i < 10*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + for (j = 0; j < samples; j++) + { + amp[j] += awgn(&chan_noise_source); + power = power_meter_update(&power_state, amp[j]); + if (power > max_power) + max_power = power; + /*endif*/ + level2 += ((abs(amp[j]) - level2) >> 5); + if (level2 > max_level2) + max_level2 = level2; + } + /*endfor*/ + modem_connect_tones_rx(&cng_rx, amp, samples); + } + /*endfor*/ + hit = modem_connect_tones_rx_get(&cng_rx); + if (pitch < (1100 - CED_FREQ_BLACKOUT) || pitch > (1100 + CED_FREQ_BLACKOUT)) + { + if (hit != MODEM_CONNECT_TONES_NONE) + false_hit = TRUE; + /*endif*/ + } + else if (pitch > (1100 - CED_FREQ_TOLERANCE) && pitch < (1100 + CED_FREQ_TOLERANCE)) + { + if (hit != tone_type) + false_miss = TRUE; + /*endif*/ + } + /*endif*/ + if (hit != MODEM_CONNECT_TONES_NONE) + printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, cng_rx.channel_level, cng_rx.notch_level, hit); + /*endif*/ + } + /*endfor*/ + if (false_hit || false_miss) + { + printf("Test failed.\n"); + exit(2); + } + /*endif*/ + printf("Test passed.\n"); + } + /*endif*/ + + if ((test_list & PERFORM_TEST_2B)) + { + printf("Test 2b: CED/ANS detection with frequency\n"); + awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f); + false_hit = FALSE; + false_miss = FALSE; + for (pitch = 1600; pitch < 2600; pitch++) + { + /* Use the transmitter to test the receiver */ + modem_connect_tones_tx_init(&modem_tone_tx, MODEM_CONNECT_TONES_ANS); + /* Fudge things for the test */ + modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch); + modem_connect_tones_rx_init(&ced_rx, MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE, NULL, NULL); + for (i = 0; i < 10*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + for (j = 0; j < samples; j++) + amp[j] += awgn(&chan_noise_source); + /*endfor*/ + modem_connect_tones_rx(&ced_rx, amp, samples); + } + /*endfor*/ + hit = modem_connect_tones_rx_get(&ced_rx); + if (pitch < (2100 - CNG_FREQ_BLACKOUT) || pitch > (2100 + CNG_FREQ_BLACKOUT)) + { + if (hit != MODEM_CONNECT_TONES_NONE) + false_hit = TRUE; + /*endif*/ + } + else if (pitch > (2100 - CNG_FREQ_TOLERANCE) && pitch < (2100 + CNG_FREQ_TOLERANCE)) + { + if (hit != MODEM_CONNECT_TONES_FAX_CED) + false_miss = TRUE; + /*endif*/ + } + /*endif*/ + if (hit != MODEM_CONNECT_TONES_NONE) + printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ced_rx.channel_level, ced_rx.notch_level, hit); + /*endif*/ + } + if (false_hit || false_miss) + { + printf("Test failed.\n"); + exit(2); + } + /*endif*/ + printf("Test passed.\n"); + } + /*endif*/ + + if ((test_list & PERFORM_TEST_2C)) + { + printf("Test 2c: ANSam detection with frequency\n"); + tone_type = MODEM_CONNECT_TONES_ANSAM; + awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f); + false_hit = FALSE; + false_miss = FALSE; + for (pitch = 2000; pitch <= 2200; pitch++) + { + /* Use the transmitter to test the receiver */ + modem_connect_tones_tx_init(&modem_tone_tx, tone_type); + /* Fudge things for the test */ + modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch); + modem_connect_tones_rx_init(&ans_pr_rx, tone_type, NULL, NULL); + for (i = 0; i < 10*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + for (j = 0; j < samples; j++) + amp[j] += awgn(&chan_noise_source); + /*endfor*/ + modem_connect_tones_rx(&ans_pr_rx, amp, samples); + } + /*endfor*/ + hit = modem_connect_tones_rx_get(&ans_pr_rx); + if (pitch < (2100 - CNG_FREQ_BLACKOUT) || pitch > (2100 + CNG_FREQ_BLACKOUT)) + { + if (hit != MODEM_CONNECT_TONES_NONE) + false_hit = TRUE; + /*endif*/ + } + else if (pitch > (2100 - CNG_FREQ_TOLERANCE) && pitch < (2100 + CNG_FREQ_TOLERANCE)) + { + if (hit != tone_type) + false_miss = TRUE; + /*endif*/ + } + /*endif*/ + if (hit != MODEM_CONNECT_TONES_NONE) + printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit); + /*endif*/ + } + /*endfor*/ + if (false_hit || false_miss) + { + printf("Test failed.\n"); + exit(2); + } + /*endif*/ + printf("Test passed.\n"); + } + /*endif*/ + + if ((test_list & PERFORM_TEST_2D)) + { + printf("Test 2d: ANS/ (EC-disable) detection with frequency\n"); + tone_type = MODEM_CONNECT_TONES_ANS_PR; + awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f); + false_hit = FALSE; + false_miss = FALSE; + for (pitch = 2000; pitch <= 2200; pitch++) + { + /* Use the transmitter to test the receiver */ + modem_connect_tones_tx_init(&modem_tone_tx, tone_type); + /* Fudge things for the test */ + modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch); + modem_connect_tones_rx_init(&ans_pr_rx, tone_type, NULL, NULL); + for (i = 0; i < 10*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + for (j = 0; j < samples; j++) + amp[j] += awgn(&chan_noise_source); + /*endfor*/ + modem_connect_tones_rx(&ans_pr_rx, amp, samples); + } + /*endfor*/ + hit = modem_connect_tones_rx_get(&ans_pr_rx); + if (pitch < (2100 - CNG_FREQ_BLACKOUT) || pitch > (2100 + CNG_FREQ_BLACKOUT)) + { + if (hit != MODEM_CONNECT_TONES_NONE) + false_hit = TRUE; + /*endif*/ + } + else if (pitch > (2100 - CNG_FREQ_TOLERANCE) && pitch < (2100 + CNG_FREQ_TOLERANCE)) + { + if (hit != tone_type) + false_miss = TRUE; + /*endif*/ + } + /*endif*/ + if (hit != MODEM_CONNECT_TONES_NONE) + printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit); + /*endif*/ + } + /*endfor*/ + if (false_hit || false_miss) + { + printf("Test failed.\n"); + exit(2); + } + /*endif*/ + printf("Test passed.\n"); + } + /*endif*/ + + if ((test_list & PERFORM_TEST_2E)) + { + printf("Test 2e: ANSam/ (Modulated EC-disable) detection with frequency\n"); + tone_type = MODEM_CONNECT_TONES_ANSAM_PR; + awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f); + false_hit = FALSE; + false_miss = FALSE; + for (pitch = 2000; pitch <= 2200; pitch++) + { + /* Use the transmitter to test the receiver */ + modem_connect_tones_tx_init(&modem_tone_tx, tone_type); + /* Fudge things for the test */ + modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch); + modem_connect_tones_rx_init(&ans_pr_rx, tone_type, NULL, NULL); + for (i = 0; i < 10*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + for (j = 0; j < samples; j++) + amp[j] += awgn(&chan_noise_source); + /*endfor*/ + modem_connect_tones_rx(&ans_pr_rx, amp, samples); + } + /*endfor*/ + hit = modem_connect_tones_rx_get(&ans_pr_rx); + if (pitch < (2100 - CNG_FREQ_BLACKOUT) || pitch > (2100 + CNG_FREQ_BLACKOUT)) + { + if (hit != MODEM_CONNECT_TONES_NONE) + false_hit = TRUE; + /*endif*/ + } + else if (pitch > (2100 - CNG_FREQ_TOLERANCE) && pitch < (2100 + CNG_FREQ_TOLERANCE)) + { + if (hit != tone_type) + false_miss = TRUE; + /*endif*/ + } + /*endif*/ + if (hit != MODEM_CONNECT_TONES_NONE) + printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit); + /*endif*/ + } + /*endfor*/ + if (false_hit || false_miss) + { + printf("Test failed.\n"); + exit(2); + } + /*endif*/ + printf("Test passed.\n"); + } + /*endif*/ + + if ((test_list & PERFORM_TEST_3A)) + { + printf("Test 3a: CNG detection with level\n"); + tone_type = MODEM_CONNECT_TONES_FAX_CNG; + awgn_init_dbm0(&chan_noise_source, 7162534, -60.0f); + false_hit = FALSE; + false_miss = FALSE; + for (pitch = 1100 - CED_FREQ_TOLERANCE; pitch <= 1100 + CED_FREQ_TOLERANCE; pitch += 2*CED_FREQ_TOLERANCE) + { + for (level = LEVEL_MAX; level >= LEVEL_MIN; level--) + { + /* Use the transmitter to test the receiver */ + modem_connect_tones_tx_init(&modem_tone_tx, tone_type); + /* Fudge things for the test */ + modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch); + modem_tone_tx.level = dds_scaling_dbm0(level); + modem_connect_tones_rx_init(&cng_rx, tone_type, NULL, NULL); + for (i = 0; i < 10*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + for (j = 0; j < samples; j++) + amp[j] += awgn(&chan_noise_source); + /*endfor*/ + modem_connect_tones_rx(&cng_rx, amp, samples); + } + /*endfor*/ + hit = modem_connect_tones_rx_get(&cng_rx); + if (level < LEVEL_MIN_REJECT) + { + if (hit != MODEM_CONNECT_TONES_NONE) + false_hit = TRUE; + /*endif*/ + } + else if (level > LEVEL_MIN_ACCEPT) + { + if (hit != tone_type) + false_miss = TRUE; + /*endif*/ + } + /*endif*/ + if (hit != MODEM_CONNECT_TONES_NONE) + printf("Detected at %5dHz %4ddB %12" PRId32 " %12" PRId32 " %d\n", pitch, level, cng_rx.channel_level, cng_rx.notch_level, hit); + /*endif*/ + } + /*endfor*/ + } + /*endfor*/ + if (false_hit || false_miss) + { + printf("Test failed.\n"); + exit(2); + } + /*endif*/ + printf("Test passed.\n"); + } + /*endif*/ + + if ((test_list & PERFORM_TEST_3B)) + { + printf("Test 3b: CED/ANS detection with level\n"); + tone_type = MODEM_CONNECT_TONES_ANS; + awgn_init_dbm0(&chan_noise_source, 7162534, -60.0f); + false_hit = FALSE; + false_miss = FALSE; + for (pitch = 2100 - CNG_FREQ_TOLERANCE; pitch <= 2100 + CNG_FREQ_TOLERANCE; pitch += 2*CNG_FREQ_TOLERANCE) + { + for (level = LEVEL_MAX; level >= LEVEL_MIN; level--) + { + /* Use the transmitter to test the receiver */ + modem_connect_tones_tx_init(&modem_tone_tx, tone_type); + /* Fudge things for the test */ + modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch); + modem_tone_tx.level = dds_scaling_dbm0(level); + modem_connect_tones_rx_init(&ced_rx, MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE, NULL, NULL); + for (i = 0; i < 10*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + for (j = 0; j < samples; j++) + amp[j] += awgn(&chan_noise_source); + /*endfor*/ + modem_connect_tones_rx(&ced_rx, amp, samples); + } + /*endfor*/ + hit = modem_connect_tones_rx_get(&ced_rx); + if (level < LEVEL_MIN_REJECT) + { + if (hit != MODEM_CONNECT_TONES_NONE) + false_hit = TRUE; + /*endif*/ + } + else if (level > LEVEL_MIN_ACCEPT) + { + if (hit != tone_type) + false_miss = TRUE; + /*endif*/ + } + /*endif*/ + if (hit != MODEM_CONNECT_TONES_NONE) + printf("Detected at %5dHz %4ddB %12" PRId32 " %12" PRId32 " %d\n", pitch, level, ced_rx.channel_level, ced_rx.notch_level, hit); + /*endif*/ + } + /*endfor*/ + } + /*endfor*/ + if (false_hit || false_miss) + { + printf("Test failed.\n"); + exit(2); + } + /*endif*/ + printf("Test passed.\n"); + } + /*endif*/ + + if ((test_list & PERFORM_TEST_3C)) + { + printf("Test 3c: ANSam detection with level\n"); + tone_type = MODEM_CONNECT_TONES_ANSAM; + awgn_init_dbm0(&chan_noise_source, 7162534, -60.0f); + false_hit = FALSE; + false_miss = FALSE; + for (pitch = 2100 - CNG_FREQ_TOLERANCE; pitch <= 2100 + CNG_FREQ_TOLERANCE; pitch += 2*CNG_FREQ_TOLERANCE) + { + //for (level = LEVEL_MAX; level >= LEVEL_MIN; level--) + for (level = -26; level >= -26; level--) + { + /* Use the transmitter to test the receiver */ + modem_connect_tones_tx_init(&modem_tone_tx, tone_type); + /* Fudge things for the test */ + modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch); + modem_tone_tx.level = dds_scaling_dbm0(level); + modem_tone_tx.mod_level = modem_tone_tx.level*20/100; + modem_connect_tones_rx_init(&ans_pr_rx, tone_type, NULL, NULL); + for (i = 0; i < 10*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + for (j = 0; j < samples; j++) + amp[j] += awgn(&chan_noise_source); + /*endfor*/ + modem_connect_tones_rx(&ans_pr_rx, amp, samples); + } + /*endfor*/ + hit = modem_connect_tones_rx_get(&ans_pr_rx); + if (level < LEVEL_MIN_REJECT) + { + if (hit != MODEM_CONNECT_TONES_NONE) + false_hit = TRUE; + /*endif*/ + } + else if (level > LEVEL_MIN_ACCEPT) + { + if (hit != tone_type) + false_miss = TRUE; + /*endif*/ + } + /*endif*/ + //if (hit != MODEM_CONNECT_TONES_NONE) + printf("Detected at %5dHz %4ddB %12" PRId32 " %12" PRId32 " %d\n", pitch, level, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit); + /*endif*/ + } + /*endfor*/ + } + /*endfor*/ + if (false_hit || false_miss) + { + printf("Test failed.\n"); + exit(2); + } + /*endif*/ + printf("Test passed.\n"); + } + /*endif*/ + + if ((test_list & PERFORM_TEST_3D)) + { + printf("Test 3d: ANS/ (EC-disable) detection with level\n"); + tone_type = MODEM_CONNECT_TONES_ANS_PR; + awgn_init_dbm0(&chan_noise_source, 7162534, -60.0f); + false_hit = FALSE; + false_miss = FALSE; + for (pitch = 2100 - CNG_FREQ_TOLERANCE; pitch <= 2100 + CNG_FREQ_TOLERANCE; pitch += 2*CNG_FREQ_TOLERANCE) + { + for (level = LEVEL_MAX; level >= LEVEL_MIN; level--) + { + /* Use the transmitter to test the receiver */ + modem_connect_tones_tx_init(&modem_tone_tx, tone_type); + /* Fudge things for the test */ + modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch); + modem_tone_tx.level = dds_scaling_dbm0(level); + modem_connect_tones_rx_init(&ans_pr_rx, tone_type, NULL, NULL); + for (i = 0; i < 10*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + for (j = 0; j < samples; j++) + amp[j] += awgn(&chan_noise_source); + /*endfor*/ + modem_connect_tones_rx(&ans_pr_rx, amp, samples); + } + /*endfor*/ + hit = modem_connect_tones_rx_get(&ans_pr_rx); + if (level < LEVEL_MIN_REJECT) + { + if (hit != MODEM_CONNECT_TONES_NONE) + false_hit = TRUE; + /*endif*/ + } + else if (level > LEVEL_MIN_ACCEPT) + { + if (hit != tone_type) + false_miss = TRUE; + /*endif*/ + } + /*endif*/ + if (hit != MODEM_CONNECT_TONES_NONE) + printf("Detected at %5dHz %4ddB %12" PRId32 " %12" PRId32 " %d\n", pitch, level, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit); + /*endif*/ + } + /*endfor*/ + } + /*endfor*/ + if (false_hit || false_miss) + { + printf("Test failed.\n"); + exit(2); + } + /*endif*/ + printf("Test passed.\n"); + } + /*endif*/ + + if ((test_list & PERFORM_TEST_3E)) + { + printf("Test 3e: ANSam/ (Modulated EC-disable) detection with level\n"); + tone_type = MODEM_CONNECT_TONES_ANSAM_PR; + awgn_init_dbm0(&chan_noise_source, 7162534, -60.0f); + false_hit = FALSE; + false_miss = FALSE; + for (pitch = 2100 - CNG_FREQ_TOLERANCE; pitch <= 2100 + CNG_FREQ_TOLERANCE; pitch += 2*CNG_FREQ_TOLERANCE) + { + for (level = LEVEL_MAX; level >= LEVEL_MIN; level--) + { + /* Use the transmitter to test the receiver */ + modem_connect_tones_tx_init(&modem_tone_tx, tone_type); + /* Fudge things for the test */ + modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch); + modem_tone_tx.level = dds_scaling_dbm0(level); + modem_tone_tx.mod_level = modem_tone_tx.level*20/100; + modem_connect_tones_rx_init(&ans_pr_rx, tone_type, NULL, NULL); + for (i = 0; i < 10*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + for (j = 0; j < samples; j++) + amp[j] += awgn(&chan_noise_source); + /*endfor*/ + modem_connect_tones_rx(&ans_pr_rx, amp, samples); + } + /*endfor*/ + hit = modem_connect_tones_rx_get(&ans_pr_rx); + if (level < LEVEL_MIN_REJECT) + { + if (hit != MODEM_CONNECT_TONES_NONE) + false_hit = TRUE; + /*endif*/ + } + else if (level > LEVEL_MIN_ACCEPT) + { + if (hit != tone_type) + false_miss = TRUE; + /*endif*/ + } + /*endif*/ + if (hit != MODEM_CONNECT_TONES_NONE) + printf("Detected at %5dHz %4ddB %12" PRId32 " %12" PRId32 " %d\n", pitch, level, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit); + /*endif*/ + } + /*endfor*/ + } + /*endfor*/ + if (false_hit || false_miss) + { + printf("Test failed.\n"); + exit(2); + } + /*endif*/ + printf("Test passed.\n"); + } + /*endif*/ + + if ((test_list & PERFORM_TEST_4)) + { + printf("Test 4: CED detection, when stimulated with V.21 preamble\n"); + false_hit = FALSE; + false_miss = FALSE; + + /* Send 255 bits of preamble (0.85s, the minimum specified preamble for T.30), and then + some random bits. Check the preamble detector comes on, and goes off at reasonable times. */ + fsk_tx_init(&preamble_tx, &preset_fsk_specs[FSK_V21CH2], preamble_get_bit, NULL); + modem_connect_tones_rx_init(&ced_rx, MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE, preamble_detected, NULL); + for (i = 0; i < 2*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = fsk_tx(&preamble_tx, amp, SAMPLES_PER_CHUNK); + modem_connect_tones_rx(&ced_rx, amp, samples); + } + /*endfor*/ + for (i = 0; i < SAMPLE_RATE/10; i += SAMPLES_PER_CHUNK) + { + memset(amp, 0, sizeof(int16_t)*SAMPLES_PER_CHUNK); + modem_connect_tones_rx(&ced_rx, amp, SAMPLES_PER_CHUNK); + } + /*endfor*/ + if (preamble_on_at < 40 || preamble_on_at > 50 + || + preamble_off_at < 580 || preamble_off_at > 620) + { + printf("Test failed.\n"); + exit(2); + } + /*endif*/ + printf("Test passed.\n"); + } + /*endif*/ + + if ((test_list & PERFORM_TEST_5A)) + { + printf("Test 5A: ANS and ANS/ detection with reversal interval\n"); + tone_type = MODEM_CONNECT_TONES_ANS_PR; + awgn_init_dbm0(&chan_noise_source, 7162534, -60.0f); + false_hit = FALSE; + false_miss = FALSE; + for (interval = 400; interval < 800; interval++) + { + printf("Reversal interval = %d\n", interval); + /* Use the transmitter to test the receiver */ + modem_connect_tones_tx_init(&modem_tone_tx, tone_type); + modem_connect_tones_rx_init(&ans_pr_rx, tone_type, ans_pr_detected, NULL); + hits = 0; + for (i = 0; i < 10*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + when = i; + samples = SAMPLES_PER_CHUNK; + for (j = 0; j < samples; j++) + { + if (--modem_tone_tx.hop_timer <= 0) + { + modem_tone_tx.hop_timer = ms_to_samples(interval); + modem_tone_tx.tone_phase += 0x80000000; + } + /*endif*/ + amp[j] = dds_mod(&modem_tone_tx.tone_phase, modem_tone_tx.tone_phase_rate, modem_tone_tx.level, 0); + } + for (j = 0; j < samples; j++) + amp[j] += awgn(&chan_noise_source); + /*endfor*/ + modem_connect_tones_rx(&ans_pr_rx, amp, samples); + } + /*endfor*/ + if (interval < (450 - 25) || interval > (450 + 25)) + { + if (hits != 0) + false_hit = TRUE; + /*endif*/ + } + else if (interval > (450 - 25) && interval < (450 + 25)) + { + if (hits == 0) + false_miss = TRUE; + /*endif*/ + } + /*endif*/ + if (hits) + printf("Detected at %5dHz %4ddB %dms %12" PRId32 " %12" PRId32 " %d\n", 2100, -11, interval, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hits); + /*endif*/ + } + /*endfor*/ + if (false_hit || false_miss) + { + printf("Test failed.\n"); + exit(2); + } + /*endif*/ + printf("Test passed.\n"); + } + /*endif*/ + + if ((test_list & PERFORM_TEST_5B)) + { + printf("Test 5B: ANS and ANS/ detection with mixed reversal intervals\n"); + awgn_init_dbm0(&chan_noise_source, 7162534, -60.0f); + tone_type = MODEM_CONNECT_TONES_ANS_PR; + false_hit = FALSE; + false_miss = FALSE; + interval = 450; + printf("Reversal interval = %d\n", interval); + /* Use the transmitter to test the receiver */ + modem_connect_tones_tx_init(&modem_tone_tx, tone_type); + modem_connect_tones_rx_init(&ans_pr_rx, tone_type, ans_pr_detected, NULL); + cycle = 0; + hits = 0; + for (i = 0; i < 60*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + when = i; + samples = SAMPLES_PER_CHUNK; + for (j = 0; j < samples; j++) + { + if (--modem_tone_tx.hop_timer <= 0) + { + if (++cycle == 10) + interval = 1000; + if (cycle == 20) + interval = 450; + modem_tone_tx.hop_timer = ms_to_samples(interval); + modem_tone_tx.tone_phase += 0x80000000; + } + amp[j] = dds_mod(&modem_tone_tx.tone_phase, modem_tone_tx.tone_phase_rate, modem_tone_tx.level, 0); + } + /*endfor*/ + for (j = 0; j < samples; j++) + amp[j] += awgn(&chan_noise_source); + /*endfor*/ + modem_connect_tones_rx(&ans_pr_rx, amp, samples); + /* TODO: Add test result detection logic. */ + } + /*endfor*/ + if (false_hit || false_miss) + { + printf("Test failed.\n"); + exit(2); + } + /*endif*/ + printf("Test passed.\n"); + } + /*endif*/ + + if ((test_list & PERFORM_TEST_6A)) + { + printf("Test 6a: ANSam detection with AM pitch\n"); + tone_type = MODEM_CONNECT_TONES_ANSAM; + awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f); + false_hit = FALSE; + false_miss = FALSE; + for (pitch = 5; pitch < 25; pitch++) + { + /* Use the transmitter to test the receiver */ + modem_connect_tones_tx_init(&modem_tone_tx, tone_type); + /* Fudge things for the test */ + modem_tone_tx.mod_phase_rate = dds_phase_rate(pitch); + modem_connect_tones_rx_init(&ans_pr_rx, tone_type, NULL, NULL); + for (i = 0; i < 10*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + for (j = 0; j < samples; j++) + amp[j] += awgn(&chan_noise_source); + /*endfor*/ + modem_connect_tones_rx(&ans_pr_rx, amp, samples); + } + /*endfor*/ + hit = modem_connect_tones_rx_get(&ans_pr_rx); + if (pitch < (15 - 10) || pitch > (15 + 10)) + { + if (hit == tone_type) + false_hit = TRUE; + /*endif*/ + } + else if (pitch > (15 - AM_FREQ_TOLERANCE) && pitch < (15 + AM_FREQ_TOLERANCE)) + { + if (hit != tone_type) + false_miss = TRUE; + /*endif*/ + } + /*endif*/ + if (hit != MODEM_CONNECT_TONES_NONE) + printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit); + /*endif*/ + } + /*endfor*/ + if (false_hit || false_miss) + { + printf("Test failed.\n"); + exit(2); + } + /*endif*/ + printf("Test passed.\n"); + } + /*endif*/ + + if ((test_list & PERFORM_TEST_6B)) + { + printf("Test 6b: ANSam/ (Modulated EC-disable) detection with AM pitch\n"); + tone_type = MODEM_CONNECT_TONES_ANSAM_PR; + awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f); + false_hit = FALSE; + false_miss = FALSE; + for (pitch = 5; pitch < 25; pitch++) + { + /* Use the transmitter to test the receiver */ + modem_connect_tones_tx_init(&modem_tone_tx, tone_type); + /* Fudge things for the test */ + modem_tone_tx.mod_phase_rate = dds_phase_rate(pitch); + modem_connect_tones_rx_init(&ans_pr_rx, tone_type, NULL, NULL); + for (i = 0; i < 10*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + for (j = 0; j < samples; j++) + amp[j] += awgn(&chan_noise_source); + /*endfor*/ + modem_connect_tones_rx(&ans_pr_rx, amp, samples); + } + /*endfor*/ + hit = modem_connect_tones_rx_get(&ans_pr_rx); + if (pitch < (15 - 10) || pitch > (15 + 10)) + { + if (hit == tone_type) + false_hit = TRUE; + /*endif*/ + } + else if (pitch > (15 - AM_FREQ_TOLERANCE) && pitch < (15 + AM_FREQ_TOLERANCE)) + { + if (hit != tone_type) + false_miss = TRUE; + /*endif*/ + } + /*endif*/ + if (hit != MODEM_CONNECT_TONES_NONE) + printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit); + /*endif*/ + } + /*endfor*/ + if (false_hit || false_miss) + { + printf("Test failed.\n"); + exit(2); + } + /*endif*/ + printf("Test passed.\n"); + } + /*endif*/ + + if ((test_list & PERFORM_TEST_7A)) + { + printf("Test 7a: ANSam detection with AM depth\n"); + tone_type = MODEM_CONNECT_TONES_ANSAM; + pitch = 2100; + awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f); + false_hit = FALSE; + false_miss = FALSE; + for (depth = 0; depth < 40; depth++) + { + /* Use the transmitter to test the receiver */ + modem_connect_tones_tx_init(&modem_tone_tx, tone_type); + /* Fudge things for the test */ + modem_tone_tx.mod_level = modem_tone_tx.level*depth/100; + modem_connect_tones_rx_init(&ans_pr_rx, tone_type, NULL, NULL); + for (i = 0; i < 10*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + for (j = 0; j < samples; j++) + amp[j] += awgn(&chan_noise_source); + /*endfor*/ + modem_connect_tones_rx(&ans_pr_rx, amp, samples); + } + /*endfor*/ + hit = modem_connect_tones_rx_get(&ans_pr_rx); + if (depth < 10) + { + if (hit == tone_type) + false_hit = TRUE; + /*endif*/ + } + else if (depth > 15) + { + if (hit != tone_type) + false_miss = TRUE; + /*endif*/ + } + /*endif*/ + if (hit != MODEM_CONNECT_TONES_NONE) + printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit); + /*endif*/ + } + /*endfor*/ + if (false_hit || false_miss) + { + printf("Test failed.\n"); + exit(2); + } + /*endif*/ + printf("Test passed.\n"); + } + /*endif*/ + + if ((test_list & PERFORM_TEST_7B)) + { + printf("Test 7b: ANSam/ (Modulated EC-disable) detection with AM depth\n"); + tone_type = MODEM_CONNECT_TONES_ANSAM_PR; + pitch = 2100; + awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f); + false_hit = FALSE; + false_miss = FALSE; + for (depth = 0; depth < 40; depth++) + { + /* Use the transmitter to test the receiver */ + modem_connect_tones_tx_init(&modem_tone_tx, tone_type); + /* Fudge things for the test */ + modem_tone_tx.mod_level = modem_tone_tx.level*depth/100; + modem_connect_tones_rx_init(&ans_pr_rx, tone_type, NULL, NULL); + for (i = 0; i < 10*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + for (j = 0; j < samples; j++) + amp[j] += awgn(&chan_noise_source); + /*endfor*/ + modem_connect_tones_rx(&ans_pr_rx, amp, samples); + } + /*endfor*/ + hit = modem_connect_tones_rx_get(&ans_pr_rx); + if (depth < 10) + { + if (hit == tone_type) + false_hit = TRUE; + /*endif*/ + } + else if (depth > 15) + { + if (hit != tone_type) + false_miss = TRUE; + /*endif*/ + } + /*endif*/ + if (hit != MODEM_CONNECT_TONES_NONE) + printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit); + /*endif*/ + } + /*endfor*/ + if (false_hit || false_miss) + { + printf("Test failed.\n"); + exit(2); + } + /*endif*/ + printf("Test passed.\n"); + } + /*endif*/ + + if ((test_list & PERFORM_TEST_8)) + { + /* Talk-off test */ + /* Here we use the BellCore and Mitel talk off test tapes, intended for DTMF + detector testing. Presumably they should also have value here, but I am not + sure. If those voice snippets were chosen to be tough on DTMF detectors, they + might go easy on detectors looking for different pitches. However, the + Mitel DTMF test tape is known (the hard way) to exercise 2280Hz tone + detectors quite well. */ + printf("Test 8: Talk-off test\n"); + modem_connect_tones_rx_init(&cng_rx, MODEM_CONNECT_TONES_FAX_CNG, NULL, NULL); + modem_connect_tones_rx_init(&ced_rx, MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE, NULL, NULL); + modem_connect_tones_rx_init(&ans_pr_rx, MODEM_CONNECT_TONES_ANS_PR, NULL, NULL); + for (j = 0; bellcore_files[j][0]; j++) + { + if ((inhandle = sf_open_telephony_read(bellcore_files[j], 1)) == NULL) + { + fprintf(stderr, " Cannot open speech file '%s'\n", bellcore_files[j]); + exit (2); + } + /*endif*/ + + when = 0; + hits = 0; + while ((frames = sf_readf_short(inhandle, amp, 8000))) + { + when++; + modem_connect_tones_rx(&cng_rx, amp, frames); + modem_connect_tones_rx(&ced_rx, amp, frames); + modem_connect_tones_rx(&ans_pr_rx, amp, frames); + if (modem_connect_tones_rx_get(&cng_rx) != MODEM_CONNECT_TONES_NONE) + { + /* This is not a true measure of hits, as there might be more + than one in a block of data. However, since the only good + result is no hits, this approximation is OK. */ + printf("Hit CNG at %ds\n", when); + hits++; + modem_connect_tones_rx_init(&cng_rx, MODEM_CONNECT_TONES_FAX_CNG, NULL, NULL); + } + /*endif*/ + if (modem_connect_tones_rx_get(&ced_rx) != MODEM_CONNECT_TONES_NONE) + { + printf("Hit CED at %ds\n", when); + hits++; + modem_connect_tones_rx_init(&ced_rx, MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE, NULL, NULL); + } + /*endif*/ + if (modem_connect_tones_rx_get(&ans_pr_rx) != MODEM_CONNECT_TONES_NONE) + { + printf("Hit EC disable at %ds\n", when); + hits++; + modem_connect_tones_rx_init(&ans_pr_rx, MODEM_CONNECT_TONES_ANS_PR, NULL, NULL); + } + /*endif*/ + } + /*endwhile*/ + if (sf_close(inhandle) != 0) + { + fprintf(stderr, " Cannot close speech file '%s'\n", bellcore_files[j]); + exit(2); + } + /*endif*/ + printf(" File %d gave %d false hits.\n", j + 1, hits); + } + /*endfor*/ + if (hits > 0) + { + printf("Test failed.\n"); + exit(2); + } + /*endif*/ + printf("Test passed.\n"); + } + /*endif*/ + + if (decode_test_file) + { + printf("Decode file '%s'\n", decode_test_file); + modem_connect_tones_rx_init(&cng_rx, MODEM_CONNECT_TONES_FAX_CNG, cng_detected, NULL); + modem_connect_tones_rx_init(&ced_rx, MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE, ced_detected, NULL); + modem_connect_tones_rx_init(&ans_pr_rx, MODEM_CONNECT_TONES_ANS_PR, ans_pr_detected, NULL); + hits = 0; + if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL) + { + fprintf(stderr, " Cannot open speech file '%s'\n", decode_test_file); + exit (2); + } + /*endif*/ + + when = 0; + hits = 0; + while ((frames = sf_readf_short(inhandle, amp, 8000))) + { + when++; + modem_connect_tones_rx(&cng_rx, amp, frames); + modem_connect_tones_rx(&ced_rx, amp, frames); + modem_connect_tones_rx(&ans_pr_rx, amp, frames); + } + /*endwhile*/ + if (sf_close(inhandle) != 0) + { + fprintf(stderr, " Cannot close speech file '%s'\n", decode_test_file); + exit(2); + } + /*endif*/ + printf(" File gave %d hits.\n", hits); + } + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/modem_echo_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/modem_echo_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,406 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * modem_echo_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: modem_echo_tests.c,v 1.32 2009/05/30 15:23:14 steveu Exp $ + */ + +/*! \page modem_echo_can_tests_page Line echo cancellation for modems tests +\section modem_echo_can_tests_page_sec_1 What does it do? +Currently the echo cancellation tests only provide simple exercising of the +cancellor in the way it might be used for line echo cancellation. The test code +is in echotests.c. + +The goal is to test the echo cancellor again the G.16X specs. Clearly, that also +means the goal for the cancellor itself is to comply with those specs. Right +now, the only aspect of these tests implemented is the line impulse response +models in g168tests.c. + +\section modem_echo_can_tests_page_sec_2 How does it work? +The current test consists of feeding an audio file of real speech to the echo +cancellor as the transmit signal. A very simple model of a telephone line is +used to simulate a simple echo from the transmit signal. A second audio file of +real speech is also used to simulate a signal received form the far end of the +line. This is gated so it is only placed for one second every 10 seconds, +simulating the double talk condition. The resulting echo cancelled signal can +either be store in a file for further analysis, or played back as the data is +processed. + +A number of modified versions of this test have been performed. The signal level +of the two speech sources has been varied. Several simple models of the +telephone line have been used. Although the current cancellor design has known +limitations, it seems stable for all these test conditions. No instability has +been observed in the current version due to arithmetic overflow when the speech +is very loud (with earlier versions, well, ....:) ). The lack of saturating +arithmetic in general purpose CPUs is a huge disadvantage here, as software +saturation logic would cause a major slow down. Floating point would be good, +but is not usable in the Linux kernel. Anyway, the bottom line seems to be the +current design is genuinely useful, if imperfect. + +\section modem_echo_can_tests_page_sec_2 How do I use it? + +Build the tests with the command "./build". Currently there is no proper make +setup, or way to build individual tests. "./build" will built all the tests +which currently exist for the DSP functions. The echo cancellation test assumes +there are two audio files containing mono, 16 bit signed PCM speech data, sampled +at 8kHz. These should be called local_sound.wav and far_sound.wav. A third wave +file will be produced. This very crudely starts with the first 256 bytes from +the local_sound.wav file, followed by the results of the echo cancellation. The +resulting audio is also played to the /dev/dsp device. A printf near the end of +echo_tests.c is commented out with a \#if. If this is enabled, detailed +information about the results of the echo cancellation will be written to +stdout. By saving this into a file, Grace (recommended), GnuPlot, or some other +plotting package may be used to graphically display the functioning of the +cancellor. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#if defined(HAVE_FL_FL_H) && defined(HAVE_FL_FL_CARTESIAN_H) && defined(HAVE_FL_FL_AUDIO_METER_H) +#define ENABLE_GUI +#endif + +#include +#include +#include +#include +#include +#include +#if defined(HAVE_MATH_H) +#define GEN_CONST +#endif + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp/g168models.h" +#include "spandsp-sim.h" + +#if defined(ENABLE_GUI) +#include "echo_monitor.h" +#endif + +#if !defined(NULL) +#define NULL (void *) 0 +#endif + +typedef struct +{ + const char *name; + int max; + int cur; + SNDFILE *handle; + int16_t signal[8000]; +} signal_source_t; + +signal_source_t local_css; + +fir32_state_t line_model; + +SNDFILE *resulthandle; +int16_t residue_sound[8000]; +int residue_cur = 0; +int do_codec_munge = TRUE; +int use_gui = FALSE; + +static const int16_t tone_1khz[] = {10362, 7327, 0, -7327, -10362, -7327, 0, 7327}; + +static inline void put_residue(int16_t tx, int16_t residue) +{ + int outframes; + + residue_sound[residue_cur++] = tx; + residue_sound[residue_cur++] = residue; + if (residue_cur >= 8000) + { + residue_cur >>= 1; + outframes = sf_writef_short(resulthandle, residue_sound, residue_cur); + if (outframes != residue_cur) + { + fprintf(stderr, " Error writing residue sound\n"); + exit(2); + } + residue_cur = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +static void signal_load(signal_source_t *sig, const char *name) +{ + sig->name = name; + if ((sig->handle = sf_open_telephony_read(sig->name, 1)) == NULL) + { + fprintf(stderr, " Cannot open sound file '%s'\n", sig->name); + exit(2); + } + sig->max = sf_readf_short(sig->handle, sig->signal, 8000); + if (sig->max < 0) + { + fprintf(stderr, " Error reading sound file '%s'\n", sig->name); + exit(2); + } +} +/*- End of function --------------------------------------------------------*/ + +static void signal_free(signal_source_t *sig) +{ + if (sf_close(sig->handle) != 0) + { + fprintf(stderr, " Cannot close sound file '%s'\n", sig->name); + exit(2); + } +} +/*- End of function --------------------------------------------------------*/ + +static void signal_restart(signal_source_t *sig) +{ + sig->cur = 0; +} +/*- End of function --------------------------------------------------------*/ + +static int16_t signal_amp(signal_source_t *sig) +{ + int16_t tx; + + tx = sig->signal[sig->cur++]; + if (sig->cur >= sig->max) + sig->cur = 0; + return tx; +} +/*- End of function --------------------------------------------------------*/ + +static inline int16_t codec_munger(int16_t amp) +{ + if (do_codec_munge) + return alaw_to_linear(linear_to_alaw(amp)); + return amp; +} +/*- End of function --------------------------------------------------------*/ + +static void channel_model_create(int model) +{ + static const int32_t *line_models[] = + { + line_model_d2_coeffs, + line_model_d3_coeffs, + line_model_d4_coeffs, + line_model_d5_coeffs, + line_model_d6_coeffs, + line_model_d7_coeffs, + line_model_d8_coeffs, + line_model_d9_coeffs + }; + + static int line_model_sizes[] = + { + sizeof(line_model_d2_coeffs)/sizeof(int32_t), + sizeof(line_model_d3_coeffs)/sizeof(int32_t), + sizeof(line_model_d4_coeffs)/sizeof(int32_t), + sizeof(line_model_d5_coeffs)/sizeof(int32_t), + sizeof(line_model_d6_coeffs)/sizeof(int32_t), + sizeof(line_model_d7_coeffs)/sizeof(int32_t), + sizeof(line_model_d8_coeffs)/sizeof(int32_t), + sizeof(line_model_d9_coeffs)/sizeof(int32_t) + }; + + fir32_create(&line_model, line_models[model], line_model_sizes[model]); +} +/*- End of function --------------------------------------------------------*/ + +static int16_t channel_model(int16_t local, int16_t far) +{ + int16_t echo; + int16_t rx; + + /* Channel modelling is merely simulating the effects of A-law distortion + and using one of the echo models from G.168 */ + + /* The local tx signal will have gone through an A-law munging before + it reached the line's analogue area where the echo occurs. */ + echo = fir32(&line_model, codec_munger(local/8)); + /* The far end signal will have been through an A-law munging, although + this should not affect things. */ + rx = echo + codec_munger(far); + /* This mixed echo and far end signal will have been through an A-law munging when it came back into + the digital network. */ + rx = codec_munger(rx); + return rx; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + modem_echo_can_state_t *ctx; + //awgn_state_t local_noise_source; + awgn_state_t far_noise_source; + int i; + int clean; + int16_t rx; + int16_t tx; + int local_cur; + int far_cur; + int result_cur; + int line_model_no; + time_t now; + power_meter_t power_before; + power_meter_t power_after; + float unadapted_output_power; + float unadapted_echo_power; + float adapted_output_power; + float adapted_echo_power; +#if defined(ENABLE_GUI) + int16_t amp[2]; +#endif + + line_model_no = 0; + use_gui = FALSE; + for (i = 1; i < argc; i++) + { + if (strcmp(argv[i], "-g") == 0) + { + use_gui = TRUE; + continue; + } + line_model_no = atoi(argv[1]); + } + time(&now); + ctx = modem_echo_can_create(256); + awgn_init_dbm0(&far_noise_source, 7162534, -50.0f); + + signal_load(&local_css, "sound_c1_8k.wav"); + + if ((resulthandle = sf_open_telephony_write("modem_echo.wav", 2)) == NULL) + { + fprintf(stderr, " Failed to open result file\n"); + exit(2); + } + +#if defined(ENABLE_GUI) + if (use_gui) + start_echo_can_monitor(256); +#endif + + local_cur = 0; + far_cur = 0; + result_cur = 0; + channel_model_create(line_model_no); +#if defined(ENABLE_GUI) + if (use_gui) + echo_can_monitor_line_model_update(line_model.coeffs, line_model.taps); +#endif + + modem_echo_can_flush(ctx); + + power_meter_init(&power_before, 5); + power_meter_init(&power_after, 5); + + /* Measure the echo power before adaption */ + modem_echo_can_adaption_mode(ctx, FALSE); + for (i = 0; i < 8000*5; i++) + { + tx = tone_1khz[i & 7]; + rx = channel_model(tx, 0); + clean = modem_echo_can_update(ctx, tx, rx); + power_meter_update(&power_before, rx); + power_meter_update(&power_after, clean); + } + unadapted_output_power = power_meter_current_dbm0(&power_before); + unadapted_echo_power = power_meter_current_dbm0(&power_after); + printf("Pre-adaption: output power %10.5fdBm0, echo power %10.5fdBm0\n", unadapted_output_power, unadapted_echo_power); + + /* Converge the canceller */ + signal_restart(&local_css); + modem_echo_can_adaption_mode(ctx, TRUE); + for (i = 0; i < 800*2; i++) + { + clean = modem_echo_can_update(ctx, 0, 0); + put_residue(0, clean); + } + + for (i = 0; i < 8000*50; i++) + { + tx = signal_amp(&local_css); + rx = channel_model(tx, 0); + clean = modem_echo_can_update(ctx, tx, rx); + power_meter_update(&power_before, rx); + power_meter_update(&power_after, clean); +#if 0 + if (i%800 == 0) + printf("Powers %10.5fdBm0 %10.5fdBm0\n", power_meter_current_dbm0(&power_before), power_meter_current_dbm0(&power_after)); +#endif + put_residue(tx, clean); +#if defined(ENABLE_GUI) + if (use_gui) + { + echo_can_monitor_can_update(ctx->fir_taps16, 256); + amp[0] = tx; + echo_can_monitor_line_spectrum_update(amp, 1); + } +#endif + } + + /* Now lets see how well adapted we are */ + modem_echo_can_adaption_mode(ctx, FALSE); + for (i = 0; i < 8000*5; i++) + { + tx = tone_1khz[i & 7]; + rx = channel_model(tx, 0); + clean = modem_echo_can_update(ctx, tx, rx); + power_meter_update(&power_before, rx); + power_meter_update(&power_after, clean); + } + adapted_output_power = power_meter_current_dbm0(&power_before); + adapted_echo_power = power_meter_current_dbm0(&power_after); + printf("Post-adaption: output power %10.5fdBm0, echo power %10.5fdBm0\n", adapted_output_power, adapted_echo_power); + + if (fabsf(adapted_output_power - unadapted_output_power) > 0.1f + || + adapted_echo_power > unadapted_echo_power - 30.0f) + { + printf("Tests failed.\n"); + exit(2); + } + + modem_echo_can_free(ctx); + signal_free(&local_css); + + if (sf_close(resulthandle) != 0) + { + fprintf(stderr, " Cannot close speech file '%s'\n", "result_sound.wav"); + exit(2); + } + +#if defined(ENABLE_GUI) + if (use_gui) + echo_can_monitor_wait_to_end(); +#endif + + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/modem_monitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/modem_monitor.cpp Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,594 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * modem_monitor.cpp - Display QAM constellations, using the FLTK toolkit. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: modem_monitor.cpp,v 1.17 2008/09/04 14:40:05 steveu Exp $ + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#if defined(HAVE_FL_FL_H) && defined(HAVE_FL_FL_CARTESIAN_H) + +#define __STDC_LIMIT_MACROS + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "spandsp.h" + +#define SYMBOL_TRACKER_POINTS 12000 +#define CARRIER_TRACKER_POINTS 12000 + +#define FP_FACTOR 4096 + +struct qam_monitor_s +{ + Fl_Double_Window *w; + Fl_Group *c_const; + Fl_Group *c_right; + Fl_Group *c_eq; + Fl_Group *c_symbol_track; + + /* Constellation stuff */ + Ca_Canvas *canvas_const; + Ca_X_Axis *sig_i; + Ca_Y_Axis *sig_q; + + Ca_Point *constel_point[100000]; + int constel_window; + int next_constel_point; + int skip; + + /* Equalizer stuff */ + Ca_Canvas *canvas_eq; + + Ca_X_Axis *eq_x; + Ca_Y_Axis *eq_y; + + Ca_Line *eq_re; + Ca_Line *eq_im; + + double eq_re_plot[200]; + double eq_im_plot[200]; + + /* Carrier and symbol tracking stuff */ + Ca_Canvas *canvas_track; + + Ca_X_Axis *track_x; + Ca_Y_Axis *symbol_track_y; + Ca_Y_Axis *carrier_y; + + Ca_Line *symbol_track; + Ca_Line *carrier; + + float symbol_tracker[SYMBOL_TRACKER_POINTS]; + double symbol_track_plot[SYMBOL_TRACKER_POINTS*2]; + int symbol_track_points; + int symbol_track_ptr; + int symbol_track_window; + + float carrier_tracker[CARRIER_TRACKER_POINTS]; + double carrier_plot[CARRIER_TRACKER_POINTS*2]; + int carrier_points; + int carrier_ptr; + int carrier_window; + + /* Audio meter stuff */ + Fl_Audio_Meter *audio_meter; + Fl_Output *audio_level; + int32_t power_reading; +}; + +#include "modem_monitor.h" + +int qam_monitor_clear_constel(qam_monitor_t *s) +{ + int i; + + s->canvas_const->current(s->canvas_const); + for (i = 0; i < s->constel_window; i++) + { + if (s->constel_point[i]) + { + delete s->constel_point[i]; + s->constel_point[i] = NULL; + } + } + s->next_constel_point = 0; + Fl::check(); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int qam_monitor_update_constel(qam_monitor_t *s, const complexf_t *pt) +{ + int i; + + s->canvas_const->current(s->canvas_const); + if (s->constel_point[s->next_constel_point]) + delete s->constel_point[s->next_constel_point]; + s->constel_point[s->next_constel_point++] = new Ca_Point(pt->re, pt->im, FL_BLACK); + if (s->next_constel_point >= s->constel_window) + s->next_constel_point = 0; + if (++s->skip >= 100) + { + s->skip = 0; + Fl::check(); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int qam_monitor_update_equalizer(qam_monitor_t *s, const complexf_t *coeffs, int len) +{ + int i; + float min; + float max; + + /* Protect against screwy values */ + for (i = 0; i < len; i++) + { + if (isnan(coeffs[i].re) || isinf(coeffs[i].re)) + break; + if (isnan(coeffs[i].im) || isinf(coeffs[i].im)) + break; + if (coeffs[i].re < -20.0f || coeffs[i].re > 20.0f) + break; + if (coeffs[i].im < -20.0f || coeffs[i].im > 20.0f) + break; + } + if (i != len) + return -1; + + if (s->eq_re) + delete s->eq_re; + if (s->eq_im) + delete s->eq_im; + + s->canvas_eq->current(s->canvas_eq); + i = 0; + min = coeffs[i].re; + if (min > coeffs[i].im) + min = coeffs[i].im; + max = coeffs[i].re; + if (max < coeffs[i].im) + max = coeffs[i].im; + for (i = 0; i < len; i++) + { + s->eq_re_plot[2*i] = (i - len/2)/2.0; + s->eq_re_plot[2*i + 1] = coeffs[i].re; + if (min > coeffs[i].re) + min = coeffs[i].re; + if (max < coeffs[i].re) + max = coeffs[i].re; + + s->eq_im_plot[2*i] = (i - len/2)/2.0; + s->eq_im_plot[2*i + 1] = coeffs[i].im; + if (min > coeffs[i].im) + min = coeffs[i].im; + if (max < coeffs[i].im) + max = coeffs[i].im; + } + + s->eq_x->minimum(-len/4.0); + s->eq_x->maximum(len/4.0); + s->eq_y->maximum((max == min) ? max + 0.2 : max); + s->eq_y->minimum(min); + s->eq_re = new Ca_Line(len, s->eq_re_plot, 0, 0, FL_BLUE, CA_NO_POINT); + s->eq_im = new Ca_Line(len, s->eq_im_plot, 0, 0, FL_RED, CA_NO_POINT); + Fl::check(); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int qam_monitor_update_int_equalizer(qam_monitor_t *s, const complexi16_t *coeffs, int len) +{ + int i; + float min; + float max; + + if (s->eq_re) + delete s->eq_re; + if (s->eq_im) + delete s->eq_im; + + s->canvas_eq->current(s->canvas_eq); + i = 0; + min = coeffs[i].re; + if (min > coeffs[i].im) + min = coeffs[i].im; + max = coeffs[i].re; + if (max < coeffs[i].im) + max = coeffs[i].im; + for (i = 0; i < len; i++) + { + s->eq_re_plot[2*i] = (i - len/2)/2.0f; + s->eq_re_plot[2*i + 1] = coeffs[i].re/(float) FP_FACTOR; + if (min > coeffs[i].re) + min = coeffs[i].re; + if (max < coeffs[i].re) + max = coeffs[i].re; + + s->eq_im_plot[2*i] = (i - len/2)/2.0f; + s->eq_im_plot[2*i + 1] = coeffs[i].im/(float) FP_FACTOR; + if (min > coeffs[i].im) + min = coeffs[i].im; + if (max < coeffs[i].im) + max = coeffs[i].im; + } + min /= (float) FP_FACTOR; + max /= (float) FP_FACTOR; + + s->eq_x->minimum(-len/4.0); + s->eq_x->maximum(len/4.0); + s->eq_y->maximum((max == min) ? max + 0.2 : max); + s->eq_y->minimum(min); + s->eq_re = new Ca_Line(len, s->eq_re_plot, 0, 0, FL_BLUE, CA_NO_POINT); + s->eq_im = new Ca_Line(len, s->eq_im_plot, 0, 0, FL_RED, CA_NO_POINT); + Fl::check(); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int qam_monitor_update_symbol_tracking(qam_monitor_t *s, float total_correction) +{ + int i; + int j; + float min; + float max; + + s->symbol_tracker[s->symbol_track_ptr++] = total_correction; + if (s->symbol_track_points < SYMBOL_TRACKER_POINTS) + s->symbol_track_points++; + if (s->symbol_track_ptr >= SYMBOL_TRACKER_POINTS) + s->symbol_track_ptr = 0; + + s->canvas_track->current(s->canvas_track); + if (s->symbol_track) + delete s->symbol_track; + s->track_x->current(); + s->symbol_track_y->current(); + + min = + max = s->symbol_tracker[0]; + for (i = s->symbol_track_ptr, j = 0; i < s->symbol_track_points; i++, j++) + { + s->symbol_track_plot[2*j] = j; + s->symbol_track_plot[2*j + 1] = s->symbol_tracker[i]; + if (min > s->symbol_tracker[i]) + min = s->symbol_tracker[i]; + if (max < s->symbol_tracker[i]) + max = s->symbol_tracker[i]; + } + for (i = 0; i < s->symbol_track_ptr; i++, j++) + { + s->symbol_track_plot[2*j] = j; + s->symbol_track_plot[2*j + 1] = s->symbol_tracker[i]; + if (min > s->symbol_tracker[i]) + min = s->symbol_tracker[i]; + if (max < s->symbol_tracker[i]) + max = s->symbol_tracker[i]; + } + s->symbol_track_y->maximum((fabs(max - min) < 0.05) ? max + 0.05 : max); + s->symbol_track_y->minimum(min); + + s->symbol_track = new Ca_Line(s->symbol_track_points, s->symbol_track_plot, 0, 0, FL_RED, CA_NO_POINT); + //Fl::check(); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int qam_monitor_update_audio_level(qam_monitor_t *s, const int16_t amp[], int len) +{ + int i; + char buf[11]; + double val; + + for (i = 0; i < len; i++) + { + s->audio_meter->sample(amp[i]/32768.0); + s->power_reading += ((amp[i]*amp[i] - s->power_reading) >> 10); + } + if (s->power_reading <= 0) + val = -90.0; + else + val = log10((double) s->power_reading/(32767.0f*32767.0f))*10.0f + 3.14 + 3.02; + + snprintf(buf, sizeof(buf), "%5.1fdBm0", val); + s->audio_level->value(buf); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int qam_monitor_update_carrier_tracking(qam_monitor_t *s, float carrier_freq) +{ + int i; + int j; + float min; + float max; + + s->carrier_tracker[s->carrier_ptr++] = carrier_freq; + if (s->carrier_points < CARRIER_TRACKER_POINTS) + s->carrier_points++; + if (s->carrier_ptr >= CARRIER_TRACKER_POINTS) + s->carrier_ptr = 0; + + s->canvas_track->current(s->canvas_track); + if (s->carrier) + delete s->carrier; + s->track_x->current(); + s->carrier_y->current(); + + min = + max = s->carrier_tracker[0]; + for (i = s->carrier_ptr, j = 0; i < s->carrier_points; i++, j++) + { + s->carrier_plot[2*j] = j; + s->carrier_plot[2*j + 1] = s->carrier_tracker[i]; + if (min > s->carrier_tracker[i]) + min = s->carrier_tracker[i]; + if (max < s->carrier_tracker[i]) + max = s->carrier_tracker[i]; + } + for (i = 0; i < s->carrier_ptr; i++, j++) + { + s->carrier_plot[2*j] = j; + s->carrier_plot[2*j + 1] = s->carrier_tracker[i]; + if (min > s->carrier_tracker[i]) + min = s->carrier_tracker[i]; + if (max < s->carrier_tracker[i]) + max = s->carrier_tracker[i]; + } + + s->carrier_y->maximum((fabs(max - min) < 0.05) ? max + 0.05 : max); + s->carrier_y->minimum(min); + + s->carrier = new Ca_Line(s->carrier_points, s->carrier_plot, 0, 0, FL_BLUE, CA_NO_POINT); + //Fl::check(); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +qam_monitor_t *qam_monitor_init(float constel_width, const char *tag) +{ + char buf[132 + 1]; + float x; + float y; + qam_monitor_t *s; + + if ((s = (qam_monitor_t *) malloc(sizeof(*s))) == NULL) + return NULL; + + s->w = new Fl_Double_Window(905, 400, (tag) ? tag : "QAM monitor"); + + s->c_const = new Fl_Group(0, 0, 380, 400); + s->c_const->box(FL_DOWN_BOX); + s->c_const->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE); + + s->canvas_const = new Ca_Canvas(60, 30, 300, 300, "Constellation"); + s->canvas_const->box(FL_PLASTIC_DOWN_BOX); + s->canvas_const->color(7); + s->canvas_const->align(FL_ALIGN_TOP); + s->canvas_const->border(15); + + s->sig_i = new Ca_X_Axis(65, 330, 290, 30, "I"); + s->sig_i->align(FL_ALIGN_BOTTOM); + s->sig_i->minimum(-constel_width); + s->sig_i->maximum(constel_width); + s->sig_i->label_format("%g"); + s->sig_i->minor_grid_color(fl_gray_ramp(20)); + s->sig_i->major_grid_color(fl_gray_ramp(15)); + s->sig_i->label_grid_color(fl_gray_ramp(10)); + s->sig_i->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->sig_i->minor_grid_style(FL_DOT); + s->sig_i->major_step(5); + s->sig_i->label_step(1); + s->sig_i->axis_color(FL_BLACK); + s->sig_i->axis_align(CA_BOTTOM | CA_LINE); + + s->sig_q = new Ca_Y_Axis(20, 35, 40, 290, "Q"); + s->sig_q->align(FL_ALIGN_LEFT); + s->sig_q->minimum(-constel_width); + s->sig_q->maximum(constel_width); + s->sig_q->minor_grid_color(fl_gray_ramp(20)); + s->sig_q->major_grid_color(fl_gray_ramp(15)); + s->sig_q->label_grid_color(fl_gray_ramp(10)); + //s->sig_q->grid_visible(CA_MINOR_TICK | CA_MAJOR_TICK | CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->sig_q->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->sig_q->minor_grid_style(FL_DOT); + s->sig_q->major_step(5); + s->sig_q->label_step(1); + s->sig_q->axis_color(FL_BLACK); + + s->sig_q->current(); + + s->c_const->end(); + + s->c_right = new Fl_Group(440, 0, 465, 405); + + s->c_eq = new Fl_Group(380, 0, 265, 200); + s->c_eq->box(FL_DOWN_BOX); + s->c_eq->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE); + s->c_eq->current(); + s->canvas_eq = new Ca_Canvas(460, 35, 150, 100, "Equalizer"); + s->canvas_eq->box(FL_PLASTIC_DOWN_BOX); + s->canvas_eq->color(7); + s->canvas_eq->align(FL_ALIGN_TOP); + Fl_Group::current()->resizable(s->canvas_eq); + s->canvas_eq->border(15); + + s->eq_x = new Ca_X_Axis(465, 135, 140, 30, "Symbol"); + s->eq_x->align(FL_ALIGN_BOTTOM); + s->eq_x->minimum(-8.0); + s->eq_x->maximum(8.0); + s->eq_x->label_format("%g"); + s->eq_x->minor_grid_color(fl_gray_ramp(20)); + s->eq_x->major_grid_color(fl_gray_ramp(15)); + s->eq_x->label_grid_color(fl_gray_ramp(10)); + s->eq_x->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->eq_x->minor_grid_style(FL_DOT); + s->eq_x->major_step(5); + s->eq_x->label_step(1); + s->eq_x->axis_align(CA_BOTTOM | CA_LINE); + s->eq_x->axis_color(FL_BLACK); + s->eq_x->current(); + + s->eq_y = new Ca_Y_Axis(420, 40, 40, 90, "Amp"); + s->eq_y->align(FL_ALIGN_LEFT); + s->eq_y->minimum(-0.1); + s->eq_y->maximum(0.1); + s->eq_y->minor_grid_color(fl_gray_ramp(20)); + s->eq_y->major_grid_color(fl_gray_ramp(15)); + s->eq_y->label_grid_color(fl_gray_ramp(10)); + s->eq_y->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->eq_y->minor_grid_style(FL_DOT); + s->eq_y->major_step(5); + s->eq_y->label_step(1); + s->eq_y->axis_color(FL_BLACK); + s->eq_y->current(); + + s->c_eq->end(); + + s->c_symbol_track = new Fl_Group(380, 200, 525, 200); + s->c_symbol_track->box(FL_DOWN_BOX); + s->c_symbol_track->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE); + s->c_symbol_track->current(); + + s->canvas_track = new Ca_Canvas(490, 235, 300, 100, "Symbol and carrier tracking"); + s->canvas_track->box(FL_PLASTIC_DOWN_BOX); + s->canvas_track->color(7); + s->canvas_track->align(FL_ALIGN_TOP); + Fl_Group::current()->resizable(s->canvas_track); + s->canvas_track->border(15); + + s->track_x = new Ca_X_Axis(495, 335, 290, 30, "Time (symbols)"); + s->track_x->align(FL_ALIGN_BOTTOM); + s->track_x->minimum(0.0); + s->track_x->maximum(2400.0*5.0); + s->track_x->label_format("%g"); + s->track_x->minor_grid_color(fl_gray_ramp(20)); + s->track_x->major_grid_color(fl_gray_ramp(15)); + s->track_x->label_grid_color(fl_gray_ramp(10)); + s->track_x->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->track_x->minor_grid_style(FL_DOT); + s->track_x->major_step(5); + s->track_x->label_step(1); + s->track_x->axis_align(CA_BOTTOM | CA_LINE); + s->track_x->axis_color(FL_BLACK); + s->track_x->current(); + + s->symbol_track_y = new Ca_Y_Axis(420, 240, 70, 90, "Cor"); + s->symbol_track_y->align(FL_ALIGN_LEFT); + s->symbol_track_y->minimum(-0.1); + s->symbol_track_y->maximum(0.1); + s->symbol_track_y->minor_grid_color(fl_gray_ramp(20)); + s->symbol_track_y->major_grid_color(fl_gray_ramp(15)); + s->symbol_track_y->label_grid_color(fl_gray_ramp(10)); + s->symbol_track_y->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->symbol_track_y->minor_grid_style(FL_DOT); + s->symbol_track_y->major_step(5); + s->symbol_track_y->label_step(1); + s->symbol_track_y->axis_color(FL_RED); + s->symbol_track_y->current(); + + s->carrier_y = new Ca_Y_Axis(790, 240, 70, 90, "Freq"); + s->carrier_y->align(FL_ALIGN_RIGHT); + s->carrier_y->minimum(-0.1); + s->carrier_y->maximum(0.1); + s->carrier_y->minor_grid_color(fl_gray_ramp(20)); + s->carrier_y->major_grid_color(fl_gray_ramp(15)); + s->carrier_y->label_grid_color(fl_gray_ramp(10)); + s->carrier_y->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE); + s->carrier_y->minor_grid_style(FL_DOT); + s->carrier_y->major_step(5); + s->carrier_y->label_step(1); + s->carrier_y->axis_align(CA_RIGHT); + s->carrier_y->axis_color(FL_BLUE); + s->carrier_y->current(); + + s->c_symbol_track->end(); + + s->audio_meter = new Fl_Audio_Meter(672, 10, 16, 150, ""); + s->audio_meter->box(FL_PLASTIC_UP_BOX); + s->audio_meter->type(FL_VERT_AUDIO_METER); + + s->audio_level = new Fl_Output(650, 170, 60, 20, ""); + s->audio_level->textsize(10); + + s->c_right->end(); + + Fl_Group::current()->resizable(s->c_right); + s->w->end(); + s->w->show(); + + s->next_constel_point = 0; + s->constel_window = 10000; + + s->carrier_points = 0; + s->carrier_ptr = 0; + s->carrier_window = 100; + + s->symbol_track_points = 0; + s->symbol_track_window = 10000; + Fl::check(); + return s; +} +/*- End of function --------------------------------------------------------*/ + +void qam_wait_to_end(qam_monitor_t *s) +{ + fd_set rfds; + int res; + struct timeval tv; + + fprintf(stderr, "Processing complete. Press the key to end\n"); + do + { + usleep(100000); + Fl::check(); + FD_ZERO(&rfds); + FD_SET(0, &rfds); + tv.tv_usec = 100000; + tv.tv_sec = 0; + res = select(1, &rfds, NULL, NULL, &tv); + } + while (res <= 0); +} +/*- End of function --------------------------------------------------------*/ +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/modem_monitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/modem_monitor.h Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,70 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * constel.h - Display QAM constellations, using the FLTK toolkit. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: modem_monitor.h,v 1.16 2008/09/03 13:41:42 steveu Exp $ + */ + +/*! \page constel_page Modem performance monitoring +\section constel_page_sec_1 What does it do? +This code controls a GUI window, which provides monitoring of the internal status +of a modem. It shows, graphically: + + - the constellation, for PSK, QAM and other similar modulations. + - the equalizer status, for modems with adaptive equalizers. + - the carrier frequency. + - the symbol timing correction. + +\section constel_page_sec_2 How does it work? +This code uses the FLTK cross platform GUI toolkit. It works on X11 and Windows platforms. +In addition to the basic FLTK toolkit, fltk_cartesian is also required. +*/ + +#if !defined(_MODEM_MONITOR_H_) +#define _MODEM_MONITOR_H_ + +struct qam_monitor_s; + +typedef struct qam_monitor_s qam_monitor_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +qam_monitor_t *qam_monitor_init(float constel_width, const char *tag); +int qam_monitor_clear_constel(qam_monitor_t *s); +int qam_monitor_update_constel(qam_monitor_t *s, const complexf_t *pt); +int qam_monitor_update_equalizer(qam_monitor_t *s, const complexf_t *coeffs, int len); +int qam_monitor_update_int_equalizer(qam_monitor_t *s, const complexi16_t *coeffs, int len); +int qam_monitor_update_symbol_tracking(qam_monitor_t *s, float total_correction); +int qam_monitor_update_carrier_tracking(qam_monitor_t *s, float carrier); +int qam_monitor_update_audio_level(qam_monitor_t *s, const int16_t amp[], int len); +void qam_wait_to_end(qam_monitor_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/msvc/adsi_tests.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/msvc/adsi_tests.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/msvc/complex_tests.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/msvc/complex_tests.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/msvc/complex_vector_float_tests.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/msvc/complex_vector_float_tests.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/msvc/complex_vector_int_tests.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/msvc/complex_vector_int_tests.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/msvc/dtmf_rx_tests.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/msvc/dtmf_rx_tests.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/msvc/dtmf_tx_tests.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/msvc/dtmf_tx_tests.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/msvc/queue_tests.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/msvc/queue_tests.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/msvc/t38_core_tests.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/msvc/t38_core_tests.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/msvc/t38_non_ecm_buffer_tests.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/msvc/t38_non_ecm_buffer_tests.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/msvc/t38_terminal_tests.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/msvc/t38_terminal_tests.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,202 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/msvc/v22bis_tests.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/msvc/v22bis_tests.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/msvc/v29_tests.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/msvc/v29_tests.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/msvc/v80_tests.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/msvc/v80_tests.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/msvc/v8_tests.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/msvc/v8_tests.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/msvc/vector_float_tests.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/msvc/vector_float_tests.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/msvc/vector_int_tests.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/msvc/vector_int_tests.vcproj Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/noise_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/noise_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,238 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * noise_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: noise_tests.c,v 1.18 2009/05/30 15:23:14 steveu Exp $ + */ + +/*! \page noise_tests_page Noise generator tests +\section noise_tests_page_sec_1 What does it do? +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#if !defined(M_PI) +# define M_PI 3.14159265358979323846 /* pi */ +#endif + +#define OUT_FILE_NAME "noise.wav" + +/* Some simple sanity tests for the noise generation routines */ + +int main (int argc, char *argv[]) +{ + int i; + int j; + int level; + int clip_high; + int clip_low; + int quality; + int total_samples; + int seed = 1234567; + int outframes; + int16_t value; + double total; + double x; + double p; + double o; + int bins[65536]; + int16_t amp[1024]; + noise_state_t noise_source; + SNDFILE *outhandle; + + if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + + for (quality = 7; quality <= 20; quality += (20 - 7)) + { + /* Generate AWGN at several RMS levels between -50dBOv and 0dBOv. Noise is + generated for a large number of samples (1,000,000), and the RMS value + of the noise is calculated along the way. If the resulting level is + close to the requested RMS level, at least the scaling of the noise + should be Ok. At high levels some clipping may distort the result a + little. */ + printf("Testing AWGN power, with quality %d\n", quality); + for (level = -50; level <= 0; level += 5) + { + clip_high = 0; + clip_low = 0; + total = 0.0; + noise_init_dbov(&noise_source, seed, (float) level, NOISE_CLASS_AWGN, quality); + total_samples = 1000000; + for (i = 0; i < total_samples; i++) + { + value = noise(&noise_source); + if (value == 32767) + clip_high++; + else if (value == -32768) + clip_low++; + total += ((double) value)*((double) value); + } + printf ("RMS = %.3f (expected %d) %.2f%% error [clipped samples %d+%d]\n", + log10(sqrt(total/total_samples)/32768.0)*20.0, + level, + 100.0*(1.0 - sqrt(total/total_samples)/(pow(10.0, level/20.0)*32768.0)), + clip_low, + clip_high); + if (level < -5 && fabs(log10(sqrt(total/total_samples)/32768.0)*20.0 - level) > 0.2) + { + printf("Test failed\n"); + exit(2); + } + } + } + + /* Now look at the statistical spread of the results, by collecting data in + bins from a large number of samples. Use a fairly high noise level, but + low enough to avoid significant clipping. Use the Gaussian model to + predict the real probability, and present the results for graphing. */ + quality = 7; + printf("Testing the statistical spread of AWGN, with quality %d\n", quality); + memset(bins, 0, sizeof(bins)); + clip_high = 0; + clip_low = 0; + level = -15; + noise_init_dbov(&noise_source, seed, (float) level, NOISE_CLASS_AWGN, quality); + total_samples = 10000000; + for (i = 0; i < total_samples; i++) + { + value = noise(&noise_source); + if (value == 32767) + clip_high++; + else if (value == -32768) + clip_low++; + bins[value + 32768]++; + } + /* Find the RMS power level to expect */ + o = pow(10.0, level/20.0)*(32768.0*0.70711); + for (i = 0; i < 65536 - 10; i++) + { + x = i - 32768; + /* Find the real probability for this bin */ + p = (1.0/(o*sqrt(2.0*M_PI)))*exp(-(x*x)/(2.0*o*o)); + /* Now do a little smoothing on the real data to get a reasonably + steady answer */ + x = 0; + for (j = 0; j < 10; j++) + x += bins[i + j]; + x /= 10.0; + x /= total_samples; + /* Now send it out for graphing. */ + if (p > 0.0000001) + printf("%6d %.7f %.7f\n", i - 32768, x, p); + } + + printf("Generating AWGN at -15dBOv to file\n"); + for (j = 0; j < 50; j++) + { + for (i = 0; i < 1024; i++) + amp[i] = noise(&noise_source); + outframes = sf_writef_short(outhandle, amp, 1024); + if (outframes != 1024) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + } + + /* Generate Hoth noise at several RMS levels between -50dBm and 0dBm. Noise + is generated for a large number of samples (1,000,000), and the RMS value + of the noise is calculated along the way. If the resulting level is + close to the requested RMS level, at least the scaling of the noise + should be Ok. At high levels some clipping may distort the result a + little. */ + quality = 7; + printf("Testing Hoth noise power, with quality %d\n", quality); + for (level = -50; level <= 0; level += 5) + { + clip_high = 0; + clip_low = 0; + total = 0.0; + noise_init_dbov(&noise_source, seed, (float) level, NOISE_CLASS_HOTH, quality); + total_samples = 1000000; + for (i = 0; i < total_samples; i++) + { + value = noise(&noise_source); + if (value == 32767) + clip_high++; + else if (value == -32768) + clip_low++; + total += ((double) value)*((double) value); + } + printf ("RMS = %.3f (expected %d) %.2f%% error [clipped samples %d+%d]\n", + log10(sqrt(total/total_samples)/32768.0)*20.0, + level, + 100.0*(1.0 - sqrt(total/total_samples)/(pow(10.0, level/20.0)*32768.0)), + clip_low, + clip_high); + if (level < -5 && fabs(log10(sqrt(total/total_samples)/32768.0)*20.0 - level) > 0.2) + { + printf("Test failed\n"); + exit(2); + } + } + + quality = 7; + printf("Generating Hoth noise at -15dBOv to file\n"); + level = -15; + noise_init_dbov(&noise_source, seed, (float) level, NOISE_CLASS_HOTH, quality); + for (j = 0; j < 50; j++) + { + for (i = 0; i < 1024; i++) + amp[i] = noise(&noise_source); + outframes = sf_writef_short(outhandle, amp, 1024); + if (outframes != 1024) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + } + + if (sf_close(outhandle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/oki_adpcm_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/oki_adpcm_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,225 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * oki_adpcm_tests.c - Test the Oki (Dialogic) ADPCM encode and decode + * software at 24kbps and 32kbps. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: oki_adpcm_tests.c,v 1.37 2009/05/30 15:23:14 steveu Exp $ + */ + +/*! \file */ + +/*! \page oki_adpcm_tests_page OKI (Dialogic) ADPCM tests +\section oki_adpcm_tests_page_sec_1 What does it do? +To perform a general audio quality test, oki_adpcm_tests should be run. The test file +../test-data/local/short_nb_voice.wav will be compressed to the specified bit rate, +decompressed, and the resulting audio stored in post_oki_adpcm.wav. A simple SNR test +is automatically performed. Listening tests may be used for a more detailed evaluation +of the degradation in quality caused by the compression. Both 32k bps and 24k bps +compression may be tested. + +\section oki_adpcm_tests_page_sec_2 How is it used? +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define IN_FILE_NAME "../test-data/local/short_nb_voice.wav" +#define OUT_FILE_NAME "post_oki_adpcm.wav" + +#define HIST_LEN 1000 + +int main(int argc, char *argv[]) +{ + int i; + SNDFILE *inhandle; + SNDFILE *outhandle; + int frames; + int dec_frames; + int outframes; + int oki_bytes; + int bit_rate; + double pre_energy; + double post_energy; + double diff_energy; + int16_t pre_amp[HIST_LEN]; + int16_t post_amp[HIST_LEN]; + uint8_t oki_data[HIST_LEN]; + int16_t history[HIST_LEN]; + int hist_in; + int hist_out; + oki_adpcm_state_t *oki_enc_state; + oki_adpcm_state_t *oki_dec_state; + int xx; + int total_pre_samples; + int total_compressed_bytes; + int total_post_samples; + const char *in_file_name; + int log_encoded_data; + int opt; + + bit_rate = 32000; + in_file_name = IN_FILE_NAME; + log_encoded_data = FALSE; + while ((opt = getopt(argc, argv, "2i:l")) != -1) + { + switch (opt) + { + case '2': + bit_rate = 24000; + break; + case 'i': + in_file_name = optarg; + break; + case 'l': + log_encoded_data = TRUE; + break; + default: + //usage(); + exit(2); + break; + } + } + + if ((inhandle = sf_open_telephony_read(in_file_name, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", in_file_name); + exit(2); + } + if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + + if ((oki_enc_state = oki_adpcm_init(NULL, bit_rate)) == NULL) + { + fprintf(stderr, " Cannot create encoder\n"); + exit(2); + } + + if ((oki_dec_state = oki_adpcm_init(NULL, bit_rate)) == NULL) + { + fprintf(stderr, " Cannot create decoder\n"); + exit(2); + } + + hist_in = 0; + if (bit_rate == 32000) + hist_out = 0; + else + hist_out = HIST_LEN - 27; + memset(history, 0, sizeof(history)); + pre_energy = 0.0; + post_energy = 0.0; + diff_energy = 0.0; + total_pre_samples = 0; + total_compressed_bytes = 0; + total_post_samples = 0; + while ((frames = sf_readf_short(inhandle, pre_amp, 159))) + { + total_pre_samples += frames; + oki_bytes = oki_adpcm_encode(oki_enc_state, oki_data, pre_amp, frames); + if (log_encoded_data) + write(1, oki_data, oki_bytes); + total_compressed_bytes += oki_bytes; + dec_frames = oki_adpcm_decode(oki_dec_state, post_amp, oki_data, oki_bytes); + total_post_samples += dec_frames; + for (i = 0; i < frames; i++) + { + history[hist_in++] = pre_amp[i]; + if (hist_in >= HIST_LEN) + hist_in = 0; + pre_energy += (double) pre_amp[i] * (double) pre_amp[i]; + } + for (i = 0; i < dec_frames; i++) + { + post_energy += (double) post_amp[i] * (double) post_amp[i]; + xx = post_amp[i] - history[hist_out++]; + if (hist_out >= HIST_LEN) + hist_out = 0; + diff_energy += (double) xx * (double) xx; + //post_amp[i] = xx; + } + outframes = sf_writef_short(outhandle, post_amp, dec_frames); + } + if (sf_close(inhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", in_file_name); + exit(2); + } + if (sf_close(outhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + oki_adpcm_release(oki_enc_state); + oki_adpcm_release(oki_dec_state); + + printf("Pre samples: %d\n", total_pre_samples); + printf("Compressed bytes: %d\n", total_compressed_bytes); + printf("Post samples: %d\n", total_post_samples); + + printf("Output energy is %f%% of input energy.\n", 100.0*post_energy/pre_energy); + printf("Residual energy is %f%% of the total.\n", 100.0*diff_energy/post_energy); + if (bit_rate == 32000) + { + if (fabs(1.0 - post_energy/pre_energy) > 0.05 + || + fabs(diff_energy/post_energy) > 0.03) + { + printf("Tests failed.\n"); + exit(2); + } + } + else + { + if (fabs(1.0 - post_energy/pre_energy) > 0.20 + || + fabs(diff_energy/post_energy) > 0.10) + { + printf("Tests failed.\n"); + exit(2); + } + } + + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/playout_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/playout_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,339 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * playout_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: playout_tests.c,v 1.29 2009/05/30 15:23:14 steveu Exp $ + */ + +/*! \page playout_tests_page Playout (jitter buffering) tests +\section playout_tests_page_sec_1 What does it do? +These tests simulate timing jitter and packet loss in an audio stream, and see +how well the playout module copes. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include + +#include "spandsp.h" +#include "spandsp/private/time_scale.h" +#include "spandsp-sim.h" + +#define INPUT_FILE_NAME "playout_in.wav" +#define OUTPUT_FILE_NAME "playout_out.wav" + +#define BLOCK_LEN 160 + +static void dynamic_buffer_tests(void) +{ + playout_state_t *s; + playout_frame_t frame; + playout_frame_t *p; + plc_state_t plc; + time_scale_state_t ts; + int16_t *amp; + int16_t fill[BLOCK_LEN]; + int16_t buf[20*BLOCK_LEN]; + int16_t out[10*BLOCK_LEN]; + timestamp_t time_stamp; + timestamp_t next_actual_receive; + timestamp_t next_scheduled_receive; + int near_far_time_offset; + int rng; + int i; + int j; + int ret; + int len; + int inframes; + int outframes; + SNDFILE *inhandle; + SNDFILE *outhandle; + + if ((inhandle = sf_open_telephony_read(INPUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Failed to open audio file '%s'\n", INPUT_FILE_NAME); + exit(2); + } + if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Failed to create audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + + near_far_time_offset = 54321; + time_stamp = 12345; + next_actual_receive = time_stamp + near_far_time_offset; + next_scheduled_receive = 0; + for (i = 0; i < BLOCK_LEN; i++) + fill[i] = 32767; + + if ((s = playout_init(2*BLOCK_LEN, 15*BLOCK_LEN)) == NULL) + return; + plc_init(&plc); + time_scale_init(&ts, SAMPLE_RATE, 1.0); + for (i = 0; i < 1000000; i++) + { + if (i >= next_actual_receive) + { + amp = malloc(BLOCK_LEN*sizeof(int16_t)); + inframes = sf_readf_short(inhandle, amp, BLOCK_LEN); + if (inframes < BLOCK_LEN) + break; + ret = playout_put(s, + amp, + PLAYOUT_TYPE_SPEECH, + inframes, + time_stamp, + next_actual_receive); +#if 0 + switch (ret) + { + case PLAYOUT_OK: + printf("<< Record\n"); + break; + case PLAYOUT_ERROR: + printf("<< Error\n"); + break; + default: + printf("<< Eh?\n"); + break; + } +#endif + rng = rand() & 0xFF; + if (i < 100000) + rng = (rng*rng) >> 7; + else if (i < 200000) + rng = (rng*rng) >> 6; + else if (i < 300000) + rng = (rng*rng) >> 5; + else if (i < 400000) + rng = (rng*rng) >> 7; + time_stamp += BLOCK_LEN; + next_actual_receive = time_stamp + near_far_time_offset + rng; + } + if (i >= next_scheduled_receive) + { + do + { + ret = playout_get(s, &frame, next_scheduled_receive); + if (ret == PLAYOUT_DROP) + printf(">> Drop %d\n", next_scheduled_receive); + } + while (ret == PLAYOUT_DROP); + switch (ret) + { + case PLAYOUT_OK: + printf(">> Play %d\n", next_scheduled_receive); + plc_rx(&plc, frame.data, frame.sender_len); + len = time_scale(&ts, out, ((int16_t *) frame.data), frame.sender_len); +printf("len = %d\n", len); + for (j = 0; j < len; j++) + { + buf[2*j] = out[j]; + buf[2*j + 1] = 10*playout_current_length(s); + } + outframes = sf_writef_short(outhandle, buf, len); + if (outframes != len) + { + fprintf(stderr, " Error writing out sound\n"); + exit(2); + } + free(frame.data); + next_scheduled_receive += BLOCK_LEN; + break; + case PLAYOUT_FILLIN: + printf(">> Fill %d\n", next_scheduled_receive); + plc_fillin(&plc, fill, BLOCK_LEN); + time_scale_rate(&ts, 0.5); + len = time_scale(&ts, out, fill, BLOCK_LEN); + time_scale_rate(&ts, 1.0); +printf("len = %d\n", len); + for (j = 0; j < len; j++) + { + buf[2*j] = out[j]; + buf[2*j + 1] = 10*playout_current_length(s); + } + outframes = sf_writef_short(outhandle, buf, len); + if (outframes != len) + { + fprintf(stderr, " Error writing out sound\n"); + exit(2); + } + next_scheduled_receive += BLOCK_LEN; + break; + case PLAYOUT_DROP: + printf(">> Drop %d\n", next_scheduled_receive); + break; + case PLAYOUT_NOFRAME: + printf(">> No frame %d %d %d %d\n", next_scheduled_receive, playout_next_due(s), s->last_speech_sender_stamp, s->last_speech_sender_len); + next_scheduled_receive += BLOCK_LEN; + break; + case PLAYOUT_EMPTY: + printf(">> Empty %d\n", next_scheduled_receive); + next_scheduled_receive += BLOCK_LEN; + break; + case PLAYOUT_ERROR: + printf(">> Error %d\n", next_scheduled_receive); + next_scheduled_receive += BLOCK_LEN; + break; + default: + printf(">> Eh? %d\n", next_scheduled_receive); + break; + } + } + } + if (sf_close(inhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", INPUT_FILE_NAME); + exit(2); + } + if (sf_close(outhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + + printf("%10" PRId32 " %10" PRId32 " %10d\n", s->state_just_in_time, s->state_late, playout_current_length(s)); + + /* Clear everything from the queue */ + while ((p = playout_get_unconditional(s))) + /*free(p->data)*/; + /* Now free the context itself */ + playout_free(s); +} +/*- End of function --------------------------------------------------------*/ + +static void static_buffer_tests(void) +{ + playout_state_t *s; + playout_frame_t frame; + playout_frame_t *p; + int type; + uint8_t fr[BLOCK_LEN]; + timestamp_t next_scheduled_send; + int transit_time; + timestamp_t next_actual_receive; + timestamp_t next_scheduled_receive; + int len; + int i; + int ret; + + next_scheduled_send = 0; + transit_time = 320; + next_actual_receive = next_scheduled_send + transit_time; + next_scheduled_receive = 960; + + memset(fr, 0, sizeof(fr)); + type = PLAYOUT_TYPE_SPEECH; + len = BLOCK_LEN; + + if ((s = playout_init(2*BLOCK_LEN, 2*BLOCK_LEN)) == NULL) + return; + for (i = 0; i < 1000000; i++) + { + if (i >= next_actual_receive) + { + ret = playout_put(s, + fr, + type, + len, + next_scheduled_send, + next_actual_receive); + switch (ret) + { + case PLAYOUT_OK: + printf("<< Record\n"); + break; + case PLAYOUT_ERROR: + printf("<< Error\n"); + break; + default: + printf("<< Eh?\n"); + break; + } + next_scheduled_send += BLOCK_LEN; + ret = rand() & 0xFF; + ret = (ret*ret) >> 7; + transit_time = 320 + ret; + next_actual_receive = next_scheduled_send + transit_time; + } + if (i >= next_scheduled_receive) + { + do + { + ret = playout_get(s, &frame, next_scheduled_receive); + } + while (ret == PLAYOUT_DROP); + switch (ret) + { + case PLAYOUT_OK: + printf(">> Play\n"); + next_scheduled_receive += BLOCK_LEN; + break; + case PLAYOUT_FILLIN: + printf(">> Fill\n"); + next_scheduled_receive += BLOCK_LEN; + break; + case PLAYOUT_DROP: + printf(">> Drop\n"); + break; + case PLAYOUT_NOFRAME: + printf(">> No frame\n"); + next_scheduled_receive += BLOCK_LEN; + break; + case PLAYOUT_EMPTY: + printf(">> Empty\n"); + next_scheduled_receive += BLOCK_LEN; + break; + case PLAYOUT_ERROR: + printf(">> Error\n"); + next_scheduled_receive += BLOCK_LEN; + break; + default: + printf(">> Eh?\n"); + break; + } + } + } + /* Clear everything from the queue */ + while ((p = playout_get_unconditional(s))) + /*free(p->data)*/; + /* Now free the context itself */ + playout_free(s); +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + printf("Dynamic buffering tests\n"); + dynamic_buffer_tests(); + printf("Static buffering tests\n"); + static_buffer_tests(); +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/plc_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/plc_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,184 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * plc_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: plc_tests.c,v 1.26 2009/05/30 15:23:14 steveu Exp $ + */ + +/*! \page plc_tests_page Packet loss concealment tests +\section plc_tests_page_sec_1 What does it do? +These tests run a speech file through the packet loss concealment routines. +The loss rate, in percent, and the packet size, in samples, may be specified +on the command line. + +\section plc_tests_page_sec_2 How are the tests run? +These tests process a speech file called pre_plc.wav. This file should contain +8000 sample/second 16 bits/sample linear audio. The tests read this file in +blocks, of a size specified on the command line. Some of these blocks are +dropped, to simulate packet loss. The rate of loss is also specified on the +command line. The PLC module is then used to reconstruct an acceptable +approximation to the original signal. The resulting audio is written to a new +audio file, called post_plc.wav. This file contains 8000 sample/second +16 bits/sample linear audio. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include + +#include + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define INPUT_FILE_NAME "../test-data/local/short_nb_voice.wav" +#define OUTPUT_FILE_NAME "post_plc.wav" + +int main(int argc, char *argv[]) +{ + SNDFILE *inhandle; + SNDFILE *outhandle; + plc_state_t plc; + int inframes; + int outframes; + int16_t amp[1024]; + int block_no; + int lost_blocks; + int block_len; + int loss_rate; + int dropit; + int block_real; + int block_synthetic; + int tone; + int i; + uint32_t phase_acc; + int32_t phase_rate; + int opt; + + loss_rate = 25; + block_len = 160; + block_real = FALSE; + block_synthetic = FALSE; + tone = -1; + while ((opt = getopt(argc, argv, "b:l:rst:")) != -1) + { + switch (opt) + { + case 'b': + block_len = atoi(optarg); + break; + case 'l': + loss_rate = atoi(optarg); + break; + case 'r': + block_real = TRUE; + break; + case 's': + block_synthetic = TRUE; + break; + case 't': + tone = atoi(optarg); + break; + } + } + phase_rate = 0; + inhandle = NULL; + if (tone < 0) + { + if ((inhandle = sf_open_telephony_read(INPUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Failed to open audio file '%s'\n", INPUT_FILE_NAME); + exit(2); + } + } + else + { + phase_rate = dds_phase_ratef((float) tone); + } + if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Failed to open audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + plc_init(&plc); + lost_blocks = 0; + for (block_no = 0; ; block_no++) + { + if (tone < 0) + { + inframes = sf_readf_short(inhandle, amp, block_len); + if (inframes != block_len) + break; + } + else + { + if (block_no > 10000) + break; + for (i = 0; i < block_len; i++) + amp[i] = (int16_t) dds_modf(&phase_acc, phase_rate, 10000.0, 0); + inframes = block_len; + } + dropit = rand()/(RAND_MAX/100); + if (dropit > loss_rate) + { + plc_rx(&plc, amp, inframes); + if (block_real) + memset(amp, 0, sizeof(int16_t)*inframes); + } + else + { + lost_blocks++; + plc_fillin(&plc, amp, inframes); + if (block_synthetic) + memset(amp, 0, sizeof(int16_t)*inframes); + } + outframes = sf_writef_short(outhandle, amp, inframes); + if (outframes != inframes) + { + fprintf(stderr, " Error writing out sound\n"); + exit(2); + } + } + printf("Dropped %d of %d blocks\n", lost_blocks, block_no); + if (tone < 0) + { + if (sf_close(inhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", INPUT_FILE_NAME); + exit(2); + } + } + if (sf_close(outhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/power_meter_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/power_meter_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,368 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * power_meter_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: power_meter_tests.c,v 1.24 2009/05/30 15:23:14 steveu Exp $ + */ + +/*! \page power_meter_tests_page Power meter tests +\section power_meter_tests_page_sec_1 What does it do? +These tests assess the accuracy of power meters built from the power meter module. +Both tones and noise are used to check the meter's behaviour. + +\section power_meter_tests_page_sec_2 How does it work? +???. +*/ + +#if defined(HAVE_CONFIG_H) +#include +#endif + +#include +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define IN_FILE_NAME "../test-data/local/short_nb_voice.wav" +#define OUT_FILE_NAME "power_meter_tests.wav" + +static int power_surge_detector_tests(void) +{ + SNDFILE *outhandle; + power_surge_detector_state_t *sig; + int i; + int sample; + int16_t amp[8000]; + int16_t amp_out[2*8000]; + awgn_state_t *awgnx; + int32_t phase_rate; + uint32_t phase_acc; + int16_t phase_scale; + float signal_power; + int32_t signal_level; + int signal_present; + int prev_signal_present; + int ok; + int extremes[4]; + + if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 2)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + sig = power_surge_detector_init(NULL, -50.0f, 5.0f); + prev_signal_present = FALSE; + + phase_rate = dds_phase_rate(450.0f); + phase_acc = 0; + + phase_scale = dds_scaling_dbm0(-33.0f); + awgnx = awgn_init_dbm0(NULL, 1234567, -45.0f); + + extremes[0] = 8001; + extremes[1] = -1; + extremes[2] = 8001; + extremes[3] = -1; + for (sample = 0; sample < 800000; sample += 8000) + { + ok = 0; + for (i = 0; i < 8000; i++) + { + amp[i] = awgn(awgnx); + if (i < 4000) + amp[i] += dds_mod(&phase_acc, phase_rate, phase_scale, 0); + + signal_level = power_surge_detector(sig, amp[i]); + signal_present = (signal_level != 0); + if (prev_signal_present != signal_present) + { + signal_power = power_surge_detector_current_dbm0(sig); + if (signal_present) + { + if (ok == 0 && i >= 0 && i < 25) + ok = 1; + if (extremes[0] > i) + extremes[0] = i; + if (extremes[1] < i) + extremes[1] = i; + printf("On at %f (%fdBm0)\n", (sample + i)/8000.0, signal_power); + } + else + { + if (ok == 1 && i >= 4000 + 0 && i < 4000 + 35) + ok = 2; + if (extremes[2] > i) + extremes[2] = i; + if (extremes[3] < i) + extremes[3] = i; + printf("Off at %f (%fdBm0)\n", (sample + i)/8000.0, signal_power); + } + prev_signal_present = signal_present; + } + amp_out[2*i] = amp[i]; + amp_out[2*i + 1] = signal_present*5000; + } + sf_writef_short(outhandle, amp_out, 8000); + if (ok != 2 + || + extremes[0] < 1 + || + extremes[1] > 30 + || + extremes[2] < 4001 + || + extremes[3] > 4030) + { + printf(" Surge not detected correctly (%d)\n", ok); + exit(2); + } + } + sf_close(outhandle); + printf("Min on %d, max on %d, min off %d, max off %d\n", extremes[0], extremes[1], extremes[2], extremes[3]); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int power_surge_detector_file_test(const char *file) +{ + SNDFILE *inhandle; + SNDFILE *outhandle; + int inframes; + power_surge_detector_state_t *sig; + int i; + int16_t amp[8000]; + int16_t amp_out[2*8000]; + int sample; + float signal_power; + int32_t signal_level; + int signal_present; + int prev_signal_present; + + if ((inhandle = sf_open_telephony_read(file, 1)) == NULL) + { + printf(" Cannot open speech file '%s'\n", file); + exit(2); + } + + if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + sig = power_surge_detector_init(NULL, -50.0f, 6.0f); + prev_signal_present = FALSE; + + sample = 0; + while ((inframes = sf_readf_short(inhandle, amp, 8000))) + { + for (i = 0; i < inframes; i++) + { + signal_level = power_surge_detector(sig, amp[i]); + signal_present = (signal_level != 0); + if (prev_signal_present != signal_present) + { + signal_power = power_surge_detector_current_dbm0(sig); + if (signal_present) + printf("On at %f (%fdBm0)\n", (sample + i)/8000.0, signal_power); + else + printf("Off at %f (%fdBm0)\n", (sample + i)/8000.0, signal_power); + prev_signal_present = signal_present; + } + amp_out[2*i] = amp[i]; + amp_out[2*i + 1] = signal_present*5000; + } + sf_writef_short(outhandle, amp_out, inframes); + sample += inframes; + } + sf_close(inhandle); + sf_close(outhandle); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int power_meter_tests(void) +{ + awgn_state_t noise_source; + power_meter_t meter; + tone_gen_descriptor_t tone_desc; + tone_gen_state_t gen; + int i; + int idum = 1234567; + int16_t amp[1000]; + int len; + int32_t level; + + power_meter_init(&meter, 7); + printf("Testing with zero in the power register\n"); + printf("Power: expected %fdBm0, got %fdBm0\n", -90.169f, power_meter_current_dbm0(&meter)); + printf("Power: expected %fdBOv, got %fdBOv\n", -96.329f, power_meter_current_dbov(&meter)); + + printf("Testing with a square wave 10dB from maximum\n"); + for (i = 0; i < 1000; i++) + { + amp[i] = (i & 1) ? 10362 : -10362; + level = power_meter_update(&meter, amp[i]); + //printf("%12d %fdBm0 %fdBov\n", level, power_meter_current_dbm0(&meter), power_meter_current_dbov(&meter)); + } + printf("Level: expected %" PRId32 "/%" PRId32 ", got %" PRId32 "\n", power_meter_level_dbov(-10.0f), power_meter_level_dbm0(-10.0f + DBM0_MAX_POWER), level); + printf("Power: expected %fdBm0, got %fdBm0\n", -10.0f + DBM0_MAX_POWER, power_meter_current_dbm0(&meter)); + printf("Power: expected %fdBOv, got %fdBOv\n", -10.0f, power_meter_current_dbov(&meter)); + if (level < power_meter_level_dbov(-10.0f)*0.99f + || + level > power_meter_level_dbov(-10.0f)*1.01f) + { + printf("Test failed (level)\n"); + exit(2); + } + if (0.1f < fabsf(power_meter_current_dbm0(&meter) + 10.0f - DBM0_MAX_POWER)) + { + printf("Test failed (dBm0)\n"); + exit(2); + } + if (0.1f < fabsf(power_meter_current_dbov(&meter) + 10.0)) + { + printf("Test failed (dBOv)\n"); + exit(2); + } + + printf("Testing with a sine wave tone 10dB from maximum\n"); + make_tone_gen_descriptor(&tone_desc, + 1000, + -4, + 0, + 1, + 1, + 0, + 0, + 0, + TRUE); + tone_gen_init(&gen, &tone_desc); + len = tone_gen(&gen, amp, 1000); + for (i = 0; i < len; i++) + { + level = power_meter_update(&meter, amp[i]); + //printf("%12d %fdBm0 %fdBov\n", level, power_meter_current_dbm0(&meter), power_meter_current_dbov(&meter)); + } + printf("Level: expected %" PRId32 "/%" PRId32 ", got %" PRId32 "\n", power_meter_level_dbov(-10.0f), power_meter_level_dbm0(-10.0f + DBM0_MAX_POWER), level); + printf("Power: expected %fdBm0, got %fdBm0\n", -10.0f + DBM0_MAX_POWER, power_meter_current_dbm0(&meter)); + printf("Power: expected %fdBOv, got %fdBOv\n", -10.0f, power_meter_current_dbov(&meter)); + if (level < power_meter_level_dbov(-10.0f)*0.95f + || + level > power_meter_level_dbov(-10.0f)*1.05f) + { + printf("Test failed (level)\n"); + exit(2); + } + if (0.2f < fabsf(power_meter_current_dbm0(&meter) + 10.0f - DBM0_MAX_POWER)) + { + printf("Test failed (dBm0)\n"); + exit(2); + } + if (0.2f < fabsf(power_meter_current_dbov(&meter) + 10.0)) + { + printf("Test failed (dBOv)\n"); + exit(2); + } + + printf("Testing with AWGN 10dB from maximum\n"); + awgn_init_dbov(&noise_source, idum, -10.0f); + for (i = 0; i < 1000; i++) + amp[i] = awgn(&noise_source); + for (i = 0; i < 1000; i++) + { + level = power_meter_update(&meter, amp[i]); + //printf("%12d %fdBm0 %fdBov\n", level, power_meter_current_dbm0(&meter), power_meter_current_dbov(&meter)); + } + printf("Level: expected %" PRId32 "/%" PRId32 ", got %" PRId32 "\n", power_meter_level_dbov(-10.0f), power_meter_level_dbm0(-10.0f + DBM0_MAX_POWER), level); + printf("Power: expected %fdBm0, got %fdBm0\n", -10.0f + DBM0_MAX_POWER, power_meter_current_dbm0(&meter)); + printf("Power: expected %fdBOv, got %fdBOv\n", -10.0f, power_meter_current_dbov(&meter)); + if (level < power_meter_level_dbov(-10.0f)*0.95f + || + level > power_meter_level_dbov(-10.0f)*1.05f) + { + printf("Test failed (level)\n"); + exit(2); + } + if (0.2f < fabsf(power_meter_current_dbm0(&meter) + 10.0f - DBM0_MAX_POWER)) + { + printf("Test failed (dBm0)\n"); + exit(2); + } + if (0.2f < fabsf(power_meter_current_dbov(&meter) + 10.0f)) + { + printf("Test failed (dBOv)\n"); + exit(2); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int basic_tests; + int decode; + int opt; + const char *in_file; + + basic_tests = TRUE; + decode = FALSE; + in_file = IN_FILE_NAME; + while ((opt = getopt(argc, argv, "d:")) != -1) + { + switch (opt) + { + case 'd': + in_file = optarg; + basic_tests = FALSE; + decode = TRUE; + break; + default: + //usage(); + exit(2); + } + } + + if (basic_tests) + { + power_meter_tests(); + power_surge_detector_tests(); + } + if (decode) + { + power_surge_detector_file_test(in_file); + } + printf("Tests passed\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/queue_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/queue_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,740 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * queue_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: queue_tests.c,v 1.13 2009/04/11 17:43:04 steveu Exp $ + */ + +/* THIS IS A WORK IN PROGRESS. IT IS NOT FINISHED. */ + +/*! \page queue_tests_page Queue tests +\section queue_tests_page_sec_1 What does it do? +*/ + +#if defined(HAVE_CONFIG_H) +#include +#endif + +#include +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" + +#define BUF_LEN 10000 +#define MSG_LEN 17 + +pthread_t thread[2]; +queue_state_t *queue; +volatile int put_oks; +volatile int put_misses; +volatile int got_oks; +volatile int got_misses; + +int total_in; +int total_out; + +static void tests_failed(void) +{ + printf("Tests failed\n"); + exit(2); +} +/*- End of function --------------------------------------------------------*/ + +static void display_queue_pointers(void) +{ + printf("Pointers %d %d %d\n", queue->iptr, queue->optr, queue->len); +} +/*- End of function --------------------------------------------------------*/ + +static void *run_stream_write(void *arg) +{ + uint8_t buf[MSG_LEN]; + int i; + int next; + + printf("Write thread\n"); + next = 0; + for (i = 0; i < MSG_LEN; i++) + buf[i] = next; + next = (next + 1) & 0xFF; + put_oks = 0; + put_misses = 0; + for (;;) + { + if (queue_write(queue, buf, MSG_LEN) == MSG_LEN) + { + for (i = 0; i < MSG_LEN; i++) + buf[i] = next; + next = (next + 1) & 0xFF; + put_oks++; + if (put_oks%1000000 == 0) + printf("%d puts, %d misses\n", put_oks, put_misses); + } + else + { + sched_yield(); + put_misses++; + } + } + return NULL; +} +/*- End of function --------------------------------------------------------*/ + +static void *run_stream_read(void *arg) +{ + uint8_t buf[MSG_LEN]; + int i; + int len; + int next; + + printf("Read thread\n"); + next = 0; + got_oks = 0; + got_misses = 0; + for (;;) + { + if ((len = queue_read(queue, buf, MSG_LEN)) >= 0) + { + if (len != MSG_LEN) + { + printf("AHH! - len %d\n", len); + tests_failed(); + } + for (i = 0; i < len; i++) + { + if (buf[i] != next) + { + printf("AHH! - 0x%X 0x%X\n", buf[i], next); + tests_failed(); + } + } + next = (next + 1) & 0xFF; + got_oks++; + if (got_oks%1000000 == 0) + printf("%d gots, %d misses\n", got_oks, got_misses); + } + else + { + sched_yield(); + got_misses++; + } + } + return NULL; +} +/*- End of function --------------------------------------------------------*/ + +static void threaded_stream_tests(void) +{ + pthread_attr_t attr; + + if ((queue = queue_init(NULL, BUF_LEN, QUEUE_READ_ATOMIC | QUEUE_WRITE_ATOMIC)) == NULL) + { + printf("Failed to create the queue\n"); + tests_failed(); + } + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + if (pthread_create(&thread[0], &attr, run_stream_write, NULL)) + { + printf("Failed to create thread\n"); + tests_failed(); + } + if (pthread_create(&thread[1], &attr, run_stream_read, NULL)) + { + printf("Failed to create thread\n"); + tests_failed(); + } + for (;;) + { + sleep(5); + printf("Main thread - %d %d\n", put_oks, got_oks); + } + queue_free(queue); +} +/*- End of function --------------------------------------------------------*/ + +static void *run_message_write(void *arg) +{ + uint8_t buf[MSG_LEN]; + int i; + int next; + + printf("Write thread\n"); + next = 0; + for (i = 0; i < MSG_LEN; i++) + buf[i] = next; + next = (next + 1) & 0xFF; + put_oks = 0; + put_misses = 0; + for (;;) + { + if (queue_write_msg(queue, buf, MSG_LEN) == MSG_LEN) + { + for (i = 0; i < MSG_LEN; i++) + buf[i] = next; + next = (next + 1) & 0xFF; + put_oks++; + if (put_oks%1000000 == 0) + printf("%d puts, %d misses\n", put_oks, put_misses); + } + else + { + sched_yield(); + put_misses++; + } + } + return NULL; +} +/*- End of function --------------------------------------------------------*/ + +static void *run_message_read(void *arg) +{ + uint8_t buf[1024]; + int i; + int len; + int next; + + printf("Read thread\n"); + next = 0; + got_oks = 0; + got_misses = 0; + for (;;) + { + if ((len = queue_read_msg(queue, buf, 1024)) >= 0) + { + if (len != MSG_LEN) + { + printf("AHH! - len %d\n", len); + tests_failed(); + } + for (i = 0; i < len; i++) + { + if (buf[i] != next) + { + printf("AHH! - 0x%X 0x%X\n", buf[i], next); + tests_failed(); + } + } + next = (next + 1) & 0xFF; + got_oks++; + if (got_oks%1000000 == 0) + printf("%d gots, %d misses\n", got_oks, got_misses); + } + else + { + sched_yield(); + got_misses++; + } + } + return NULL; +} +/*- End of function --------------------------------------------------------*/ + +static void threaded_message_tests(void) +{ + pthread_attr_t attr; + + if ((queue = queue_init(NULL, BUF_LEN, QUEUE_READ_ATOMIC | QUEUE_WRITE_ATOMIC)) == NULL) + { + printf("Failed to create the queue\n"); + tests_failed(); + } + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + if (pthread_create(&thread[0], &attr, run_message_write, NULL)) + { + printf("Failed to create thread\n"); + tests_failed(); + } + if (pthread_create(&thread[1], &attr, run_message_read, NULL)) + { + printf("Failed to create thread\n"); + tests_failed(); + } + for (;;) + { + sleep(5); + printf("Main thread - %d %d\n", put_oks, got_oks); + } + queue_free(queue); +} +/*- End of function --------------------------------------------------------*/ + +static void check_contents(int total_in, int total_out) +{ + if (queue_contents(queue) != (total_in - total_out)) + { + printf("Contents = %d (%d)\n", queue_contents(queue), (total_in - total_out)); + display_queue_pointers(); + tests_failed(); + } + if (queue_free_space(queue) != BUF_LEN - (total_in - total_out)) + { + printf("Free space = %d (%d)\n", queue_free_space(queue), BUF_LEN - (total_in - total_out)); + display_queue_pointers(); + tests_failed(); + } +} +/*- End of function --------------------------------------------------------*/ + +static int monitored_queue_write(const uint8_t buf[], int len) +{ + int lenx; + + lenx = queue_write(queue, buf, len); + if (lenx >= 0) + total_in += lenx; + check_contents(total_in, total_out); + return lenx; +} +/*- End of function --------------------------------------------------------*/ + +static int monitored_queue_write_byte(const uint8_t buf) +{ + int res; + + if ((res = queue_write_byte(queue, buf)) >= 0) + total_in++; + check_contents(total_in, total_out); + return res; +} +/*- End of function --------------------------------------------------------*/ + +static int monitored_queue_read(uint8_t buf[], int len) +{ + int lenx; + + lenx = queue_read(queue, buf, len); + if (lenx >= 0) + total_out += lenx; + check_contents(total_in, total_out); + return lenx; +} +/*- End of function --------------------------------------------------------*/ + +static int monitored_queue_read_byte(void) +{ + int res; + + if ((res = queue_read_byte(queue)) >= 0) + total_out++; + check_contents(total_in, total_out); + return res; +} +/*- End of function --------------------------------------------------------*/ + +static void functional_stream_tests(void) +{ + uint8_t buf[MSG_LEN]; + int i; + int res; + + total_in = 0; + total_out = 0; + + for (i = 0; i < MSG_LEN; i++) + buf[i] = i; + if ((queue = queue_init(NULL, BUF_LEN, QUEUE_READ_ATOMIC | QUEUE_WRITE_ATOMIC)) == NULL) + { + printf("Failed to create the queue\n"); + tests_failed(); + } + check_contents(total_in, total_out); + /* Half fill the buffer, and check we can get out what we put in. */ + for (i = 1; i < 5000; i++) + { + if (monitored_queue_write_byte(i & 0xFF) != 1) + { + printf("Byte by byte full at %d/%d\n", i, BUF_LEN); + tests_failed(); + } + } + for (i = 1; i < 5001; i++) + { + if ((res = monitored_queue_read_byte()) != (i & 0xFF)) + break; + } + printf("Byte by byte read breaks at %d (expected %d) - %d\n", i, 5000, res); + if (i != 5000) + tests_failed(); + /* Now completely fill the buffer, and we should roll around the end. Check we can + get out what we put in. */ + for (i = 1; i < 20000; i++) + { + if (monitored_queue_write_byte(i & 0xFF) != 1) + break; + } + printf("Byte by byte full at %d (expected %d)\n", i, 10001); + if (i != 10001) + tests_failed(); + for (i = 1; i < 20000; i++) + { + if ((res = monitored_queue_read_byte()) != (i & 0xFF)) + break; + } + printf("Byte by byte read breaks at %d (expected %d) - %d\n", i, 10001, res); + if (i != 10001) + tests_failed(); + /* Fill the buffer, checking the contents grow correctly */ + for (i = 1; i < 1000; i++) + { + if (monitored_queue_write(buf, MSG_LEN) != MSG_LEN) + break; + } + printf("Full at chunk %d (expected %d)\n", i, BUF_LEN/MSG_LEN + 1); + if (i != BUF_LEN/MSG_LEN + 1) + tests_failed(); + if (monitored_queue_write(buf, 5) == 5) + { + printf("Write of 5 succeeded\n"); + tests_failed(); + } + if (monitored_queue_write(buf, 4) != 4) + { + printf("Write of 4 failed\n"); + tests_failed(); + } + /* Now full. Empty a little, and refill around the end */ + if (monitored_queue_read(buf, MSG_LEN) != MSG_LEN) + { + printf("Read failed\n"); + tests_failed(); + } + if (monitored_queue_write(buf, MSG_LEN) != MSG_LEN) + { + printf("Write failed\n"); + tests_failed(); + } + /* Empty completely, checking the contents shrink correctly */ + for (;;) + { + if (monitored_queue_read(buf, MSG_LEN) != MSG_LEN) + break; + } + if (monitored_queue_read(buf, 4) != 4) + { + printf("Read failed\n"); + tests_failed(); + } + /* Nudge around the buffer */ + for (i = 1; i < 588; i++) + { + if (monitored_queue_write(buf, MSG_LEN) != MSG_LEN) + { + printf("Write failed\n"); + tests_failed(); + } + if (monitored_queue_read(buf, MSG_LEN) != MSG_LEN) + { + printf("Read failed\n"); + tests_failed(); + } + } + /* Fill the buffer, checking the contents grow correctly */ + for (i = 1; i < 1000; i++) + { + if (monitored_queue_write(buf, MSG_LEN) != MSG_LEN) + break; + } + printf("Full at chunk %d (expected %d)\n", i, BUF_LEN/MSG_LEN + 1); + if (i != BUF_LEN/MSG_LEN + 1) + tests_failed(); + display_queue_pointers(); + if (monitored_queue_read(buf, MSG_LEN) != MSG_LEN) + { + printf("Read failed\n"); + tests_failed(); + } + if (monitored_queue_write(buf, MSG_LEN) != MSG_LEN) + { + printf("Write failed\n"); + tests_failed(); + } + display_queue_pointers(); + for (i = 1; i < 5000; i++) + { + if (monitored_queue_read(buf, MSG_LEN) != MSG_LEN) + { + printf("Read failed\n"); + tests_failed(); + } + if (monitored_queue_write(buf, MSG_LEN) != MSG_LEN) + { + printf("Write failed\n"); + tests_failed(); + } + } + display_queue_pointers(); + if (monitored_queue_write(buf, 5) == 5) + { + printf("Write of 5 succeeded\n"); + tests_failed(); + } + if (monitored_queue_write(buf, 4) != 4) + { + printf("Write of 4 failed\n"); + tests_failed(); + } + display_queue_pointers(); + for (i = 1; i < 5000; i++) + { + if (monitored_queue_read(buf, MSG_LEN) != MSG_LEN) + { + printf("Read failed\n"); + tests_failed(); + } + if (monitored_queue_write(buf, MSG_LEN) != MSG_LEN) + { + printf("Write failed\n"); + tests_failed(); + } + } + display_queue_pointers(); + queue_free(queue); +} +/*- End of function --------------------------------------------------------*/ + +static int monitored_queue_write_msg(const uint8_t buf[], int len) +{ + int lenx; + + lenx = queue_write_msg(queue, buf, len); + if (lenx >= 0) + total_in += lenx + sizeof(uint16_t); + check_contents(total_in, total_out); + return lenx; +} +/*- End of function --------------------------------------------------------*/ + +static int monitored_queue_read_msg(uint8_t buf[], int len) +{ + int lenx; + + lenx = queue_read_msg(queue, buf, len); + if (lenx >= 0) + total_out += lenx + sizeof(uint16_t); + check_contents(total_in, total_out); + return lenx; +} +/*- End of function --------------------------------------------------------*/ + +static void functional_message_tests(void) +{ + uint8_t buf[MSG_LEN]; + int i; + int len; + + total_in = 0; + total_out = 0; + + for (i = 0; i < MSG_LEN; i++) + buf[i] = i; + if ((queue = queue_init(NULL, BUF_LEN, QUEUE_READ_ATOMIC | QUEUE_WRITE_ATOMIC)) == NULL) + { + printf("Failed to create the queue\n"); + tests_failed(); + } + check_contents(total_in, total_out); + /* Fill the buffer, checking the contents grow correctly */ + for (i = 1; i < 1000; i++) + { + if (monitored_queue_write_msg(buf, MSG_LEN) != MSG_LEN) + break; + } + printf("Full at chunk %d (expected %u)\n", i, BUF_LEN/(MSG_LEN + sizeof(uint16_t)) + 1); + if (i != BUF_LEN/(MSG_LEN + sizeof(uint16_t)) + 1) + tests_failed(); + if ((len = monitored_queue_write_msg(buf, 5)) == 5) + { + printf("Write of 5 succeeded\n"); + tests_failed(); + } + if ((len = monitored_queue_write_msg(buf, 4)) != 4) + { + printf("Write of 4 failed\n"); + tests_failed(); + } + /* Now full. Empty a little, and refill around the end */ + if ((len = monitored_queue_read_msg(buf, MSG_LEN)) != MSG_LEN) + { + printf("Read failed - %d\n", len); + tests_failed(); + } + if ((len = monitored_queue_write_msg(buf, MSG_LEN)) != MSG_LEN) + { + printf("Write failed - %d\n", len); + tests_failed(); + } + /* Empty completely, checking the contents shrink correctly */ + for (;;) + { + if ((len = monitored_queue_read_msg(buf, MSG_LEN)) != MSG_LEN) + break; + } + if (len != 4) + { + printf("Read failed - %d\n", len); + tests_failed(); + } + /* We should now have one MSG_LEN message in the buffer */ + /* Nudge around the buffer */ + for (i = 1; i < 527; i++) + { + if ((len = monitored_queue_write_msg(buf, MSG_LEN)) != MSG_LEN) + { + printf("Write failed - %d\n", len); + tests_failed(); + } + if ((len = monitored_queue_read_msg(buf, MSG_LEN)) != MSG_LEN) + { + printf("Read failed - %d\n", len); + tests_failed(); + } + } + /* Fill the buffer, checking the contents grow correctly */ + for (i = 1; i < 1000; i++) + { + if ((len = monitored_queue_write_msg(buf, MSG_LEN)) != MSG_LEN) + break; + } + printf("Free space = %d (%d)\n", queue_free_space(queue), BUF_LEN - (total_in - total_out)); + display_queue_pointers(); + printf("Full at chunk %d (expected %u)\n", i, BUF_LEN/(MSG_LEN + sizeof(uint16_t))); + if (i != BUF_LEN/(MSG_LEN + sizeof(uint16_t))) + tests_failed(); + display_queue_pointers(); + + if ((len = monitored_queue_read_msg(buf, MSG_LEN)) != MSG_LEN) + { + printf("Read failed - %d\n", len); + tests_failed(); + } + if ((len = monitored_queue_write_msg(buf, MSG_LEN)) != MSG_LEN) + { + printf("Write failed - %d\n", len); + tests_failed(); + } + display_queue_pointers(); + for (i = 1; i < 5000; i++) + { + if ((len = monitored_queue_read_msg(buf, MSG_LEN)) != MSG_LEN) + { + printf("Read failed - %d\n", len); + tests_failed(); + } + if ((len = monitored_queue_write_msg(buf, MSG_LEN)) != MSG_LEN) + { + printf("Write failed - %d\n", len); + tests_failed(); + } + } + display_queue_pointers(); + if ((len = monitored_queue_write_msg(buf, 5)) == 5) + { + printf("Write of 5 succeeded\n"); + tests_failed(); + } + if ((len = monitored_queue_write_msg(buf, 4)) != 4) + { + printf("Write of 4 failed\n"); + tests_failed(); + } + display_queue_pointers(); + for (i = 1; i < 5000; i++) + { + if (i == 527) + { + if ((len = monitored_queue_read_msg(buf, MSG_LEN)) != 4) + { + printf("Read failed - %d\n", len); + tests_failed(); + } + } + if ((len = monitored_queue_read_msg(buf, MSG_LEN)) != MSG_LEN) + { + printf("Read failed - %d\n", len); + tests_failed(); + } + if ((len = monitored_queue_write_msg(buf, MSG_LEN)) != MSG_LEN) + { + printf("Write failed - %d\n", len); + tests_failed(); + } + } + display_queue_pointers(); + queue_free(queue); +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int threaded_messages; + int threaded_streams; + int opt; + + threaded_messages = FALSE; + threaded_streams = FALSE; + while ((opt = getopt(argc, argv, "ms")) != -1) + { + switch (opt) + { + case 'm': + threaded_messages = TRUE; + break; + case 's': + threaded_streams = TRUE; + break; + } + } + + /* Test the basic functionality of the queueing code in stream and message modes */ + printf("Stream mode functional tests\n"); + functional_stream_tests(); + printf("Message mode functional tests\n"); + functional_message_tests(); + + /* Run separate write and read threads for a while, to verify there are no locking + issues. */ + if (threaded_streams) + { + printf("Stream mode threaded tests\n"); + threaded_stream_tests(); + } + if (threaded_messages) + { + printf("Message mode threaded tests\n"); + threaded_message_tests(); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/r2_mf_rx_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/r2_mf_rx_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,606 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * r2_mf_tests.c - Test the R2 MF detector against the spec., whatever the + * spec. may be :) + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: r2_mf_rx_tests.c,v 1.14 2009/05/30 15:23:14 steveu Exp $ + */ + +/*! \file */ + +/*! \page r2_mf_tests_page R2 MF tone generation and detection tests +\section r2_mf_tests_page_sec_1 What does it do? +These tests are fashioned after those on the CM7291 test tape from +Mitel. Those tests are for DTMF, rather than R2 MF, but make a +fair starting point for a set of meaningful tests of R2 MF. + +These tests include conversion to and from A-law. It is assumed the +distortion this produces is comparable to u-law, so it should be +a fair test of performance in a real PSTN channel. +*/ + +/* Enable the following definition to enable direct probing into the FAX structures */ +//#define WITH_SPANDSP_INTERNALS + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" + +/* R2 tone generation specs. + * Power: -11.5dBm +- 1dB + * Frequency: within +-4Hz + * Mismatch between the start time of a pair of tones: <=1ms. + * Mismatch between the end time of a pair of tones: <=1ms. + */ +/* Basic MFC/R2 tone detection specs: + * Receiver response range: -5dBm to -35dBm + * Difference in level for a pair of frequencies + * Adjacent tones: <5dB + * Non-adjacent tones: <7dB + * Receiver not to detect a signal of 2 frequencies of level -5dB and + * duration <7ms. + * Receiver not to recognise a signal of 2 frequencies having a difference + * in level >=20dB. + * Max received signal frequency error: +-10Hz + * The sum of the operate and release times of a 2 frequency signal not to + * exceed 80ms (there are no individual specs for the operate and release + * times). + * Receiver not to release for signal interruptions <=7ms. + * System malfunction due to signal interruptions >7ms (typically 20ms) is + * prevented by further logic elements. + */ + +#define MF_DURATION (68*8) +#define MF_PAUSE (68*8) +#define MF_CYCLE (MF_DURATION + MF_PAUSE) + +/*! + MF tone generator descriptor for tests. +*/ +typedef struct +{ + float f1; /* First freq */ + float f2; /* Second freq */ + int8_t level1; /* Level of the first freq (dB) */ + int8_t level2; /* Level of the second freq (dB) */ + uint8_t on_time; /* Tone on time (ms) */ + uint8_t off_time; /* Minimum post tone silence (ms) */ +} mf_digit_tones_t; + +static const mf_digit_tones_t r2_mf_fwd_tones[] = +{ + {1380.0, 1500.0, -11, -11, 1, 0}, + {1380.0, 1620.0, -11, -11, 1, 0}, + {1500.0, 1620.0, -11, -11, 1, 0}, + {1380.0, 1740.0, -11, -11, 1, 0}, + {1500.0, 1740.0, -11, -11, 1, 0}, + {1620.0, 1740.0, -11, -11, 1, 0}, + {1380.0, 1860.0, -11, -11, 1, 0}, + {1500.0, 1860.0, -11, -11, 1, 0}, + {1620.0, 1860.0, -11, -11, 1, 0}, + {1740.0, 1860.0, -11, -11, 1, 0}, + {1380.0, 1980.0, -11, -11, 1, 0}, + {1500.0, 1980.0, -11, -11, 1, 0}, + {1620.0, 1980.0, -11, -11, 1, 0}, + {1740.0, 1980.0, -11, -11, 1, 0}, + {1860.0, 1980.0, -11, -11, 1, 0}, + {0.0, 0.0, 0, 0, 0, 0} +}; + +static const mf_digit_tones_t r2_mf_back_tones[] = +{ + {1140.0, 1020.0, -11, -11, 1, 0}, + {1140.0, 900.0, -11, -11, 1, 0}, + {1020.0, 900.0, -11, -11, 1, 0}, + {1140.0, 780.0, -11, -11, 1, 0}, + {1020.0, 780.0, -11, -11, 1, 0}, + { 900.0, 780.0, -11, -11, 1, 0}, + {1140.0, 660.0, -11, -11, 1, 0}, + {1020.0, 660.0, -11, -11, 1, 0}, + { 900.0, 660.0, -11, -11, 1, 0}, + { 780.0, 660.0, -11, -11, 1, 0}, + {1140.0, 540.0, -11, -11, 1, 0}, + {1020.0, 540.0, -11, -11, 1, 0}, + { 900.0, 540.0, -11, -11, 1, 0}, + { 780.0, 540.0, -11, -11, 1, 0}, + { 660.0, 540.0, -11, -11, 1, 0}, + {0.0, 0.0, 0, 0, 0, 0} +}; + +static tone_gen_descriptor_t my_mf_digit_tones[16]; + +static char r2_mf_tone_codes[] = "1234567890BCDEF"; + +int callback_ok; +int callback_roll; + +static void my_mf_gen_init(float low_fudge, + int low_level, + float high_fudge, + int high_level, + int duration, + int fwd) +{ + const mf_digit_tones_t *tone; + int i; + + for (i = 0; i < 15; i++) + { + if (fwd) + tone = &r2_mf_fwd_tones[i]; + else + tone = &r2_mf_back_tones[i]; + make_tone_gen_descriptor(&my_mf_digit_tones[i], + tone->f1*(1.0 + low_fudge), + low_level, + tone->f2*(1.0 + high_fudge), + high_level, + duration, + 0, + 0, + 0, + FALSE); + } +} +/*- End of function --------------------------------------------------------*/ + +static int my_mf_generate(int16_t amp[], char digit) +{ + int len; + char *cp; + tone_gen_state_t tone; + + len = 0; + if ((cp = strchr(r2_mf_tone_codes, digit))) + { + tone_gen_init(&tone, &my_mf_digit_tones[cp - r2_mf_tone_codes]); + len += tone_gen(&tone, amp + len, 9999); + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +static void codec_munge(int16_t amp[], int len) +{ + int i; + uint8_t alaw; + + for (i = 0; i < len; i++) + { + alaw = linear_to_alaw (amp[i]); + amp[i] = alaw_to_linear (alaw); + } +} +/*- End of function --------------------------------------------------------*/ + +static void digit_delivery(void *data, int digit, int level, int delay) +{ + char ch; + + if (data != (void *) 0x12345678) + { + callback_ok = FALSE; + return; + } + if ((callback_roll & 1)) + ch = 0; + else + ch = r2_mf_tone_codes[callback_roll >> 1]; + if (ch == digit) + callback_ok = TRUE; + else + callback_ok = FALSE; + if (r2_mf_tone_codes[callback_roll >> 1]) + callback_roll++; + else + callback_ok = FALSE; +} +/*- End of function --------------------------------------------------------*/ + +static int test_a_tone_set(int fwd) +{ + int i; + int j; + int len; + int sample; + const char *s; + char digit; + int actual; + int nplus; + int nminus; + float rrb; + float rcfo; + int16_t amp[100000]; + r2_mf_rx_state_t mf_state; + awgn_state_t noise_source; + const mf_digit_tones_t *tone; + + if (fwd) + tone = &r2_mf_fwd_tones[0]; + else + tone = &r2_mf_back_tones[0]; + r2_mf_rx_init(&mf_state, fwd, NULL, NULL); + + /* Test 1: Mitel's test 1 isn't really a test. Its a calibration step, + which has no meaning here. */ + + printf ("Test 1: Calibration\n"); + printf (" Passed\n"); + + /* Test 2: Decode check + This is a sanity check, that all digits are reliably detected + under ideal conditions. Each possible digit is repeated 10 times, + with 68ms bursts. The level of each tone is about 6dB down from clip */ + + printf ("Test 2: Decode check\n"); + my_mf_gen_init(0.0, -3, 0.0, -3, 68, fwd); + s = r2_mf_tone_codes; + while (*s) + { + digit = *s++; + for (i = 0; i < 10; i++) + { + len = my_mf_generate(amp, digit); + codec_munge (amp, len); + r2_mf_rx(&mf_state, amp, len); + actual = r2_mf_rx_get(&mf_state); + if (actual != digit) + { + printf (" Sent '%c'\n", digit); + printf (" Received 0x%X\n", actual); + printf (" Failed\n"); + exit (2); + } + } + } + printf (" Passed\n"); + + /* Test 3: Recognition bandwidth and channel centre frequency check. + Use all digits. Each digit types requires four tests to complete + the check. Each section contains 40 pulses of 68ms duration, + with an amplitude of -20dB from clip per frequency. + + Four sections covering the tests for one tone (1 digit) are: + a. H frequency at 0% deviation from center, L frequency at +0.1%. + L frequency is then increments in +01.% steps up to +4%. The + number of tone bursts is noted and designated N+. + b. H frequency at 0% deviation, L frequency at -0.1%. L frequency + is then incremental in -0.1% steps, up to -4%. The number of + tone bursts is noted and designated N-. + c. The test in (a) is repeated with the L frequency at 0% and the + H frequency varied up to +4%. + d. The test in (b) is repeated with the L frequency and 0% and the + H frequency varied to -4%. + + Receiver Recognition Bandwidth (RRB) is calculated as follows: + RRB% = (N+ + N-)/10 + Receiver Center Frequency Offset (RCFO) is calculated as follows: + RCFO% = X + (N+ - N-)/20 + + Note that this test doesn't test what it says it is testing at all, + and the results are quite inaccurate, if not a downright lie! However, + it follows the Mitel procedure, so how can it be bad? :) + + The spec calls for +-4 +-10Hz (ie +-14Hz) of bandwidth. */ + + printf ("Test 3: Recognition bandwidth and channel centre frequency check\n"); + s = r2_mf_tone_codes; + j = 0; + while (*s) + { + digit = *s++; + for (nplus = 0, i = 1; i <= 60; i++) + { + my_mf_gen_init((float) i/1000.0, -17, 0.0, -17, 68, fwd); + len = my_mf_generate(amp, digit); + codec_munge(amp, len); + r2_mf_rx(&mf_state, amp, len); + if (r2_mf_rx_get(&mf_state) == digit) + nplus++; + } + for (nminus = 0, i = -1; i >= -60; i--) + { + my_mf_gen_init((float) i/1000.0, -17, 0.0, -17, 68, fwd); + len = my_mf_generate(amp, digit); + codec_munge(amp, len); + r2_mf_rx(&mf_state, amp, len); + if (r2_mf_rx_get(&mf_state) == digit) + nminus++; + } + rrb = (float) (nplus + nminus)/10.0; + rcfo = (float) (nplus - nminus)/10.0; + printf (" %c (low) rrb = %5.2f%%, rcfo = %5.2f%%, max -ve = %5.2f, max +ve = %5.2f\n", + digit, + rrb, + rcfo, + (float) nminus/10.0, + (float) nplus/10.0); + + if (rrb < rcfo + (2.0*100.0*14.0/r2_mf_fwd_tones[j].f1) || rrb >= 15.0 + rcfo) + { + printf (" Failed\n"); + exit (2); + } + + for (nplus = 0, i = 1; i <= 60; i++) + { + my_mf_gen_init(0.0, -17, (float) i/1000.0, -17, 68, fwd); + len = my_mf_generate(amp, digit); + codec_munge(amp, len); + r2_mf_rx(&mf_state, amp, len); + if (r2_mf_rx_get(&mf_state) == digit) + nplus++; + } + for (nminus = 0, i = -1; i >= -60; i--) + { + my_mf_gen_init(0.0, -17, (float) i/1000.0, -17, 68, fwd); + len = my_mf_generate(amp, digit); + codec_munge(amp, len); + r2_mf_rx(&mf_state, amp, len); + if (r2_mf_rx_get(&mf_state) == digit) + nminus++; + } + rrb = (float) (nplus + nminus)/10.0; + rcfo = (float) (nplus - nminus)/10.0; + printf (" %c (high) rrb = %5.2f%%, rcfo = %5.2f%%, max -ve = %5.2f, max +ve = %5.2f\n", + digit, + rrb, + rcfo, + (float) nminus/10.0, + (float) nplus/10.0); + if (rrb < rcfo + (2.0*100.0*14.0/r2_mf_fwd_tones[j].f2) || rrb >= 15.0 + rcfo) + { + printf (" Failed\n"); + exit (2); + } + j++; + } + printf (" Passed\n"); + + /* Test 4: Acceptable amplitude ratio (twist). + Twist all digits in both directions, and check the maximum twist + we can accept. The way this is done is styled after the Mitel DTMF + test, and has good and bad points. */ + + printf ("Test 4: Acceptable amplitude ratio (twist)\n"); + s = r2_mf_tone_codes; + while (*s) + { + digit = *s++; + for (nplus = 0, i = -50; i >= -250; i--) + { + my_mf_gen_init(0.0, -5, 0.0, i/10, 68, fwd); + + len = my_mf_generate(amp, digit); + codec_munge (amp, len); + r2_mf_rx(&mf_state, amp, len); + if (r2_mf_rx_get(&mf_state) == digit) + nplus++; + } + printf (" %c normal twist = %.2fdB\n", digit, (float) nplus/10.0); + if (nplus < 70) + { + printf (" Failed\n"); + exit (2); + } + for (nminus = 0, i = -50; i >= -250; i--) + { + my_mf_gen_init(0.0, i/10, 0.0, -5, 68, fwd); + + len = my_mf_generate(amp, digit); + codec_munge(amp, len); + r2_mf_rx(&mf_state, amp, len); + if (r2_mf_rx_get(&mf_state) == digit) + nminus++; + } + printf (" %c reverse twist = %.2fdB\n", digit, (float) nminus/10.0); + if (nminus < 70) + { + printf (" Failed\n"); + exit (2); + } + } + printf (" Passed\n"); + + /* Test 5: Dynamic range + This test sends all possible digits, with gradually increasing + amplitude. We determine the span over which we achieve reliable + detection. */ + + printf ("Test 5: Dynamic range\n"); + for (nplus = nminus = -1000, i = -50; i <= 3; i++) + { + s = r2_mf_tone_codes; + while (*s) + { + digit = *s++; + my_mf_gen_init(0.0, i, 0.0, i, 68, fwd); + for (j = 0; j < 100; j++) + { + len = my_mf_generate(amp, digit); + codec_munge(amp, len); + r2_mf_rx(&mf_state, amp, len); + if (r2_mf_rx_get(&mf_state) != digit) + break; + } + if (j < 100) + break; + } + if (j == 100) + { + if (nplus == -1000) + nplus = i; + } + else + { + if (nplus != -1000 && nminus == -1000) + nminus = i; + } + } + printf (" Dynamic range = %ddB to %ddB\n", nplus, nminus - 1); + if (nplus > -35 || nminus <= -5) + { + printf(" Failed\n"); + exit(2); + } + printf (" Passed\n"); + + /* Test 6: Guard time + This test sends all possible digits, with a gradually reducing + duration. */ + + printf ("Test 6: Guard time\n"); + for (i = 30; i < 62; i++) + { + s = r2_mf_tone_codes; + j = 0; + while (*s) + { + digit = *s++; + my_mf_gen_init(0.0, -5, 0.0, -3, i, fwd); + for (j = 0; j < 500; j++) + { + len = my_mf_generate(amp, digit); + codec_munge(amp, len); + r2_mf_rx(&mf_state, amp, len); + if (r2_mf_rx_get(&mf_state) != digit) + break; + } + if (j < 500) + break; + } + if (j == 500) + break; + } + printf (" Guard time = %dms\n", i); + if (i > 61) + { + printf(" Failed\n"); + exit(2); + } + printf (" Passed\n"); + + /* Test 7: Acceptable signal to noise ratio + We send all possible digits at -6dBm from clip, mixed with AWGN. + We gradually reduce the noise until we get clean detection. */ + + printf ("Test 7: Acceptable signal to noise ratio\n"); + my_mf_gen_init(0.0, -3, 0.0, -3, 68, fwd); + for (i = -3; i > -50; i--) + { + s = r2_mf_tone_codes; + while (*s) + { + digit = *s++; + awgn_init_dbm0(&noise_source, 1234567, (float) i); + for (j = 0; j < 500; j++) + { + len = my_mf_generate(amp, digit); + for (sample = 0; sample < len; sample++) + amp[sample] = saturate(amp[sample] + awgn(&noise_source)); + codec_munge(amp, len); + r2_mf_rx(&mf_state, amp, len); + if (r2_mf_rx_get(&mf_state) != digit) + break; + } + if (j < 500) + break; + } + if (j == 500) + break; + } + printf(" Acceptable S/N ratio is %ddB\n", -3 - i); + if (-3 - i > 26) + { + printf(" Failed\n"); + exit(2); + } + printf(" Passed\n"); + + printf("Test 8: Callback digit delivery mode.\n"); + callback_ok = FALSE; + callback_roll = 0; + r2_mf_rx_init(&mf_state, fwd, digit_delivery, (void *) 0x12345678); + my_mf_gen_init(0.0, -3, 0.0, -3, 68, fwd); + s = r2_mf_tone_codes; + awgn_init_dbm0(&noise_source, 1234567, -40.0f); + while (*s) + { + digit = *s++; + len = my_mf_generate(amp, digit); + for (sample = 0; sample < len; sample++) + amp[sample] = saturate(amp[sample] + awgn(&noise_source)); + codec_munge(amp, len); + r2_mf_rx(&mf_state, amp, len); + len = 160; + memset(amp, '\0', len*sizeof(int16_t)); + for (sample = 0; sample < len; sample++) + amp[sample] = saturate(amp[sample] + awgn(&noise_source)); + codec_munge(amp, len); + r2_mf_rx(&mf_state, amp, len); + } + if (!callback_ok) + { + printf(" Failed\n"); + exit (2); + } + printf(" Passed\n"); + + /* The remainder of the Mitel tape is the talk-off test. This is + meaningless for R2 MF. However the decoder's tolerance of + out of band noise is significant. */ + /* TODO: add a OOB tolerance test. */ + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + time_t now; + time_t duration; + + now = time(NULL); + printf("R2 forward tones\n"); + test_a_tone_set(TRUE); + printf("R2 backward tones\n"); + test_a_tone_set(FALSE); + duration = time(NULL) - now; + printf ("Tests passed in %lds\n", duration); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/r2_mf_tx_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/r2_mf_tx_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,116 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * r2_mf_tx_tests.c - Test the Bell MF generator. + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: r2_mf_tx_tests.c,v 1.16 2009/05/30 15:23:14 steveu Exp $ + */ + +/*! \file */ + +/*! \page r2_mf_tx_tests_page R2 MF generation tests +\section r2_mf_tx_tests_page_sec_1 What does it do? +???. + +\section r2_mf_tx_tests_page_sec_2 How does it work? +???. +*/ + +/* Enable the following definition to enable direct probing into the FAX structures */ +//#define WITH_SPANDSP_INTERNALS + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define OUTPUT_FILE_NAME "r2_mf.wav" + +int main(int argc, char *argv[]) +{ + r2_mf_tx_state_t gen; + int16_t amp[1000]; + int len; + SNDFILE *outhandle; + int outframes; + int digit; + const char *digits = "0123456789BCDEF"; + + if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + + r2_mf_tx_init(&gen, FALSE); + for (digit = 0; digits[digit]; digit++) + { + r2_mf_tx_put(&gen, digits[digit]); + len = r2_mf_tx(&gen, amp, 1000); + printf("Generated %d samples of %c\n", len, digits[digit]); + if (len > 0) + outframes = sf_writef_short(outhandle, amp, len); + r2_mf_tx_put(&gen, 0); + len = r2_mf_tx(&gen, amp, 1000); + printf("Generated %d samples\n", len); + if (len > 0) + outframes = sf_writef_short(outhandle, amp, len); + } + + r2_mf_tx_init(&gen, TRUE); + for (digit = 0; digits[digit]; digit++) + { + r2_mf_tx_put(&gen, digits[digit]); + len = r2_mf_tx(&gen, amp, 1000); + printf("Generated %d samples of %c\n", len, digits[digit]); + if (len > 0) + outframes = sf_writef_short(outhandle, amp, len); + r2_mf_tx_put(&gen, 0); + len = r2_mf_tx(&gen, amp, 1000); + printf("Generated %d samples\n", len); + if (len > 0) + outframes = sf_writef_short(outhandle, amp, len); + } + + if (sf_close(outhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME); + exit (2); + } + + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/regression_tests.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/regression_tests.sh Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,841 @@ +#!/bin/sh +# +# SpanDSP - a series of DSP components for telephony +# +# regression_tests.sh +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 2.1, +# as published by the Free Software Foundation. +# +# 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 Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# $Id: regression_tests.sh,v 1.59 2009/09/22 13:28:18 steveu Exp $ +# + +ITUTESTS_TIF=../test-data/itu/fax/itutests.tif +MIXEDSIZES_TIF=../test-data/itu/fax/mixed_size_pages.tif +STDOUT_DEST=xyzzy +STDERR_DEST=xyzzy2 + +echo Performing basic spandsp regression tests +echo + +./adsi_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo adsi_tests failed! + exit $RETVAL +fi +echo adsi_tests completed OK + +./async_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo async_tests failed! + exit $RETVAL +fi +echo async_tests completed OK + +./at_interpreter_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo at_interpreter_tests failed! + exit $RETVAL +fi +echo at_interpreter_tests completed OK + +./awgn_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo awgn_tests failed! + exit $RETVAL +fi +echo awgn_tests completed OK + +./bell_mf_rx_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo bell_mf_rx_tests failed! + exit $RETVAL +fi +echo bell_mf_rx_tests completed OK + +./bell_mf_tx_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo bell_mf_tx_tests failed! + exit $RETVAL +fi +echo bell_mf_tx_tests completed OK + +./bert_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo bert_tests failed! + exit $RETVAL +fi +echo bert_tests completed OK + +./bit_operations_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo bit_operations_tests failed! + exit $RETVAL +fi +echo bit_operations_tests completed OK + +./complex_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo complex_tests failed! + exit $RETVAL +fi +echo complex_tests completed OK + +./complex_vector_float_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo complex_vector_float_tests failed! + exit $RETVAL +fi +echo complex_vector_float_tests completed OK + +./complex_vector_int_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo complex_vector_int_tests failed! + exit $RETVAL +fi +echo complex_vector_int_tests completed OK + +./crc_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo crc_tests failed! + exit $RETVAL +fi +echo crc_tests completed OK + +./dc_restore_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo dc_restore_tests failed! + exit $RETVAL +fi +echo dc_restore_tests completed OK + +./dds_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo dds_tests failed! + exit $RETVAL +fi +echo dds_tests completed OK + +./dtmf_rx_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo dtmf_rx_tests failed! + exit $RETVAL +fi +echo dtmf_rx_tests completed OK + +./dtmf_tx_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo dtmf_tx_tests failed! + exit $RETVAL +fi +echo dtmf_tx_tests completed OK + +#./echo_tests >$STDOUT_DEST 2>$STDERR_DEST +#RETVAL=$? +#if [ $RETVAL != 0 ] +#then +# echo echo_tests failed! +# exit $RETVAL +#fi +#echo echo_tests completed OK +echo echo_tests not enabled + +#Try the ITU test pages without ECM +rm -f fax_tests_1.tif +./fax_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo fax_tests failed! + exit $RETVAL +fi +# Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t +# option means the normal differences in tags will be ignored. +tiffcmp -t ${ITUTESTS_TIF} fax_tests_1.tif >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo fax_tests failed! + exit $RETVAL +fi +#Try the ITU test pages with ECM +rm -f fax_tests_1.tif +./fax_tests -e >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo fax_tests -e failed! + exit $RETVAL +fi +# Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t +# option means the normal differences in tags will be ignored. +tiffcmp -t ${ITUTESTS_TIF} fax_tests_1.tif >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo fax_tests -e failed! + exit $RETVAL +fi +#Try some mixed sized test pages without ECM +rm -f fax_tests_1.tif +./fax_tests -i ${MIXEDSIZES_TIF} >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo fax_tests failed! + exit $RETVAL +fi +# Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t +# option means the normal differences in tags will be ignored. +tiffcmp -t ${MIXEDSIZES_TIF} fax_tests_1.tif >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo fax_tests failed! + exit $RETVAL +fi +echo fax_tests completed OK + +./fsk_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo fsk_tests failed! + exit $RETVAL +fi +echo fsk_tests completed OK + +#./g1050_tests >$STDOUT_DEST 2>$STDERR_DEST +#RETVAL=$? +#if [ $RETVAL != 0 ] +#then +# echo g1050_tests failed! +# exit $RETVAL +#fi +#echo g1050_tests completed OK + +./g711_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo g711_tests failed! + exit $RETVAL +fi +echo g711_tests completed OK + +./g722_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo g722_tests failed! + exit $RETVAL +fi +echo g722_tests completed OK + +./g726_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo g726_tests failed! + exit $RETVAL +fi +echo g726_tests completed OK + +./gsm0610_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo gsm0610_tests failed! + exit $RETVAL +fi +echo gsm0610_tests completed OK + +./hdlc_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo hdlc_tests failed! + exit $RETVAL +fi +echo hdlc_tests completed OK + +./ima_adpcm_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo ima_adpcm_tests failed! + exit $RETVAL +fi +echo ima_adpcm_tests completed OK + +./logging_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo logging_tests failed! + exit $RETVAL +fi +echo logging_tests completed OK + +./lpc10_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo lpc10_tests failed! + exit $RETVAL +fi +echo lpc10_tests completed OK + +./modem_echo_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo modem_echo_tests failed! + exit $RETVAL +fi +echo modem_echo_tests completed OK + +./modem_connect_tones_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo modem_connect_tones_tests failed! + exit $RETVAL +fi +echo modem_connect_tones_tests completed OK + +./noise_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo noise_tests failed! + exit $RETVAL +fi +echo noise_tests completed OK + +./oki_adpcm_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo oki_adpcm_tests failed! + exit $RETVAL +fi +echo oki_adpcm_tests completed OK + +#./playout_tests >$STDOUT_DEST 2>$STDERR_DEST +#RETVAL=$? +#if [ $RETVAL != 0 ] +#then +# echo playout_tests failed! +# exit $RETVAL +#fi +#echo playout_tests completed OK +echo playout_tests not enabled + +#./plc_tests >$STDOUT_DEST 2>$STDERR_DEST +#RETVAL=$? +#if [ $RETVAL != 0 ] +#then +# echo plc_tests failed! +# exit $RETVAL +#fi +#echo plc_tests completed OK +echo plc_tests not enabled + +./power_meter_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo power_meter_tests failed! + exit $RETVAL +fi +echo power_meter_tests completed OK + +./queue_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo queue_tests failed! + exit $RETVAL +fi +echo queue_tests completed OK + +./r2_mf_rx_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo r2_mf_rx_tests failed! + exit $RETVAL +fi +echo r2_mf_rx_tests completed OK + +./r2_mf_tx_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo r2_mf_tx_tests failed! + exit $RETVAL +fi +echo r2_mf_tx_tests completed OK + +#./rfc2198_sim_tests >$STDOUT_DEST 2>$STDERR_DEST +#RETVAL=$? +#if [ $RETVAL != 0 ] +#then +# echo rfc2198_sim_tests failed! +# exit $RETVAL +#fi +#echo rfc2198_sim_tests completed OK + +./schedule_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo schedule_tests failed! + exit $RETVAL +fi +echo schedule_tests completed OK + +#./sig_tone_tests >$STDOUT_DEST 2>$STDERR_DEST +#RETVAL=$? +#if [ $RETVAL != 0 ] +#then +# echo sig_tone_tests failed! +# exit $RETVAL +#fi +#echo sig_tone_tests completed OK +echo sig_tone_tests not enabled + +#./super_tone_rx_tests >$STDOUT_DEST 2>$STDERR_DEST +#RETVAL=$? +#if [ $RETVAL != 0 ] +#then +# echo super_tone_rx_tests failed! +# exit $RETVAL +#fi +#echo super_tone_rx_tests completed OK +echo super_tone_rx_tests not enabled + +#./super_tone_tx_tests >$STDOUT_DEST 2>$STDERR_DEST +#RETVAL=$? +#if [ $RETVAL != 0 ] +#then +# echo super_tone_tx_tests failed! +# exit $RETVAL +#fi +#echo super_tone_tx_tests completed OK +echo super_tone_tx_tests not enabled + +#./swept_tone_tests >$STDOUT_DEST 2>$STDERR_DEST +#RETVAL=$? +#if [ $RETVAL != 0 ] +#then +# echo swept_tone_tests failed! +# exit $RETVAL +#fi +#echo swept_tone_tests completed OK +echo swept_tone_tests not enabled + +./t31_tests -r >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t31_tests -r failed! + exit $RETVAL +fi +./t31_tests -s >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t31_tests -s failed! + exit $RETVAL +fi +echo t31_tests completed OK + +./t38_core_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t38_core_tests failed! + exit $RETVAL +fi +echo t38_core_tests completed OK + +rm -f t38.tif +./t38_gateway_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t38_gateway_tests failed! + exit $RETVAL +fi +# Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t +# option means the normal differences in tags will be ignored. +tiffcmp -t ${ITUTESTS_TIF} t38.tif >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t38_gateway_tests failed! + exit $RETVAL +fi +rm -f t38.tif +./t38_gateway_tests -e >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t38_gateway_tests -e failed! + exit $RETVAL +fi +# Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t +# option means the normal differences in tags will be ignored. +tiffcmp -t ${ITUTESTS_TIF} t38.tif >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t38_gateway_tests -e failed! + exit $RETVAL +fi +echo t38_gateway_tests completed OK + +rm -f t38.tif +./t38_gateway_to_terminal_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t38_gateway_to_terminal_tests failed! + exit $RETVAL +fi +# Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t +# option means the normal differences in tags will be ignored. +tiffcmp -t ${ITUTESTS_TIF} t38.tif >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t38_gateway_to_terminal_tests failed! + exit $RETVAL +fi +rm -f t38.tif +./t38_gateway_to_terminal_tests -e >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t38_gateway_to_terminal_tests -e failed! + exit $RETVAL +fi +# Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t +# option means the normal differences in tags will be ignored. +tiffcmp -t ${ITUTESTS_TIF} t38.tif >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t38_gateway_to_terminal_tests -e failed! + exit $RETVAL +fi +echo t38_gateway_to_terminal_tests completed OK + +./t38_non_ecm_buffer_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t38_non_ecm_buffer_tests failed! + exit $RETVAL +fi +echo t38_non_ecm_buffer_tests completed OK + +rm -f t38.tif +./t38_terminal_to_gateway_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t38_terminal_to_gateway_tests failed! + exit $RETVAL +fi +# Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t +# option means the normal differences in tags will be ignored. +tiffcmp -t ${ITUTESTS_TIF} t38.tif >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t38_terminal_to_gateway_tests failed! + exit $RETVAL +fi +rm -f t38.tif +./t38_terminal_to_gateway_tests -e >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t38_terminal_to_gateway_tests -e failed! + exit $RETVAL +fi +# Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t +# option means the normal differences in tags will be ignored. +tiffcmp -t ${ITUTESTS_TIF} t38.tif >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t38_terminal_to_gateway_tests -e failed! + exit $RETVAL +fi +echo t38_terminal_to_gateway_tests completed OK + +rm -f t38.tif +./t38_terminal_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t38_terminal_tests failed! + exit $RETVAL +fi +# Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t +# option means the normal differences in tags will be ignored. +tiffcmp -t ${ITUTESTS_TIF} t38.tif >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t38_terminal_tests failed! + exit $RETVAL +fi +rm -f t38.tif +./t38_terminal_tests -e >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t38_terminal_tests -e failed! + exit $RETVAL +fi +# Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t +# option means the normal differences in tags will be ignored. +tiffcmp -t ${ITUTESTS_TIF} t38.tif >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t38_terminal_tests -e failed! + exit $RETVAL +fi +echo t38_terminal_tests completed OK + +rm -f t4_tests_receive.tif +./t4_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t4_tests failed! + exit $RETVAL +fi +echo t4_tests completed OK + +#./time_scale_tests >$STDOUT_DEST 2>$STDERR_DEST +#RETVAL=$? +#if [ $RETVAL != 0 ] +#then +# echo time_scale_tests failed! +# exit $RETVAL +#fi +#echo time_scale_tests completed OK +echo time_scale_tests not enabled + +#./tone_detect_tests >$STDOUT_DEST 2>$STDERR_DEST +#RETVAL=$? +#if [ $RETVAL != 0 ] +#then +# echo tone_detect_tests failed! +# exit $RETVAL +#fi +#echo tone_detect_tests completed OK +echo tone_detect_tests not enabled + +#./tone_generate_tests >$STDOUT_DEST 2>$STDERR_DEST +#RETVAL=$? +#if [ $RETVAL != 0 ] +#then +# echo tone_generate_tests failed! +# exit $RETVAL +#fi +#echo tone_generate_tests completed OK +echo tone_generate_tests not enabled + +./v17_tests -b 14400 -s -42 -n -66 >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo v17_tests failed! + exit $RETVAL +fi +./v17_tests -b 12000 -s -42 -n -61 >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo v17_tests failed! + exit $RETVAL +fi +./v17_tests -b 9600 -s -42 -n -59 >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo v17_tests failed! + exit $RETVAL +fi +./v17_tests -b 7200 -s -42 -n -56 >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo v17_tests failed! + exit $RETVAL +fi +echo v17_tests completed OK + +#./v22bis_tests -b 2400 >$STDOUT_DEST 2>$STDERR_DEST +#RETVAL=$? +#if [ $RETVAL != 0 ] +#then +# echo v22bis_tests failed! +# exit $RETVAL +#fi +#./v22bis_tests -b 1200 >$STDOUT_DEST 2>$STDERR_DEST +#RETVAL=$? +#if [ $RETVAL != 0 ] +#then +# echo v22bis_tests failed! +# exit $RETVAL +#fi +#echo v22bis_tests completed OK +echo v22bis_tests not enabled + +./v27ter_tests -b 4800 -s -42 -n -57 >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo v27ter_tests failed! + exit $RETVAL +fi +./v27ter_tests -b 2400 -s -42 -n -51 >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo v27ter_tests failed! + exit $RETVAL +fi +echo v27ter_tests completed OK + +./v29_tests -b 9600 -s -42 -n -62 >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo v29_tests failed! + exit $RETVAL +fi +./v29_tests -b 7200 -s -42 -n -58 >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo v29_tests failed! + exit $RETVAL +fi +./v29_tests -b 4800 -s -42 -n -54 >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo v29_tests failed! + exit $RETVAL +fi +echo v29_tests completed OK + +#./v42_tests >$STDOUT_DEST 2>$STDERR_DEST +#RETVAL=$? +#if [ $RETVAL != 0 ] +#then +# echo v42_tests failed! +# exit $RETVAL +#fi +#echo v42_tests completed OK +echo v42_tests not enabled + +./v42bis_tests.sh >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo v42bis_tests failed! + exit $RETVAL +fi +echo v42bis_tests completed OK + +./v8_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo v8_tests failed! + exit $RETVAL +fi +echo v8_tests completed OK + +./v18_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo v18_tests failed! + exit $RETVAL +fi +echo v18_tests completed OK + +./vector_float_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo vector_float_tests failed! + exit $RETVAL +fi +echo vector_float_tests completed OK + +./vector_int_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo vector_int_tests failed! + exit $RETVAL +fi +echo vector_int_tests completed OK + +echo +echo All regression tests successfully completed diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/rfc2198_sim_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/rfc2198_sim_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,242 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * rfc2198_sim_tests.c - Tests for the G.1050/TIA-921 model + * with redundant transmission in the + * style of UDPTL or RFC2198.. + * + * Written by Steve Underwood + * + * Copyright (C) 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: rfc2198_sim_tests.c,v 1.7 2009/05/30 15:23:14 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#if defined(HAVE_FL_FL_H) && defined(HAVE_FL_FL_CARTESIAN_H) && defined(HAVE_FL_FL_AUDIO_METER_H) +#define ENABLE_GUI +#endif + +#include +#include +#include +#include +#include +#include +#include +#if defined(HAVE_MATH_H) +#define GEN_CONST +#endif + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#if defined(ENABLE_GUI) +#include "media_monitor.h" +#endif + +#define PACKET_SIZE 256 +#define PACKET_INTERVAL 20 +#define SIMULATION_TIME 300 + +#define MODEL_NO 8 +#define SPEED_PATTERN_NO 133 + +int main(int argc, char *argv[]) +{ + rfc2198_sim_state_t *s; + double *packet_arrival_times; + int packets_per_sec; + int num_packets; + int model_no; + int speed_pattern_no; + int use_gui; + int simulation_time; + int i; + int len; + uint8_t put_pkt[256]; + uint8_t get_pkt[256]; + int put_pkt_len; + int get_pkt_len; + int get_seq_no; + double get_departure_time; + double get_arrival_time; + int packets_put; + int packets_really_put; + int packets_got; + int oos_packets_got; + int missing_packets_got; + int highest_seq_no_got; + int opt; + FILE *out_file; + + model_no = MODEL_NO; + speed_pattern_no = SPEED_PATTERN_NO; + simulation_time = SIMULATION_TIME; + use_gui = FALSE; + while ((opt = getopt(argc, argv, "gm:s:t:")) != -1) + { + switch (opt) + { + case 'g': +#if defined(ENABLE_GUI) + use_gui = TRUE; +#else + fprintf(stderr, "Graphical monitoring not available\n"); + exit(2); +#endif + break; + case 'm': + model_no = optarg[0] - 'A' + 1; + if (model_no < 0 || model_no > 8) + { + fprintf(stderr, "Bad model ID '%s'\n", optarg); + exit(2); + } + break; + case 's': + speed_pattern_no = atoi(optarg); + if (speed_pattern_no < 1 || speed_pattern_no > 133) + { + fprintf(stderr, "Bad link speed pattern %s\n", optarg); + exit(2); + } + break; + case 't': + simulation_time = atoi(optarg); + break; + default: + //usage(); + exit(2); + break; + } + } + argc -= optind; + argv += optind; + + if ((out_file = fopen("rfc2198_sim_tests.txt", "w")) == NULL) + { + fprintf(stderr, "Can't open %s\n", "rfc2198_sim_tests.txt"); + return 2; + } + packets_per_sec = 1000/PACKET_INTERVAL; + num_packets = packets_per_sec*simulation_time; + + if ((packet_arrival_times = calloc(num_packets, sizeof(double))) == NULL) + { + fprintf(stderr, "Can't allocate the data buffers\n"); + return 2; + } + for (i = 0; i < num_packets; i++) + packet_arrival_times[i] = 0.0; + + /* If we don't initialise this random number generator it gives endless zeros on some systems. */ + /* Use a fixed seed to produce identical results in successive runs of the simulation, for debug purposes. */ + srand48(0x1234567); + + if ((s = rfc2198_sim_init(model_no, speed_pattern_no, PACKET_SIZE, packets_per_sec, 3)) == NULL) + { + fprintf(stderr, "Failed to start the G.1050 model\n"); + exit(2); + } + //rfc2198_sim_dump_parms(model_no, speed_pattern_no); + +#if defined(ENABLE_GUI) + if (use_gui) + start_media_monitor(); +#endif + + for (i = 0; i < 256; i++) + put_pkt[i] = i; + put_pkt_len = 256; + get_pkt_len = -1; + get_seq_no = -1; + get_arrival_time = -1; + packets_put = 0; + packets_really_put = 0; + packets_got = 0; + oos_packets_got = 0; + missing_packets_got = 0; + highest_seq_no_got = -1; + for (i = 0; i < num_packets; i++) + { + if ((len = rfc2198_sim_put(s, put_pkt, put_pkt_len, i, (double) i*0.001*PACKET_INTERVAL)) > 0) + packets_really_put++; + packets_put++; +#if 0 + if (i == 5) + rfc2198_sim_queue_dump(s); +#endif + if (i >= 5) + { + do + { + get_pkt_len = rfc2198_sim_get(s, get_pkt, 256, (double) i*0.001*PACKET_INTERVAL, &get_seq_no, &get_departure_time, &get_arrival_time); + if (get_pkt_len >= 0) + { +#if defined(ENABLE_GUI) + if (use_gui) + media_monitor_rx(get_seq_no, get_departure_time, get_arrival_time); +#endif + packets_got++; + if (get_seq_no < highest_seq_no_got) + oos_packets_got++; + else if (get_seq_no > highest_seq_no_got + 1) + missing_packets_got += (get_seq_no - highest_seq_no_got - 1); + if (get_seq_no > highest_seq_no_got) + highest_seq_no_got = get_seq_no; + fprintf(out_file, "%d, %.3f, %.8f\n", get_seq_no, get_seq_no*0.001*PACKET_INTERVAL, get_arrival_time); + } + } + while (get_pkt_len >= 0); + } +#if defined(ENABLE_GUI) + if (use_gui) + media_monitor_update_display(); +#endif + } + /* Clear out anything remaining in the queue, by jumping forwards in time */ + do + { + get_pkt_len = rfc2198_sim_get(s, get_pkt, 256, (double) i*0.001*PACKET_INTERVAL + 5.0, &get_seq_no, &get_departure_time, &get_arrival_time); + if (get_pkt_len >= 0) + { + packets_got++; + fprintf(out_file, "%d, %.3f, %.8f\n", get_seq_no, get_seq_no*0.001*PACKET_INTERVAL, get_arrival_time); + } + } + while (get_pkt_len >= 0); + + fclose(out_file); + + printf("Put %d packets. Really put %d packets. Got %d packets.\n", packets_put, packets_really_put, packets_got); + printf("%d OOS packets, %d missing packets\n", oos_packets_got, missing_packets_got - oos_packets_got); + printf("%d packets queued, %d received\n", packets_really_put, packets_got); + printf("%.3f%% of packets lost before redundancy\n", 100.0*(packets_put - packets_really_put)/packets_put); + printf("%.3f%% of packets lost after redundancy\n", 100.0*(packets_put - packets_got)/packets_put); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/schedule_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/schedule_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,118 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * schedule_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: schedule_tests.c,v 1.20 2008/11/30 05:43:37 steveu Exp $ + */ + +/*! \page schedule_tests_page Event scheduler tests +\section schedule_tests_page_sec_1 What does it do? +???. + +\section schedule_tests_page_sec_2 How does it work? +???. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include + +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +#include "spandsp.h" + +uint64_t when1; +uint64_t when2; + +static void callback1(span_sched_state_t *s, void *user_data) +{ + int id; + uint64_t when; + + when = span_schedule_time(s); + printf("1: Callback at %f %" PRId64 "\n", (float) when/1000000.0, when - when1); + if ((when - when1)) + { + printf("Callback occured at the wrong time.\n"); + exit(2); + } + id = span_schedule_event(s, 500000, callback1, NULL); + when1 = when + 500000; + when = span_schedule_next(s); + printf("1: Event %d, earliest is %" PRId64 "\n", id, when); +} + +static void callback2(span_sched_state_t *s, void *user_data) +{ + int id; + uint64_t when; + + when = span_schedule_time(s); + printf("2: Callback at %f %" PRId64 "\n", (float) when/1000000.0, when - when2); + id = span_schedule_event(s, 550000, callback2, NULL); + if ((when - when2) != 10000) + { + printf("Callback occured at the wrong time.\n"); + exit(2); + } + when2 = when + 550000; + when = span_schedule_next(s); + printf("2: Event %d, earliest is %" PRId64 "\n", id, when); +} + +int main(int argc, char *argv[]) +{ + int i; + int id1; + int id2; + span_sched_state_t sched; + uint64_t when; + + span_schedule_init(&sched); + + id1 = span_schedule_event(&sched, 500000, callback1, NULL); + id2 = span_schedule_event(&sched, 550000, callback2, NULL); + when1 = span_schedule_time(&sched) + 500000; + when2 = span_schedule_time(&sched) + 550000; + //span_schedule_del(&sched, id); + + for (i = 0; i < 100000000; i += 20000) + { + span_schedule_update(&sched, 20000); + } + when = span_schedule_time(&sched); + if ((when1 - when) < 0 || (when1 - when) > 500000 || (when2 - when) < 0 || (when2 - when) > 550000) + { + printf("Callback failed to occur.\n"); + exit(2); + } + span_schedule_release(&sched); + + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/sig_tone_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/sig_tone_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,261 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * sig_tone_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: sig_tone_tests.c,v 1.27 2009/09/23 16:02:59 steveu Exp $ + */ + +/*! \file */ + +/*! \page sig_tone_tests_page The signaling tone processor tests +\section sig_tone_tests_sec_1 What does it do? +???. + +\section sig_tone_tests_sec_2 How does it work? +???. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define OUT_FILE_NAME "sig_tone.wav" + +#define SAMPLES_PER_CHUNK 160 + +static int sampleno = 0; +static int tone_1_present = 0; +static int tone_2_present = 0; +static int tx_section = 0; +static int dial_pulses = 0; + +static void tx_handler(void *user_data, int what, int level, int duration) +{ + sig_tone_tx_state_t *s; + + s = (sig_tone_tx_state_t *) user_data; + //printf("What - %d, duration - %d\n", what, duration); + if ((what & SIG_TONE_TX_UPDATE_REQUEST)) + { + printf("Tx: update request\n"); + /* The sig tone transmit side wants to know what to do next */ + switch (tx_section) + { + case 0: + printf("33ms break - %d samples\n", ms_to_samples(33)); + tx_section++; + sig_tone_tx_set_mode(s, SIG_TONE_1_PRESENT, ms_to_samples(33)); + break; + case 1: + printf("67ms make - %d samples\n", ms_to_samples(67)); + if (++dial_pulses == 9) + tx_section++; + else + tx_section--; + sig_tone_tx_set_mode(s, 0, ms_to_samples(67)); + break; + case 2: + tx_section++; + sig_tone_tx_set_mode(s, SIG_TONE_1_PRESENT, ms_to_samples(600)); + break; + case 3: + sig_tone_tx_set_mode(s, SIG_TONE_1_PRESENT | SIG_TONE_TX_PASSTHROUGH, 0); + break; + } + /*endswitch*/ + } + /*endif*/ +} +/*- End of function --------------------------------------------------------*/ + +static void rx_handler(void *user_data, int what, int level, int duration) +{ + float ms; + + ms = 1000.0f*(float) duration/(float) SAMPLE_RATE; + printf("What - %d, duration - %d\n", what, duration); + if ((what & SIG_TONE_1_CHANGE)) + { + tone_1_present = what & SIG_TONE_1_PRESENT; + printf("Rx: tone 1 is %s after %d samples (%fms)\n", (tone_1_present) ? "on" : "off", duration, ms); + } + /*endif*/ + if ((what & SIG_TONE_2_CHANGE)) + { + tone_2_present = what & SIG_TONE_2_PRESENT; + printf("Rx: tone 2 is %s after %d samples (%fms)\n", (tone_2_present) ? "on" : "off", duration, ms); + } + /*endif*/ +} +/*- End of function --------------------------------------------------------*/ + +static void map_frequency_response(sig_tone_rx_state_t *s) +{ + int16_t buf[8192]; + int i; + int len; + double sumin; + double sumout; + swept_tone_state_t *swept; + + /* Things like noise don't highlight the frequency response of the high Q notch + very well. We use a slowly swept frequency to check it. */ + swept = swept_tone_init(NULL, 200.0f, 3900.0f, -10.0f, 120*SAMPLE_RATE, 0); + for (;;) + { + if ((len = swept_tone(swept, buf, SAMPLES_PER_CHUNK)) <= 0) + break; + sumin = 0.0; + for (i = 0; i < len; i++) + sumin += (double) buf[i]*(double) buf[i]; + sig_tone_rx(s, buf, len); + sumout = 0.0; + for (i = 0; i < len; i++) + sumout += (double) buf[i]*(double) buf[i]; + /*endfor*/ + printf("%7.1f %f\n", swept_tone_current_frequency(swept), 10.0*log10(sumout/sumin)); + } + /*endfor*/ + swept_tone_free(swept); +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int16_t amp[SAMPLES_PER_CHUNK]; + int16_t out_amp[2*SAMPLES_PER_CHUNK]; + SNDFILE *outhandle; + int outframes; + int i; + int type; + int rx_samples; + int tx_samples; + sig_tone_tx_state_t tx_state; + sig_tone_rx_state_t rx_state; + awgn_state_t noise_source; + codec_munge_state_t *munge; + + if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 2)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + /*endif*/ + + awgn_init_dbm0(&noise_source, 1234567, -20.0f); + + for (type = 1; type <= 3; type++) + { + sampleno = 0; + tone_1_present = 0; + tone_2_present = 0; + tx_section = 0; + munge = NULL; + switch (type) + { + case 1: + printf("2280Hz tests.\n"); + munge = codec_munge_init(MUNGE_CODEC_ALAW, 0); + sig_tone_tx_init(&tx_state, SIG_TONE_2280HZ, tx_handler, &tx_state); + sig_tone_rx_init(&rx_state, SIG_TONE_2280HZ, rx_handler, &rx_state); + rx_state.current_rx_tone |= SIG_TONE_RX_PASSTHROUGH; + break; + case 2: + printf("2600Hz tests.\n"); + munge = codec_munge_init(MUNGE_CODEC_ULAW, 0); + sig_tone_tx_init(&tx_state, SIG_TONE_2600HZ, tx_handler, &tx_state); + sig_tone_rx_init(&rx_state, SIG_TONE_2600HZ, rx_handler, &rx_state); + rx_state.current_rx_tone |= SIG_TONE_RX_PASSTHROUGH; + break; + case 3: + printf("2400Hz/2600Hz tests.\n"); + munge = codec_munge_init(MUNGE_CODEC_ULAW, 0); + sig_tone_tx_init(&tx_state, SIG_TONE_2400HZ_2600HZ, tx_handler, &tx_state); + sig_tone_rx_init(&rx_state, SIG_TONE_2400HZ_2600HZ, rx_handler, &rx_state); + rx_state.current_rx_tone |= SIG_TONE_RX_PASSTHROUGH; + break; + } + /*endswitch*/ + /* Set to the default of hook condition */ + sig_tone_rx_set_mode(&rx_state, SIG_TONE_RX_PASSTHROUGH | SIG_TONE_RX_FILTER_TONE, 0); + sig_tone_tx_set_mode(&tx_state, SIG_TONE_1_PRESENT | SIG_TONE_2_PRESENT | SIG_TONE_TX_PASSTHROUGH, 0); + + map_frequency_response(&rx_state); + + sig_tone_rx_set_mode(&rx_state, SIG_TONE_RX_PASSTHROUGH, 0); + for (sampleno = 0; sampleno < 30000; sampleno += SAMPLES_PER_CHUNK) + { + if (sampleno == 8000) + { + /* 100ms seize */ + printf("100ms seize - %d samples\n", ms_to_samples(100)); + dial_pulses = 0; + sig_tone_tx_set_mode(&tx_state, 0, ms_to_samples(100)); + } + for (i = 0; i < SAMPLES_PER_CHUNK; i++) + amp[i] = awgn(&noise_source); + /*endfor*/ + tx_samples = sig_tone_tx(&tx_state, amp, SAMPLES_PER_CHUNK); + for (i = 0; i < tx_samples; i++) + out_amp[2*i] = amp[i]; + /*endfor*/ + codec_munge(munge, amp, tx_samples); + rx_samples = sig_tone_rx(&rx_state, amp, tx_samples); + for (i = 0; i < rx_samples; i++) + out_amp[2*i + 1] = amp[i]; + /*endfor*/ + outframes = sf_writef_short(outhandle, out_amp, rx_samples); + if (outframes != rx_samples) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + /*endif*/ + } + /*endfor*/ + } + /*endfor*/ + if (sf_close(outhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + /*endif*/ + + printf("Tests completed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/super_tone_rx_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/super_tone_rx_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,444 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * super_tone_detect_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: super_tone_rx_tests.c,v 1.33 2009/06/02 14:55:36 steveu Exp $ + */ + +/*! \file */ + +/*! \page super_tone_rx_tests_page Supervisory tone detection tests +\section super_tone_rx_tests_page_sec_1 What does it do? +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(HAVE_LIBXML_XMLMEMORY_H) +#include +#endif +#if defined(HAVE_LIBXML_PARSER_H) +#include +#endif +#if defined(HAVE_LIBXML_XINCLUDE_H) +#include +#endif + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define IN_FILE_NAME "super_tone.wav" + +#define MITEL_DIR "../test-data/mitel/" +#define BELLCORE_DIR "../test-data/bellcore/" + +const char *bellcore_files[] = +{ + MITEL_DIR "mitel-cm7291-talkoff.wav", + BELLCORE_DIR "tr-tsy-00763-1.wav", + BELLCORE_DIR "tr-tsy-00763-2.wav", + BELLCORE_DIR "tr-tsy-00763-3.wav", + BELLCORE_DIR "tr-tsy-00763-4.wav", + BELLCORE_DIR "tr-tsy-00763-5.wav", + BELLCORE_DIR "tr-tsy-00763-6.wav", + "" +}; + +const char *tone_names[20] = {NULL}; + +SNDFILE *inhandle; + +super_tone_rx_segment_t tone_segments[20][10]; + +super_tone_tx_step_t *dialtone_tree = NULL; +super_tone_tx_step_t *ringback_tree = NULL; +super_tone_tx_step_t *busytone_tree = NULL; +super_tone_tx_step_t *nutone_tree = NULL; +super_tone_tx_step_t *congestiontone_tree = NULL; +super_tone_tx_step_t *waitingtone_tree = NULL; + +#if defined(HAVE_LIBXML2) +static int parse_tone(super_tone_rx_descriptor_t *desc, int tone_id, super_tone_tx_step_t **tree, xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) +{ + xmlChar *x; + float f1; + float f2; + float f_tol; + float l1; + float l2; + float length; + float length_tol; + float recognition_length; + float recognition_length_tol; + int cycles; + super_tone_tx_step_t *treep; + int min_duration; + int max_duration; + + cur = cur->xmlChildrenNode; + while (cur) + { + if (xmlStrcmp(cur->name, (const xmlChar *) "step") == 0) + { + printf("Step - "); + /* Set some defaults */ + f1 = 0.0; + f2 = 0.0; + f_tol = 1.0; + l1 = -11.0; + l2 = -11.0; + length = 0.0; + length_tol = 10.0; + recognition_length = 0.0; + recognition_length_tol = 10.0; + cycles = 1; + if ((x = xmlGetProp(cur, (const xmlChar *) "freq"))) + { + sscanf((char *) x, "%f [%f%%]", &f1, &f_tol); + sscanf((char *) x, "%f+%f [%f%%]", &f1, &f2, &f_tol); + printf(" Frequency=%.2f+%.2f [%.2f%%]", f1, f2, f_tol); + } + if ((x = xmlGetProp(cur, (const xmlChar *) "level"))) + { + if (sscanf((char *) x, "%f+%f", &l1, &l2) < 2) + l2 = l1; + printf(" Level=%.2f+%.2f", l1, l2); + } + if ((x = xmlGetProp(cur, (const xmlChar *) "length"))) + { + sscanf((char *) x, "%f [%f%%]", &length, &length_tol); + printf(" Length=%.2f [%.2f%%]", length, length_tol); + } + if ((x = xmlGetProp(cur, (const xmlChar *) "recognition-length"))) + { + sscanf((char *) x, "%f [%f%%]", &recognition_length, &recognition_length_tol); + printf(" Recognition length=%.2f [%.2f%%]", recognition_length, recognition_length_tol); + } + if ((x = xmlGetProp(cur, (const xmlChar *) "cycles"))) + { + if (strcasecmp((char *) x, "endless") == 0) + cycles = 0; + else + cycles = atoi((char *) x); + printf(" Cycles='%d' ", cycles); + } + if ((x = xmlGetProp(cur, (const xmlChar *) "recorded-announcement"))) + printf(" Recorded announcement='%s'", x); + printf("\n"); + if (f1 || f2 || length) + { + /* TODO: This cannot handle cycling patterns */ + if (length == 0.0) + { + if (recognition_length) + min_duration = recognition_length*1000.0 + 0.5; + else + min_duration = 700; + max_duration = 0; + } + else + { + if (recognition_length) + min_duration = recognition_length*1000.0 + 0.5; + else + min_duration = (length*1000.0 + 0.5)*(1.0 - length_tol/100.0) - 30; + max_duration = (length*1000.0 + 0.5)*(1.0 + length_tol/100.0) + 30; + } + printf(">>>Detector element %10d %10d %10d %10d\n", (int) (f1 + 0.5), (int) (f2 + 0.5), min_duration, max_duration); + super_tone_rx_add_element(desc, tone_id, f1 + 0.5, f2 + 0.5, min_duration, max_duration); + } + treep = super_tone_tx_make_step(NULL, + f1, + l1, + f2, + l2, + length*1000.0 + 0.5, + cycles); + *tree = treep; + tree = &(treep->next); + parse_tone(desc, tone_id, &(treep->nest), doc, ns, cur); + } + /*endif*/ + cur = cur->next; + } + /*endwhile*/ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void parse_tone_set(super_tone_rx_descriptor_t *desc, xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) +{ + int tone_id; + + printf("Parsing tone set\n"); + cur = cur->xmlChildrenNode; + while (cur) + { + if (strcmp((char *) cur->name, "dial-tone") == 0) + { + printf("Hit %s\n", cur->name); + tone_id = super_tone_rx_add_tone(desc); + dialtone_tree = NULL; + parse_tone(desc, tone_id, &dialtone_tree, doc, ns, cur); + tone_names[tone_id] = "Dial tone"; + } + else if (strcmp((char *) cur->name, "ringback-tone") == 0) + { + printf("Hit %s\n", cur->name); + tone_id = super_tone_rx_add_tone(desc); + ringback_tree = NULL; + parse_tone(desc, tone_id, &ringback_tree, doc, ns, cur); + tone_names[tone_id] = "Ringback tone"; + } + else if (strcmp((char *) cur->name, "busy-tone") == 0) + { + printf("Hit %s\n", cur->name); + tone_id = super_tone_rx_add_tone(desc); + busytone_tree = NULL; + parse_tone(desc, tone_id, &busytone_tree, doc, ns, cur); + tone_names[tone_id] = "Busy tone"; + } + else if (strcmp((char *) cur->name, "number-unobtainable-tone") == 0) + { + printf("Hit %s\n", cur->name); + tone_id = super_tone_rx_add_tone(desc); + nutone_tree = NULL; + parse_tone(desc, tone_id, &nutone_tree, doc, ns, cur); + tone_names[tone_id] = "NU tone"; + } + else if (strcmp((char *) cur->name, "congestion-tone") == 0) + { + printf("Hit %s\n", cur->name); + tone_id = super_tone_rx_add_tone(desc); + congestiontone_tree = NULL; + parse_tone(desc, tone_id, &congestiontone_tree, doc, ns, cur); + tone_names[tone_id] = "Congestion tone"; + } + else if (strcmp((char *) cur->name, "waiting-tone") == 0) + { + printf("Hit %s\n", cur->name); + tone_id = super_tone_rx_add_tone(desc); + waitingtone_tree = NULL; + parse_tone(desc, tone_id, &waitingtone_tree, doc, ns, cur); + tone_names[tone_id] = "Waiting tone"; + } + /*endif*/ + cur = cur->next; + } + /*endwhile*/ +} +/*- End of function --------------------------------------------------------*/ + +static void get_tone_set(super_tone_rx_descriptor_t *desc, const char *tone_file, const char *set_id) +{ + xmlDocPtr doc; + xmlNsPtr ns; + xmlNodePtr cur; +#if 1 + xmlValidCtxt valid; +#endif + xmlChar *x; + + ns = NULL; + xmlKeepBlanksDefault(0); + xmlCleanupParser(); + if ((doc = xmlParseFile(tone_file)) == NULL) + { + fprintf(stderr, "No document\n"); + exit(2); + } + /*endif*/ + xmlXIncludeProcess(doc); +#if 1 + if (!xmlValidateDocument(&valid, doc)) + { + fprintf(stderr, "Invalid document\n"); + exit(2); + } + /*endif*/ +#endif + /* Check the document is of the right kind */ + if ((cur = xmlDocGetRootElement(doc)) == NULL) + { + fprintf(stderr, "Empty document\n"); + xmlFreeDoc(doc); + exit(2); + } + /*endif*/ + if (xmlStrcmp(cur->name, (const xmlChar *) "global-tones")) + { + fprintf(stderr, "Document of the wrong type, root node != global-tones"); + xmlFreeDoc(doc); + exit(2); + } + /*endif*/ + cur = cur->xmlChildrenNode; + while (cur && xmlIsBlankNode (cur)) + cur = cur->next; + /*endwhile*/ + if (cur == NULL) + exit(2); + /*endif*/ + while (cur) + { + if (xmlStrcmp(cur->name, (const xmlChar *) "tone-set") == 0) + { + if ((x = xmlGetProp(cur, (const xmlChar *) "uncode"))) + { + if (strcmp((char *) x, set_id) == 0) + parse_tone_set(desc, doc, ns, cur); + } + /*endif*/ + } + /*endif*/ + cur = cur->next; + } + /*endwhile*/ + xmlFreeDoc(doc); +} +/*- End of function --------------------------------------------------------*/ +#endif + +static void super_tone_rx_fill_descriptor(super_tone_rx_descriptor_t *desc) +{ + int tone_id; + + tone_id = super_tone_rx_add_tone(desc); + super_tone_rx_add_element(desc, tone_id, 400, 0, 700, 0); + tone_names[tone_id] = "XXX"; + + tone_id = super_tone_rx_add_tone(desc); + super_tone_rx_add_element(desc, tone_id, 1100, 0, 400, 600); + super_tone_rx_add_element(desc, tone_id, 0, 0, 2800, 3200); + tone_names[tone_id] = "FAX tone"; +} +/*- End of function --------------------------------------------------------*/ + +static void wakeup(void *data, int code, int level, int delay) +{ + if (code >= 0) + printf("Current tone is %d '%s' '%s'\n", code, (tone_names[code]) ? tone_names[code] : "???", (char *) data); + else + printf("Tone off '%s'\n", (char *) data); +} +/*- End of function --------------------------------------------------------*/ + +static void tone_segment(void *data, int f1, int f2, int duration) +{ + if (f1 < 0) + printf("Result %5d silence\n", duration); + else if (f2 < 0) + printf("Result %5d %4d\n", duration, f1); + else + printf("Result %5d %4d + %4d\n", duration, f1, f2); +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int x; + int16_t amp[8000]; + int sample; + int frames; + awgn_state_t noise_source; + super_tone_rx_state_t *super; + super_tone_rx_descriptor_t desc; + + if ((inhandle = sf_open_telephony_read(IN_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", IN_FILE_NAME); + exit(2); + } + super_tone_rx_make_descriptor(&desc); +#if defined(HAVE_LIBXML2) + get_tone_set(&desc, "../spandsp/global-tones.xml", (argc > 1) ? argv[1] : "hk"); +#endif + super_tone_rx_fill_descriptor(&desc); + if ((super = super_tone_rx_init(NULL, &desc, wakeup, (void *) "test")) == NULL) + { + printf(" Failed to create detector.\n"); + exit(2); + } + super_tone_rx_segment_callback(super, tone_segment); + awgn_init_dbm0(&noise_source, 1234567, -30.0f); + printf("Processing file\n"); + while ((frames = sf_readf_short(inhandle, amp, 8000))) + { + /* Add some noise to the signal for a more meaningful test. */ + //for (sample = 0; sample < frames; sample++) + // amp[sample] += saturate(amp[sample] + awgn (&noise_source)); + for (sample = 0; sample < frames; ) + { + x = super_tone_rx(super, amp + sample, frames - sample); + sample += x; + } + } + if (sf_close(inhandle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME); + exit(2); + } +#if 0 + /* Test for voice immunity */ + for (j = 0; bellcore_files[j][0]; j++) + { + if ((inhandle = sf_open_telephony_read(bellcore_files[j], 1)) == NULL) + { + printf(" Cannot open audio file '%s'\n", bellcore_files[j]); + exit(2); + } + while ((frames = sf_readf_short(inhandle, amp, 8000))) + { + for (sample = 0; sample < frames; ) + { + x = super_tone_rx(super, amp + sample, frames - sample); + sample += x; + } + } + if (sf_close(inhandle) != 0) + { + printf(" Cannot close speech file '%s'\n", bellcore_files[j]); + exit(2); + } + } +#endif + super_tone_rx_free(super); + printf("Done\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/super_tone_tx_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/super_tone_tx_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,303 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * super_tone_generate_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: super_tone_tx_tests.c,v 1.26 2009/05/30 15:23:14 steveu Exp $ + */ + +/*! \file */ + +/*! \page super_tone_tx_tests_page Supervisory tone generation tests +\section super_tone_tx_tests_page_sec_1 What does it do? +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(HAVE_LIBXML_XMLMEMORY_H) +#include +#endif +#if defined(HAVE_LIBXML_PARSER_H) +#include +#endif +#if defined(HAVE_LIBXML_XINCLUDE_H) +#include +#endif + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define OUT_FILE_NAME "super_tone.wav" + +SNDFILE *outhandle; + +super_tone_tx_step_t *tone_tree = NULL; + +static void play_tones(super_tone_tx_state_t *tone, int max_samples) +{ + int16_t amp[8000]; + int len; + int outframes; + int i; + int total_length; + + i = 500; + total_length = 0; + do + { + len = super_tone_tx(tone, amp, 160); + outframes = sf_writef_short(outhandle, amp, len); + if (outframes != len) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + total_length += len; + } + while (len > 0 && --i > 0); + printf("Tone length = %d samples (%dms)\n", total_length, total_length/8); +} +/*- End of function --------------------------------------------------------*/ + +#if defined(HAVE_LIBXML2) +static int parse_tone(super_tone_tx_step_t **tree, xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) +{ + xmlChar *x; + float f1; + float f2; + float f_tol; + float l1; + float l2; + float length; + float length_tol; + int cycles; + super_tone_tx_step_t *treep; + + cur = cur->xmlChildrenNode; + while (cur) + { + if (xmlStrcmp(cur->name, (const xmlChar *) "step") == 0) + { + printf("Step - "); + /* Set some defaults */ + f1 = 0.0; + f2 = 0.0; + f_tol = 1.0; + l1 = -11.0; + l2 = -11.0; + length = 0.0; + length_tol = 10.0; + cycles = 1; + if ((x = xmlGetProp(cur, (const xmlChar *) "freq"))) + { + sscanf((char *) x, "%f [%f%%]", &f1, &f_tol); + sscanf((char *) x, "%f+%f [%f%%]", &f1, &f2, &f_tol); + printf("Frequency=%.2f+%.2f [%.2f%%]", f1, f2, f_tol); + xmlFree(x); + } + if ((x = xmlGetProp(cur, (const xmlChar *) "level"))) + { + if (sscanf((char *) x, "%f+%f", &l1, &l2) < 2) + l2 = l1; + printf("Level=%.2f+%.2f", l1, l2); + xmlFree(x); + } + if ((x = xmlGetProp(cur, (const xmlChar *) "length"))) + { + sscanf((char *) x, "%f [%f%%]", &length, &length_tol); + printf("Length=%.2f [%.2f%%]", length, length_tol); + xmlFree(x); + } + if ((x = xmlGetProp(cur, (const xmlChar *) "recognition-length"))) + { + printf("Recognition length='%s'", x); + xmlFree(x); + } + if ((x = xmlGetProp(cur, (const xmlChar *) "cycles"))) + { + if (strcasecmp((char *) x, "endless") == 0) + cycles = 0; + else + cycles = atoi((char *) x); + printf("Cycles=%d ", cycles); + xmlFree(x); + } + if ((x = xmlGetProp(cur, (const xmlChar *) "recorded-announcement"))) + { + printf("Recorded announcement='%s'", x); + xmlFree(x); + } + printf("\n"); + treep = super_tone_tx_make_step(NULL, + f1, + l1, + f2, + l2, + length*1000.0 + 0.5, + cycles); + *tree = treep; + tree = &(treep->next); + parse_tone(&(treep->nest), doc, ns, cur); + } + /*endif*/ + cur = cur->next; + } + /*endwhile*/ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void parse_tone_set(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) +{ + super_tone_tx_state_t tone; + + printf("Parsing tone set\n"); + cur = cur->xmlChildrenNode; + while (cur) + { + if (strcmp((char *) cur->name + strlen((char *) cur->name) - 5, "-tone") == 0) + { + printf("Hit %s\n", cur->name); + tone_tree = NULL; + parse_tone(&tone_tree, doc, ns, cur); + super_tone_tx_init(&tone, tone_tree); +//printf("Len %p %p %d %d\n", (void *) tone.levels[0], (void *) tone_tree, tone_tree->length, tone_tree->tone); + play_tones(&tone, 99999999); + super_tone_tx_free_tone(tone_tree); + } + /*endif*/ + cur = cur->next; + } + /*endwhile*/ +} +/*- End of function --------------------------------------------------------*/ + +static void get_tone_set(const char *tone_file, const char *set_id) +{ + xmlDocPtr doc; + xmlNsPtr ns; + xmlNodePtr cur; +#if 0 + xmlValidCtxt valid; +#endif + xmlChar *x; + + ns = NULL; + xmlKeepBlanksDefault(0); + xmlCleanupParser(); + doc = xmlParseFile(tone_file); + if (doc == NULL) + { + fprintf(stderr, "No document\n"); + exit(2); + } + /*endif*/ + xmlXIncludeProcess(doc); +#if 0 + if (!xmlValidateDocument(&valid, doc)) + { + fprintf(stderr, "Invalid document\n"); + exit(2); + } + /*endif*/ +#endif + /* Check the document is of the right kind */ + if ((cur = xmlDocGetRootElement(doc)) == NULL) + { + fprintf(stderr, "Empty document\n"); + xmlFreeDoc(doc); + exit(2); + } + /*endif*/ + if (xmlStrcmp(cur->name, (const xmlChar *) "global-tones")) + { + fprintf(stderr, "Document of the wrong type, root node != global-tones"); + xmlFreeDoc(doc); + exit(2); + } + /*endif*/ + cur = cur->xmlChildrenNode; + while (cur && xmlIsBlankNode(cur)) + cur = cur->next; + /*endwhile*/ + if (cur == NULL) + exit(2); + /*endif*/ + while (cur) + { + if (xmlStrcmp(cur->name, (const xmlChar *) "tone-set") == 0) + { + if ((x = xmlGetProp(cur, (const xmlChar *) "uncode"))) + { + if (strcmp((char *) x, set_id) == 0) + parse_tone_set(doc, ns, cur); + /*endif*/ + xmlFree(x); + } + /*endif*/ + } + /*endif*/ + cur = cur->next; + } + /*endwhile*/ + xmlFreeDoc(doc); +} +/*- End of function --------------------------------------------------------*/ +#endif + +int main(int argc, char *argv[]) +{ + if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } +#if defined(HAVE_LIBXML2) + get_tone_set("../spandsp/global-tones.xml", (argc > 1) ? argv[1] : "hk"); +#endif + if (sf_close (outhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + printf("Done\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/swept_tone_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/swept_tone_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,101 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * swept_tone_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: swept_tone_tests.c,v 1.2 2009/09/22 13:28:18 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define OUTPUT_FILE_NAME "swept_tone.wav" + +#define BLOCK_LEN 160 + +int main(int argc, char *argv[]) +{ + int i; + int j; + int outframes; + int len; + SNDFILE *outhandle; + power_meter_t meter; + swept_tone_state_t *s; + int16_t buf[BLOCK_LEN]; + + power_meter_init(&meter, 10); + + if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + + printf("Test with swept tone.\n"); + s = swept_tone_init(NULL, 200.0f, 3900.0f, -10.0f, 60*SAMPLE_RATE, 1); + for (j = 0; j < 60*SAMPLE_RATE; j += BLOCK_LEN) + { + len = swept_tone(s, buf, BLOCK_LEN); + for (i = 0; i < len; i++) + power_meter_update(&meter, buf[i]); + outframes = sf_writef_short(outhandle, buf, len); + if (outframes != len) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } +#if 0 + printf("Current freq %.1fHz, Level is %fdBOv/%fdBm0\n", + swept_tone_current_frequency(s), + power_meter_current_dbov(&meter), + power_meter_current_dbm0(&meter)); +#else + printf("%.1f %f\n", + swept_tone_current_frequency(s), + power_meter_current_dbm0(&meter)); +#endif + } + + if (sf_close(outhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/t31_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/t31_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,950 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t31_tests.c - Tests for the T.31 modem. + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t31_tests.c,v 1.72 2009/05/30 15:23:14 steveu Exp $ + */ + +/*! \file */ + +/*! \page t31_tests_page T.31 tests +\section t31_tests_page_sec_1 What does it do? +*/ + +/* Enable the following definition to enable direct probing into the FAX structures */ +//#define WITH_SPANDSP_INTERNALS + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#if defined(HAVE_FL_FL_H) && defined(HAVE_FL_FL_CARTESIAN_H) && defined(HAVE_FL_FL_AUDIO_METER_H) +#define ENABLE_GUI +#endif + +#include +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp/t30_fcf.h" +#include "spandsp-sim.h" + +#if defined(ENABLE_GUI) +#include "media_monitor.h" +#endif +#include "fax_utils.h" + +#define INPUT_FILE_NAME "../test-data/itu/fax/itu1.tif" +#define OUTPUT_FILE_NAME "t31.tif" +#define OUTPUT_WAVE_FILE_NAME "t31_tests.wav" + +enum +{ + ETX = 0x03, + DLE = 0x10, + SUB = 0x1A +}; + +#define MANUFACTURER "www.soft-switch.org" + +#define SAMPLES_PER_CHUNK 160 + +struct command_response_s +{ + const char *command; + int len_command; + const char *response; + int len_response; +}; + +g1050_state_t *path_a_to_b; +g1050_state_t *path_b_to_a; + +double when = 0.0; + +#define EXCHANGE(a,b) {a, sizeof(a) - 1, b, sizeof(b) - 1} +#define RESPONSE(b) {"", 0, b, sizeof(b) - 1} +#define FAST_RESPONSE(b) {NULL, -1, b, sizeof(b) - 1} +#define FAST_SEND(b) {(const char *) 1, -2, b, sizeof(b) - 1} +#define FAST_SEND_TCF(b) {(const char *) 2, -2, b, sizeof(b) - 1} + +static const struct command_response_s fax_send_test_seq[] = +{ + EXCHANGE("ATE0\r", "ATE0\r\r\nOK\r\n"), + EXCHANGE("AT+FCLASS=1\r", "\r\nOK\r\n"), + EXCHANGE("ATD123456789\r", "\r\nCONNECT\r\n"), + // AT+FRH=3 is implied when dialing in the AT+FCLASS=1 state + //RESPONSE("\xFF\x03\x10\x03"), + //RESPONSE("\r\nOK\r\n"), + //EXCHANGE("AT+FRH=3\r", "\r\nCONNECT\r\n"), + // + RESPONSE("\xFF\x03\x40\x31\x31\x31\x31\x31\x31\x31\x31\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x1e\x46\x10\x03"), + RESPONSE("\r\nOK\r\n"), + EXCHANGE("AT+FRH=3\r", "\r\nCONNECT\r\n"), + // + RESPONSE("\xFF\x13\x80\x00\xEE\xF8\x80\x80\x91\x80\x80\x80\x18\x78\x57\x10\x03"), // For audio FAXing + //RESPONSE("\xFF\x13\x80\x04\xEE\xF8\x80\x80\x91\x80\x80\x80\x18\xE4\xE7\x10\x03"), // For T.38 FAXing + RESPONSE("\r\nOK\r\n"), + //EXCHANGE("AT+FRH=3\r", "\r\nNO CARRIER\r\n"), + EXCHANGE("AT+FTH=3\r", "\r\nCONNECT\r\n"), + // + EXCHANGE("\xFF\x03\x43\x32\x32\x32\x32\x32\x32\x32\x32\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x10\x03", "\r\nCONNECT\r\n"), + // + EXCHANGE("\xFF\x13\x83\x01\xC6\x80\x80\x80\x80\x01\xFD\x13\x10\x03", "\r\nOK\r\n"), + //Do a wait for timed silence at this point, or there won't be one in the tests + EXCHANGE("AT+FRS=7\r", "\r\nOK\r\n"), + //EXCHANGE("AT+FTS=8;+FTM=96\r", "\r\nCONNECT\r\n"), + EXCHANGE("AT+FTS=8\r", "\r\nOK\r\n"), + EXCHANGE("AT+FTM=96\r", "\r\nCONNECT\r\n"), + // + FAST_SEND_TCF("\r\nOK\r\n"), + EXCHANGE("AT+FRH=3\r", "\r\nCONNECT\r\n"), + // + RESPONSE("\xFF\x13\x84\xEA\x7D\x10\x03"), + RESPONSE("\r\nOK\r\n"), + EXCHANGE("AT+FTM=96\r", "\r\nCONNECT\r\n"), + // + FAST_SEND("\r\nOK\r\n"), + //EXCHANGE("AT+FTS=8;+FTH=3\r", "\r\nCONNECT\r\n"), + EXCHANGE("AT+FTS=8\r", "\r\nOK\r\n"), + EXCHANGE("AT+FTH=3\r", "\r\nCONNECT\r\n"), + // + EXCHANGE("\xFF\x13\x2E\x10\x03", "\r\nOK\r\n"), + EXCHANGE("AT+FRH=3\r", "\r\nCONNECT\r\n"), + // + RESPONSE("\xFF\x13\x8C\xA2\xF1\x10\x03"), + RESPONSE("\r\nOK\r\n"), + EXCHANGE("AT+FTH=3\r", "\r\nCONNECT\r\n"), + // + EXCHANGE("\xFF\x13\xFB\x10\x03", "\r\nOK\r\n"), + EXCHANGE("ATH0\r", "\r\nOK\r\n") +}; + +static const struct command_response_s fax_receive_test_seq[] = +{ + EXCHANGE("ATE0\r", "ATE0\r\r\nOK\r\n"), + EXCHANGE("AT+FCLASS=1\r", "\r\nOK\r\n"), + RESPONSE("\r\nRING\r\n"), + EXCHANGE("ATA\r", "\r\nCONNECT\r\n"), + // + EXCHANGE("\xFF\x03\x40\x32\x32\x32\x32\x32\x32\x32\x32\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x10\x03", "\r\nCONNECT\r\n"), + // + EXCHANGE("\xFF\x13\x80\x01\xCE\xF4\x80\x80\x81\x80\x80\x80\x18\x10\x03", "\r\nOK\r\n"), + EXCHANGE("AT+FRH=3\r", "\r\nCONNECT\r\n"), + // + RESPONSE("\xFF\x03\x43\x31\x31\x31\x31\x31\x31\x31\x31\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\xAA\x1F\x10\x03"), + RESPONSE("\r\nOK\r\n"), + EXCHANGE("AT+FRH=3\r", "\r\nCONNECT\r\n"), + // + RESPONSE("\xFF\x13\x83\x00\xC6\x74\x53\x00\x10\x03"), + RESPONSE("\r\nOK\r\n"), + EXCHANGE("AT+FRM=96\r", "\r\nCONNECT\r\n"), + // + FAST_RESPONSE(NULL), + RESPONSE("\r\nNO CARRIER\r\n"), + EXCHANGE("AT+FTH=3\r", "\r\nCONNECT\r\n"), + // + EXCHANGE("\xFF\x13\x84\x10\x03", "\r\nOK\r\n"), + EXCHANGE("AT+FRM=96\r", "\r\nCONNECT\r\n"), + // + FAST_RESPONSE(NULL), + RESPONSE("\r\nNO CARRIER\r\n"), + EXCHANGE("AT+FRH=3\r", "\r\nCONNECT\r\n"), + // + RESPONSE("\xFF\x13\x2F\x33\x66\x10\x03"), + RESPONSE("\r\nOK\r\n"), + EXCHANGE("AT+FTH=3\r", "\r\nCONNECT\r\n"), + // + EXCHANGE("\xFF\x13\x8C\x10\x03", "\r\nOK\r\n"), + EXCHANGE("AT+FRH=3\r", "\r\nCONNECT\r\n"), + // + RESPONSE("\xFF\x13\xfb\x9a\xf6\x10\x03"), + RESPONSE("\r\nOK\r\n"), + EXCHANGE("ATH0\r", "\r\nOK\r\n") +}; + +char *decode_test_file = NULL; +int countdown = 0; +int command_response_test_step = -1; +char response_buf[1000]; +int response_buf_ptr = 0; +int answered = FALSE; +int kick = FALSE; +int dled = FALSE; +int done = FALSE; + +static const struct command_response_s *fax_test_seq; + +int test_seq_ptr = 0; + +t31_state_t *t31_state; + +static int phase_b_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + char tag[20]; + + i = (int) (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase B:", i); + printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result)); + log_rx_parameters(s, tag); + return T30_ERR_OK; +} +/*- End of function --------------------------------------------------------*/ + +static int phase_d_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + char tag[20]; + + i = (int) (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase D:", i); + printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result)); + log_transfer_statistics(s, tag); + log_tx_parameters(s, tag); + log_rx_parameters(s, tag); + return T30_ERR_OK; +} +/*- End of function --------------------------------------------------------*/ + +static void phase_e_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + char tag[20]; + + i = (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase E:", i); + printf("Phase E handler on channel %c\n", i); + log_transfer_statistics(s, tag); + log_tx_parameters(s, tag); + log_rx_parameters(s, tag); + //exit(0); +} +/*- End of function --------------------------------------------------------*/ + +static int modem_call_control(t31_state_t *s, void *user_data, int op, const char *num) +{ + switch (op) + { + case AT_MODEM_CONTROL_ANSWER: + printf("\nModem control - Answering\n"); + answered = TRUE; + break; + case AT_MODEM_CONTROL_CALL: + printf("\nModem control - Dialing '%s'\n", num); + t31_call_event(t31_state, AT_CALL_EVENT_CONNECTED); + break; + case AT_MODEM_CONTROL_HANGUP: + printf("\nModem control - Hanging up\n"); + done = TRUE; + break; + case AT_MODEM_CONTROL_OFFHOOK: + printf("\nModem control - Going off hook\n"); + break; + case AT_MODEM_CONTROL_DTR: + printf("\nModem control - DTR %d\n", (int) (intptr_t) num); + break; + case AT_MODEM_CONTROL_RTS: + printf("\nModem control - RTS %d\n", (int) (intptr_t) num); + break; + case AT_MODEM_CONTROL_CTS: + printf("\nModem control - CTS %d\n", (int) (intptr_t) num); + break; + case AT_MODEM_CONTROL_CAR: + printf("\nModem control - CAR %d\n", (int) (intptr_t) num); + break; + case AT_MODEM_CONTROL_RNG: + printf("\nModem control - RNG %d\n", (int) (intptr_t) num); + break; + case AT_MODEM_CONTROL_DSR: + printf("\nModem control - DSR %d\n", (int) (intptr_t) num); + break; + default: + printf("\nModem control - operation %d\n", op); + break; + } + /*endswitch*/ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int at_tx_handler(at_state_t *s, void *user_data, const uint8_t *buf, size_t len) +{ + size_t i; + + i = 0; + if (fax_test_seq[test_seq_ptr].command == NULL) + { + /* TCF or non-ECM image data expected */ + for ( ; i < len; i++) + { + if (dled) + { + if (buf[i] == ETX) + { + printf("\nFast data ended\n"); + response_buf_ptr = 0; + response_buf[response_buf_ptr] = '\0'; + test_seq_ptr++; + if (fax_test_seq[test_seq_ptr].command) + kick = TRUE; + break; + } + dled = FALSE; + } + else + { + if (buf[i] == DLE) + dled = TRUE; + } + } + i++; + if (i >= len) + return 0; + } + for ( ; i < len; i++) + { + response_buf[response_buf_ptr++] = buf[i]; + putchar(buf[i]); + } + response_buf[response_buf_ptr] = '\0'; + printf("Expected "); + for (i = 0; i < response_buf_ptr; i++) + printf("%02x ", fax_test_seq[test_seq_ptr].response[i] & 0xFF); + printf("\n"); + printf("Response "); + for (i = 0; i < response_buf_ptr; i++) + printf("%02x ", response_buf[i] & 0xFF); + printf("\n"); +printf("Match %d against %d\n", response_buf_ptr, fax_test_seq[test_seq_ptr].len_response); + if (response_buf_ptr >= fax_test_seq[test_seq_ptr].len_response + && + memcmp(fax_test_seq[test_seq_ptr].response, response_buf, fax_test_seq[test_seq_ptr].len_response) == 0) + { + printf("\nMatched\n"); + test_seq_ptr++; + response_buf_ptr = 0; + response_buf[response_buf_ptr] = '\0'; + if (fax_test_seq[test_seq_ptr].command) + kick = TRUE; + else + dled = FALSE; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count) +{ + t31_state_t *t; + int i; + + /* This routine queues messages between two instances of T.38 processing */ + t = (t31_state_t *) user_data; + span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d, count %d\n", s->tx_seq_no, len, count); + + for (i = 0; i < count; i++) + { + if (g1050_put(path_a_to_b, buf, len, s->tx_seq_no, when) < 0) + printf("Lost packet %d\n", s->tx_seq_no); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int t31_tx_packet_handler(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count) +{ + //t38_terminal_state_t *t; + int i; + + /* This routine queues messages between two instances of T.38 processing */ + //t = (t38_terminal_state_t *) user_data; + span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d, count %d\n", s->tx_seq_no, len, count); + + for (i = 0; i < count; i++) + { + if (g1050_put(path_b_to_a, buf, len, s->tx_seq_no, when) < 0) + printf("Lost packet %d\n", s->tx_seq_no); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int t38_tests(int use_gui, int test_sending, int model_no, int speed_pattern_no) +{ + t38_terminal_state_t *t38_state; + int fast_send; + int fast_send_tcf; + int fast_blocks; + uint8_t fast_buf[1000]; + int msg_len; + uint8_t msg[1024]; + int t38_version; + int without_pacing; + int use_tep; + int seq_no; + double tx_when; + double rx_when; + t30_state_t *t30; + t38_core_state_t *t38_core; + logging_state_t *logging; + int i; + + t38_version = 1; + without_pacing = FALSE; + use_tep = FALSE; + + srand48(0x1234567); + if ((path_a_to_b = g1050_init(model_no, speed_pattern_no, 100, 33)) == NULL) + { + fprintf(stderr, "Failed to start IP network path model\n"); + exit(2); + } + if ((path_b_to_a = g1050_init(model_no, speed_pattern_no, 100, 33)) == NULL) + { + fprintf(stderr, "Failed to start IP network path model\n"); + exit(2); + } + if ((t31_state = t31_init(NULL, at_tx_handler, NULL, modem_call_control, NULL, t31_tx_packet_handler, NULL)) == NULL) + { + fprintf(stderr, " Cannot start the T.31 T.38 modem\n"); + exit(2); + } + logging = t31_get_logging_state(t31_state); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.31"); + + t38_core = t31_get_t38_core_state(t31_state); + span_log_set_level(&t38_core->logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(&t38_core->logging, "T.31"); + + span_log_set_level(&t31_state->at_state.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(&t31_state->at_state.logging, "T.31"); + + t31_set_mode(t31_state, TRUE); + t38_set_t38_version(t38_core, t38_version); + + if (test_sending) + { + if ((t38_state = t38_terminal_init(NULL, FALSE, t38_tx_packet_handler, t31_state)) == NULL) + { + fprintf(stderr, "Cannot start the T.38 channel\n"); + exit(2); + } + t30 = t38_terminal_get_t30_state(t38_state); + t30_set_rx_file(t30, OUTPUT_FILE_NAME, -1); + fax_test_seq = fax_send_test_seq; + countdown = 0; + } + else + { + if ((t38_state = t38_terminal_init(NULL, TRUE, t38_tx_packet_handler, t31_state)) == NULL) + { + fprintf(stderr, "Cannot start the T.38 channel\n"); + exit(2); + } + t30 = t38_terminal_get_t30_state(t38_state); + t30_set_tx_file(t30, INPUT_FILE_NAME, -1, -1); + fax_test_seq = fax_receive_test_seq; + countdown = 250; + } + + t30 = t38_terminal_get_t30_state(t38_state); + t38_core = t38_terminal_get_t38_core_state(t38_state); + t38_set_t38_version(t38_core, t38_version); + t38_terminal_set_config(t38_state, without_pacing); + t38_terminal_set_tep_mode(t38_state, use_tep); + + t30_set_tx_ident(t30, "11111111"); + t30_set_supported_modems(t30, T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17); + //t30_set_tx_nsf(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp\x00", 12); + t30_set_phase_b_handler(t30, phase_b_handler, (void *) 'A'); + t30_set_phase_d_handler(t30, phase_d_handler, (void *) 'A'); + t30_set_phase_e_handler(t30, phase_e_handler, (void *) 'A'); + + logging = t38_terminal_get_logging_state(t38_state); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38"); + + t38_core = t38_terminal_get_t38_core_state(t38_state); + span_log_set_level(&t38_core->logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(&t38_core->logging, "T.38"); + + logging = t30_get_logging_state(t30); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38"); + + fast_send = FALSE; + fast_send_tcf = TRUE; + fast_blocks = 0; + kick = TRUE; +#if defined(ENABLE_GUI) + if (use_gui) + start_media_monitor(); +#endif + while (!done) + { + logging = t38_terminal_get_logging_state(t38_state); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + t38_core = t38_terminal_get_t38_core_state(t38_state); + logging = t38_core_get_logging_state(t38_core); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + t30 = t38_terminal_get_t30_state(t38_state); + logging = t30_get_logging_state(t30); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + + logging = t31_get_logging_state(t31_state); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + t38_core = t31_get_t38_core_state(t31_state); + logging = t38_core_get_logging_state(t38_core); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + span_log_bump_samples(&t31_state->at_state.logging, SAMPLES_PER_CHUNK); + + t38_terminal_send_timeout(t38_state, SAMPLES_PER_CHUNK); + t31_t38_send_timeout(t31_state, SAMPLES_PER_CHUNK); + + when += (float) SAMPLES_PER_CHUNK/(float) SAMPLE_RATE; + + if (kick) + { + kick = FALSE; + if (fax_test_seq[test_seq_ptr].command > (const char *) 2) + { + if (fax_test_seq[test_seq_ptr].command[0]) + { + printf("%s\n", fax_test_seq[test_seq_ptr].command); + t31_at_rx(t31_state, fax_test_seq[test_seq_ptr].command, fax_test_seq[test_seq_ptr].len_command); + } + } + else + { + if (fax_test_seq[test_seq_ptr].command == (const char *) 2) + { + printf("Fast send TCF\n"); + fast_send = TRUE; + fast_send_tcf = TRUE; + fast_blocks = 100; + } + else + { + printf("Fast send image\n"); + fast_send = TRUE; + fast_send_tcf = FALSE; + fast_blocks = 100; + } + } + } + if (fast_send) + { + /* Send fast modem data */ + if (fast_send_tcf) + { + memset(fast_buf, 0, 36); + } + else + { + if (fast_blocks == 1) + { + /* Create the end of page condition */ + for (i = 0; i < 36; i += 2) + { + fast_buf[i] = 0x00; + fast_buf[i + 1] = 0x80; + } + } + else + { + /* Create a chunk of white page */ + for (i = 0; i < 36; i += 4) + { + fast_buf[i] = 0x00; + fast_buf[i + 1] = 0x80; + fast_buf[i + 2] = 0xB2; + fast_buf[i + 3] = 0x01; + } + } + } + if (fast_blocks == 1) + { + /* Insert EOLs */ + fast_buf[35] = ETX; + fast_buf[34] = DLE; + fast_buf[31] = + fast_buf[28] = + fast_buf[25] = + fast_buf[22] = + fast_buf[19] = + fast_buf[16] = 1; + } + t31_at_rx(t31_state, (char *) fast_buf, 36); + if (--fast_blocks == 0) + fast_send = FALSE; + } + if (countdown) + { + if (answered) + { + countdown = 0; + t31_call_event(t31_state, AT_CALL_EVENT_ANSWERED); + } + else if (--countdown == 0) + { + t31_call_event(t31_state, AT_CALL_EVENT_ALERTING); + countdown = 250; + } + } + while ((msg_len = g1050_get(path_a_to_b, msg, 1024, when, &seq_no, &tx_when, &rx_when)) >= 0) + { +#if defined(ENABLE_GUI) + if (use_gui) + media_monitor_rx(seq_no, tx_when, rx_when); +#endif + t38_core = t31_get_t38_core_state(t31_state); + t38_core_rx_ifp_packet(t38_core, msg, msg_len, seq_no); + } + while ((msg_len = g1050_get(path_b_to_a, msg, 1024, when, &seq_no, &tx_when, &rx_when)) >= 0) + { +#if defined(ENABLE_GUI) + if (use_gui) + media_monitor_rx(seq_no, tx_when, rx_when); +#endif + t38_core = t38_terminal_get_t38_core_state(t38_state); + t38_core_rx_ifp_packet(t38_core, msg, msg_len, seq_no); + } +#if defined(ENABLE_GUI) + if (use_gui) + media_monitor_update_display(); +#endif + } + t38_terminal_release(t38_state); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int t30_tests(int log_audio, int test_sending) +{ + int k; + int outframes; + fax_state_t *fax_state; + int16_t t30_amp[SAMPLES_PER_CHUNK]; + int16_t t31_amp[SAMPLES_PER_CHUNK]; + int16_t silence[SAMPLES_PER_CHUNK]; + int16_t out_amp[2*SAMPLES_PER_CHUNK]; + int t30_len; + int t31_len; + SNDFILE *wave_handle; + SNDFILE *in_handle; + int fast_send; + int fast_send_tcf; + int fast_blocks; + uint8_t fast_buf[1000]; + t30_state_t *t30; + logging_state_t *logging; + int i; + + wave_handle = NULL; + if (log_audio) + { + if ((wave_handle = sf_open_telephony_write(OUTPUT_WAVE_FILE_NAME, 2)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_WAVE_FILE_NAME); + exit(2); + } + } + + memset(silence, 0, sizeof(silence)); + + in_handle = NULL; + if (decode_test_file) + { + if ((in_handle = sf_open_telephony_read(decode_test_file, 1)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", decode_test_file); + exit(2); + } + } + + if ((t31_state = t31_init(NULL, at_tx_handler, NULL, modem_call_control, NULL, NULL, NULL)) == NULL) + { + fprintf(stderr, " Cannot start the T.31 FAX modem\n"); + exit(2); + } + logging = t31_get_logging_state(t31_state); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.31"); + + if (test_sending) + { + fax_state = fax_init(NULL, FALSE); + t30 = fax_get_t30_state(fax_state); + t30_set_rx_file(t30, OUTPUT_FILE_NAME, -1); + fax_test_seq = fax_send_test_seq; + countdown = 0; + } + else + { + fax_state = fax_init(NULL, TRUE); + t30 = fax_get_t30_state(fax_state); + t30_set_tx_file(t30, INPUT_FILE_NAME, -1, -1); + fax_test_seq = fax_receive_test_seq; + countdown = 250; + } + + t30_set_tx_ident(t30, "11111111"); + t30_set_supported_modems(t30, T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17); + t30_set_phase_b_handler(t30, phase_b_handler, (void *) 'A'); + t30_set_phase_d_handler(t30, phase_d_handler, (void *) 'A'); + t30_set_phase_e_handler(t30, phase_e_handler, (void *) 'A'); + memset(t30_amp, 0, sizeof(t30_amp)); + + logging = t30_get_logging_state(t30); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "FAX"); + + logging = fax_get_logging_state(fax_state); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "FAX"); + + fast_send = FALSE; + fast_send_tcf = TRUE; + fast_blocks = 0; + kick = TRUE; + while (!done) + { + if (kick) + { + kick = FALSE; + if (fax_test_seq[test_seq_ptr].command > (const char *) 2) + { + if (fax_test_seq[test_seq_ptr].command[0]) + { + printf("%s\n", fax_test_seq[test_seq_ptr].command); + t31_at_rx(t31_state, fax_test_seq[test_seq_ptr].command, fax_test_seq[test_seq_ptr].len_command); + } + } + else + { + if (fax_test_seq[test_seq_ptr].command == (const char *) 2) + { + printf("Fast send TCF\n"); + fast_send = TRUE; + fast_send_tcf = TRUE; + fast_blocks = 100; + } + else + { + printf("Fast send image\n"); + fast_send = TRUE; + fast_send_tcf = FALSE; + fast_blocks = 100; + } + } + } + if (fast_send) + { + /* Send fast modem data */ + if (fast_send_tcf) + { + memset(fast_buf, 0, 36); + } + else + { + if (fast_blocks == 1) + { + /* Create the end of page condition */ + for (i = 0; i < 36; i += 2) + { + fast_buf[i] = 0x00; + fast_buf[i + 1] = 0x80; + } + } + else + { + /* Create a chunk of white page */ + for (i = 0; i < 36; i += 4) + { + fast_buf[i] = 0x00; + fast_buf[i + 1] = 0x80; + fast_buf[i + 2] = 0xB2; + fast_buf[i + 3] = 0x01; + } + } + } + if (fast_blocks == 1) + { + /* Insert EOLs */ + fast_buf[35] = ETX; + fast_buf[34] = DLE; + fast_buf[31] = + fast_buf[28] = + fast_buf[25] = + fast_buf[22] = + fast_buf[19] = + fast_buf[16] = 1; + } + t31_at_rx(t31_state, (char *) fast_buf, 36); + if (--fast_blocks == 0) + fast_send = FALSE; + } + t30_len = fax_tx(fax_state, t30_amp, SAMPLES_PER_CHUNK); + /* The receive side always expects a full block of samples, but the + transmit side may not be sending any when it doesn't need to. We + may need to pad with some silence. */ + if (t30_len < SAMPLES_PER_CHUNK) + { + memset(t30_amp + t30_len, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - t30_len)); + t30_len = SAMPLES_PER_CHUNK; + } + if (log_audio) + { + for (k = 0; k < t30_len; k++) + out_amp[2*k] = t30_amp[k]; + } + if (t31_rx(t31_state, t30_amp, t30_len)) + break; + if (countdown) + { + if (answered) + { + countdown = 0; + t31_call_event(t31_state, AT_CALL_EVENT_ANSWERED); + } + else if (--countdown == 0) + { + t31_call_event(t31_state, AT_CALL_EVENT_ALERTING); + countdown = 250; + } + } + + t31_len = t31_tx(t31_state, t31_amp, SAMPLES_PER_CHUNK); + if (t31_len < SAMPLES_PER_CHUNK) + { + memset(t31_amp + t31_len, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - t31_len)); + t31_len = SAMPLES_PER_CHUNK; + } + if (log_audio) + { + for (k = 0; k < t31_len; k++) + out_amp[2*k + 1] = t31_amp[k]; + } + if (fax_rx(fax_state, t31_amp, SAMPLES_PER_CHUNK)) + break; + + span_log_bump_samples(&fax_state->logging, SAMPLES_PER_CHUNK); + span_log_bump_samples(&t30->logging, SAMPLES_PER_CHUNK); + + if (log_audio) + { + outframes = sf_writef_short(wave_handle, out_amp, SAMPLES_PER_CHUNK); + if (outframes != SAMPLES_PER_CHUNK) + break; + } + } + if (decode_test_file) + { + if (sf_close(in_handle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", decode_test_file); + exit(2); + } + } + if (log_audio) + { + if (sf_close(wave_handle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_WAVE_FILE_NAME); + exit(2); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int log_audio; + int t38_mode; + int test_sending; + int use_gui; + int opt; + + decode_test_file = NULL; + log_audio = FALSE; + test_sending = FALSE; + t38_mode = FALSE; + use_gui = FALSE; + while ((opt = getopt(argc, argv, "d:glrst")) != -1) + { + switch (opt) + { + case 'd': + decode_test_file = optarg; + break; + case 'g': +#if defined(ENABLE_GUI) + use_gui = TRUE; +#else + fprintf(stderr, "Graphical monitoring not available\n"); + exit(2); +#endif + break; + case 'l': + log_audio = TRUE; + break; + case 'r': + test_sending = FALSE; + break; + case 's': + test_sending = TRUE; + break; + case 't': + t38_mode = TRUE; + break; + default: + //usage(); + exit(2); + break; + } + } + + if (t38_mode) + t38_tests(use_gui, test_sending, 0, 1); + else + t30_tests(log_audio, test_sending); + if (done) + { + printf("Tests passed\n"); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/t38_core_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/t38_core_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,303 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t38_core_tests.c - Tests for the T.38 FoIP core module. + * + * Written by Steve Underwood + * + * Copyright (C) 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t38_core_tests.c,v 1.16 2009/07/14 13:54:22 steveu Exp $ + */ + +/*! \file */ + +/*! \page t38_core_tests_page T.38 core tests +\section t38_core_tests_page_sec_1 What does it do? +These tests exercise the T.38 core ASN.1 processing code. +*/ + +#if defined(HAVE_CONFIG_H) +#include +#endif + +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" + +#define MAX_FIELDS 42 +#define MAX_FIELD_LEN 8192 + +int t38_version; +int succeeded = TRUE; +int ok_indicator_packets; +int bad_indicator_packets; +int ok_data_packets; +int bad_data_packets; +int missing_packets; + +int current_indicator; +int current_data_type; +int current_field_type; +int skip; + +uint8_t field_body[MAX_FIELDS][MAX_FIELD_LEN]; +int field_len[MAX_FIELDS]; + +static int rx_missing_handler(t38_core_state_t *s, void *user_data, int rx_seq_no, int expected_seq_no) +{ + missing_packets++; + //printf("Hit missing\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int rx_indicator_handler(t38_core_state_t *s, void *user_data, int indicator) +{ + if (indicator == current_indicator) + ok_indicator_packets++; + else + bad_indicator_packets++; + //printf("Hit indicator %d\n", indicator); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int rx_data_handler(t38_core_state_t *s, void *user_data, int data_type, int field_type, const uint8_t *buf, int len) +{ + if (--skip >= 0) + { + if (data_type == current_data_type && field_type == current_field_type) + ok_data_packets++; + else + bad_data_packets++; + } + else + { + if (data_type == current_data_type && field_type == T38_FIELD_T4_NON_ECM_SIG_END) + ok_data_packets++; + else + bad_data_packets++; + } + //printf("Hit data %d, field %d\n", data_type, field_type); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int tx_packet_handler(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count) +{ + t38_core_state_t *t; + static int seq_no = 0; + + t = (t38_core_state_t *) user_data; + span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d, count %d\n", s->tx_seq_no, len, count); + if (t38_core_rx_ifp_packet(t, buf, len, seq_no) < 0) + succeeded = FALSE; + seq_no++; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int encode_decode_tests(t38_core_state_t *a, t38_core_state_t *b) +{ + t38_data_field_t field[MAX_FIELDS]; + int i; + int j; + + ok_indicator_packets = 0; + bad_indicator_packets = 0; + ok_data_packets = 0; + bad_data_packets = 0; + missing_packets = 0; + + /* Try all the indicator types */ + for (i = 0; i < 100; i++) + { + current_indicator = i; + if (t38_core_send_indicator(a, i) < 0) + break; + } + + /* Try all the data types, as single field messages with no data */ + for (i = 0; i < 100; i++) + { + for (j = 0; j < 100; j++) + { + current_data_type = i; + current_field_type = j; + skip = 99; + if (t38_core_send_data(a, i, j, (uint8_t *) "", 0, T38_PACKET_CATEGORY_CONTROL_DATA) < 0) + break; + } + if (j == 0) + break; + } + + /* Try all the data types and field types, as single field messages with data */ + for (i = 0; i < 100; i++) + { + for (j = 0; j < 100; j++) + { + current_data_type = i; + current_field_type = j; + skip = 99; + if (t38_core_send_data(a, i, j, (uint8_t *) "ABCD", 4, T38_PACKET_CATEGORY_CONTROL_DATA) < 0) + break; + } + if (j == 0) + break; + } + + /* Try all the data types and field types, as multi-field messages */ + for (i = 0; i < 100; i++) + { + for (j = 0; j < 100; j++) + { + current_data_type = i; + current_field_type = j; + skip = 1; + + field_len[0] = 444; + field_len[1] = 333; + + field[0].field_type = j; + field[0].field = field_body[0]; + field[0].field_len = field_len[0]; + field[1].field_type = T38_FIELD_T4_NON_ECM_SIG_END; + field[1].field = field_body[1]; + field[1].field_len = field_len[1]; + if (t38_core_send_data_multi_field(a, i, field, 2, T38_PACKET_CATEGORY_CONTROL_DATA) < 0) + break; + } + if (j == 0) + break; + } + printf("Indicator packets: OK = %d, bad = %d\n", ok_indicator_packets, bad_indicator_packets); + printf("Data packets: OK = %d, bad = %d\n", ok_data_packets, bad_data_packets); + printf("Missing packets = %d\n", missing_packets); + if (t38_version == 0) + { + if (ok_indicator_packets != 16 || bad_indicator_packets != 0) + { + printf("Tests failed\n"); + return -1; + } + if (ok_data_packets != 288 || bad_data_packets != 0) + { + printf("Tests failed\n"); + return -1; + } + } + else + { + if (ok_indicator_packets != 23 || bad_indicator_packets != 0) + { + printf("Tests failed\n"); + return -1; + } + if (ok_data_packets != 720 || bad_data_packets != 0) + { + printf("Tests failed\n"); + return -1; + } + } + if (missing_packets > 0) + { + printf("Tests failed\n"); + return -1; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int attack_tests(t38_core_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + t38_core_state_t t38_core_a; + t38_core_state_t t38_core_b; + + for (t38_version = 0; t38_version < 2; t38_version++) + { + printf("Using T.38 version %d\n", t38_version); + + if (t38_core_init(&t38_core_a, + rx_indicator_handler, + rx_data_handler, + rx_missing_handler, + &t38_core_b, + tx_packet_handler, + &t38_core_b) == NULL) + { + fprintf(stderr, "Cannot start the T.38 core\n"); + exit(2); + } + if (t38_core_init(&t38_core_b, + rx_indicator_handler, + rx_data_handler, + rx_missing_handler, + &t38_core_a, + tx_packet_handler, + &t38_core_a) == NULL) + { + fprintf(stderr, "Cannot start the T.38 core\n"); + exit(2); + } + + t38_set_t38_version(&t38_core_a, t38_version); + t38_set_t38_version(&t38_core_b, t38_version); + + span_log_set_level(&t38_core_a.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG); + span_log_set_tag(&t38_core_a.logging, "T.38-A"); + span_log_set_level(&t38_core_b.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG); + span_log_set_tag(&t38_core_b.logging, "T.38-B"); + + if (encode_decode_tests(&t38_core_a, &t38_core_b)) + { + printf("Encode/decode tests failed\n"); + exit(2); + } + if (attack_tests(&t38_core_a)) + { + printf("Attack tests failed\n"); + exit(2); + } + } + if (!succeeded) + { + printf("Tests failed\n"); + exit(2); + } + printf("Tests passed\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/t38_gateway_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/t38_gateway_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,645 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t38_gateway_tests.c - Tests for the T.38 FoIP gateway module. + * + * Written by Steve Underwood + * + * Copyright (C) 2005, 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t38_gateway_tests.c,v 1.82.4.1 2009/12/19 09:47:57 steveu Exp $ + */ + +/*! \file */ + +/*! \page t38_gateway_tests_page T.38 gateway tests +\section t38_gateway_tests_page_sec_1 What does it do? +These tests exercise the path + + FAX machine <-> T.38 gateway <-> T.38 gateway <-> FAX machine +*/ + +/* Enable the following definition to enable direct probing into the FAX structures */ +//#define WITH_SPANDSP_INTERNALS + +#if defined(HAVE_CONFIG_H) +#include +#endif + +#if defined(HAVE_FL_FL_H) && defined(HAVE_FL_FL_CARTESIAN_H) && defined(HAVE_FL_FL_AUDIO_METER_H) +#define ENABLE_GUI +#endif + +#include +#include +#include +#include +#include +#include +#include +#if !defined(_WIN32) +#include +#endif + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#if defined(ENABLE_GUI) +#include "media_monitor.h" +#endif +#include "fax_utils.h" + +#define SAMPLES_PER_CHUNK 160 + +#define INPUT_FILE_NAME "../test-data/itu/fax/itutests.tif" +#define OUTPUT_FILE_NAME "t38.tif" +#define OUTPUT_FILE_NAME_WAVE "t38_gateway.wav" +#define OUTPUT_FILE_NAME_T30A "t38_gateway_t30a.wav" +#define OUTPUT_FILE_NAME_T38A "t38_gateway_t38a.wav" +#define OUTPUT_FILE_NAME_T30B "t38_gateway_t30b.wav" +#define OUTPUT_FILE_NAME_T38B "t38_gateway_t38b.wav" + +fax_state_t *fax_state_a; +t38_gateway_state_t *t38_state_a; +t38_gateway_state_t *t38_state_b; +fax_state_t *fax_state_b; + +g1050_state_t *path_a_to_b; +g1050_state_t *path_b_to_a; + +double when = 0.0; + +int done[2] = {FALSE, FALSE}; +int succeeded[2] = {FALSE, FALSE}; + +int simulate_incrementing_repeats = FALSE; + +static int phase_b_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + char tag[20]; + + i = (int) (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase B", i); + printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result)); + log_rx_parameters(s, tag); + return T30_ERR_OK; +} +/*- End of function --------------------------------------------------------*/ + +static int phase_d_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + char tag[20]; + + i = (int) (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase D", i); + printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result)); + log_transfer_statistics(s, tag); + log_tx_parameters(s, tag); + log_rx_parameters(s, tag); + return T30_ERR_OK; +} +/*- End of function --------------------------------------------------------*/ + +static void phase_e_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + t30_stats_t t; + char tag[20]; + + i = (int) (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase E", i); + printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result)); + log_transfer_statistics(s, tag); + log_tx_parameters(s, tag); + log_rx_parameters(s, tag); + t30_get_transfer_statistics(s, &t); + succeeded[i - 'A'] = (result == T30_ERR_OK) && (t.pages_tx == 12 || t.pages_rx == 12); + done[i - 'A'] = TRUE; +} +/*- End of function --------------------------------------------------------*/ + +static void real_time_frame_handler(t38_gateway_state_t *s, + void *user_data, + int direction, + const uint8_t *msg, + int len) +{ + int i; + + i = (intptr_t) user_data; + printf("%d: Real time frame handler on channel %d - %s, %s, length = %d\n", + i, + i, + (direction) ? "PSTN->T.38" : "T.38->PSTN", + t30_frametype(msg[2]), + len); +} +/*- End of function --------------------------------------------------------*/ + +static int tx_packet_handler_a(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count) +{ + t38_terminal_state_t *t; + int i; + static int subst_seq = 0; + + /* This routine queues messages between two instances of T.38 processing */ + t = (t38_terminal_state_t *) user_data; + if (simulate_incrementing_repeats) + { + for (i = 0; i < count; i++) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d\n", subst_seq, len); + + g1050_put(path_a_to_b, buf, len, subst_seq, when); + subst_seq = (subst_seq + 1) & 0xFFFF; + } + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d, count %d\n", s->tx_seq_no, len, count); + + for (i = 0; i < count; i++) + g1050_put(path_a_to_b, buf, len, s->tx_seq_no, when); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int tx_packet_handler_b(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count) +{ + t38_terminal_state_t *t; + int i; + static int subst_seq = 0; + + /* This routine queues messages between two instances of T.38 processing */ + t = (t38_terminal_state_t *) user_data; + if (simulate_incrementing_repeats) + { + for (i = 0; i < count; i++) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d\n", subst_seq, len); + + g1050_put(path_b_to_a, buf, len, subst_seq, when); + subst_seq = (subst_seq + 1) & 0xFFFF; + } + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d, count %d\n", s->tx_seq_no, len, count); + + for (i = 0; i < count; i++) + g1050_put(path_b_to_a, buf, len, s->tx_seq_no, when); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int16_t silence[SAMPLES_PER_CHUNK]; + int16_t t30_amp_a[SAMPLES_PER_CHUNK]; + int16_t t38_amp_a[SAMPLES_PER_CHUNK]; + int16_t t38_amp_hist_a[8][SAMPLES_PER_CHUNK]; + int16_t t38_amp_b[SAMPLES_PER_CHUNK]; + int16_t t38_amp_hist_b[8][SAMPLES_PER_CHUNK]; + int16_t t30_amp_b[SAMPLES_PER_CHUNK]; + int16_t out_amp[SAMPLES_PER_CHUNK*4]; + int t30_len_a; + int t38_len_a; + int t38_len_b; + int t30_len_b; + int hist_ptr; + int log_audio; + int msg_len; + uint8_t msg[1024]; + int outframes; + SNDFILE *wave_handle; + int use_ecm; + int use_tep; + int feedback_audio; + int use_transmit_on_idle; + int t38_version; + const char *input_file_name; + int i; + int seq_no; + int model_no; + int speed_pattern_no; + double tx_when; + double rx_when; + int supported_modems; + int fill_removal; + int use_gui; + int opt; + t38_stats_t stats; + fax_state_t *fax; + t30_state_t *t30; + t38_gateway_state_t *t38; + t38_core_state_t *t38_core; + logging_state_t *logging; + + log_audio = FALSE; + use_ecm = FALSE; + t38_version = 1; + input_file_name = INPUT_FILE_NAME; + simulate_incrementing_repeats = FALSE; + model_no = 0; + speed_pattern_no = 1; + fill_removal = FALSE; + use_gui = FALSE; + use_tep = FALSE; + feedback_audio = FALSE; + use_transmit_on_idle = TRUE; + supported_modems = T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17; + while ((opt = getopt(argc, argv, "efFgi:Ilm:M:s:tv:")) != -1) + { + switch (opt) + { + case 'e': + use_ecm = TRUE; + break; + case 'f': + feedback_audio = TRUE; + break; + case 'F': + fill_removal = TRUE; + break; + case 'g': +#if defined(ENABLE_GUI) + use_gui = TRUE; +#else + fprintf(stderr, "Graphical monitoring not available\n"); + exit(2); +#endif + break; + case 'i': + input_file_name = optarg; + break; + case 'I': + simulate_incrementing_repeats = TRUE; + break; + case 'l': + log_audio = TRUE; + break; + case 'm': + supported_modems = atoi(optarg); + break; + case 'M': + model_no = optarg[0] - 'A' + 1; + break; + case 's': + speed_pattern_no = atoi(optarg); + break; + case 't': + use_tep = TRUE; + break; + case 'v': + t38_version = atoi(optarg); + break; + default: + //usage(); + exit(2); + break; + } + } + + printf("Using T.38 version %d\n", t38_version); + if (use_ecm) + printf("Using ECM\n"); + + wave_handle = NULL; + if (log_audio) + { + if ((wave_handle = sf_open_telephony_write(OUTPUT_FILE_NAME_WAVE, 4)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_FILE_NAME_WAVE); + exit(2); + } + } + memset(silence, 0, sizeof(silence)); + + srand48(0x1234567); + if ((path_a_to_b = g1050_init(model_no, speed_pattern_no, 100, 33)) == NULL) + { + fprintf(stderr, "Failed to start IP network path model\n"); + exit(2); + } + if ((path_b_to_a = g1050_init(model_no, speed_pattern_no, 100, 33)) == NULL) + { + fprintf(stderr, "Failed to start IP network path model\n"); + exit(2); + } + + if ((fax_state_a = fax_init(NULL, TRUE)) == NULL) + { + fprintf(stderr, "Cannot start FAX\n"); + exit(2); + } + fax = fax_state_a; + t30 = fax_get_t30_state(fax); + fax_set_transmit_on_idle(fax, use_transmit_on_idle); + fax_set_tep_mode(fax, use_tep); + t30_set_supported_modems(t30, supported_modems); + t30_set_tx_ident(t30, "11111111"); + t30_set_tx_nsf(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp\x00", 12); + t30_set_tx_file(t30, input_file_name, -1, -1); + t30_set_phase_b_handler(t30, phase_b_handler, (void *) (intptr_t) 'A'); + t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'A'); + t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'A'); + t30_set_ecm_capability(t30, use_ecm); + if (use_ecm) + t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION); + t30_set_minimum_scan_line_time(t30, 40); + //t30_set_iaf_mode(t30, T30_IAF_MODE_NO_FILL_BITS); + + logging = fax_get_logging_state(fax); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "FAX-A "); + + logging = t30_get_logging_state(t30); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "FAX-A "); + + memset(t30_amp_a, 0, sizeof(t30_amp_a)); + memset(t38_amp_hist_a, 0, sizeof(t38_amp_hist_a)); + memset(t38_amp_hist_b, 0, sizeof(t38_amp_hist_b)); + + if ((t38_state_a = t38_gateway_init(NULL, tx_packet_handler_a, t38_state_b)) == NULL) + { + fprintf(stderr, "Cannot start the T.38 channel\n"); + exit(2); + } + t38 = t38_state_a; + t38_core = t38_gateway_get_t38_core_state(t38); + t38_gateway_set_transmit_on_idle(t38, use_transmit_on_idle); + t38_gateway_set_supported_modems(t38, supported_modems); + //t38_gateway_set_nsx_suppression(t38, NULL, 0, NULL, 0); + t38_gateway_set_fill_bit_removal(t38, fill_removal); + t38_gateway_set_real_time_frame_handler(t38, real_time_frame_handler, NULL); + t38_set_t38_version(t38_core, t38_version); + t38_gateway_set_ecm_capability(t38, use_ecm); + + logging = t38_gateway_get_logging_state(t38); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-A"); + + logging = t38_core_get_logging_state(t38_core); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-A"); + memset(t38_amp_a, 0, sizeof(t38_amp_a)); + + if ((t38_state_b = t38_gateway_init(NULL, tx_packet_handler_b, t38_state_a)) == NULL) + { + fprintf(stderr, "Cannot start the T.38 channel\n"); + exit(2); + } + t38 = t38_state_b; + t38_core = t38_gateway_get_t38_core_state(t38); + t38_gateway_set_transmit_on_idle(t38, use_transmit_on_idle); + t38_gateway_set_supported_modems(t38, supported_modems); + //t38_gateway_set_nsx_suppression(t38, FALSE); + t38_gateway_set_fill_bit_removal(t38, fill_removal); + t38_set_t38_version(t38_core, t38_version); + t38_gateway_set_ecm_capability(t38, use_ecm); + + logging = t38_gateway_get_logging_state(t38); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-B"); + + logging = t38_core_get_logging_state(t38_core); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-B"); + memset(t38_amp_b, 0, sizeof(t38_amp_b)); + + if ((fax_state_b = fax_init(NULL, FALSE)) == NULL) + { + fprintf(stderr, "Cannot start FAX\n"); + exit(2); + } + fax = fax_state_b; + t30 = fax_get_t30_state(fax); + fax_set_transmit_on_idle(fax, use_transmit_on_idle); + fax_set_tep_mode(fax, use_tep); + t30_set_supported_modems(t30, supported_modems); + t30_set_tx_ident(t30, "22222222"); + t30_set_tx_nsf(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp\x00", 12); + t30_set_rx_file(t30, OUTPUT_FILE_NAME, -1); + t30_set_phase_b_handler(t30, phase_b_handler, (void *) (intptr_t) 'B'); + t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'B'); + t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'B'); + t30_set_ecm_capability(t30, use_ecm); + if (use_ecm) + t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION); + t30_set_minimum_scan_line_time(t30, 40); + + logging = fax_get_logging_state(fax); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "FAX-B "); + + logging = t30_get_logging_state(t30); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "FAX-B "); + + memset(t30_amp_b, 0, sizeof(t30_amp_b)); + +#if defined(ENABLE_GUI) + if (use_gui) + start_media_monitor(); +#endif + hist_ptr = 0; + for (;;) + { + logging = fax_get_logging_state(fax_state_a); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + t30 = fax_get_t30_state(fax_state_a); + logging = t30_get_logging_state(t30); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + logging = t38_gateway_get_logging_state(t38_state_a); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + t38_core = t38_gateway_get_t38_core_state(t38_state_a); + logging = t38_core_get_logging_state(t38_core); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + logging = t38_gateway_get_logging_state(t38_state_b); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + t38_core = t38_gateway_get_t38_core_state(t38_state_b); + logging = t38_core_get_logging_state(t38_core); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + logging = fax_get_logging_state(fax_state_b); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + t30 = fax_get_t30_state(fax_state_b); + logging = t30_get_logging_state(t30); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + memset(out_amp, 0, sizeof(out_amp)); + + t30_len_a = fax_tx(fax_state_a, t30_amp_a, SAMPLES_PER_CHUNK); + if (!use_transmit_on_idle) + { + /* The receive side always expects a full block of samples, but the + transmit side may not be sending any when it doesn't need to. We + may need to pad with some silence. */ + if (t30_len_a < SAMPLES_PER_CHUNK) + { + memset(t30_amp_a + t30_len_a, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - t30_len_a)); + t30_len_a = SAMPLES_PER_CHUNK; + } + } + if (log_audio) + { + for (i = 0; i < t30_len_a; i++) + out_amp[i*4] = t30_amp_a[i]; + } + if (feedback_audio) + { + for (i = 0; i < t30_len_a; i++) + t30_amp_a[i] += t38_amp_hist_a[hist_ptr][i] >> 1; + memcpy(t38_amp_hist_a[hist_ptr], t38_amp_a, sizeof(int16_t)*SAMPLES_PER_CHUNK); + } + if (t38_gateway_rx(t38_state_a, t30_amp_a, t30_len_a)) + break; + + t38_len_a = t38_gateway_tx(t38_state_a, t38_amp_a, SAMPLES_PER_CHUNK); + if (!use_transmit_on_idle) + { + if (t38_len_a < SAMPLES_PER_CHUNK) + { + memset(t38_amp_a + t38_len_a, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - t38_len_a)); + t38_len_a = SAMPLES_PER_CHUNK; + } + } + if (log_audio) + { + for (i = 0; i < t38_len_a; i++) + out_amp[i*4 + 1] = t38_amp_a[i]; + } + if (fax_rx(fax_state_a, t38_amp_a, SAMPLES_PER_CHUNK)) + break; + + t30_len_b = fax_tx(fax_state_b, t30_amp_b, SAMPLES_PER_CHUNK); + if (!use_transmit_on_idle) + { + /* The receive side always expects a full block of samples, but the + transmit side may not be sending any when it doesn't need to. We + may need to pad with some silence. */ + if (t30_len_b < SAMPLES_PER_CHUNK) + { + memset(t30_amp_b + t30_len_b, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - t30_len_b)); + t30_len_b = SAMPLES_PER_CHUNK; + } + } + if (log_audio) + { + for (i = 0; i < t30_len_b; i++) + out_amp[i*4 + 3] = t30_amp_b[i]; + } + if (feedback_audio) + { + for (i = 0; i < t30_len_b; i++) + t30_amp_b[i] += t38_amp_hist_b[hist_ptr][i] >> 1; + memcpy(t38_amp_hist_b[hist_ptr], t38_amp_b, sizeof(int16_t)*SAMPLES_PER_CHUNK); + } + if (t38_gateway_rx(t38_state_b, t30_amp_b, t30_len_b)) + break; + + t38_len_b = t38_gateway_tx(t38_state_b, t38_amp_b, SAMPLES_PER_CHUNK); + if (!use_transmit_on_idle) + { + if (t38_len_b < SAMPLES_PER_CHUNK) + { + memset(t38_amp_b + t38_len_b, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - t38_len_b)); + t38_len_b = SAMPLES_PER_CHUNK; + } + } + if (log_audio) + { + for (i = 0; i < t38_len_b; i++) + out_amp[i*4 + 2] = t38_amp_b[i]; + } + if (fax_rx(fax_state_b, t38_amp_b, SAMPLES_PER_CHUNK)) + break; + + when += (float) SAMPLES_PER_CHUNK/(float) SAMPLE_RATE; + + while ((msg_len = g1050_get(path_a_to_b, msg, 1024, when, &seq_no, &tx_when, &rx_when)) >= 0) + { +#if defined(ENABLE_GUI) + if (use_gui) + media_monitor_rx(seq_no, tx_when, rx_when); +#endif + t38_core = t38_gateway_get_t38_core_state(t38_state_b); + t38_core_rx_ifp_packet(t38_core, msg, msg_len, seq_no); + } + while ((msg_len = g1050_get(path_b_to_a, msg, 1024, when, &seq_no, &tx_when, &rx_when)) >= 0) + { +#if defined(ENABLE_GUI) + if (use_gui) + media_monitor_rx(seq_no, tx_when, rx_when); +#endif + t38_core = t38_gateway_get_t38_core_state(t38_state_a); + t38_core_rx_ifp_packet(t38_core, msg, msg_len, seq_no); + } + if (log_audio) + { + outframes = sf_writef_short(wave_handle, out_amp, SAMPLES_PER_CHUNK); + if (outframes != SAMPLES_PER_CHUNK) + break; + } + + if (done[0] && done[1]) + break; +#if defined(ENABLE_GUI) + if (use_gui) + media_monitor_update_display(); +#endif + if (++hist_ptr > 3) + hist_ptr = 0; + } + t38_gateway_get_transfer_statistics(t38_state_a, &stats); + printf("A side exchanged %d pages at %dbps, in %s mode\n", + stats.pages_transferred, + stats.bit_rate, + (stats.error_correcting_mode) ? "ECM" : "non-ECM"); + t38_gateway_get_transfer_statistics(t38_state_a, &stats); + printf("B side exchanged %d pages at %dbps, in %s mode\n", + stats.pages_transferred, + stats.bit_rate, + (stats.error_correcting_mode) ? "ECM" : "non-ECM"); + fax_release(fax_state_a); + fax_release(fax_state_b); + if (log_audio) + { + if (sf_close(wave_handle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME_WAVE); + exit(2); + } + } + if (!succeeded[0] || !succeeded[1]) + { + printf("Tests failed\n"); + exit(2); + } + printf("Tests passed\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/t38_gateway_to_terminal_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/t38_gateway_to_terminal_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,516 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t38_gateway_to_terminal_tests.c - Joint tests for the T.38 FoIP terminal and gateway modules. + * + * Written by Steve Underwood + * + * Copyright (C) 2005, 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t38_gateway_to_terminal_tests.c,v 1.66.4.1 2009/12/19 09:47:57 steveu Exp $ + */ + +/*! \file */ + +/*! \page t38_gateway_to_terminal_tests_page T.38 mixed gateway and termination tests +\section t38_gateway_to_terminal_tests_page_sec_1 What does it do? +These tests exercise the path + + FAX machine -> T.38 gateway -> T.38 termination +*/ + +/* Enable the following definition to enable direct probing into the FAX structures */ +//#define WITH_SPANDSP_INTERNALS + +#if defined(HAVE_CONFIG_H) +#include +#endif + +#if defined(HAVE_FL_FL_H) && defined(HAVE_FL_FL_CARTESIAN_H) && defined(HAVE_FL_FL_AUDIO_METER_H) +#define ENABLE_GUI +#endif + +#include +#include +#include +#include +#include +#include +#include +#if !defined(_WIN32) +#include +#endif + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#if defined(ENABLE_GUI) +#include "media_monitor.h" +#endif +#include "fax_utils.h" + +#define SAMPLES_PER_CHUNK 160 + +#define INPUT_FILE_NAME "../test-data/itu/fax/itutests.tif" +#define OUTPUT_FILE_NAME "t38.tif" +#define OUTPUT_FILE_NAME_WAVE "t38_gateway_to_terminal.wav" + +fax_state_t *fax_state_a; +t38_gateway_state_t *t38_state_a; +t38_terminal_state_t *t38_state_b; + +g1050_state_t *path_a_to_b; +g1050_state_t *path_b_to_a; + +double when = 0.0; + +int done[2] = {FALSE, FALSE}; +int succeeded[2] = {FALSE, FALSE}; + +int simulate_incrementing_repeats = FALSE; + +static int phase_b_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + char tag[20]; + + i = (int) (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase B", i); + printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result)); + log_rx_parameters(s, tag); + return T30_ERR_OK; +} +/*- End of function --------------------------------------------------------*/ + +static int phase_d_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + char tag[20]; + + i = (int) (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase D", i); + printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result)); + log_transfer_statistics(s, tag); + log_tx_parameters(s, tag); + log_rx_parameters(s, tag); + return T30_ERR_OK; +} +/*- End of function --------------------------------------------------------*/ + +static void phase_e_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + t30_stats_t t; + char tag[20]; + + i = (int) (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase E", i); + printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result)); + log_transfer_statistics(s, tag); + log_tx_parameters(s, tag); + log_rx_parameters(s, tag); + t30_get_transfer_statistics(s, &t); + succeeded[i - 'A'] = (result == T30_ERR_OK) && (t.pages_tx == 12 || t.pages_rx == 12); + done[i - 'A'] = TRUE; +} +/*- End of function --------------------------------------------------------*/ + +static int tx_packet_handler_a(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count) +{ + t38_terminal_state_t *t; + int i; + static int subst_seq = 0; + + /* This routine queues messages between two instances of T.38 processing */ + t = (t38_terminal_state_t *) user_data; + if (simulate_incrementing_repeats) + { + for (i = 0; i < count; i++) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d\n", subst_seq, len); + + g1050_put(path_a_to_b, buf, len, subst_seq, when); + subst_seq = (subst_seq + 1) & 0xFFFF; + } + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d, count %d\n", s->tx_seq_no, len, count); + + for (i = 0; i < count; i++) + g1050_put(path_a_to_b, buf, len, s->tx_seq_no, when); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int tx_packet_handler_b(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count) +{ + t38_terminal_state_t *t; + int i; + static int subst_seq = 0; + + /* This routine queues messages between two instances of T.38 processing */ + t = (t38_terminal_state_t *) user_data; + if (simulate_incrementing_repeats) + { + for (i = 0; i < count; i++) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d\n", subst_seq, len); + + g1050_put(path_b_to_a, buf, len, subst_seq, when); + subst_seq = (subst_seq + 1) & 0xFFFF; + } + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d, count %d\n", s->tx_seq_no, len, count); + + for (i = 0; i < count; i++) + g1050_put(path_b_to_a, buf, len, s->tx_seq_no, when); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int16_t t38_amp_a[SAMPLES_PER_CHUNK]; + int16_t t30_amp_a[SAMPLES_PER_CHUNK]; + int16_t out_amp[2*SAMPLES_PER_CHUNK]; + int t38_len_a; + int t30_len_a; + int msg_len; + uint8_t msg[1024]; + int log_audio; + int outframes; + int t38_version; + int use_ecm; + int use_tep; + int feedback_audio; + int use_transmit_on_idle; + SNDFILE *wave_handle; + const char *input_file_name; + int i; + int seq_no; + int model_no; + int speed_pattern_no; + double tx_when; + double rx_when; + int supported_modems; + int use_gui; + int opt; + t30_state_t *t30; + t38_core_state_t *t38_core; + logging_state_t *logging; + + log_audio = FALSE; + t38_version = 1; + use_ecm = FALSE; + input_file_name = INPUT_FILE_NAME; + simulate_incrementing_repeats = FALSE; + model_no = 0; + speed_pattern_no = 1; + use_gui = FALSE; + use_tep = FALSE; + feedback_audio = FALSE; + use_transmit_on_idle = TRUE; + supported_modems = T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17; + while ((opt = getopt(argc, argv, "efgi:Ilm:M:s:tv:")) != -1) + { + switch (opt) + { + case 'e': + use_ecm = TRUE; + break; + case 'f': + feedback_audio = TRUE; + break; + case 'g': +#if defined(ENABLE_GUI) + use_gui = TRUE; +#else + fprintf(stderr, "Graphical monitoring not available\n"); + exit(2); +#endif + break; + case 'i': + input_file_name = optarg; + break; + case 'I': + simulate_incrementing_repeats = TRUE; + break; + case 'l': + log_audio = TRUE; + break; + case 'm': + supported_modems = atoi(optarg); + break; + case 'M': + model_no = optarg[0] - 'A' + 1; + break; + case 's': + speed_pattern_no = atoi(optarg); + break; + case 't': + use_tep = TRUE; + break; + case 'v': + t38_version = atoi(optarg); + break; + default: + //usage(); + exit(2); + break; + } + } + + printf("Using T.38 version %d\n", t38_version); + if (use_ecm) + printf("Using ECM\n"); + + wave_handle = NULL; + if (log_audio) + { + if ((wave_handle = sf_open_telephony_write(OUTPUT_FILE_NAME_WAVE, 2)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_FILE_NAME_WAVE); + exit(2); + } + } + + srand48(0x1234567); + if ((path_a_to_b = g1050_init(model_no, speed_pattern_no, 100, 33)) == NULL) + { + fprintf(stderr, "Failed to start IP network path model\n"); + exit(2); + } + if ((path_b_to_a = g1050_init(model_no, speed_pattern_no, 100, 33)) == NULL) + { + fprintf(stderr, "Failed to start IP network path model\n"); + exit(2); + } + + if ((fax_state_a = fax_init(NULL, TRUE)) == NULL) + { + fprintf(stderr, "Cannot start FAX\n"); + exit(2); + } + t30 = fax_get_t30_state(fax_state_a); + fax_set_transmit_on_idle(fax_state_a, use_transmit_on_idle); + fax_set_tep_mode(fax_state_a, use_tep); + t30_set_supported_modems(t30, supported_modems); + t30_set_tx_ident(t30, "11111111"); + t30_set_tx_nsf(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp\x00", 12); + t30_set_tx_file(t30, input_file_name, -1, -1); + t30_set_phase_b_handler(t30, phase_b_handler, (void *) (intptr_t) 'A'); + t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'A'); + t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'A'); + t30_set_ecm_capability(t30, use_ecm); + if (use_ecm) + t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION); + + logging = fax_get_logging_state(fax_state_a); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "FAX-A "); + + logging = t30_get_logging_state(t30); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "FAX-A "); + + memset(t30_amp_a, 0, sizeof(t30_amp_a)); + + if ((t38_state_a = t38_gateway_init(NULL, tx_packet_handler_a, t38_state_b)) == NULL) + { + fprintf(stderr, "Cannot start the T.38 channel\n"); + exit(2); + } + t38_core = t38_gateway_get_t38_core_state(t38_state_a); + t38_gateway_set_transmit_on_idle(t38_state_a, use_transmit_on_idle); + t38_set_t38_version(t38_core, t38_version); + t38_gateway_set_ecm_capability(t38_state_a, use_ecm); + + logging = t38_gateway_get_logging_state(t38_state_a); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-A"); + + logging = t38_core_get_logging_state(t38_core); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-A"); + + memset(t38_amp_a, 0, sizeof(t38_amp_a)); + + if ((t38_state_b = t38_terminal_init(NULL, FALSE, tx_packet_handler_b, t38_state_a)) == NULL) + { + fprintf(stderr, "Cannot start the T.38 channel\n"); + exit(2); + } + t30 = t38_terminal_get_t30_state(t38_state_b); + t38_core = t38_terminal_get_t38_core_state(t38_state_b); + t38_set_t38_version(t38_core, t38_version); + + logging = t38_terminal_get_logging_state(t38_state_b); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-B"); + + logging = t38_core_get_logging_state(t38_core); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-B"); + + logging = t30_get_logging_state(t30); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-B"); + + t30_set_supported_modems(t30, supported_modems); + t30_set_tx_ident(t30, "22222222"); + t30_set_rx_file(t30, OUTPUT_FILE_NAME, -1); + t30_set_phase_b_handler(t30, phase_b_handler, (void *) (intptr_t) 'B'); + t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'B'); + t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'B'); + t30_set_ecm_capability(t30, use_ecm); + if (use_ecm) + t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION); + +#if defined(ENABLE_GUI) + if (use_gui) + start_media_monitor(); +#endif + for (;;) + { + logging = fax_get_logging_state(fax_state_a); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + t30 = fax_get_t30_state(fax_state_a); + logging = t30_get_logging_state(t30); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + logging = t38_gateway_get_logging_state(t38_state_a); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + t38_core = t38_gateway_get_t38_core_state(t38_state_a); + logging = t38_core_get_logging_state(t38_core); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + logging = t38_terminal_get_logging_state(t38_state_b); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + t38_core = t38_terminal_get_t38_core_state(t38_state_b); + logging = t38_core_get_logging_state(t38_core); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + t30 = t38_terminal_get_t30_state(t38_state_b); + logging = t30_get_logging_state(t30); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + memset(out_amp, 0, sizeof(out_amp)); + + t38_terminal_send_timeout(t38_state_b, SAMPLES_PER_CHUNK); + + t30_len_a = fax_tx(fax_state_a, t30_amp_a, SAMPLES_PER_CHUNK); + if (!use_transmit_on_idle) + { + /* The receive side always expects a full block of samples, but the + transmit side may not be sending any when it doesn't need to. We + may need to pad with some silence. */ + if (t30_len_a < SAMPLES_PER_CHUNK) + { + memset(t30_amp_a + t30_len_a, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - t30_len_a)); + t30_len_a = SAMPLES_PER_CHUNK; + } + } + if (log_audio) + { + for (i = 0; i < t30_len_a; i++) + out_amp[2*i] = t30_amp_a[i]; + } + if (feedback_audio) + { + for (i = 0; i < t30_len_a; i++) + t30_amp_a[i] += t38_amp_a[i] >> 1; + } + if (t38_gateway_rx(t38_state_a, t30_amp_a, t30_len_a)) + break; + + t38_len_a = t38_gateway_tx(t38_state_a, t38_amp_a, SAMPLES_PER_CHUNK); + if (!use_transmit_on_idle) + { + if (t38_len_a < SAMPLES_PER_CHUNK) + { + memset(t38_amp_a + t38_len_a, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - t38_len_a)); + t38_len_a = SAMPLES_PER_CHUNK; + } + } + if (log_audio) + { + for (i = 0; i < t38_len_a; i++) + out_amp[2*i + 1] = t38_amp_a[i]; + } + if (fax_rx(fax_state_a, t38_amp_a, SAMPLES_PER_CHUNK)) + break; + + when += (float) SAMPLES_PER_CHUNK/(float) SAMPLE_RATE; + + while ((msg_len = g1050_get(path_a_to_b, msg, 1024, when, &seq_no, &tx_when, &rx_when)) >= 0) + { +#if defined(ENABLE_GUI) + if (use_gui) + media_monitor_rx(seq_no, tx_when, rx_when); +#endif + t38_core = t38_terminal_get_t38_core_state(t38_state_b); + t38_core_rx_ifp_packet(t38_core, msg, msg_len, seq_no); + } + while ((msg_len = g1050_get(path_b_to_a, msg, 1024, when, &seq_no, &tx_when, &rx_when)) >= 0) + { +#if defined(ENABLE_GUI) + if (use_gui) + media_monitor_rx(seq_no, tx_when, rx_when); +#endif + t38_core = t38_gateway_get_t38_core_state(t38_state_a); + t38_core_rx_ifp_packet(t38_core, msg, msg_len, seq_no); + } + if (log_audio) + { + outframes = sf_writef_short(wave_handle, out_amp, SAMPLES_PER_CHUNK); + if (outframes != SAMPLES_PER_CHUNK) + break; + } + + if (done[0] && done[1]) + break; +#if defined(ENABLE_GUI) + if (use_gui) + media_monitor_update_display(); +#endif + } + fax_release(fax_state_a); + t38_terminal_release(t38_state_b); + if (log_audio) + { + if (sf_close(wave_handle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME_WAVE); + exit(2); + } + } + if (!succeeded[0] || !succeeded[1]) + { + printf("Tests failed\n"); + exit(2); + } + printf("Tests passed\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/t38_non_ecm_buffer_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/t38_non_ecm_buffer_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,707 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t38_non_ecm_buffer_tests.c - Tests for the T.38 non-ECM image data buffer module. + * + * Written by Steve Underwood + * + * Copyright (C) 2008 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t38_non_ecm_buffer_tests.c,v 1.5.4.1 2009/12/19 06:43:28 steveu Exp $ + */ + +/*! \file */ + +/*! \page t38_non_ecm_buffer_tests_page T.38 non-ECM buffer tests +\section t38_non_ecm_buffer_tests_page_sec_1 What does it do? +These tests exercise the flow controlling non-ECM image data buffer +module, used for T.38 gateways. +*/ + +#if defined(HAVE_CONFIG_H) +#include +#endif + +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" + +/* A pattern of widening gaps between ones, until at 11 apart an + EOL should be registered */ +static const uint8_t spreader[] = +{ + 0x55, + 0x55, + 0x55, + 0x55, + 0x55, + 0x55, + 0x55, + 0x55, /* 1 apart */ + 0x22, /* 2 and 3 apart */ + 0x10, /* 4 apart */ + 0x40, /* 5 apart */ + 0x80, /* 6 apart */ + 0x80, /* 7 apart */ + 0x40, /* 8 apart */ + 0x10, /* 9 apart */ + 0x02, /* 10 apart */ + 0x00, + 0x25 /* 11 apart */ +}; + +static int bit_no; + +static int xxx(t38_non_ecm_buffer_state_t *s, logging_state_t *l, int log_bits, int n, int expected) +{ + int i; + int j; + int bit; + + t38_non_ecm_buffer_inject(s, &spreader[n], 1); + if (expected >= 0) + { + for (i = 0; i < 128; i++) + { + bit = t38_non_ecm_buffer_get_bit((void *) s); + if (log_bits) + printf("Rx bit %d - %d\n", bit_no, bit); + if (bit != expected) + { + printf("Tests failed - %d %d %d\n", bit_no, bit, expected); + exit(2); + } + bit_no++; + } + } + else + { + j = -1; + for (i = 0; i < 256; i++) + { + bit = t38_non_ecm_buffer_get_bit((void *) s); + if (log_bits) + printf("Rx bit %d - %d\n", bit_no, bit); + if (j < 0) + { + if (bit == 1) + j = 18*8 - 5; + } + else + { + expected = (spreader[j >> 3] >> (7 - (j & 7))) & 1; + if (bit != expected) + { + printf("Tests failed - %d %d %d\n", bit_no, bit, expected); + exit(2); + } + j++; + if (j >= 18*8) + j = 0; + } + bit_no++; + if (j == 17*8) + return 0; + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + t38_non_ecm_buffer_state_t buffer; + logging_state_t logging; + uint8_t buf[1024]; + int bit; + int n; + int log_bits; + int i; + + log_bits = (argc > 1); + printf("T.38 non-ECM rate adapting buffer tests.\n"); + span_log_init(&logging, SPAN_LOG_FLOW, NULL); + span_log_set_protocol(&logging, "Buffer"); + + printf("1 - Impose no minimum for the bits per row\n"); + t38_non_ecm_buffer_init(&buffer, TRUE, 0); + n = 0; + bit_no = 0; + /* We should get ones until the buffers recognises an EOL */ + printf(" We should get ones here\n"); + for (i = 0; i < 17; i++) + xxx(&buffer, &logging, log_bits, i, 1); + printf(" We should change to zeros here\n"); + xxx(&buffer, &logging, log_bits, i, 0); + for (i = 0; i < 17; i++) + xxx(&buffer, &logging, log_bits, i, 0); + printf(" We should get the first row here\n"); + xxx(&buffer, &logging, log_bits, i, -1); + for (i = 0; i < 17; i++) + xxx(&buffer, &logging, log_bits, i, 0); + printf(" We should get the second row here\n"); + xxx(&buffer, &logging, log_bits, i, -1); + for (i = 0; i < 17; i++) + xxx(&buffer, &logging, log_bits, i, 0); + printf(" We should get the third row here\n"); + xxx(&buffer, &logging, log_bits, i, -1); + printf(" Done\n"); + t38_non_ecm_buffer_report_input_status(&buffer, &logging); + t38_non_ecm_buffer_report_output_status(&buffer, &logging); + + printf("2 - Impose no minimum for the bits per row, different alignment\n"); + t38_non_ecm_buffer_init(&buffer, TRUE, 0); + n = 0; + memset(buf, 0, sizeof(buf)); + /* The first one in this should be seen as the first EOL */ + memset(buf + 10, 0x55, 10); + /* EOL 2 */ + buf[25] = 0x20; + /* EOL 3 */ + memset(buf + 30, 0x55, 10); + /* EOL 4 */ + buf[45] = 0x10; + t38_non_ecm_buffer_inject(&buffer, buf, 50); + t38_non_ecm_buffer_push(&buffer); + for (;;) + { + bit = t38_non_ecm_buffer_get_bit((void *) &buffer); + if (log_bits) + printf("Rx bit %d - %d\n", n, bit); + n++; + if (bit == SIG_STATUS_END_OF_DATA) + { + if (n != 337) + { + printf("Tests failed\n"); + exit(2); + } + break; + } + if (n >= 18 && n <= 96) + { + if (bit == (n & 1)) + { + printf("Tests failed\n"); + exit(2); + } + } + else if (n >= 178 && n <= 256) + { + if (bit == (n & 1)) + { + printf("Tests failed\n"); + exit(2); + } + } + else if (n == 139 || n == 300) + { + if (bit != 1) + { + printf("Tests failed\n"); + exit(2); + } + } + else + { + if (bit != 0) + { + printf("Tests failed\n"); + exit(2); + } + } + } + t38_non_ecm_buffer_report_input_status(&buffer, &logging); + t38_non_ecm_buffer_report_output_status(&buffer, &logging); + + printf("3 - Demand a fairly high minimum for the bits per row\n"); + t38_non_ecm_buffer_init(&buffer, TRUE, 400); + n = 0; + memset(buf, 0, sizeof(buf)); + /* The first one in this should be seen as the first EOL */ + memset(buf + 10, 0x55, 10); + /* EOL 2 */ + buf[25] = 0x08; + /* EOL 3 */ + memset(buf + 30, 0x55, 10); + /* EOL 4 */ + buf[45] = 0x04; + t38_non_ecm_buffer_inject(&buffer, buf, 50); + t38_non_ecm_buffer_push(&buffer); + for (;;) + { + bit = t38_non_ecm_buffer_get_bit((void *) &buffer); + if (log_bits) + printf("Rx bit %d - %d\n", n, bit); + n++; + if (bit == SIG_STATUS_END_OF_DATA) + { + if (n != 1273) + { + printf("Tests failed\n"); + exit(2); + } + break; + } + if (n >= 18 && n <= 96) + { + if (bit == (n & 1)) + { + printf("Tests failed\n"); + exit(2); + } + } + else if (n >= 834 && n <= 912) + { + if (bit == (n & 1)) + { + printf("Tests failed\n"); + exit(2); + } + } + else if (n == 429 || n == 1238) + { + if (bit != 1) + { + printf("Tests failed\n"); + exit(2); + } + } + else + { + if (bit != 0) + { + printf("Tests failed\n"); + exit(2); + } + } + } + t38_non_ecm_buffer_report_input_status(&buffer, &logging); + t38_non_ecm_buffer_report_output_status(&buffer, &logging); + + printf("4 - Take some time to get to the first row of the image, output ahead\n"); + t38_non_ecm_buffer_init(&buffer, TRUE, 400); + n = 0; + /* Get some initial bits from an empty buffer. These should be ones */ + for (i = 0; i < 1000; i++) + { + bit = t38_non_ecm_buffer_get_bit((void *) &buffer); + if (log_bits) + printf("Rx bit %d - %d\n", n++, bit); + if (bit != 1) + { + printf("Tests failed\n"); + exit(2); + } + } + printf(" Initial ones OK\n"); + /* Now put some zeros into the buffer, but no EOL. We should continue + getting ones out. */ + memset(buf, 0, sizeof(buf)); + t38_non_ecm_buffer_inject(&buffer, buf, 20); + for (i = 0; i < 1000; i++) + { + bit = t38_non_ecm_buffer_get_bit((void *) &buffer); + if (log_bits) + printf("Rx bit %d - %d\n", n++, bit); + if (bit != 1) + { + printf("Tests failed\n"); + exit(2); + } + } + printf(" Continuing initial ones OK\n"); + /* Now add a one, to make an EOL. We should see the zeros come out. */ + buf[0] = 0x01; + t38_non_ecm_buffer_inject(&buffer, buf, 1); + for (i = 0; i < 1000; i++) + { + bit = t38_non_ecm_buffer_get_bit((void *) &buffer); + if (log_bits) + printf("Rx bit %d - %d\n", n++, bit); + if (bit != 0) + { + printf("Tests failed\n"); + exit(2); + } + } + printf(" First EOL caused zeros to output OK\n"); + /* Now add another line. We should see the first line come out. This means just the + 23rd bit from now will be a one. */ + buf[0] = 0x00; + buf[4] = 0x01; + t38_non_ecm_buffer_inject(&buffer, buf, 5); + for (i = 0; i < 1000; i++) + { + bit = t38_non_ecm_buffer_get_bit((void *) &buffer); + if (log_bits) + printf("Rx bit %d - %d\n", n++, bit); + if ((i == 23 && bit == 0) || (i != 23 && bit != 0)) + { + printf("Tests failed (%d)\n", i); + exit(2); + } + } + printf(" Second EOL caused the first row to output OK\n"); + /* Now inject an RTC - 6 EOLs */ + memset(buf, 0, sizeof(buf)); + /* T.4 1D style */ + for (i = 10; i < 19; i += 3) + { + buf[i] = 0x00; + buf[i + 1] = 0x10; + buf[i + 2] = 0x01; + } + /* T.4 2D style */ + buf[25 + 0] = 0x00; + buf[25 + 1] = 0x18; + buf[25 + 2] = 0x00; + buf[25 + 3] = 0xC0; + buf[25 + 4] = 0x06; + buf[25 + 5] = 0x00; + buf[25 + 6] = 0x30; + buf[25 + 7] = 0x01; + buf[25 + 8] = 0x80; + buf[25 + 9] = 0x0C; + t38_non_ecm_buffer_inject(&buffer, buf, 50); + t38_non_ecm_buffer_push(&buffer); + for (i = 0; i < 1000; i++) + { + bit = t38_non_ecm_buffer_get_bit((void *) &buffer); + if (log_bits) + printf("Rx bit %d - %d\n", n++, bit); + if (i == 7 + || + i == 400 + 11 + 0*12 + || + i == 400 + 11 + 1*12 + || + i == 400 + 11 + 2*12 + || + i == 400 + 11 + 3*12 + || + i == 400 + 11 + 4*12 + || + i == 400 + 11 + 5*12 + || + i == 400 + 11 + 60 + 400 + 4 + 0*13 + || + i == 400 + 11 + 60 + 400 + 4 + 0*13 + 1 + || + i == 400 + 11 + 60 + 400 + 4 + 1*13 + || + i == 400 + 11 + 60 + 400 + 4 + 1*13 + 1 + || + i == 400 + 11 + 60 + 400 + 4 + 2*13 + || + i == 400 + 11 + 60 + 400 + 4 + 2*13 + 1 + || + i == 400 + 11 + 60 + 400 + 4 + 3*13 + || + i == 400 + 11 + 60 + 400 + 4 + 3*13 + 1 + || + i == 400 + 11 + 60 + 400 + 4 + 4*13 + || + i == 400 + 11 + 60 + 400 + 4 + 4*13 + 1 + || + i == 400 + 11 + 60 + 400 + 4 + 5*13 + || + i == 400 + 11 + 60 + 400 + 4 + 5*13 + 1) + { + if (bit == 0) + { + printf("Tests failed (%d)\n", i); + exit(2); + } + } + else + { + if (bit == 1) + { + printf("Tests failed (%d)\n", i); + exit(2); + } + } + } + printf(" RTC output OK\n"); + t38_non_ecm_buffer_report_input_status(&buffer, &logging); + t38_non_ecm_buffer_report_output_status(&buffer, &logging); + + printf("5 - Take some time to get to the first row of the image, output behind\n"); + t38_non_ecm_buffer_init(&buffer, TRUE, 400); + n = 0; + /* Inject some ones. */ + memset(buf, 0xFF, 100); + t38_non_ecm_buffer_inject(&buffer, buf, 100); + /* Inject some zeros */ + memset(buf, 0, sizeof(buf)); + t38_non_ecm_buffer_inject(&buffer, buf, 100); + for (i = 0; i < 1000; i++) + { + bit = t38_non_ecm_buffer_get_bit((void *) &buffer); + if (log_bits) + printf("Rx bit %d - %d\n", n++, bit); + if (bit != 1) + { + printf("Tests failed\n"); + exit(2); + } + } + printf(" Initial ones OK\n"); + /* Now add a one, to make an EOL. We should see the zeros come out. */ + buf[0] = 0x01; + t38_non_ecm_buffer_inject(&buffer, buf, 1); + for (i = 0; i < 1000; i++) + { + bit = t38_non_ecm_buffer_get_bit((void *) &buffer); + if (log_bits) + printf("Rx bit %d - %d\n", n++, bit); + if (bit != 0) + { + printf("Tests failed\n"); + exit(2); + } + } + printf(" First EOL caused zeros to output OK\n"); + /* Now add another line. We should see the first line come out. This means just the + 23rd bit from now will be a one. */ + buf[0] = 0x00; + buf[4] = 0x01; + t38_non_ecm_buffer_inject(&buffer, buf, 5); + for (i = 0; i < 1000; i++) + { + bit = t38_non_ecm_buffer_get_bit((void *) &buffer); + if (log_bits) + printf("Rx bit %d - %d\n", n++, bit); + if ((i == 23 && bit == 0) || (i != 23 && bit != 0)) + { + printf("Tests failed (%d)\n", i); + exit(2); + } + } + printf(" Second EOL caused the first row to output OK\n"); + /* Now inject an RTC - 6 EOLs */ + memset(buf, 0, sizeof(buf)); + /* T.4 1D style */ + for (i = 10; i < 19; i += 3) + { + buf[i] = 0x00; + buf[i + 1] = 0x10; + buf[i + 2] = 0x01; + } + /* T.4 2D style */ + buf[25 + 0] = 0x00; + buf[25 + 1] = 0x18; + buf[25 + 2] = 0x00; + buf[25 + 3] = 0xC0; + buf[25 + 4] = 0x06; + buf[25 + 5] = 0x00; + buf[25 + 6] = 0x30; + buf[25 + 7] = 0x01; + buf[25 + 8] = 0x80; + buf[25 + 9] = 0x0C; + t38_non_ecm_buffer_inject(&buffer, buf, 50); + t38_non_ecm_buffer_push(&buffer); + for (i = 0; i < 1000; i++) + { + bit = t38_non_ecm_buffer_get_bit((void *) &buffer); + if (log_bits) + printf("Rx bit %d - %d\n", n++, bit); + if (i == 7 + || + i == 400 + 11 + 0*12 + || + i == 400 + 11 + 1*12 + || + i == 400 + 11 + 2*12 + || + i == 400 + 11 + 3*12 + || + i == 400 + 11 + 4*12 + || + i == 400 + 11 + 5*12 + || + i == 400 + 11 + 60 + 400 + 4 + 0*13 + || + i == 400 + 11 + 60 + 400 + 4 + 0*13 + 1 + || + i == 400 + 11 + 60 + 400 + 4 + 1*13 + || + i == 400 + 11 + 60 + 400 + 4 + 1*13 + 1 + || + i == 400 + 11 + 60 + 400 + 4 + 2*13 + || + i == 400 + 11 + 60 + 400 + 4 + 2*13 + 1 + || + i == 400 + 11 + 60 + 400 + 4 + 3*13 + || + i == 400 + 11 + 60 + 400 + 4 + 3*13 + 1 + || + i == 400 + 11 + 60 + 400 + 4 + 4*13 + || + i == 400 + 11 + 60 + 400 + 4 + 4*13 + 1 + || + i == 400 + 11 + 60 + 400 + 4 + 5*13 + || + i == 400 + 11 + 60 + 400 + 4 + 5*13 + 1) + { + if (bit == 0) + { + printf("Tests failed (%d)\n", i); + exit(2); + } + } + else + { + if (bit == 1) + { + printf("Tests failed (%d)\n", i); + exit(2); + } + } + } + printf(" RTC output OK\n"); + t38_non_ecm_buffer_report_input_status(&buffer, &logging); + t38_non_ecm_buffer_report_output_status(&buffer, &logging); + + printf("6 - TCF without leading ones\n"); + t38_non_ecm_buffer_init(&buffer, FALSE, 400); + n = 0; + /* Get some initial bits from an empty buffer. These should be ones */ + for (i = 0; i < 1000; i++) + { + bit = t38_non_ecm_buffer_get_bit((void *) &buffer); + if (log_bits) + printf("Rx bit %d - %d\n", n++, bit); + if (bit != 1) + { + printf("Tests failed\n"); + exit(2); + } + } + printf(" Initial ones from an empty TCF buffer OK\n"); + /* Now send some TCF through, and see that it comes out */ + memset(buf, 0x00, sizeof(buf)); + t38_non_ecm_buffer_inject(&buffer, buf, 500); + t38_non_ecm_buffer_push(&buffer); + for (i = 0; i < 500*8; i++) + { + bit = t38_non_ecm_buffer_get_bit((void *) &buffer); + if (log_bits) + printf("Rx bit %d - %d\n", n++, bit); + if (bit != 0) + { + printf("Tests failed\n"); + exit(2); + } + } + printf(" Passthrough of TCF OK\n"); + /* Check the right number of bits was buffered */ + bit = t38_non_ecm_buffer_get_bit((void *) &buffer); + if (log_bits) + printf("Rx bit %d - %d\n", n++, bit); + if (bit != SIG_STATUS_END_OF_DATA) + { + printf("Tests failed\n"); + exit(2); + } + printf(" End of data seen OK\n"); + t38_non_ecm_buffer_report_input_status(&buffer, &logging); + t38_non_ecm_buffer_report_output_status(&buffer, &logging); + + printf("7 - TCF with leading ones\n"); + t38_non_ecm_buffer_init(&buffer, FALSE, 400); + n = 0; + /* Get some initial bits from an empty buffer. These should be ones */ + for (i = 0; i < 1000; i++) + { + bit = t38_non_ecm_buffer_get_bit((void *) &buffer); + if (log_bits) + printf("Rx bit %d - %d\n", n++, bit); + if (bit != 1) + { + printf("Tests failed\n"); + exit(2); + } + } + printf(" Initial ones from an empty TCF buffer OK\n"); + + /* Now send some initial ones, and see that we continue to get all ones + as the stuffing. */ + memset(buf, 0xFF, 500); + t38_non_ecm_buffer_inject(&buffer, buf, 500); + for (i = 0; i < 500*8; i++) + { + bit = t38_non_ecm_buffer_get_bit((void *) &buffer); + if (log_bits) + printf("Rx bit %d - %d\n", n++, bit); + if (bit != 1) + { + printf("Tests failed\n"); + exit(2); + } + } + printf(" Sustaining ones OK\n"); + + /* Now send some initial ones, and some TCF through, and see that only + the TCF comes out */ + memset(buf, 0x00, sizeof(buf)); + memset(buf, 0xFF, 100); + /* End the ones mid byte */ + buf[100] = 0xF0; + t38_non_ecm_buffer_inject(&buffer, buf, 500); + t38_non_ecm_buffer_push(&buffer); + for (i = 0; i < 400*8; i++) + { + bit = t38_non_ecm_buffer_get_bit((void *) &buffer); + if (log_bits) + printf("Rx bit %d - %d\n", n++, bit); + if ((i < 4 && bit == 0) || (i >= 4 && bit != 0)) + { + printf("Tests failed\n"); + exit(2); + } + } + printf(" Passthrough of TCF OK\n"); + /* Check the right number of bits was buffered */ + bit = t38_non_ecm_buffer_get_bit((void *) &buffer); + if (log_bits) + printf("Rx bit %d - %d\n", n++, bit); + if (bit != SIG_STATUS_END_OF_DATA) + { + printf("Tests failed\n"); + exit(2); + } + printf(" End of data seen OK\n"); + t38_non_ecm_buffer_report_input_status(&buffer, &logging); + t38_non_ecm_buffer_report_output_status(&buffer, &logging); + + printf("Tests passed\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/t38_terminal_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/t38_terminal_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,420 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t38_terminal_tests.c - Tests for the T.38 FoIP terminal module. + * + * Written by Steve Underwood + * + * Copyright (C) 2005, 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t38_terminal_tests.c,v 1.67.4.1 2009/12/19 09:47:57 steveu Exp $ + */ + +/*! \file */ + +/*! \page t38_terminal_tests_page T.38 termination tests +\section t38_terminal_tests_page_sec_1 What does it do? +These tests exercise the path + + T.38 termination <-> T.38 termination +*/ + +//#define WITH_SPANDSP_INTERNALS + +#if defined(HAVE_CONFIG_H) +#include +#endif + +#if defined(HAVE_FL_FL_H) && defined(HAVE_FL_FL_CARTESIAN_H) && defined(HAVE_FL_FL_AUDIO_METER_H) +#define ENABLE_GUI +#endif + +#include +#include +#include +#include +#include +#include +#if !defined(_WIN32) +#include +#endif + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#if defined(ENABLE_GUI) +#include "media_monitor.h" +#endif +#include "fax_utils.h" + +#define SAMPLES_PER_CHUNK 160 + +#define INPUT_FILE_NAME "../test-data/itu/fax/itutests.tif" +#define OUTPUT_FILE_NAME "t38.tif" + +t38_terminal_state_t *t38_state_a; +t38_terminal_state_t *t38_state_b; + +g1050_state_t *path_a_to_b; +g1050_state_t *path_b_to_a; + +double when = 0.0; + +int done[2] = {FALSE, FALSE}; +int succeeded[2] = {FALSE, FALSE}; + +int simulate_incrementing_repeats = FALSE; + +static int phase_b_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + char tag[20]; + + i = (int) (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase B", i); + printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result)); + log_rx_parameters(s, tag); + return T30_ERR_OK; +} +/*- End of function --------------------------------------------------------*/ + +static int phase_d_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + char tag[20]; + + i = (int) (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase D", i); + printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result)); + log_transfer_statistics(s, tag); + log_tx_parameters(s, tag); + log_rx_parameters(s, tag); + return T30_ERR_OK; +} +/*- End of function --------------------------------------------------------*/ + +static void phase_e_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + t30_stats_t t; + char tag[20]; + + i = (int) (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase E", i); + printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result)); + log_transfer_statistics(s, tag); + log_tx_parameters(s, tag); + log_rx_parameters(s, tag); + t30_get_transfer_statistics(s, &t); + succeeded[i - 'A'] = (result == T30_ERR_OK) && (t.pages_tx == 12 || t.pages_rx == 12); + //done[i - 'A'] = TRUE; +} +/*- End of function --------------------------------------------------------*/ + +static int tx_packet_handler_a(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count) +{ + t38_terminal_state_t *t; + int i; + static int subst_seq = 0; + + /* This routine queues messages between two instances of T.38 processing */ + t = (t38_terminal_state_t *) user_data; + if (simulate_incrementing_repeats) + { + for (i = 0; i < count; i++) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d\n", subst_seq, len); + + if (g1050_put(path_a_to_b, buf, len, subst_seq, when) < 0) + printf("Lost packet %d\n", subst_seq); + subst_seq = (subst_seq + 1) & 0xFFFF; + } + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d, count %d\n", s->tx_seq_no, len, count); + + for (i = 0; i < count; i++) + { + if (g1050_put(path_a_to_b, buf, len, s->tx_seq_no, when) < 0) + printf("Lost packet %d\n", s->tx_seq_no); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int tx_packet_handler_b(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count) +{ + t38_terminal_state_t *t; + int i; + static int subst_seq = 0; + + /* This routine queues messages between two instances of T.38 processing */ + t = (t38_terminal_state_t *) user_data; + if (simulate_incrementing_repeats) + { + for (i = 0; i < count; i++) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d\n", subst_seq, len); + + g1050_put(path_b_to_a, buf, len, subst_seq, when); + subst_seq = (subst_seq + 1) & 0xFFFF; + } + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d, count %d\n", s->tx_seq_no, len, count); + + for (i = 0; i < count; i++) + g1050_put(path_b_to_a, buf, len, s->tx_seq_no, when); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int msg_len; + uint8_t msg[1024]; + int t38_version; + int seq_no; + int use_ecm; + int without_pacing; + int use_tep; + int model_no; + int speed_pattern_no; + const char *input_file_name; + double tx_when; + double rx_when; + int use_gui; + int supported_modems; + int opt; + t30_state_t *t30; + t38_core_state_t *t38_core; + logging_state_t *logging; + + t38_version = 1; + without_pacing = FALSE; + use_tep = FALSE; + input_file_name = INPUT_FILE_NAME; + use_ecm = FALSE; + simulate_incrementing_repeats = FALSE; + model_no = 0; + speed_pattern_no = 1; + use_gui = FALSE; + supported_modems = T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17; + while ((opt = getopt(argc, argv, "efgi:Im:M:ps:tv:")) != -1) + { + switch (opt) + { + case 'e': + use_ecm = TRUE; + break; + case 'g': +#if defined(ENABLE_GUI) + use_gui = TRUE; +#else + fprintf(stderr, "Graphical monitoring not available\n"); + exit(2); +#endif + break; + case 'i': + input_file_name = optarg; + break; + case 'I': + simulate_incrementing_repeats = TRUE; + break; + case 'm': + supported_modems = atoi(optarg); + break; + case 'M': + model_no = optarg[0] - 'A' + 1; + break; + case 'p': + without_pacing = TRUE; + break; + case 's': + speed_pattern_no = atoi(optarg); + break; + case 't': + use_tep = TRUE; + break; + case 'v': + t38_version = atoi(optarg); + break; + default: + //usage(); + exit(2); + break; + } + } + + printf("Using T.38 version %d\n", t38_version); + if (use_ecm) + printf("Using ECM\n"); + + srand48(0x1234567); + if ((path_a_to_b = g1050_init(model_no, speed_pattern_no, 100, 33)) == NULL) + { + fprintf(stderr, "Failed to start IP network path model\n"); + exit(2); + } + if ((path_b_to_a = g1050_init(model_no, speed_pattern_no, 100, 33)) == NULL) + { + fprintf(stderr, "Failed to start IP network path model\n"); + exit(2); + } + + if ((t38_state_a = t38_terminal_init(NULL, TRUE, tx_packet_handler_a, t38_state_b)) == NULL) + { + fprintf(stderr, "Cannot start the T.38 channel\n"); + exit(2); + } + t30 = t38_terminal_get_t30_state(t38_state_a); + t38_core = t38_terminal_get_t38_core_state(t38_state_a); + t38_set_t38_version(t38_core, t38_version); + t38_terminal_set_config(t38_state_a, without_pacing); + t38_terminal_set_tep_mode(t38_state_a, use_tep); + + logging = t38_terminal_get_logging_state(t38_state_a); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-A"); + + logging = t38_core_get_logging_state(t38_core); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-A"); + + logging = t30_get_logging_state(t30); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-A"); + + t30_set_supported_modems(t30, supported_modems); + t30_set_tx_ident(t30, "11111111"); + t30_set_tx_nsf(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp\x00", 12); + t30_set_tx_file(t30, input_file_name, -1, -1); + t30_set_phase_b_handler(t30, phase_b_handler, (void *) (intptr_t) 'A'); + t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'A'); + t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'A'); + t30_set_ecm_capability(t30, use_ecm); + if (use_ecm) + t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION); + + if ((t38_state_b = t38_terminal_init(NULL, FALSE, tx_packet_handler_b, t38_state_a)) == NULL) + { + fprintf(stderr, "Cannot start the T.38 channel\n"); + exit(2); + } + t30 = t38_terminal_get_t30_state(t38_state_b); + t38_core = t38_terminal_get_t38_core_state(t38_state_b); + t38_set_t38_version(t38_core, t38_version); + t38_terminal_set_config(t38_state_b, without_pacing); + t38_terminal_set_tep_mode(t38_state_b, use_tep); + + logging = t38_terminal_get_logging_state(t38_state_b); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-B"); + + logging = t38_core_get_logging_state(t38_core); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-B"); + + logging = t30_get_logging_state(t30); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-B"); + + t30_set_supported_modems(t30, supported_modems); + t30_set_tx_ident(t30, "22222222"); + t30_set_tx_nsf(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp\x00", 12); + t30_set_rx_file(t30, OUTPUT_FILE_NAME, -1); + t30_set_phase_b_handler(t30, phase_b_handler, (void *) (intptr_t) 'B'); + t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'B'); + t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'B'); + t30_set_ecm_capability(t30, use_ecm); + if (use_ecm) + t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION); + +#if defined(ENABLE_GUI) + if (use_gui) + start_media_monitor(); +#endif + for (;;) + { + logging = t38_terminal_get_logging_state(t38_state_a); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + t38_core = t38_terminal_get_t38_core_state(t38_state_a); + logging = t38_core_get_logging_state(t38_core); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + t30 = t38_terminal_get_t30_state(t38_state_a); + logging = t30_get_logging_state(t30); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + logging = t38_terminal_get_logging_state(t38_state_b); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + t38_core = t38_terminal_get_t38_core_state(t38_state_b); + logging = t38_core_get_logging_state(t38_core); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + t30 = t38_terminal_get_t30_state(t38_state_b); + logging = t30_get_logging_state(t30); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + + done[0] = t38_terminal_send_timeout(t38_state_a, SAMPLES_PER_CHUNK); + done[1] = t38_terminal_send_timeout(t38_state_b, SAMPLES_PER_CHUNK); + + when += (float) SAMPLES_PER_CHUNK/(float) SAMPLE_RATE; + + while ((msg_len = g1050_get(path_a_to_b, msg, 1024, when, &seq_no, &tx_when, &rx_when)) >= 0) + { +#if defined(ENABLE_GUI) + if (use_gui) + media_monitor_rx(seq_no, tx_when, rx_when); +#endif + t38_core = t38_terminal_get_t38_core_state(t38_state_b); + t38_core_rx_ifp_packet(t38_core, msg, msg_len, seq_no); + } + while ((msg_len = g1050_get(path_b_to_a, msg, 1024, when, &seq_no, &tx_when, &rx_when)) >= 0) + { +#if defined(ENABLE_GUI) + if (use_gui) + media_monitor_rx(seq_no, tx_when, rx_when); +#endif + t38_core = t38_terminal_get_t38_core_state(t38_state_a); + t38_core_rx_ifp_packet(t38_core, msg, msg_len, seq_no); + } + if (done[0] && done[1]) + break; +#if defined(ENABLE_GUI) + if (use_gui) + media_monitor_update_display(); +#endif + } + t38_terminal_release(t38_state_a); + t38_terminal_release(t38_state_b); + if (!succeeded[0] || !succeeded[1]) + { + printf("Tests failed\n"); + exit(2); + } + printf("Tests passed\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/t38_terminal_to_gateway_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/t38_terminal_to_gateway_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,516 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t38_terminal_to_gateway_tests.c - Joint tests for the T.38 FoIP terminal and gateway modules. + * + * Written by Steve Underwood + * + * Copyright (C) 2005, 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t38_terminal_to_gateway_tests.c,v 1.65.4.1 2009/12/19 09:47:57 steveu Exp $ + */ + +/*! \file */ + +/*! \page t38_terminal_to_gateway_tests_page T.38 mixed gateway and termination tests +\section t38_terminal_to_gateway_tests_page_sec_1 What does it do? +These tests exercise the path + + T.38 termination -> T.38 gateway -> FAX machine +*/ + +/* Enable the following definition to enable direct probing into the FAX structures */ +//#define WITH_SPANDSP_INTERNALS + +#if defined(HAVE_CONFIG_H) +#include +#endif + +#if defined(HAVE_FL_FL_H) && defined(HAVE_FL_FL_CARTESIAN_H) && defined(HAVE_FL_FL_AUDIO_METER_H) +#define ENABLE_GUI +#endif + +#include +#include +#include +#include +#include +#include +#include +#if !defined(_WIN32) +#include +#endif + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#if defined(ENABLE_GUI) +#include "media_monitor.h" +#endif +#include "fax_utils.h" + +#define SAMPLES_PER_CHUNK 160 + +#define INPUT_FILE_NAME "../test-data/itu/fax/itutests.tif" +#define OUTPUT_FILE_NAME "t38.tif" +#define OUTPUT_FILE_NAME_WAVE "t38_terminal_to_gateway.wav" + +t38_terminal_state_t *t38_state_a; +t38_gateway_state_t *t38_state_b; +fax_state_t *fax_state_b; + +g1050_state_t *path_a_to_b; +g1050_state_t *path_b_to_a; + +double when = 0.0; + +int done[2] = {FALSE, FALSE}; +int succeeded[2] = {FALSE, FALSE}; + +int simulate_incrementing_repeats = FALSE; + +static int phase_b_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + char tag[20]; + + i = (int) (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase B", i); + printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result)); + log_rx_parameters(s, tag); + return T30_ERR_OK; +} +/*- End of function --------------------------------------------------------*/ + +static int phase_d_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + char tag[20]; + + i = (int) (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase D", i); + printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result)); + log_transfer_statistics(s, tag); + log_tx_parameters(s, tag); + log_rx_parameters(s, tag); + return T30_ERR_OK; +} +/*- End of function --------------------------------------------------------*/ + +static void phase_e_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + t30_stats_t t; + char tag[20]; + + i = (int) (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase E", i); + printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result)); + log_transfer_statistics(s, tag); + log_tx_parameters(s, tag); + log_rx_parameters(s, tag); + t30_get_transfer_statistics(s, &t); + succeeded[i - 'A'] = (result == T30_ERR_OK) && (t.pages_tx == 12 || t.pages_rx == 12); + done[i - 'A'] = TRUE; +} +/*- End of function --------------------------------------------------------*/ + +static int tx_packet_handler_a(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count) +{ + t38_terminal_state_t *t; + int i; + static int subst_seq = 0; + + /* This routine queues messages between two instances of T.38 processing */ + t = (t38_terminal_state_t *) user_data; + if (simulate_incrementing_repeats) + { + for (i = 0; i < count; i++) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d\n", subst_seq, len); + + g1050_put(path_a_to_b, buf, len, subst_seq, when); + subst_seq = (subst_seq + 1) & 0xFFFF; + } + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d, count %d\n", s->tx_seq_no, len, count); + + for (i = 0; i < count; i++) + g1050_put(path_a_to_b, buf, len, s->tx_seq_no, when); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int tx_packet_handler_b(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count) +{ + t38_terminal_state_t *t; + int i; + static int subst_seq = 0; + + /* This routine queues messages between two instances of T.38 processing */ + t = (t38_terminal_state_t *) user_data; + if (simulate_incrementing_repeats) + { + for (i = 0; i < count; i++) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d\n", subst_seq, len); + + g1050_put(path_b_to_a, buf, len, subst_seq, when); + subst_seq = (subst_seq + 1) & 0xFFFF; + } + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Send seq %d, len %d, count %d\n", s->tx_seq_no, len, count); + + for (i = 0; i < count; i++) + g1050_put(path_b_to_a, buf, len, s->tx_seq_no, when); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int16_t t38_amp_b[SAMPLES_PER_CHUNK]; + int16_t t30_amp_b[SAMPLES_PER_CHUNK]; + int16_t out_amp[2*SAMPLES_PER_CHUNK]; + int t38_len_b; + int t30_len_b; + int msg_len; + uint8_t msg[1024]; + int log_audio; + int outframes; + SNDFILE *wave_handle; + int t38_version; + int use_ecm; + int use_tep; + int feedback_audio; + int use_transmit_on_idle; + const char *input_file_name; + int i; + int seq_no; + int model_no; + int speed_pattern_no; + double tx_when; + double rx_when; + int use_gui; + int supported_modems; + int opt; + t30_state_t *t30; + t38_core_state_t *t38_core; + logging_state_t *logging; + + log_audio = FALSE; + t38_version = 1; + use_ecm = FALSE; + input_file_name = INPUT_FILE_NAME; + simulate_incrementing_repeats = FALSE; + model_no = 0; + speed_pattern_no = 1; + use_gui = FALSE; + use_tep = FALSE; + feedback_audio = FALSE; + use_transmit_on_idle = TRUE; + supported_modems = T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17; + while ((opt = getopt(argc, argv, "efgi:Ilm:M:s:tv:")) != -1) + { + switch (opt) + { + case 'e': + use_ecm = TRUE; + break; + case 'f': + feedback_audio = TRUE; + break; + case 'g': +#if defined(ENABLE_GUI) + use_gui = TRUE; +#else + fprintf(stderr, "Graphical monitoring not available\n"); + exit(2); +#endif + break; + case 'i': + input_file_name = optarg; + break; + case 'I': + simulate_incrementing_repeats = TRUE; + break; + case 'l': + log_audio = TRUE; + break; + case 'm': + supported_modems = atoi(optarg); + break; + case 'M': + model_no = optarg[0] - 'A' + 1; + break; + case 's': + speed_pattern_no = atoi(optarg); + break; + case 't': + use_tep = TRUE; + break; + case 'v': + t38_version = atoi(optarg); + break; + default: + //usage(); + exit(2); + break; + } + } + + printf("Using T.38 version %d\n", t38_version); + if (use_ecm) + printf("Using ECM\n"); + + wave_handle = NULL; + if (log_audio) + { + if ((wave_handle = sf_open_telephony_write(OUTPUT_FILE_NAME_WAVE, 2)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_FILE_NAME_WAVE); + exit(2); + } + } + + srand48(0x1234567); + if ((path_a_to_b = g1050_init(model_no, speed_pattern_no, 100, 33)) == NULL) + { + fprintf(stderr, "Failed to start IP network path model\n"); + exit(2); + } + if ((path_b_to_a = g1050_init(model_no, speed_pattern_no, 100, 33)) == NULL) + { + fprintf(stderr, "Failed to start IP network path model\n"); + exit(2); + } + + if ((t38_state_a = t38_terminal_init(NULL, TRUE, tx_packet_handler_a, &t38_state_b)) == NULL) + { + fprintf(stderr, "Cannot start the T.38 channel\n"); + exit(2); + } + t30 = t38_terminal_get_t30_state(t38_state_a); + t38_core = t38_terminal_get_t38_core_state(t38_state_a); + t38_set_t38_version(t38_core, t38_version); + + logging = t38_terminal_get_logging_state(t38_state_a); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-A"); + + logging = t38_core_get_logging_state(t38_core); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-A"); + + logging = t30_get_logging_state(t30); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-A"); + + t30_set_supported_modems(t30, supported_modems); + t30_set_tx_ident(t30, "11111111"); + t30_set_tx_file(t30, input_file_name, -1, -1); + t30_set_phase_b_handler(t30, phase_b_handler, (void *) (intptr_t) 'A'); + t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'A'); + t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'A'); + t30_set_ecm_capability(t30, use_ecm); + if (use_ecm) + t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION); + + if ((t38_state_b = t38_gateway_init(NULL, tx_packet_handler_b, &t38_state_a)) == NULL) + { + fprintf(stderr, "Cannot start the T.38 channel\n"); + exit(2); + } + t38_core = t38_gateway_get_t38_core_state(t38_state_b); + t38_gateway_set_transmit_on_idle(t38_state_b, use_transmit_on_idle); + t38_set_t38_version(t38_core, t38_version); + t38_gateway_set_ecm_capability(t38_state_b, use_ecm); + + logging = t38_gateway_get_logging_state(t38_state_b); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-B"); + + logging = t38_core_get_logging_state(t38_core); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-B"); + + memset(t38_amp_b, 0, sizeof(t38_amp_b)); + + if ((fax_state_b = fax_init(NULL, FALSE)) == NULL) + { + fprintf(stderr, "Cannot start FAX\n"); + exit(2); + } + t30 = fax_get_t30_state(fax_state_b); + fax_set_transmit_on_idle(fax_state_b, use_transmit_on_idle); + fax_set_tep_mode(fax_state_b, use_tep); + t30_set_supported_modems(t30, supported_modems); + t30_set_tx_ident(t30, "22222222"); + t30_set_tx_nsf(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp\x00", 12); + t30_set_rx_file(t30, OUTPUT_FILE_NAME, -1); + t30_set_phase_b_handler(t30, phase_b_handler, (void *) (intptr_t) 'B'); + t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'B'); + t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'B'); + t30_set_ecm_capability(t30, use_ecm); + if (use_ecm) + t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION); + + logging = fax_get_logging_state(fax_state_b); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "FAX-B "); + + logging = t30_get_logging_state(t30); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "FAX-B "); + + memset(t30_amp_b, 0, sizeof(t30_amp_b)); + +#if defined(ENABLE_GUI) + if (use_gui) + start_media_monitor(); +#endif + for (;;) + { + logging = t38_terminal_get_logging_state(t38_state_a); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + t38_core = t38_terminal_get_t38_core_state(t38_state_a); + logging = t38_core_get_logging_state(t38_core); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + t30 = t38_terminal_get_t30_state(t38_state_a); + logging = t30_get_logging_state(t30); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + logging = t38_gateway_get_logging_state(t38_state_b); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + t38_core = t38_gateway_get_t38_core_state(t38_state_b); + logging = t38_core_get_logging_state(t38_core); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + logging = fax_get_logging_state(fax_state_b); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + t30 = fax_get_t30_state(fax_state_b); + logging = t30_get_logging_state(t30); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + memset(out_amp, 0, sizeof(out_amp)); + + t38_terminal_send_timeout(t38_state_a, SAMPLES_PER_CHUNK); + + t30_len_b = fax_tx(fax_state_b, t30_amp_b, SAMPLES_PER_CHUNK); + if (!use_transmit_on_idle) + { + /* The receive side always expects a full block of samples, but the + transmit side may not be sending any when it doesn't need to. We + may need to pad with some silence. */ + if (t30_len_b < SAMPLES_PER_CHUNK) + { + memset(t30_amp_b + t30_len_b, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - t30_len_b)); + t30_len_b = SAMPLES_PER_CHUNK; + } + } + if (feedback_audio) + { + for (i = 0; i < t30_len_b; i++) + t30_amp_b[i] += t38_amp_b[i] >> 1; + } + if (log_audio) + { + for (i = 0; i < t30_len_b; i++) + out_amp[2*i + 1] = t30_amp_b[i]; + } + if (t38_gateway_rx(t38_state_b, t30_amp_b, t30_len_b)) + break; + + t38_len_b = t38_gateway_tx(t38_state_b, t38_amp_b, SAMPLES_PER_CHUNK); + if (!use_transmit_on_idle) + { + if (t38_len_b < SAMPLES_PER_CHUNK) + { + memset(t38_amp_b + t38_len_b, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - t38_len_b)); + t38_len_b = SAMPLES_PER_CHUNK; + } + } + if (log_audio) + { + for (i = 0; i < t38_len_b; i++) + out_amp[2*i] = t38_amp_b[i]; + } + if (fax_rx(fax_state_b, t38_amp_b, SAMPLES_PER_CHUNK)) + break; + + when += (float) SAMPLES_PER_CHUNK/(float) SAMPLE_RATE; + + while ((msg_len = g1050_get(path_a_to_b, msg, 1024, when, &seq_no, &tx_when, &rx_when)) >= 0) + { +#if defined(ENABLE_GUI) + if (use_gui) + media_monitor_rx(seq_no, tx_when, rx_when); +#endif + t38_core = t38_gateway_get_t38_core_state(t38_state_b); + t38_core_rx_ifp_packet(t38_core, msg, msg_len, seq_no); + } + while ((msg_len = g1050_get(path_b_to_a, msg, 1024, when, &seq_no, &tx_when, &rx_when)) >= 0) + { +#if defined(ENABLE_GUI) + if (use_gui) + media_monitor_rx(seq_no, tx_when, rx_when); +#endif + t38_core = t38_terminal_get_t38_core_state(t38_state_a); + t38_core_rx_ifp_packet(t38_core, msg, msg_len, seq_no); + } + if (log_audio) + { + outframes = sf_writef_short(wave_handle, out_amp, SAMPLES_PER_CHUNK); + if (outframes != SAMPLES_PER_CHUNK) + break; + } + + if (done[0] && done[1]) + break; +#if defined(ENABLE_GUI) + if (use_gui) + media_monitor_update_display(); +#endif + } + t38_terminal_release(t38_state_a); + fax_release(fax_state_b); + if (log_audio) + { + if (sf_close(wave_handle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME_WAVE); + exit(2); + } + } + if (!succeeded[0] || !succeeded[1]) + { + printf("Tests failed\n"); + exit(2); + } + printf("Tests passed\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/t4_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/t4_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,696 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t4_tests.c - ITU T.4 FAX image to and from TIFF file tests + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: t4_tests.c,v 1.69.4.1 2009/12/19 09:47:57 steveu Exp $ + */ + +/*! \file */ + +/*! \page t4_tests_page T.4 tests +\section t4_tests_page_sec_1 What does it do +These tests exercise the image compression and decompression methods defined +in ITU specifications T.4 and T.6. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" + +#define IN_FILE_NAME "../test-data/itu/fax/itutests.tif" +#define OUT_FILE_NAME "t4_tests_receive.tif" + +#define XSIZE 1728 + +t4_state_t send_state; +t4_state_t receive_state; + +/* The following are some test cases from T.4 */ +#define FILL_70 " " +#define FILL_80 " " +#define FILL_100 " " +#define FILL_670 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_70 +#define FILL_980 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_80 + +static const char t4_test_patterns[][1728 + 1] = +{ + "XXXXXX " FILL_980 " XXX XXX X " FILL_670 " XXXX", + "XXXXXX " FILL_980 " XXX X " FILL_670 " XXXX", + /* Line start should code to V(0). Line middle codes to VR(3) VL(2) V(0). Line end should code to V(0) V(0). */ + + " XXXX " FILL_980 " XXXXXXX " FILL_670 " XX ", + "XXXXX " FILL_980 "XX XX " FILL_670 " XXXX", + /* Line start should code to VL(1). Line middle codes to H(7,2). Line end should code to V(0) VR(2) */ + + "XXX " FILL_980 " XX XX XX XXX " FILL_670 " X ", + " " FILL_980 " X XXX XXXX " FILL_670 " X XX", + /* Line start should code to P. Line middle codes to P VL(1) V(0) H(3,4) P. Line end codes to V(0) VL(2) V(0). */ + + "XXXXX " FILL_980 " " FILL_670 " XXXX", + " XXX " FILL_980 " " FILL_670 " XX ", + /* Line start should code to VR(2). Line end codes to V(0) VL(2) V(0). */ + + " XX " FILL_980 " " FILL_670 " X XXX", + "XXX X " FILL_980 " " FILL_670 " X ", + /* Line start should code to H(0,3) VR(1). Line end codes to V(0) VR(3). */ + + " " FILL_980 " " FILL_670 " XX ", + " " FILL_980 " " FILL_670 " ", + /* Line end codes to P V(0) a'0. */ + + " " FILL_980 " " FILL_670 " XXXXXXXXXX", + " " FILL_980 " " FILL_670 " XXXXXX XXXXXX", + /* Line end codes to H(2,6). */ + + " " FILL_980 " " FILL_670 " XX XXXXX", + " " FILL_980 " " FILL_670 " XX ", + /* Line end codes to V(0) H(7,0). */ +}; + +static void dump_image_as_xxx(t4_state_t *state) +{ + uint8_t *s; + int i; + int j; + int k; + + /* Dump the entire image as text 'X's and spaces */ + printf("Image (%d x %d):\n", receive_state.image_width, receive_state.image_length); + s = state->image_buffer; + for (i = 0; i < state->image_length; i++) + { + for (j = 0; j < state->bytes_per_row; j++) + { + for (k = 0; k < 8; k++) + { + printf((state->image_buffer[i*state->bytes_per_row + j] & (0x80 >> k)) ? "X" : " "); + } + } + printf("\n"); + } +} +/*- End of function --------------------------------------------------------*/ + +static void display_page_stats(t4_state_t *s) +{ + t4_stats_t stats; + + t4_get_transfer_statistics(s, &stats); + printf("Pages = %d\n", stats.pages_transferred); + printf("Image size = %d pels x %d pels\n", stats.width, stats.length); + printf("Image resolution = %d pels/m x %d pels/m\n", stats.x_resolution, stats.y_resolution); + printf("Bad rows = %d\n", stats.bad_rows); + printf("Longest bad row run = %d\n", stats.longest_bad_row_run); + printf("Bits per row - min %d, max %d\n", s->min_row_bits, s->max_row_bits); +} +/*- End of function --------------------------------------------------------*/ + +static int row_read_handler(void *user_data, uint8_t buf[], size_t len) +{ + int i; + int j; + const char *s; + static int row = 0; + + /* Send the test pattern. */ + s = t4_test_patterns[row++]; + if (row >= 16) + return 0; + memset(buf, 0, len); + for (i = 0; i < len; i++) + { + for (j = 0; j < 8; j++) + { + if (*s++ != ' ') + buf[i] |= (0x80 >> j); + } + } + if (*s) + printf("Oops - '%c' at end of row %d\n", *s, row); + return len; +} +/*- End of function --------------------------------------------------------*/ + +static int row_write_handler(void *user_data, const uint8_t buf[], size_t len) +{ + int i; + int j; + const char *s; + static int row = 0; + uint8_t ref[8192]; + + /* Verify that what is received matches the test pattern. */ + if (len == 0) + return 0; + s = t4_test_patterns[row++]; + if (row >= 16) + row = 0; + memset(ref, 0, len); + for (i = 0; i < len; i++) + { + for (j = 0; j < 8; j++) + { + if (*s++ != ' ') + ref[i] |= (0x80 >> j); + } + } + if (*s) + printf("Oops - '%c' at end of row %d\n", *s, row); + if (memcmp(buf, ref, len)) + { + printf("Test failed at row %d\n", row); + exit(2); + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +static int detect_page_end(int bit, int page_ended) +{ + static int consecutive_eols; + static int max_consecutive_eols; + static int consecutive_zeros; + static int consecutive_ones; + static int eol_zeros; + static int eol_ones; + static int expected_eols; + static int end_marks; + + /* Check the EOLs are added properly to the end of an image. We can't rely on the + decoder giving the right answer, as a full set of EOLs is not needed for the + decoder to work. */ + if (bit == -1000000) + { + /* Reset */ + consecutive_eols = 0; + max_consecutive_eols = 0; + consecutive_zeros = 0; + consecutive_ones = 0; + end_marks = 0; + + eol_zeros = 11; + eol_ones = (page_ended == T4_COMPRESSION_ITU_T4_2D) ? 2 : 1; + expected_eols = (page_ended == T4_COMPRESSION_ITU_T6) ? 2 : 6; + return FALSE; + } + + /* Monitor whether the EOLs are there in the correct amount */ + if (bit == 0) + { + consecutive_zeros++; + consecutive_ones = 0; + } + else if (bit == 1) + { + if (++consecutive_ones == eol_ones) + { + if (consecutive_eols == 0 && consecutive_zeros >= eol_zeros) + consecutive_eols++; + else if (consecutive_zeros == eol_zeros) + consecutive_eols++; + else + consecutive_eols = 0; + consecutive_zeros = 0; + consecutive_ones = 0; + } + if (max_consecutive_eols < consecutive_eols) + max_consecutive_eols = consecutive_eols; + } + else if (bit == SIG_STATUS_END_OF_DATA) + { + if (end_marks == 0) + { + if (max_consecutive_eols != expected_eols) + { + printf("Only %d EOLs (should be %d)\n", max_consecutive_eols, expected_eols); + return 2; + } + consecutive_zeros = 0; + consecutive_eols = 0; + max_consecutive_eols = 0; + } + if (!page_ended) + { + /* We might need to push a few bits to get the receiver to report the + end of page condition (at least with T.6). */ + if (++end_marks > 50) + { + printf("Receiver missed the end of page mark\n"); + return 2; + } + return 0; + } + return 1; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + static const int compression_sequence[] = + { + //T4_COMPRESSION_NONE, + T4_COMPRESSION_ITU_T4_1D, + T4_COMPRESSION_ITU_T4_2D, + T4_COMPRESSION_ITU_T6, + //T4_COMPRESSION_ITU_T85, + //T4_COMPRESSION_ITU_T43, + //T4_COMPRESSION_ITU_T45, + //T4_COMPRESSION_ITU_T81, + //T4_COMPRESSION_ITU_SYCC_T81 + }; + int sends; + int page_no; + int bit; + int end_of_page; + int end_marks; + int res; + int compression; + int compression_step; + int add_page_headers; + int min_row_bits; + int restart_pages; + int block_size; + char buf[1024]; + uint8_t block[1024]; + const char *in_file_name; + const char *decode_file_name; + int opt; + int i; + int bit_error_rate; + int dump_as_xxx; + int tests_failed; + unsigned int last_pkt_no; + unsigned int pkt_no; + int page_ended; + FILE *file; + + tests_failed = 0; + compression = -1; + compression_step = 0; + add_page_headers = FALSE; + restart_pages = FALSE; + in_file_name = IN_FILE_NAME; + decode_file_name = NULL; + /* Use a non-zero default minimum row length to ensure we test the consecutive EOLs part + properly. */ + min_row_bits = 50; + block_size = 0; + bit_error_rate = 0; + dump_as_xxx = FALSE; + while ((opt = getopt(argc, argv, "126b:d:ehri:m:x")) != -1) + { + switch (opt) + { + case '1': + compression = T4_COMPRESSION_ITU_T4_1D; + compression_step = -1; + break; + case '2': + compression = T4_COMPRESSION_ITU_T4_2D; + compression_step = -1; + break; + case '6': + compression = T4_COMPRESSION_ITU_T6; + compression_step = -1; + break; + case 'b': + block_size = atoi(optarg); + if (block_size > 1024) + block_size = 1024; + break; + case 'd': + decode_file_name = optarg; + break; + case 'e': + bit_error_rate = 0x3FF; + break; + case 'h': + add_page_headers = TRUE; + break; + case 'r': + restart_pages = TRUE; + break; + case 'i': + in_file_name = optarg; + break; + case 'm': + min_row_bits = atoi(optarg); + break; + case 'x': + dump_as_xxx = TRUE; + break; + default: + //usage(); + exit(2); + break; + } + } + /* Create a send and a receive end */ + memset(&send_state, 0, sizeof(send_state)); + memset(&receive_state, 0, sizeof(receive_state)); + + end_of_page = FALSE; + if (decode_file_name) + { + if (compression < 0) + compression = T4_COMPRESSION_ITU_T4_1D; + /* Receive end puts TIFF to a new file. We assume the receive width here. */ + if (t4_rx_init(&receive_state, OUT_FILE_NAME, T4_COMPRESSION_ITU_T4_2D) == NULL) + { + printf("Failed to init T.4 rx\n"); + exit(2); + } + span_log_set_level(&receive_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + t4_rx_set_rx_encoding(&receive_state, compression); + t4_rx_set_x_resolution(&receive_state, T4_X_RESOLUTION_R8); + //t4_rx_set_y_resolution(&receive_state, T4_Y_RESOLUTION_FINE); + t4_rx_set_y_resolution(&receive_state, T4_Y_RESOLUTION_STANDARD); + t4_rx_set_image_width(&receive_state, XSIZE); + + page_no = 1; + t4_rx_start_page(&receive_state); + last_pkt_no = 0; + file = fopen(decode_file_name, "r"); + while (fgets(buf, 1024, file)) + { + if (sscanf(buf, "HDLC: FCD: 06 %x", &pkt_no) == 1) + { + /* Useful for breaking up T.38 ECM logs */ + for (i = 0; i < 256; i++) + { + if (sscanf(&buf[18 + 3*i], "%x", (unsigned int *) &bit) != 1) + break; + if ((end_of_page = t4_rx_put_byte(&receive_state, bit))) + break; + } + } + else if (sscanf(buf, "HDLC: %x", &pkt_no) == 1) + { + /* Useful for breaking up HDLC decodes of ECM logs */ + for (i = 0; i < 256; i++) + { + if (sscanf(&buf[19 + 3*i], "%x", (unsigned int *) &bit) != 1) + break; + if ((end_of_page = t4_rx_put_byte(&receive_state, bit))) + break; + } + } + else if (strlen(buf) > 62 && sscanf(buf + 57, "Rx %d: IFP %x %x", &pkt_no, (unsigned int *) &bit, (unsigned int *) &bit) == 3) + { + /* Useful for breaking up T.38 non-ECM logs */ + if (pkt_no != last_pkt_no + 1) + printf("Packet %u\n", pkt_no); + last_pkt_no = pkt_no; + for (i = 0; i < 256; i++) + { + if (sscanf(&buf[57 + 29 + 3*i], "%x", (unsigned int *) &bit) != 1) + break; + bit = bit_reverse8(bit); + if ((end_of_page = t4_rx_put_byte(&receive_state, bit))) + break; + } + } + else if (sscanf(buf, "%08x %02x %02x %02x", (unsigned int *) &bit, (unsigned int *) &bit, (unsigned int *) &bit, (unsigned int *) &bit) == 4) + { + for (i = 0; i < 16; i++) + { + if (sscanf(&buf[10 + 3*i], "%x", (unsigned int *) &bit) != 1) + break; + bit = bit_reverse8(bit); + if ((end_of_page = t4_rx_put_byte(&receive_state, bit))) + break; + } + } + else if (sscanf(buf, "Rx bit %*d - %d", &bit) == 1) + { + if ((end_of_page = t4_rx_put_bit(&receive_state, bit))) + { + printf("End of page detected\n"); + break; + } + } + } + fclose(file); + if (dump_as_xxx) + dump_image_as_xxx(&receive_state); + t4_rx_end_page(&receive_state); + display_page_stats(&receive_state); + t4_rx_release(&receive_state); + } + else + { +#if 1 + printf("Testing image_function->compress->decompress->image_function\n"); + /* Send end gets image from a function */ + if (t4_tx_init(&send_state, in_file_name, -1, -1) == NULL) + { + printf("Failed to init T.4 tx\n"); + exit(2); + } + span_log_set_level(&send_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + t4_tx_set_row_read_handler(&send_state, row_read_handler, NULL); + t4_tx_set_min_row_bits(&send_state, min_row_bits); + t4_tx_set_local_ident(&send_state, "111 2222 3333"); + + /* Receive end puts TIFF to a function. */ + if (t4_rx_init(&receive_state, OUT_FILE_NAME, T4_COMPRESSION_ITU_T4_2D) == NULL) + { + printf("Failed to init T.4 rx\n"); + exit(2); + } + span_log_set_level(&receive_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + t4_rx_set_row_write_handler(&receive_state, row_write_handler, NULL); + t4_rx_set_image_width(&receive_state, t4_tx_get_image_width(&send_state)); + t4_rx_set_x_resolution(&receive_state, t4_tx_get_x_resolution(&send_state)); + t4_rx_set_y_resolution(&receive_state, t4_tx_get_y_resolution(&send_state)); + + /* Now send and receive the test data with all compression modes. */ + page_no = 1; + /* If we are stepping around the compression schemes, reset to the start of the sequence. */ + if (compression_step > 0) + compression_step = 0; + for (;;) + { + end_marks = 0; + if (compression_step >= 0) + { + compression = compression_sequence[compression_step++]; + if (compression_step > 3) + break; + } + t4_tx_set_tx_encoding(&send_state, compression); + t4_rx_set_rx_encoding(&receive_state, compression); + + if (t4_tx_start_page(&send_state)) + break; + t4_rx_start_page(&receive_state); + do + { + bit = t4_tx_get_bit(&send_state); + if (bit == SIG_STATUS_END_OF_DATA) + { + if (++end_marks > 50) + { + printf("Receiver missed the end of page mark\n"); + tests_failed++; + break; + } + } + end_of_page = t4_rx_put_bit(&receive_state, bit & 1); + } + while (!end_of_page); + t4_tx_end_page(&send_state); + t4_rx_end_page(&receive_state); + if (compression_step < 0) + break; + } + t4_tx_release(&send_state); + t4_rx_release(&receive_state); +#endif +#if 1 + printf("Testing TIFF->compress->decompress->TIFF cycle\n"); + /* Send end gets TIFF from a file */ + if (t4_tx_init(&send_state, in_file_name, -1, -1) == NULL) + { + printf("Failed to init T.4 send\n"); + exit(2); + } + span_log_set_level(&send_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + t4_tx_set_min_row_bits(&send_state, min_row_bits); + t4_tx_set_local_ident(&send_state, "111 2222 3333"); + + /* Receive end puts TIFF to a new file. */ + if (t4_rx_init(&receive_state, OUT_FILE_NAME, T4_COMPRESSION_ITU_T4_2D) == NULL) + { + printf("Failed to init T.4 rx for '%s'\n", OUT_FILE_NAME); + exit(2); + } + span_log_set_level(&receive_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + t4_rx_set_x_resolution(&receive_state, t4_tx_get_x_resolution(&send_state)); + t4_rx_set_y_resolution(&receive_state, t4_tx_get_y_resolution(&send_state)); + t4_rx_set_image_width(&receive_state, t4_tx_get_image_width(&send_state)); + + /* Now send and receive all the pages in the source TIFF file */ + page_no = 1; + sends = 0; + /* If we are stepping around the compression schemes, reset to the start of the sequence. */ + if (compression_step > 0) + compression_step = 0; + for (;;) + { + end_marks = 0; + /* Add a header line to alternate pages, if required */ + if (add_page_headers && (sends & 2)) + t4_tx_set_header_info(&send_state, "Header"); + else + t4_tx_set_header_info(&send_state, NULL); + if (restart_pages && (sends & 1)) + { + /* Use restart, to send the page a second time */ + if (t4_tx_restart_page(&send_state)) + break; + } + else + { + if (compression_step >= 0) + { + compression = compression_sequence[compression_step++]; + if (compression_step > 2) + compression_step = 0; + } + t4_tx_set_tx_encoding(&send_state, compression); + t4_rx_set_rx_encoding(&receive_state, compression); + + if (t4_tx_start_page(&send_state)) + break; + } + t4_rx_start_page(&receive_state); + detect_page_end(-1000000, compression); + page_ended = FALSE; + if (block_size == 0) + { + for (;;) + { + bit = t4_tx_get_bit(&send_state); + /* Monitor whether the EOLs are there in the correct amount */ + if ((res = detect_page_end(bit, page_ended))) + { + tests_failed += (res - 1); + break; + } + if (!page_ended) + { + if (bit_error_rate) + { + if ((rand() % bit_error_rate) == 0) + bit ^= 1; + } + if (t4_rx_put_bit(&receive_state, bit & 1)) + page_ended = TRUE; + } + } + /* Now throw junk at the receive context, to ensure stuff occuring + after the end of page condition has no bad effect. */ + for (i = 0; i < 1000; i++) + { + t4_rx_put_bit(&receive_state, (rand() >> 10) & 1); + } + } + else if (block_size == 1) + { + do + { + bit = t4_tx_get_byte(&send_state); + if ((bit & 0x100)) + { + if (++end_marks > 50) + { + printf("Receiver missed the end of page mark\n"); + tests_failed++; + break; + } + } + end_of_page = t4_rx_put_byte(&receive_state, bit & 0xFF); + } + while (!end_of_page); + } + else + { + do + { + bit = t4_tx_get_chunk(&send_state, block, block_size); + if (bit > 0) + end_of_page = t4_rx_put_chunk(&receive_state, block, bit); + if (bit < block_size) + { + if (++end_marks > 50) + { + printf("Receiver missed the end of page mark\n"); + tests_failed++; + break; + } + } + } + while (!end_of_page); + } + if (dump_as_xxx) + dump_image_as_xxx(&receive_state); + display_page_stats(&receive_state); + if (!restart_pages || (sends & 1)) + t4_tx_end_page(&send_state); + t4_rx_end_page(&receive_state); + sends++; + } + t4_tx_release(&send_state); + t4_rx_release(&receive_state); + /* And we should now have a matching received TIFF file. Note this will only match + at the image level. TIFF files allow a lot of ways to express the same thing, + so bit matching of the files is not the normal case. */ + fflush(stdout); + sprintf(buf, "tiffcmp -t %s %s", in_file_name, OUT_FILE_NAME); + if (tests_failed || system(buf)) + { + printf("Tests failed\n"); + exit(2); + } +#endif + printf("Tests passed\n"); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/testadsi.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/testadsi.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,686 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * testadsi.c + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: testadsi.c,v 1.23 2009/05/30 15:23:14 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(HAVE_LIBUNICALL) + +#include +#include +#include +#include + +#include "unicall.h" +//#include "../libmfcr2/libmfcr2.h" +//#include "../libpri/libpri.h" + +#include "spandsp.h" + +#define FALSE 0 +#define TRUE (!FALSE) + +int caller_mode = FALSE; +static SNDFILE *rxhandle; +static SNDFILE *txhandle; + +#if 0 +int adsi_create_message(adsi_tx_state_t *s, uint8_t *msg) +{ + int len; + + len = adsi_add_field(s, msg, -1, CLASS_SDMF_CALLERID, 0); + len = adsi_add_field(s, msg, len, 0, "10011750", 8); + len = adsi_add_field(s, msg, len, 0, "6095551212", 10); + return len; +} +#endif +#if 0 +int adsi_create_message(adsi_tx_state_t *s, uint8_t *msg) +{ + int len; + + len = adsi_add_field(s, msg, -1, CLIP_MDMF_CALLERID, 0); + len = adsi_add_field(s, msg, len, CLIP_CALLTYPE, "\x81", 1); + len = adsi_add_field(s, msg, len, CLIP_DATETIME, "10011750", 8); + len = adsi_add_field(s, msg, len, CLIP_CALLER_NUMBER, "12345678", 8); + len = adsi_add_field(s, msg, len, CLIP_DIALED_NUMBER, "87654321", 8); + len = adsi_add_field(s, msg, len, CLIP_CALLER_NAME, "Steve Underwood", 15); + return len; +} +#endif +#if 0 +int adsi_create_message(adsi_tx_state_t *s, uint8_t *msg) +{ + int len; + + len = adsi_add_field(s, msg, -1, CLIP_MDMF_CALLERID, 0); + len = adsi_add_field(s, msg, len, CLIP_NUM_MSG, "\x03", 1); + return len; +} +#endif +#if 0 +int adsi_create_message(adsi_tx_state_t *s, uint8_t *msg) +{ + int len; + + len = adsi_add_field(s, msg, -1, CLIP_MDMF_MSG_WAITING, NULL, 0); + len = adsi_add_field(s, msg, len, CLIP_VISUAL_INDICATOR, "\x00", 1); + return len; +} +#endif +#if 0 +int adsi_create_message(adsi_tx_state_t *s, uint8_t *msg) +{ + int len; + + len = adsi_add_field(s, msg, -1, CLIP_MDMF_MSG_WAITING, NULL, 0); + len = adsi_add_field(s, msg, len, CLIP_VISUAL_INDICATOR, "\xFF", 1); + len = adsi_add_field(s, msg, len, CLIP_NUM_MSG, "\x05", 1); + return len; +} +#endif +#if 1 +int adsi_create_message(adsi_tx_state_t *s, uint8_t *msg) +{ + int len; + + len = adsi_add_field(s, msg, -1, CLASS_SDMF_MSG_WAITING, NULL, 0); + len = adsi_add_field(s, msg, len, 0, "\x6F", 1); + len = adsi_add_field(s, msg, len, 0, "\x6F", 1); + len = adsi_add_field(s, msg, len, 0, "\x6F", 1); + return len; +} +#endif +#if 0 +int adsi_create_message(adsi_tx_state_t *s, uint8_t *msg) +{ + int len; + + len = adsi_add_field(s, msg, -1, CLASS_SDMF_MSG_WAITING, NULL, 0); + len = adsi_add_field(s, msg, len, 0, "\x42", 1); + len = adsi_add_field(s, msg, len, 0, "\x42", 1); + len = adsi_add_field(s, msg, len, 0, "\x42", 1); + return len; +} +#endif +#if 0 +int adsi_create_message(adsi_tx_state_t *s, uint8_t *msg) +{ + int len; + + len = adsi_add_field(s, msg, -1, CLIP_MDMF_SMS, NULL, 0); + len = adsi_add_field(s, msg, len, CLIP_DISPLAY_INFO, "\x00ABC", 4); + return len; +} +#endif + +struct +{ + pthread_t thread; + int chan; + int sig_fd; + int fd; + uc_call_t *call; + uc_crn_t crn; + int xxx; + int cause; + + dtmf_rx_state_t dtmf_state; + char dtmf[101]; + int dtmf_ptr; + + char *tag; + + char originating_number[32]; + char destination_number[32]; + + adsi_rx_state_t adsi_rx; + adsi_tx_state_t adsi_tx; +} chan_stuff[30]; + +tone_gen_descriptor_t tone_desc; +tone_gen_state_t gen; + +void channel_read_adsi_channel(uc_t *uc, int chan, void *user_data, uint8_t *buf, int len); +int channel_write_adsi_channel(uc_t *uc, int chan, void *user_data, uint8_t *buf, int max_len); +int channel_error(uc_t *uc, int chan, void *user_data, int cause); +int signaling_error(uc_t *uc, void *user_data, int cause); + +void channel_read_adsi_channel(uc_t *uc, int chan, void *user_data, uint8_t *buf, int len) +{ + int i; + int xlen; + int16_t pcm_buf[1024]; + char *s; + int outframes; + + for (i = 0; i < len; i++) + pcm_buf[i] = alaw_to_linear(buf[i]); + /*endfor*/ + outframes = sf_writef_short(rxhandle, + AF_DEFAULT_TRACK, + pcm_buf, + len); + if (outframes != len) + { + printf("Failed to write %d samples\n", len); + exit(2); + } + + dtmf_rx(&chan_stuff[chan].dtmf_state, pcm_buf, len); + xlen = dtmf_rx_get(&chan_stuff[chan].dtmf_state, + chan_stuff[chan].dtmf + chan_stuff[chan].dtmf_ptr, + 100 - chan_stuff[chan].dtmf_ptr); + if (xlen > 0) + { + s = chan_stuff[chan].dtmf + chan_stuff[chan].dtmf_ptr; + while (*s) + { + if (*s == '#') + { + uc_set_channel_read_callback(uc, 0, NULL, 0); + uc_set_channel_write_callback(uc, 0, NULL, 0); + if (uc_call_control(uc, UC_OP_DROPCALL, chan_stuff[chan].crn, (void *) UC_CAUSE_NORMAL_CLEARING)) + printf ("A Drop Call failed\n"); + /*endif*/ + break; + } + /*endif*/ + s++; + } + /*endwhile*/ + printf("Got '%s'\n", chan_stuff[chan].dtmf); + chan_stuff[chan].dtmf_ptr += xlen; + } + /*endif*/ + adsi_rx(&(chan_stuff[chan].adsi_rx), pcm_buf, len); +} +/*- End of function --------------------------------------------------------*/ + +int channel_write_adsi_channel(uc_t *uc, int chan, void *user_data, uint8_t *buf, int max_len) +{ + int16_t pcm_buf[1024]; + int len; + int i; + static int block = 0; + uint8_t adsi_msg[256]; + int adsi_msg_len; + + if (++block == 100) + { + adsi_send_alert_tone(&(chan_stuff[chan].adsi_tx)); + printf("Alert tone sent\n"); + adsi_msg_len = adsi_create_message(&(chan_stuff[chan].adsi_tx), adsi_msg); + if ((len = adsi_put_message(&(chan_stuff[chan].adsi_tx), adsi_msg, adsi_msg_len)) > 0) + printf("Message put - %d bytes\n", len); + } + len = adsi_tx(&(chan_stuff[chan].adsi_tx), pcm_buf, max_len); + sf_writef_short(txhandle, + AF_DEFAULT_TRACK, + pcm_buf, + len); + for (i = 0; i < len; i++) + buf[i] = linear_to_alaw(pcm_buf[i]); + /*endfor*/ + return len; +} +/*- End of function --------------------------------------------------------*/ + +int channel_error(uc_t *uc, int chan, void *user_data, int cause) +{ + printf("Error %d\n", cause); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int signaling_error(uc_t *uc, void *user_data, int cause) +{ + printf("Error %d\n", cause); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void initiate_call(uc_t *uc, int chan, uc_event_t *e) +{ + uc_makecall_t makecall; + uc_callparms_t *callparms; + int ret; + + printf ("Initiating call\n"); + if ((callparms = uc_new_callparms(NULL)) == NULL) + return; + /*endif*/ + uc_callparm_originating_number(callparms, chan_stuff[chan].originating_number); + uc_callparm_destination_number(callparms, chan_stuff[chan].destination_number); + makecall.callparms = callparms; + makecall.crn = 0; + if (ret = uc_call_control(uc, UC_OP_MAKECALL, 0, (void *) &makecall) != UC_RET_OK) + fprintf(stderr, "Make Call failed - %d\n", ret); + /*endif*/ + chan_stuff[chan].crn = makecall.crn; + free(callparms); +} +/*- End of function --------------------------------------------------------*/ + +static void handle_uc_event(uc_t *uc, void *user_data, uc_event_t *e) +{ + int chan; + + chan = (int) user_data; + printf ("-- %s (%d)\n", uc_event2str(e->e), chan); + switch (e->e) + { + case UC_EVENT_DEVICEFAIL: + break; + case UC_EVENT_PROTOCOLFAIL: + printf("-- Protocol failure on channel %d, cause %d\n", e->gen.channel, e->gen.data); + break; + case UC_EVENT_SIGCHANSTATUS: + printf("-- Signalling channel status - %s\n", e->sigchanstatus.ok ? "Up" : "Down"); + break; + case UC_EVENT_ALARM: + printf("-- Alarm - 0x%X 0x%X\n", e->alarm.raised, e->alarm.cleared); + break; + case UC_EVENT_FARBLOCKED: + printf("-- Channel far end blocked! :-(\n"); + chan_stuff[chan].xxx &= ~1; + break; + case UC_EVENT_FARUNBLOCKED: + printf("-- Channel far end unblocked! :-)\n"); + chan_stuff[chan].xxx |= 1; + if (chan_stuff[chan].xxx == 3) + { + if (caller_mode) + initiate_call(uc, chan, e); + /*endif*/ + } + /*endif*/ + break; + case UC_EVENT_LOCALBLOCKED: + printf("-- Channel local end blocked! :-(\n"); + chan_stuff[chan].xxx &= ~2; + break; + case UC_EVENT_LOCALUNBLOCKED: + printf("-- Channel local end unblocked! :-)\n"); + chan_stuff[chan].xxx |= 2; + if (chan_stuff[chan].xxx == 3) + { + if (caller_mode) + initiate_call(uc, chan, e); + /*endif*/ + } + /*endif*/ + break; + case UC_EVENT_DIALING: + printf("-- Dialing on channel %d\n", e->gen.channel); + break; + case UC_EVENT_ACCEPTED: + printf("-- Accepted on channel %d\n", e->gen.channel); + if (uc_call_control(uc, UC_OP_ANSWERCALL, e->gen.crn, (void *) -1)) + fprintf(stderr, "Answer Call failed\n"); + /*endif*/ + break; + case UC_EVENT_DETECTED: + printf("-- Detected on channel %d\n", e->gen.channel); + break; + case UC_EVENT_ALERTING: + printf("-- Alerting on channel %d\n", e->gen.channel); + /* This is just a notification of call progress. We need take no action at this point. */ + break; + case UC_EVENT_FARDISCONNECTED: + printf("-- Far end disconnected on channel %d\n", e->fardisconnected.channel); + /* Kill any outstanding audio processing */ + uc_set_channel_read_callback(uc, 0, NULL, 0); + uc_set_channel_write_callback(uc, 0, NULL, 0); + if (uc_call_control(uc, UC_OP_DROPCALL, e->fardisconnected.crn, (void *) UC_CAUSE_NORMAL_CLEARING)) + fprintf(stderr, "C Drop Call failed\n"); + /*endif*/ + break; + case UC_EVENT_DROPCALL: + printf("-- Drop call on channel %d\n", e->gen.channel); + if (uc_call_control(uc, UC_OP_RELEASECALL, e->gen.crn, NULL)) + fprintf(stderr, "uc_ReleaseCall failed\n"); + /*endif*/ + break; + case UC_EVENT_RELEASECALL: + printf("-- Released on channel %d\n", e->gen.channel); + if (caller_mode) + initiate_call(uc, chan, e); + /*endif*/ + break; + case UC_EVENT_OFFERED: + printf("-- Offered on channel %d, CRN %d (ANI: %s, DNIS: %s)\n", e->offered.channel, e->offered.crn, e->offered.parms.originating_number, e->offered.parms.destination_number); + if (!caller_mode) + { + switch (chan_stuff[chan].cause) + { + case 0: + if (uc_call_control(uc, UC_OP_ACCEPTCALL, e->offered.crn, (void *) -1)) + fprintf(stderr, "uc_AcceptCall failed\n"); + /*endif*/ + break; + case 1: + if (uc_call_control(uc, UC_OP_ANSWERCALL, e->offered.crn, (void *) -1)) + fprintf(stderr, "uc_AnswerCall failed\n"); + /*endif*/ + break; + case 2: + if (uc_call_control(uc, UC_OP_DROPCALL, e->offered.crn, (void *) UC_CAUSE_USER_BUSY)) + fprintf(stderr, "E Drop Call failed\n"); + /*endif*/ + break; + case 3: + if (uc_call_control(uc, UC_OP_DROPCALL, e->offered.crn, (void *) UC_CAUSE_UNASSIGNED_NUMBER)) + fprintf(stderr, "F Drop Call failed\n"); + /*endif*/ + break; + case 4: + if (uc_call_control(uc, UC_OP_DROPCALL, e->offered.crn, (void *) UC_CAUSE_NETWORK_CONGESTION)) + fprintf(stderr, "G Drop Call failed\n"); + /*endif*/ + break; + case 5: + if (uc_call_control(uc, UC_OP_DROPCALL, e->offered.crn, (void *) UC_CAUSE_DEST_OUT_OF_ORDER)) + fprintf(stderr, "H Drop Call failed\n"); + /*endif*/ + break; + } + /*endswitch*/ + if (++chan_stuff[chan].cause > 5) + chan_stuff[chan].cause = 0; + /*endif*/ + } + /*endif*/ + break; + case UC_EVENT_ANSWERED: + printf("-- Answered on channel %d\n", e->gen.channel); + uc_set_channel_read_callback(uc, 0, channel_read_adsi_channel, (void *) chan); +printf("XXX read callback set\n"); + uc_set_channel_write_callback(uc, 0, channel_write_adsi_channel, (void *) chan); +printf("XXX write callback set\n"); + adsi_tx_init(&(chan_stuff[chan].adsi_tx), ADSI_STANDARD_CLASS); +printf("XXX ADSI inited\n"); + dtmf_rx_init(&chan_stuff[chan].dtmf_state, NULL, NULL); +printf("XXX DTMF inited\n"); + break; + case UC_EVENT_CONNECTED: + printf("-- Connected on channel %d\n", e->gen.channel); + if (uc_call_control(uc, UC_OP_DROPCALL, e->offered.crn, (void *) UC_CAUSE_NORMAL_CLEARING)) + printf ("I Drop Call failed\n"); + /*endif*/ + break; + default: + fprintf(stderr, "--!! Unknown signaling event %d\n", e->e); + break; + } + /*endswitch*/ +} +/*- End of function --------------------------------------------------------*/ + +static void *run_uc(void *arg) +{ + uc_t *uc; + uc_event_t *e; + struct timeval tv = {0,0}; + struct timeval *next; + fd_set rfds; + fd_set wfds; + fd_set efds; + int res; + int dfd; + int chan; + + chan = *((int *) arg); + + dfd = chan_stuff[chan].fd; + uc = uc_new(dfd, dfd, "mfcr2", "cn", UC_MODE_CPE, 1); + //uc = uc_new(dfd, dfd, "pri", "ctr4", UC_MODE_CPE, 1); + if (uc == NULL) + { + fprintf(stderr, "Unable to create instance\n"); + return NULL; + } + /*endif*/ + uc_set_signaling_callback(uc, handle_uc_event, (void *) chan); + uc_set_signaling_error_callback(uc, signaling_error, (void *) chan); + uc_set_channel_error_callback(uc, 0, channel_error, (void *) chan); + uc_set_logging(uc, 0x7FFFFFFF, 0, chan_stuff[chan].tag); + uc_call_control(uc, UC_OP_UNBLOCK, 0, (void *) -1); + for (;;) + { + FD_ZERO(&rfds); + FD_ZERO(&wfds); + FD_ZERO(&efds); + FD_SET(dfd, &rfds); + FD_SET(dfd, &wfds); + FD_SET(dfd, &efds); + + if ((next = uc_schedule_next(uc))) + { + gettimeofday(&tv, NULL); + tv.tv_sec = next->tv_sec - tv.tv_sec; + tv.tv_usec = next->tv_usec - tv.tv_usec; + if (tv.tv_usec < 0) + { + tv.tv_usec += 1000000; + tv.tv_sec -= 1; + } + /*endif*/ + if (tv.tv_sec < 0) + { + tv.tv_sec = 0; + tv.tv_usec = 0; + } + /*endif*/ + } + /*endif*/ + res = select(dfd + 1, &rfds, NULL, &efds, next ? &tv : NULL); + e = NULL; + if (res == 0) + { + uc_schedule_run(uc); + } + else if (res > 0) + { + e = uc_check_event(uc); + } + else if (errno != EINTR) + { + fprintf(stderr, "Error (%d) on select: %s\n", errno, strerror(errno)); + } + /*endif*/ + + if (e) + { + printf("Non-callback signaling event\n"); + handle_uc_event(uc, (void *) chan, e); + } + /*endif*/ + } + /*endfor*/ + return NULL; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + pthread_attr_t attr; + struct zt_bufferinfo b; + struct zt_gains g; + int chan; + int chanx; + char dev_name[20]; + AFfilesetup filesetup; + int j; + + filesetup = afNewFileSetup(); + if (filesetup == AF_NULL_FILESETUP) + { + fprintf(stderr, " Failed to create file setup\n"); + exit(2); + } + afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16); + afInitRate(filesetup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE); + afInitFileFormat(filesetup, AF_FILE_WAVE); + afInitChannels(filesetup, AF_DEFAULT_TRACK, 1); + rxhandle = afOpenFile("rxadsi.wav", "w", filesetup); + if (rxhandle == NULL) + { + fprintf(stderr, " Failed to open adsi audio file\n"); + exit(2); + } + txhandle = afOpenFile("txadsi.wav", "w", filesetup); + if (txhandle == NULL) + { + fprintf(stderr, " Failed to open adsi audio file\n"); + exit(2); + } + + uc_start(); + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + if (argc < 1) + { + fprintf(stderr, "Usage: testcall [call]\n"); + exit(1); + } + /*endif*/ + for (chan = 0; chan < 1/*30*/; chan++) + { + chan_stuff[chan].sig_fd = open("/dev/zap/channel", O_RDWR | O_NONBLOCK); + if (chan_stuff[chan].sig_fd < 0) + { + fprintf(stderr, "Failed to open channel: %s\n", strerror(errno)); + exit(1); + } + /*endif*/ + chan_stuff[chan].fd = chan_stuff[chan].sig_fd; + + /* Allow for the missing channel at TS16 */ + if (chan < 15) + chanx = chan + 1; + else + chanx = chan + 2; + /*endif*/ + if (ioctl(chan_stuff[chan].fd, ZT_SPECIFY, &chanx)) + { + fprintf(stderr, "Failed to specify channel %d: %s\n", chanx, strerror(errno)); + exit(1); + } + /*endif*/ + if (ioctl(chan_stuff[chan].fd, ZT_GET_BUFINFO, &b)) + { + fprintf(stderr, "Unable to get buffer info on channel %d: %s\n", chanx, strerror(errno)); + exit(1); + } + /*endif*/ + printf ("%d %d %d %d %d %d\n", + b.rxbufpolicy, + b.txbufpolicy, + b.numbufs, + b.bufsize, + b.readbufs, + b.writebufs); + b.rxbufpolicy = ZT_POLICY_IMMEDIATE; + b.txbufpolicy = ZT_POLICY_IMMEDIATE; + b.numbufs = 4; + b.bufsize = 160; + if (ioctl(chan_stuff[chan].fd, ZT_SET_BUFINFO, &b)) + { + fprintf(stderr, "Unable to set buffer info on channel %d: %s\n", chanx, strerror(errno)); + exit(1); + } + /*endif*/ + if (ioctl(chan_stuff[chan].fd, ZT_GET_BUFINFO, &b)) + { + fprintf(stderr, "Unable to get buffer info on channel %d: %s\n", chanx, strerror(errno)); + exit(1); + } + /*endif*/ + for (j = 0; j < 256; j++) + { + g.rxgain[j] = j; + g.txgain[j] = j; + } + ioctl(chan_stuff[chan].fd, ZT_SETGAINS, &g); + printf("%d %d %d %d %d %d\n", + b.rxbufpolicy, + b.txbufpolicy, + b.numbufs, + b.bufsize, + b.readbufs, + b.writebufs); + + if (argc > 1) + caller_mode = TRUE; + /*endif*/ + chan_stuff[chan].chan = chan; + sprintf(dev_name, "Chan %2d:", chanx); + chan_stuff[chan].tag = strdup(dev_name); + sprintf(chan_stuff[chan].originating_number, "%d", 987654321 + chan); + sprintf(chan_stuff[chan].destination_number, "%d", 1234 + chan); + + printf("Thread for channel %d\n", chan); + if (pthread_create(&chan_stuff[chan].thread, &attr, run_uc, &chan_stuff[chan].chan)) + exit(2); + /*endif*/ + } + /*endfor*/ + for (;;) + { + sleep(5); + printf("Main thread\n"); + } + /*endfor*/ + exit(0); + + return 0; +} +/*- End of function --------------------------------------------------------*/ +#else +int main(int argc, char *argv[]) +{ + printf("This program was not built with Unicall available\n"); +} +/*- End of function --------------------------------------------------------*/ +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/testfax.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/testfax.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,652 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * testfax.c + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: testfax.c,v 1.33 2009/05/30 15:23:14 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(HAVE_LIBUNICALL) + +#include +#include +#include +#include + +#include "unicall.h" +//#include "../libmfcr2/libmfcr2.h" +//#include "../libpri/libpri.h" +//#include "../libpri/libfx.h" + +#include "spandsp.h" + +int caller_mode = FALSE; +static SNDFILE *rxhandle; +static SNDFILE *txhandle; + +typedef struct +{ + pthread_t thread; + int chan; + int sig_fd; + int fd; + uc_call_t *call; + uc_crn_t crn; + int xxx; + int cause; + uc_t *uc; + + dtmf_rx_state_t dtmf_state; + char dtmf[101]; + int dtmf_ptr; + + char *tag; + + char originating_number[32]; + char destination_number[32]; + + t30_state_t fax; +} chan_stuff_t; + +chan_stuff_t chan_stuff[30]; + +tone_gen_descriptor_t tone_desc; +tone_gen_state_t gen; + +pthread_mutex_t mutex; + +void channel_read_fax_channel(uc_t *uc, int chan, void *user_data, uint8_t *buf, int len); +int channel_write_fax_channel(uc_t *uc, int chan, void *user_data, uint8_t *buf, int max_len); +int channel_error(uc_t *uc, int chan, void *user_data, int cause); +int signaling_error(uc_t *uc, void *user_data, int cause); + +void channel_read_fax_channel(uc_t *uc, int chan, void *user_data, uint8_t *buf, int len) +{ + int i; + int xlen; + char *s; + int outframes; + +#if 0 + outframes = sf_writef_short(rxhandle, + AF_DEFAULT_TRACK, + buf, + len >> 1); + if (outframes != len) + { + printf("Failed to write %d samples\n", len); + exit(2); + } +#endif + dtmf_rx(&chan_stuff[chan].dtmf_state, (int16_t *) buf, len); + xlen = dtmf_rx_get(&chan_stuff[chan].dtmf_state, + chan_stuff[chan].dtmf + chan_stuff[chan].dtmf_ptr, + 100 - chan_stuff[chan].dtmf_ptr); + if (xlen > 0) + { + s = chan_stuff[chan].dtmf + chan_stuff[chan].dtmf_ptr; + while (*s) + { + if (*s == '#') + { + uc_set_channel_read_callback(uc, 0, NULL, 0); + uc_set_channel_write_callback(uc, 0, NULL, 0); + if (uc_call_control(uc, UC_OP_DROPCALL, chan_stuff[chan].crn, (void *) UC_CAUSE_NORMAL_CLEARING)) + printf ("A Drop Call failed\n"); + /*endif*/ + break; + } + /*endif*/ + s++; + } + /*endwhile*/ + printf("Got '%s'\n", chan_stuff[chan].dtmf); + chan_stuff[chan].dtmf_ptr += xlen; + } + /*endif*/ + t30_rx(&(chan_stuff[chan].fax), (int16_t *) buf, len); +} +/*- End of function --------------------------------------------------------*/ + +int channel_write_fax_channel(uc_t *uc, int chan, void *user_data, uint8_t *buf, int max_len) +{ + int len; + + len = t30_tx(&(chan_stuff[chan].fax), (int16_t *) buf, max_len >> 1); + sf_writef_short(txhandle, AF_DEFAULT_TRACK, buf, len); + if (len > 0) + len <<= 1; + return len; +} +/*- End of function --------------------------------------------------------*/ + +int channel_error(uc_t *uc, int chan, void *user_data, int cause) +{ + printf("Error %d\n", cause); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int signaling_error(uc_t *uc, void *user_data, int cause) +{ + printf("Error %d\n", cause); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void initiate_call(uc_t *uc, int chan, uc_event_t *e) +{ + uc_makecall_t makecall; + uc_callparms_t *callparms; + int ret; + + printf ("Initiating call\n"); + pthread_mutex_lock(&mutex); + if ((callparms = uc_new_callparms(NULL)) == NULL) + return; + /*endif*/ + pthread_mutex_unlock(&mutex); + uc_callparm_originating_number(callparms, chan_stuff[chan].originating_number); + uc_callparm_destination_number(callparms, chan_stuff[chan].destination_number); + makecall.callparms = callparms; + makecall.crn = 0; + if (ret = uc_call_control(uc, UC_OP_MAKECALL, 0, (void *) &makecall) != UC_RET_OK) + fprintf(stderr, "Make Call failed - %d\n", ret); + /*endif*/ + chan_stuff[chan].crn = makecall.crn; + free(callparms); +} +/*- End of function --------------------------------------------------------*/ + +static void phase_b_handler(t30_state_t *s, void *user_data, int msg) +{ + chan_stuff_t *t; + + t = (chan_stuff_t *) user_data; + printf("Phase B - %d\n", msg); +} +/*- End of function --------------------------------------------------------*/ + +static void phase_d_handler(t30_state_t *s, void *user_data, int msg) +{ + chan_stuff_t *t; + + t = (chan_stuff_t *) user_data; + printf("Phase D - %d\n", msg); +} +/*- End of function --------------------------------------------------------*/ + +static void phase_e_handler(t30_state_t *s, void *user_data, int result) +{ + chan_stuff_t *t; + + printf("Phase E - %d\n", result); + t = (chan_stuff_t *) user_data; + if (uc_call_control(t->uc, UC_OP_DROPCALL, t->crn, (void *) UC_CAUSE_NORMAL_CLEARING)) + fprintf(stderr, "Phase E Drop Call failed\n"); + /*endif*/ +} +/*- End of function --------------------------------------------------------*/ + +static void flush_handler(t30_state_t *s, void *user_data, int which) +{ + chan_stuff_t *t; + + printf("Flush\n"); + t = (chan_stuff_t *) user_data; +} +/*- End of function --------------------------------------------------------*/ + +static void handle_uc_event(uc_t *uc, void *user_data, uc_event_t *e) +{ + int chan; + + chan = (int) user_data; + + printf ("-- %s (%d)\n", uc_event2str(e->e), chan); + switch (e->e) + { + case UC_EVENT_DEVICEFAIL: + break; + case UC_EVENT_PROTOCOLFAIL: + printf("-- Protocol failure on channel %d, cause %d\n", e->gen.channel, e->gen.data); + break; + case UC_EVENT_SIGCHANSTATUS: + printf("-- Signalling channel status - %s\n", e->sigchanstatus.ok ? "Up" : "Down"); + break; + case UC_EVENT_ALARM: + printf("-- Alarm - 0x%X 0x%X\n", e->alarm.raised, e->alarm.cleared); + break; + case UC_EVENT_FARBLOCKED: + printf("-- Channel far end blocked! :-(\n"); + chan_stuff[chan].xxx &= ~1; + break; + case UC_EVENT_FARUNBLOCKED: + printf("-- Channel far end unblocked! :-)\n"); + chan_stuff[chan].xxx |= 1; + if (chan_stuff[chan].xxx == 3) + { + if (caller_mode) + initiate_call(uc, chan, e); + /*endif*/ + } + /*endif*/ + break; + case UC_EVENT_LOCALBLOCKED: + printf("-- Channel local end blocked! :-(\n"); + chan_stuff[chan].xxx &= ~2; + break; + case UC_EVENT_LOCALUNBLOCKED: + printf("-- Channel local end unblocked! :-)\n"); + chan_stuff[chan].xxx |= 2; + if (chan_stuff[chan].xxx == 3) + { + if (caller_mode) + initiate_call(uc, chan, e); + /*endif*/ + } + /*endif*/ + break; + case UC_EVENT_DIALING: + printf("-- Dialing on channel %d\n", e->gen.channel); + break; + case UC_EVENT_PROCEEDING: + printf("-- Proceeding on channel %d\n", e->gen.channel); + break; + case UC_EVENT_ACCEPTED: + printf("-- Accepted on channel %d\n", e->gen.channel); + if (uc_call_control(uc, UC_OP_ANSWERCALL, e->gen.crn, (void *) -1)) + fprintf(stderr, "Answer Call failed\n"); + /*endif*/ + break; + case UC_EVENT_DETECTED: + printf("-- Detected on channel %d\n", e->gen.channel); + break; + case UC_EVENT_MOREDIGITS: + printf("-- More digits on channel %d, CRN %d (ANI: %s, DNIS: %s)\n", e->offered.channel, e->offered.crn, e->offered.parms.originating_number, e->offered.parms.destination_number); + break; + case UC_EVENT_ALERTING: + printf("-- Alerting on channel %d\n", e->gen.channel); + /* This is just a notification of call progress. We need take no action at this point. */ + break; + case UC_EVENT_FARDISCONNECTED: + printf("-- Far end disconnected on channel %d\n", e->fardisconnected.channel); + /* Kill any outstanding audio processing */ + uc_set_channel_read_callback(uc, 0, NULL, 0); + uc_set_channel_write_callback(uc, 0, NULL, 0); + if (uc_call_control(uc, UC_OP_DROPCALL, e->fardisconnected.crn, (void *) UC_CAUSE_NORMAL_CLEARING)) + fprintf(stderr, "C Drop Call failed\n"); + /*endif*/ + break; + case UC_EVENT_DROPCALL: + printf("-- Drop call on channel %d\n", e->gen.channel); + if (uc_call_control(uc, UC_OP_RELEASECALL, e->gen.crn, NULL)) + fprintf(stderr, "uc_ReleaseCall failed\n"); + /*endif*/ + break; + case UC_EVENT_RELEASECALL: + printf("-- Released on channel %d\n", e->gen.channel); + if (caller_mode) + initiate_call(uc, chan, e); + /*endif*/ + break; + case UC_EVENT_OFFERED: + printf("-- Offered on channel %d, CRN %d (ANI: %s, DNIS: %s)\n", e->offered.channel, e->offered.crn, e->offered.parms.originating_number, e->offered.parms.destination_number); + if (!caller_mode) + { + switch (chan_stuff[chan].cause) + { + case 0: + if (uc_call_control(uc, UC_OP_ACCEPTCALL, e->offered.crn, (void *) -1)) + fprintf(stderr, "uc_AcceptCall failed\n"); + /*endif*/ + chan_stuff[chan].crn = e->offered.crn; + break; + case 1: + if (uc_call_control(uc, UC_OP_ANSWERCALL, e->offered.crn, (void *) -1)) + fprintf(stderr, "uc_AnswerCall failed\n"); + /*endif*/ + chan_stuff[chan].crn = e->offered.crn; + break; + case 2: + if (uc_call_control(uc, UC_OP_DROPCALL, e->offered.crn, (void *) UC_CAUSE_USER_BUSY)) + fprintf(stderr, "E Drop Call failed\n"); + /*endif*/ + break; + case 3: + if (uc_call_control(uc, UC_OP_DROPCALL, e->offered.crn, (void *) UC_CAUSE_UNASSIGNED_NUMBER)) + fprintf(stderr, "F Drop Call failed\n"); + /*endif*/ + break; + case 4: + if (uc_call_control(uc, UC_OP_DROPCALL, e->offered.crn, (void *) UC_CAUSE_NETWORK_CONGESTION)) + fprintf(stderr, "G Drop Call failed\n"); + /*endif*/ + break; + case 5: + if (uc_call_control(uc, UC_OP_DROPCALL, e->offered.crn, (void *) UC_CAUSE_DEST_OUT_OF_ORDER)) + fprintf(stderr, "H Drop Call failed\n"); + /*endif*/ + break; + } + /*endswitch*/ + if (++chan_stuff[chan].cause > 5) + chan_stuff[chan].cause = 0; + /*endif*/ + } + /*endif*/ + break; + case UC_EVENT_ANSWERED: + printf("-- Answered on channel %d\n", e->gen.channel); + uc_set_channel_read_callback(uc, 0, channel_read_fax_channel, (void *) chan); +printf("XXX read callback set\n"); + uc_set_channel_write_callback(uc, 0, channel_write_fax_channel, (void *) chan); +printf("XXX write callback set\n"); + t30_init(&(chan_stuff[chan].fax), FALSE, uc); + t30_set_local_ident(&(chan_stuff[chan].fax), "12345678"); + t30_set_tx_file(&(chan_stuff[chan].fax), "tx.tif"); + //t30_set_rx_file(&(chan_stuff[chan].fax), "rx.tif"); + t30_set_phase_b_handler(&(chan_stuff[chan].fax), phase_b_handler, &(chan_stuff[chan])); + t30_set_phase_d_handler(&(chan_stuff[chan].fax), phase_d_handler, &(chan_stuff[chan])); + t30_set_phase_e_handler(&(chan_stuff[chan].fax), phase_e_handler, &(chan_stuff[chan])); + t30_set_flush_handler(&(chan_stuff[chan].fax), flush_handler, &(chan_stuff[chan])); +printf("XXX FAX inited\n"); + dtmf_rx_init(&chan_stuff[chan].dtmf_state, NULL, NULL); +printf("XXX DTMF inited\n"); + break; + case UC_EVENT_CONNECTED: + printf("-- Connected on channel %d\n", e->gen.channel); + uc_set_channel_read_callback(uc, 0, channel_read_fax_channel, (void *) chan); +printf("XXX read callback set\n"); + uc_set_channel_write_callback(uc, 0, channel_write_fax_channel, (void *) chan); +printf("XXX write callback set\n"); + t30_init(&(chan_stuff[chan].fax), TRUE, uc); + t30_set_local_ident(&(chan_stuff[chan].fax), "87654321"); + t30_set_tx_file(&(chan_stuff[chan].fax), "tx.tif"); + //t30_set_rx_file(&(chan_stuff[chan].fax), "rx.tif"); + t30_set_phase_b_handler(&(chan_stuff[chan].fax), phase_b_handler, &(chan_stuff[chan])); + t30_set_phase_d_handler(&(chan_stuff[chan].fax), phase_d_handler, &(chan_stuff[chan])); + t30_set_phase_e_handler(&(chan_stuff[chan].fax), phase_e_handler, &(chan_stuff[chan])); +printf("XXX FAX inited\n"); +#if 0 + if (uc_call_control(uc, UC_OP_DROPCALL, e->offered.crn, (void *) UC_CAUSE_NORMAL_CLEARING)) + printf ("I Drop Call failed\n"); + /*endif*/ +#endif + break; + default: + fprintf(stderr, "--!! Unknown signaling event %d\n", e->e); + break; + } + /*endswitch*/ +} +/*- End of function --------------------------------------------------------*/ + +static void *run_uc(void *arg) +{ + uc_t *uc; + uc_event_t *e; + struct timeval tv = {0,0}; + struct timeval *next; + fd_set rfds; + fd_set wfds; + fd_set efds; + int res; + int dfd; + int chan; + + chan = *((int *) arg); + + dfd = chan_stuff[chan].fd; + if (chan < 4) + uc = uc_new(dfd, dfd, "fx", "ls,us", UC_MODE_CO, 1); + else + uc = uc_new(dfd, dfd, "fx", "ls", UC_MODE_CPE, 1); + //uc = uc_new(dfd, dfd, "mfcr2", "cn", UC_MODE_CPE, 1); + //uc = uc_new(dfd, dfd, "pri", "ctr4", UC_MODE_CPE, 1); + if (uc == NULL) + { + fprintf(stderr, "Unable to create instance\n"); + return NULL; + } + /*endif*/ + uc_set_api_codec(uc, 0, UC_CODEC_LINEAR16); + + chan_stuff[chan].uc = uc; + uc_set_signaling_callback(uc, handle_uc_event, (void *) chan); + uc_set_signaling_error_callback(uc, signaling_error, (void *) chan); + uc_set_channel_error_callback(uc, 0, channel_error, (void *) chan); + uc_set_logging(uc, 0x7FFFFFFF, 0, chan_stuff[chan].tag); + uc_call_control(uc, UC_OP_UNBLOCK, 0, (void *) -1); + for (;;) + { + FD_ZERO(&rfds); + FD_ZERO(&wfds); + FD_ZERO(&efds); + FD_SET(dfd, &rfds); + FD_SET(dfd, &wfds); + FD_SET(dfd, &efds); + + if ((next = uc_schedule_next(uc))) + { + gettimeofday(&tv, NULL); + tv.tv_sec = next->tv_sec - tv.tv_sec; + tv.tv_usec = next->tv_usec - tv.tv_usec; + if (tv.tv_usec < 0) + { + tv.tv_usec += 1000000; + tv.tv_sec -= 1; + } + /*endif*/ + if (tv.tv_sec < 0) + { + tv.tv_sec = 0; + tv.tv_usec = 0; + } + /*endif*/ + } + /*endif*/ + res = select(dfd + 1, &rfds, NULL, &efds, next ? &tv : NULL); + e = NULL; + if (res == 0) + { + uc_schedule_run(uc); + } + else if (res > 0) + { + e = uc_check_event(uc); + } + else if (errno != EINTR) + { + fprintf(stderr, "Error (%d) on select: %s\n", errno, strerror(errno)); + } + /*endif*/ + + if (e) + { + printf("Non-callback signaling event\n"); + handle_uc_event(uc, (void *) chan, e); + } + /*endif*/ + } + /*endfor*/ + return NULL; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + pthread_attr_t attr; + struct zt_bufferinfo b; + struct zt_gains g; + int chan; + int chanx; + char dev_name[20]; + AFfilesetup filesetup; + int j; + + filesetup = afNewFileSetup(); + if (filesetup == AF_NULL_FILESETUP) + { + fprintf(stderr, " Failed to create file setup\n"); + exit(2); + } + afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16); + afInitRate(filesetup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE); + afInitFileFormat(filesetup, AF_FILE_WAVE); + afInitChannels(filesetup, AF_DEFAULT_TRACK, 1); + rxhandle = afOpenFile("rxfax.wav", "w", filesetup); + if (rxhandle == NULL) + { + fprintf(stderr, " Failed to open fax audio file\n"); + exit(2); + } + txhandle = afOpenFile("txfax.wav", "w", filesetup); + if (txhandle == NULL) + { + fprintf(stderr, " Failed to open fax audio file\n"); + exit(2); + } + + if (argc < 1) + { + fprintf(stderr, "Usage: testcall [call]\n"); + exit(1); + } + /*endif*/ + uc_start(); + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_mutex_init(&mutex, NULL); + for (chan = 0; chan < 5/*30*/; chan++) + { + chan_stuff[chan].sig_fd = open("/dev/zap/channel", O_RDWR | O_NONBLOCK); + if (chan_stuff[chan].sig_fd < 0) + { + fprintf(stderr, "Failed to open channel: %s\n", strerror(errno)); + exit(1); + } + /*endif*/ + chan_stuff[chan].fd = chan_stuff[chan].sig_fd; + + /* Allow for the missing channel at TS16 */ + chanx = chan + 1 + (chan + 15)%30; + chanx = chan + 125; + if (ioctl(chan_stuff[chan].fd, ZT_SPECIFY, &chanx)) + { + fprintf(stderr, "Failed to specify channel %d: %s\n", chanx, strerror(errno)); + exit(1); + } + /*endif*/ + if (ioctl(chan_stuff[chan].fd, ZT_GET_BUFINFO, &b)) + { + fprintf(stderr, "Unable to get buffer info on channel %d: %s\n", chanx, strerror(errno)); + exit(1); + } + /*endif*/ + printf ("%d %d %d %d %d %d\n", + b.rxbufpolicy, + b.txbufpolicy, + b.numbufs, + b.bufsize, + b.readbufs, + b.writebufs); + b.rxbufpolicy = ZT_POLICY_IMMEDIATE; + b.txbufpolicy = ZT_POLICY_IMMEDIATE; + b.numbufs = 4; + b.bufsize = 160; + if (ioctl(chan_stuff[chan].fd, ZT_SET_BUFINFO, &b)) + { + fprintf(stderr, "Unable to set buffer info on channel %d: %s\n", chanx, strerror(errno)); + exit(1); + } + /*endif*/ + if (ioctl(chan_stuff[chan].fd, ZT_GET_BUFINFO, &b)) + { + fprintf(stderr, "Unable to get buffer info on channel %d: %s\n", chanx, strerror(errno)); + exit(1); + } + /*endif*/ + for (j = 0; j < 256; j++) + { + g.rxgain[j] = j; + g.txgain[j] = j; + } + /*endif*/ + ioctl(chan_stuff[chan].fd, ZT_SETGAINS, &g); + printf("%d %d %d %d %d %d\n", + b.rxbufpolicy, + b.txbufpolicy, + b.numbufs, + b.bufsize, + b.readbufs, + b.writebufs); + + if (argc > 1) + caller_mode = TRUE; + /*endif*/ + chan_stuff[chan].chan = chan; + sprintf(dev_name, "Chan %2d:", chanx); + chan_stuff[chan].tag = strdup(dev_name); + sprintf(chan_stuff[chan].originating_number, "%d", 987654321 + chan); + sprintf(chan_stuff[chan].destination_number, "%d", 1234 + chan); + printf("Thread for channel %d\n", chan); + if (pthread_create(&chan_stuff[chan].thread, &attr, run_uc, &chan_stuff[chan].chan)) + exit(2); + /*endif*/ + } + /*endfor*/ + for (;;) + { + sleep(5); + printf("Main thread\n"); + } + /*endfor*/ + + return 0; +} +/*- End of function --------------------------------------------------------*/ +#else +int main(int argc, char *argv[]) +{ + printf("This program was not built with Unicall available\n"); +} +/*- End of function --------------------------------------------------------*/ +#endif +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/time_scale_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/time_scale_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,169 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * time_scale_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: time_scale_tests.c,v 1.24 2009/05/30 15:23:14 steveu Exp $ + */ + +/*! \page time_scale_tests_page Time scaling tests +\section time_scale_tests_page_sec_1 What does it do? +These tests run a speech file through the time scaling routines. + +\section time_scale_tests_page_sec_2 How are the tests run? +These tests process a speech file called pre_time_scale.wav. This file should contain +8000 sample/second 16 bits/sample linear audio. The tests read this file, change the +time scale of its contents, and write the resulting audio to post_time_scale.wav. +This file also contains 8000 sample/second 16 bits/sample linear audio. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +#include "spandsp.h" + +#include "spandsp/private/time_scale.h" + +#define BLOCK_LEN 160 + +#define IN_FILE_NAME "../test-data/local/short_nb_voice.wav" +#define OUT_FILE_NAME "time_scale_result.wav" + +int main(int argc, char *argv[]) +{ + SNDFILE *inhandle; + SNDFILE *outhandle; + SF_INFO info; + int16_t in[BLOCK_LEN]; + int16_t out[5*(BLOCK_LEN + TIME_SCALE_MAX_SAMPLE_RATE/TIME_SCALE_MIN_PITCH)]; + int frames; + int new_frames; + int out_frames; + int count; + int max; + time_scale_state_t state; + float rate; + float sample_rate; + const char *in_file_name; + int sweep_rate; + int opt; + + rate = 1.8f; + sweep_rate = FALSE; + in_file_name = IN_FILE_NAME; + while ((opt = getopt(argc, argv, "i:r:s")) != -1) + { + switch (opt) + { + case 'i': + in_file_name = optarg; + break; + case 'r': + rate = atof(optarg); + break; + case 's': + sweep_rate = TRUE; + break; + default: + //usage(); + exit(2); + break; + } + } + if ((inhandle = sf_open(in_file_name, SFM_READ, &info)) == NULL) + { + printf(" Cannot open audio file '%s'\n", in_file_name); + exit(2); + } + if (info.channels != 1) + { + printf(" Unexpected number of channels in audio file '%s'\n", in_file_name); + exit(2); + } + sample_rate = info.samplerate; + + memset(&info, 0, sizeof(info)); + info.frames = 0; + info.samplerate = sample_rate; + info.channels = 1; + info.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16; + info.sections = 1; + info.seekable = 1; + + if ((outhandle = sf_open(OUT_FILE_NAME, SFM_WRITE, &info)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + + if ((time_scale_init(&state, (int) sample_rate, rate)) == NULL) + { + fprintf(stderr, " Cannot start the time scaler\n"); + exit(2); + } + max = time_scale_max_output_len(&state, BLOCK_LEN); + printf("Rate is %f, longest output block is %d\n", rate, max); + count = 0; + while ((frames = sf_readf_short(inhandle, in, BLOCK_LEN))) + { + new_frames = time_scale(&state, out, in, frames); + out_frames = sf_writef_short(outhandle, out, new_frames); + if (out_frames != new_frames) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + if (sweep_rate && ++count > 100) + { + if (rate > 0.5f) + { + rate -= 0.1f; + if (rate >= 0.99f && rate <= 1.01f) + rate -= 0.1f; + time_scale_init(&state, SAMPLE_RATE, rate); + max = time_scale_max_output_len(&state, BLOCK_LEN); + printf("Rate is %f, longest output block is %d\n", rate, max); + } + count = 0; + } + } + if (sf_close(inhandle) != 0) + { + printf(" Cannot close audio file '%s'\n", in_file_name); + exit(2); + } + if (sf_close(outhandle) != 0) + { + printf(" Cannot close audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/tone_detect_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/tone_detect_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,144 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * tone_detect_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: tone_detect_tests.c,v 1.12 2009/05/30 15:23:14 steveu Exp $ + */ + +/*! \page tone_detect_tests_page Tone detection tests +\section tone_detect_tests_page_sec_1 What does it do? +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" + +#define DEC_SAMPLE_RATE 800 +#define DEC_RATIO 10 +#define BLOCK_LEN 56 +#define PG_WINDOW 56 +#define FREQ1 440.0f +#define FREQ2 480.0f + +static int periodogram_tests(void) +{ + int i; + int j; + int k; + int len; + complexf_t coeffs[PG_WINDOW/2]; + complexf_t camp[BLOCK_LEN]; + complexf_t last_result; + complexf_t result; + complexf_t phase_offset; + float freq_error; + float pg_scale; + float level; + float scale1; + float scale2; + int32_t phase_rate1; + int32_t phase_rate2; + uint32_t phase_acc1; + uint32_t phase_acc2; + awgn_state_t noise_source_re; + awgn_state_t noise_source_im; + + phase_rate1 = DEC_RATIO*dds_phase_ratef(FREQ1 - 5.0f); + phase_rate2 = DEC_RATIO*dds_phase_ratef(FREQ2); + phase_acc1 = 0; + phase_acc2 = 0; + len = periodogram_generate_coeffs(coeffs, FREQ1, DEC_SAMPLE_RATE, PG_WINDOW); + if (len != PG_WINDOW/2) + { + printf("Test failed\n"); + return -1; + } + pg_scale = periodogram_generate_phase_offset(&phase_offset, FREQ1, DEC_SAMPLE_RATE, PG_WINDOW); + scale1 = dds_scaling_dbm0f(-6.0f); + scale2 = dds_scaling_dbm0f(-6.0f); + + for (k = -50; k < 0; k++) + { + printf("Setting noise to %ddBm0\n", k); + awgn_init_dbm0(&noise_source_re, 1234567, (float) k); + awgn_init_dbm0(&noise_source_im, 7654321, (float) k); + last_result = complex_setf(0.0f, 0.0f); + for (i = 0; i < 100; i++) + { + for (j = 0; j < PG_WINDOW; j++) + { + result = dds_complexf(&phase_acc1, phase_rate1); + camp[j].re = result.re*scale1; + camp[j].im = result.im*scale1; + result = dds_complexf(&phase_acc2, phase_rate2); + camp[j].re += result.re*scale2; + camp[j].im += result.im*scale2; + camp[j].re += awgn(&noise_source_re); + camp[j].im += awgn(&noise_source_im); + } + result = periodogram(coeffs, camp, PG_WINDOW); + level = sqrtf(result.re*result.re + result.im*result.im); + freq_error = periodogram_freq_error(&phase_offset, pg_scale, &last_result, &result); + last_result = result; + if (i == 0) + continue; + + printf("Signal level = %.5f, freq error = %.5f\n", level, freq_error); + if (level < scale1*0.8f || level > scale1*1.2f) + { + printf("Test failed - %ddBm0 of noise, signal is %f (%f)\n", k, level, scale1); + return -1; + } + if (freq_error < -10.0f || freq_error > 10.0f) + { + printf("Test failed - %ddBm0 of noise, %fHz error\n", k, freq_error); + return -1; + } + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + if (periodogram_tests()) + exit(2); + printf("Tests passed\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/tone_generate_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/tone_generate_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,253 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * tone_generate_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2001 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: tone_generate_tests.c,v 1.22 2009/05/30 15:23:14 steveu Exp $ + */ + +/*! \page tone_generate_tests_page Tone generation tests +\section tone_generate_tests_page_sec_1 What does it do? +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define OUTPUT_FILE_NAME "tone_generate.wav" + +int main(int argc, char *argv[]) +{ + tone_gen_descriptor_t tone_desc; + tone_gen_state_t tone_state; + int i; + int16_t amp[16384]; + int len; + SNDFILE *outhandle; + int outframes; + + if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + + /* Try a tone pair */ + make_tone_gen_descriptor(&tone_desc, + 440, + -10, + 620, + -15, + 100, + 200, + 300, + 400, + FALSE); + tone_gen_init(&tone_state, &tone_desc); + + for (i = 0; i < 1000; i++) + { + len = tone_gen(&tone_state, amp, 160); + printf("Generated %d samples\n", len); + if (len <= 0) + break; + outframes = sf_writef_short(outhandle, amp, len); + } + + /* Try a different tone pair */ + make_tone_gen_descriptor(&tone_desc, + 350, + -10, + 440, + -15, + 400, + 300, + 200, + 100, + TRUE); + tone_gen_init(&tone_state, &tone_desc); + + for (i = 0; i < 1000; i++) + { + len = tone_gen(&tone_state, amp, 160); + printf("Generated %d samples\n", len); + if (len <= 0) + break; + outframes = sf_writef_short(outhandle, amp, len); + } + + /* Try a different tone pair */ + make_tone_gen_descriptor(&tone_desc, + 400, + -10, + 450, + -10, + 100, + 200, + 300, + 400, + TRUE); + tone_gen_init(&tone_state, &tone_desc); + + for (i = 0; i < 1000; i++) + { + len = tone_gen(&tone_state, amp, 160); + printf("Generated %d samples\n", len); + if (len <= 0) + break; + outframes = sf_writef_short(outhandle, amp, len); + } + + /* Try a single tone */ + make_tone_gen_descriptor(&tone_desc, + 400, + -10, + 0, + 0, + 100, + 200, + 300, + 400, + TRUE); + tone_gen_init(&tone_state, &tone_desc); + + for (i = 0; i < 1000; i++) + { + len = tone_gen(&tone_state, amp, 160); + printf("Generated %d samples\n", len); + if (len <= 0) + break; + outframes = sf_writef_short(outhandle, amp, len); + } + + /* Try a single non-repeating tone */ + make_tone_gen_descriptor(&tone_desc, + 820, + -10, + 0, + 0, + 2000, + 0, + 0, + 0, + FALSE); + tone_gen_init(&tone_state, &tone_desc); + + for (i = 0; i < 1000; i++) + { + len = tone_gen(&tone_state, amp, 160); + printf("Generated %d samples\n", len); + if (len <= 0) + break; + outframes = sf_writef_short(outhandle, amp, len); + } + + /* Try a single non-repeating tone at 0dBm0 */ + make_tone_gen_descriptor(&tone_desc, + 820, + 0, + 0, + 0, + 2000, + 0, + 0, + 0, + FALSE); + tone_gen_init(&tone_state, &tone_desc); + + for (i = 0; i < 1000; i++) + { + len = tone_gen(&tone_state, amp, 160); + printf("Generated %d samples\n", len); + if (len <= 0) + break; + outframes = sf_writef_short(outhandle, amp, len); + } + + /* Try an AM modulated tone at a modest modulation level (25%) */ + make_tone_gen_descriptor(&tone_desc, + 425, + -10, + -50, + 25, + 100, + 200, + 300, + 400, + TRUE); + tone_gen_init(&tone_state, &tone_desc); + + for (i = 0; i < 1000; i++) + { + len = tone_gen(&tone_state, amp, 160); + printf("Generated %d samples\n", len); + if (len <= 0) + break; + outframes = sf_writef_short(outhandle, amp, len); + } + + /* Try an AM modulated tone at maximum modulation level (100%) */ + make_tone_gen_descriptor(&tone_desc, + 425, + -10, + -50, + 100, + 100, + 200, + 300, + 400, + TRUE); + tone_gen_init(&tone_state, &tone_desc); + + for (i = 0; i < 1000; i++) + { + len = tone_gen(&tone_state, amp, 160); + printf("Generated %d samples\n", len); + if (len <= 0) + break; + outframes = sf_writef_short(outhandle, amp, len); + } + + if (sf_close(outhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME); + exit (2); + } + + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/tsb85_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/tsb85_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,1308 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * tsb85_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2008 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: tsb85_tests.c,v 1.32 2009/05/30 15:23:14 steveu Exp $ + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include +#endif + +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include +#include +#include +#include +#include + +#if defined(HAVE_LIBXML_XMLMEMORY_H) +#include +#endif +#if defined(HAVE_LIBXML_PARSER_H) +#include +#endif +#if defined(HAVE_LIBXML_XINCLUDE_H) +#include +#endif + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#include "fax_tester.h" +#include "fax_utils.h" + +#define OUTPUT_TIFF_FILE_NAME "tsb85.tif" + +#define OUTPUT_FILE_NAME_WAVE "tsb85.wav" + +#define SAMPLES_PER_CHUNK 160 + +SNDFILE *out_handle; + +int use_receiver_not_ready = FALSE; +int test_local_interrupt = FALSE; + +const char *output_tiff_file_name; + +fax_state_t *fax; +faxtester_state_t state; + +uint8_t image[1000000]; + +uint8_t awaited[1000]; +int awaited_len = 0; + +char image_path[1024]; + +t30_exchanged_info_t expected_rx_info; + +char next_tx_file[1000]; + +static int next_step(faxtester_state_t *s); + +static int phase_b_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + int status; + const char *u; + + i = (intptr_t) user_data; + status = T30_ERR_OK; + if ((u = t30_get_rx_ident(s))) + { + printf("%c: Phase B: remote ident '%s'\n", i, u); + if (expected_rx_info.ident[0] && strcmp(expected_rx_info.ident, u)) + { + printf("%c: Phase B: remote ident incorrect! - expected '%s'\n", i, expected_rx_info.ident); + status = T30_ERR_IDENT_UNACCEPTABLE; + } + } + else + { + if (expected_rx_info.ident[0]) + { + printf("%c: Phase B: remote ident missing!\n", i); + status = T30_ERR_IDENT_UNACCEPTABLE; + } + } + if ((u = t30_get_rx_sub_address(s))) + { + printf("%c: Phase B: remote sub-address '%s'\n", i, u); + if (expected_rx_info.sub_address[0] && strcmp(expected_rx_info.sub_address, u)) + { + printf("%c: Phase B: remote sub-address incorrect! - expected '%s'\n", i, expected_rx_info.sub_address); + status = T30_ERR_SUB_UNACCEPTABLE; + } + } + else + { + if (expected_rx_info.sub_address[0]) + { + printf("%c: Phase B: remote sub-address missing!\n", i); + status = T30_ERR_SUB_UNACCEPTABLE; + } + } + if ((u = t30_get_rx_polled_sub_address(s))) + { + printf("%c: Phase B: remote polled sub-address '%s'\n", i, u); + if (expected_rx_info.polled_sub_address[0] && strcmp(expected_rx_info.polled_sub_address, u)) + { + printf("%c: Phase B: remote polled sub-address incorrect! - expected '%s'\n", i, expected_rx_info.polled_sub_address); + status = T30_ERR_PSA_UNACCEPTABLE; + } + } + else + { + if (expected_rx_info.polled_sub_address[0]) + { + printf("%c: Phase B: remote polled sub-address missing!\n", i); + status = T30_ERR_PSA_UNACCEPTABLE; + } + } + if ((u = t30_get_rx_selective_polling_address(s))) + { + printf("%c: Phase B: remote selective polling address '%s'\n", i, u); + if (expected_rx_info.selective_polling_address[0] && strcmp(expected_rx_info.selective_polling_address, u)) + { + printf("%c: Phase B: remote selective polling address incorrect! - expected '%s'\n", i, expected_rx_info.selective_polling_address); + status = T30_ERR_SEP_UNACCEPTABLE; + } + } + else + { + if (expected_rx_info.selective_polling_address[0]) + { + printf("%c: Phase B: remote selective polling address missing!\n", i); + status = T30_ERR_SEP_UNACCEPTABLE; + } + } + if ((u = t30_get_rx_sender_ident(s))) + { + printf("%c: Phase B: remote sender ident '%s'\n", i, u); + if (expected_rx_info.sender_ident[0] && strcmp(expected_rx_info.sender_ident, u)) + { + printf("%c: Phase B: remote sender ident incorrect! - expected '%s'\n", i, expected_rx_info.sender_ident); + status = T30_ERR_SID_UNACCEPTABLE; + } + } + else + { + if (expected_rx_info.sender_ident[0]) + { + printf("%c: Phase B: remote sender ident missing!\n", i); + status = T30_ERR_SID_UNACCEPTABLE; + } + } + if ((u = t30_get_rx_password(s))) + { + printf("%c: Phase B: remote password '%s'\n", i, u); + if (expected_rx_info.password[0] && strcmp(expected_rx_info.password, u)) + { + printf("%c: Phase B: remote password incorrect! - expected '%s'\n", i, expected_rx_info.password); + status = T30_ERR_PWD_UNACCEPTABLE; + } + } + else + { + if (expected_rx_info.password[0]) + { + printf("%c: Phase B: remote password missing!\n", i); + status = T30_ERR_PWD_UNACCEPTABLE; + } + } + printf("%c: Phase B handler on channel %d - (0x%X) %s\n", i, i, result, t30_frametype(result)); + return status; +} +/*- End of function --------------------------------------------------------*/ + +static int phase_d_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + char tag[20]; + + i = (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase D:", i); + + printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result)); + log_transfer_statistics(s, tag); + log_tx_parameters(s, tag); + log_rx_parameters(s, tag); + + if (use_receiver_not_ready) + t30_set_receiver_not_ready(s, 3); + + if (test_local_interrupt) + { + if (i == 'A') + { + printf("%c: Initiating interrupt request\n", i); + t30_local_interrupt_request(s, TRUE); + } + else + { + switch (result) + { + case T30_PIP: + case T30_PRI_MPS: + case T30_PRI_EOM: + case T30_PRI_EOP: + printf("%c: Accepting interrupt request\n", i); + t30_local_interrupt_request(s, TRUE); + break; + case T30_PIN: + break; + } + } + } + return T30_ERR_OK; +} +/*- End of function --------------------------------------------------------*/ + +static void phase_e_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + char tag[20]; + + i = (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase E:", i); + printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result)); + log_transfer_statistics(s, tag); + log_tx_parameters(s, tag); + log_rx_parameters(s, tag); +} +/*- End of function --------------------------------------------------------*/ + +static void t30_real_time_frame_handler(t30_state_t *s, + void *user_data, + int direction, + const uint8_t *msg, + int len) +{ + if (msg == NULL) + { + } + else + { + fprintf(stderr, + "T.30: Real time frame handler - %s, %s, length = %d\n", + (direction) ? "line->T.30" : "T.30->line", + t30_frametype(msg[2]), + len); + } +} +/*- End of function --------------------------------------------------------*/ + +static int document_handler(t30_state_t *s, void *user_data, int event) +{ + int i; + + i = (intptr_t) user_data; + fprintf(stderr, "%d: Document handler on channel %d - event %d\n", i, i, event); + if (next_tx_file[0]) + { + t30_set_tx_file(s, next_tx_file, -1, -1); + next_tx_file[0] = '\0'; + return TRUE; + } + return FALSE; +} +/*- End of function --------------------------------------------------------*/ + +static void faxtester_real_time_frame_handler(faxtester_state_t *s, + void *user_data, + int direction, + const uint8_t *msg, + int len) +{ + if (msg == NULL) + { + while (next_step(s) == 0) + ; + /*endwhile*/ + } + else + { + fprintf(stderr, + "TST: Real time frame handler - %s, %s, length = %d\n", + (direction) ? "line->tester" : "tester->line", + t30_frametype(msg[2]), + len); + if (direction && msg[1] == awaited[1]) + { + if ((awaited_len >= 0 && len != abs(awaited_len)) + || + (awaited_len < 0 && len < abs(awaited_len)) + || + memcmp(msg, awaited, abs(awaited_len)) != 0) + { + span_log_buf(&s->logging, SPAN_LOG_FLOW, "Expected", awaited, abs(awaited_len)); + span_log_buf(&s->logging, SPAN_LOG_FLOW, "Received", msg, len); + printf("Test failed\n"); + exit(2); + } + } + if (msg[1] == awaited[1]) + { + while (next_step(s) == 0) + ; + /*endwhile*/ + } + } +} +/*- End of function --------------------------------------------------------*/ + +static void faxtester_front_end_step_complete_handler(faxtester_state_t *s, void *user_data) +{ + while (next_step(s) == 0) + ; + /*endwhile*/ +} +/*- End of function --------------------------------------------------------*/ + +static void faxtester_front_end_step_timeout_handler(faxtester_state_t *s, void *user_data) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "FAX tester step timed out\n"); + printf("Test failed\n"); + exit(2); +} +/*- End of function --------------------------------------------------------*/ + +static void fax_prepare(void) +{ + t30_state_t *t30; + logging_state_t *logging; + + t30 = fax_get_t30_state(fax); + fax_set_transmit_on_idle(fax, TRUE); + fax_set_tep_mode(fax, TRUE); +#if 0 + t30_set_tx_ident(t30, "1234567890"); + t30_set_tx_sub_address(t30, "Sub-address"); + t30_set_tx_sender_ident(t30, "Sender ID"); + t30_set_tx_password(t30, "Password"); + t30_set_tx_polled_sub_address(t30, "Polled sub-address"); + t30_set_tx_selective_polling_address(t30, "Sel polling address"); +#endif + t30_set_tx_nsf(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp NSF\x00", 16); + //t30_set_tx_nss(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp NSS\x00", 16); + t30_set_tx_nsc(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp NSC\x00", 16); + t30_set_ecm_capability(t30, TRUE); + t30_set_supported_t30_features(t30, + T30_SUPPORT_IDENTIFICATION + | T30_SUPPORT_SELECTIVE_POLLING + | T30_SUPPORT_SUB_ADDRESSING); + t30_set_supported_image_sizes(t30, + T30_SUPPORT_US_LETTER_LENGTH + | T30_SUPPORT_US_LEGAL_LENGTH + | T30_SUPPORT_UNLIMITED_LENGTH + | T30_SUPPORT_215MM_WIDTH + | T30_SUPPORT_255MM_WIDTH + | T30_SUPPORT_303MM_WIDTH); + t30_set_supported_resolutions(t30, + T30_SUPPORT_STANDARD_RESOLUTION + | T30_SUPPORT_FINE_RESOLUTION + | T30_SUPPORT_SUPERFINE_RESOLUTION + | T30_SUPPORT_R8_RESOLUTION + | T30_SUPPORT_R16_RESOLUTION + | T30_SUPPORT_300_300_RESOLUTION + | T30_SUPPORT_400_400_RESOLUTION + | T30_SUPPORT_600_600_RESOLUTION + | T30_SUPPORT_1200_1200_RESOLUTION + | T30_SUPPORT_300_600_RESOLUTION + | T30_SUPPORT_400_800_RESOLUTION + | T30_SUPPORT_600_1200_RESOLUTION); + t30_set_supported_modems(t30, T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17); + t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION); + t30_set_phase_b_handler(t30, phase_b_handler, (void *) (intptr_t) 'A'); + t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'A'); + t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'A'); + t30_set_real_time_frame_handler(t30, t30_real_time_frame_handler, (void *) (intptr_t) 'A'); + t30_set_document_handler(t30, document_handler, (void *) (intptr_t) 'A'); + + logging = fax_get_logging_state(fax); + span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + span_log_set_tag(logging, "A"); + + logging = t30_get_logging_state(t30); + span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + span_log_set_tag(logging, "A"); + +#if 0 + span_log_set_level(&fax.modems.v27ter_rx.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + span_log_set_tag(&fax.modems.v27ter_rx.logging, "A"); + span_log_set_level(&fax.modems.v29_rx.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + span_log_set_tag(&fax.modems.v29_rx.logging, "A"); + span_log_set_level(&fax.modems.v17_rx.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + span_log_set_tag(&fax.modems.v17_rx.logging, "A"); +#endif +} +/*- End of function --------------------------------------------------------*/ + +static int string_to_msg(uint8_t msg[], uint8_t mask[], const char buf[]) +{ + int i; + int x; + const char *t; + + msg[0] = 0; + mask[0] = 0xFF; + i = 0; + t = (char *) buf; + while (*t) + { + /* Skip white space */ + while (isspace(*t)) + t++; + /* If we find ... we allow arbitrary addition info beyond this point in the message */ + if (t[0] == '.' && t[1] == '.' && t[2] == '.') + { + return -i; + } + else if (isxdigit(*t)) + { + for ( ; isxdigit(*t); t++) + { + x = *t; + if (x >= 'a') + x -= 0x20; + if (x >= 'A') + x -= ('A' - 10); + else + x -= '0'; + msg[i] = (msg[i] << 4) | x; + } + mask[i] = 0xFF; + if (*t == '/') + { + /* There is a mask following the byte */ + mask[i] = 0; + for (t++; isxdigit(*t); t++) + { + x = *t; + if (x >= 'a') + x -= 0x20; + if (x >= 'A') + x -= ('A' - 10); + else + x -= '0'; + mask[i] = (mask[i] << 4) | x; + } + } + if (*t && !isspace(*t)) + { + /* Bad string */ + return 0; + } + i++; + } + } + return i; +} +/*- End of function --------------------------------------------------------*/ + +#if 0 +static void string_test2(const uint8_t msg[], int len) +{ + int i; + + if (len > 0) + { + for (i = 0; i < len - 1; i++) + printf("%02X ", msg[i]); + printf("%02X", msg[i]); + } +} +/*- End of function --------------------------------------------------------*/ + +static void string_test3(const char buf[]) +{ + uint8_t msg[1000]; + uint8_t mask[1000]; + int len; + int i; + + len = string_to_msg(msg, mask, buf); + printf("Len = %d: ", len); + string_test2(msg, abs(len)); + printf("/"); + string_test2(mask, abs(len)); + printf("\n"); +} +/*- End of function --------------------------------------------------------*/ + +static int string_test(void) +{ + string_test3("FF C8 12 34 56 78"); + string_test3("FF C8 12/55 34 56/aA 78 "); + string_test3("FF C8 12/55 34 56/aA 78 ..."); + string_test3("FF C8 12/55 34 56/aA 78..."); + string_test3("FF C8 12/55 34 56/aA 78 ... 99 88 77"); + exit(0); +} +/*- End of function --------------------------------------------------------*/ +#endif + +static void corrupt_image(faxtester_state_t *s, uint8_t image[], int len, const char *bad_rows) +{ + int i; + int j; + int k; + uint32_t bits; + uint32_t bitsx; + int list[1000]; + int x; + int row; + const char *t; + + /* Form the list of rows to be hit */ + x = 0; + t = bad_rows; + while (*t) + { + while (isspace(*t)) + t++; + if (sscanf(t, "%d", &list[x]) < 1) + break; + x++; + while (isdigit(*t)) + t++; + if (*t == ',') + t++; + } + + /* Go through the image, and corrupt the first bit of every listed row */ + bits = 0x7FF; + bitsx = 0x7FF; + row = 0; + for (i = 0; i < len; i++) + { + bits ^= (image[i] << 11); + bitsx ^= (image[i] << 11); + for (j = 0; j < 8; j++) + { + if ((bits & 0xFFF) == 0x800) + { + /* We are at an EOL. Is this row in the list of rows to be corrupted? */ + row++; + for (k = 0; k < x; k++) + { + if (list[k] == row) + { + /* Corrupt this row. TSB85 says to hit the first bit after the EOL */ + bitsx ^= 0x1000; + } + } + } + bits >>= 1; + bitsx >>= 1; + } + image[i] = (bitsx >> 3) & 0xFF; + } + span_log(&s->logging, SPAN_LOG_FLOW, "%d rows found. %d corrupted\n", row, x); +} +/*- End of function --------------------------------------------------------*/ + +static int next_step(faxtester_state_t *s) +{ + int delay; + int flags; + xmlChar *dir; + xmlChar *type; + xmlChar *modem; + xmlChar *value; + xmlChar *tag; + xmlChar *bad_rows; + xmlChar *crc_error; + xmlChar *pattern; + xmlChar *timeout; + xmlChar *min_bits; + xmlChar *frame_size; + xmlChar *block; + xmlChar *compression; + uint8_t buf[1000]; + uint8_t mask[1000]; + char path[1024]; + int i; + int j; + int hdlc; + int short_train; + int min_row_bits; + int ecm_frame_size; + int ecm_block; + int compression_type; + int timer; + int len; + t4_state_t t4_state; + t30_state_t *t30; + + if (s->cur == NULL) + { + if (!s->final_delayed) + { + /* Add a bit of waiting at the end, to ensure everything gets flushed through, + any timers can expire, etc. */ + faxtester_set_timeout(s, -1); + faxtester_set_rx_type(s, T30_MODEM_NONE, 0, FALSE, FALSE); + faxtester_set_tx_type(s, T30_MODEM_PAUSE, 0, 120000, FALSE); + s->final_delayed = TRUE; + return 1; + } + /* Finished */ + printf("Test passed\n"); + exit(0); + } + while (s->cur && xmlStrcmp(s->cur->name, (const xmlChar *) "step") != 0) + s->cur = s->cur->next; + if (s->cur == NULL) + { + /* Finished */ + printf("Test passed\n"); + exit(0); + } + + dir = xmlGetProp(s->cur, (const xmlChar *) "dir"); + type = xmlGetProp(s->cur, (const xmlChar *) "type"); + modem = xmlGetProp(s->cur, (const xmlChar *) "modem"); + value = xmlGetProp(s->cur, (const xmlChar *) "value"); + tag = xmlGetProp(s->cur, (const xmlChar *) "tag"); + bad_rows = xmlGetProp(s->cur, (const xmlChar *) "bad_rows"); + crc_error = xmlGetProp(s->cur, (const xmlChar *) "crc_error"); + pattern = xmlGetProp(s->cur, (const xmlChar *) "pattern"); + timeout = xmlGetProp(s->cur, (const xmlChar *) "timeout"); + min_bits = xmlGetProp(s->cur, (const xmlChar *) "min_bits"); + frame_size = xmlGetProp(s->cur, (const xmlChar *) "frame_size"); + block = xmlGetProp(s->cur, (const xmlChar *) "block"); + compression = xmlGetProp(s->cur, (const xmlChar *) "compression"); + + s->cur = s->cur->next; + + span_log(&s->logging, + SPAN_LOG_FLOW, + "Dir - %s, type - %s, modem - %s, value - %s, timeout - %s, tag - %s\n", + (dir) ? (const char *) dir : "", + (type) ? (const char *) type : "", + (modem) ? (const char *) modem : "", + (value) ? (const char *) value : "", + (timeout) ? (const char *) timeout : "", + (tag) ? (const char *) tag : ""); + if (type == NULL) + return 1; + if (timeout) + timer = atoi((const char *) timeout); + else + timer = -1; + + if (dir && strcasecmp((const char *) dir, "R") == 0) + { + /* Receive always has a timeout applied. */ + if (timer < 0) + timer = 7000; + faxtester_set_timeout(s, timer); + if (modem) + { + hdlc = (strcasecmp((const char *) type, "PREAMBLE") == 0); + short_train = (strcasecmp((const char *) type, "TCF") != 0); + faxtester_set_tx_type(s, T30_MODEM_NONE, 0, FALSE, FALSE); + if (strcasecmp((const char *) modem, "V.21") == 0) + { + faxtester_set_rx_type(s, T30_MODEM_V21, 300, FALSE, TRUE); + } + else if (strcasecmp((const char *) modem, "V.17/14400") == 0) + { + faxtester_set_rx_type(s, T30_MODEM_V17, 14400, short_train, hdlc); + } + else if (strcasecmp((const char *) modem, "V.17/12000") == 0) + { + faxtester_set_rx_type(s, T30_MODEM_V17, 12000, short_train, hdlc); + } + else if (strcasecmp((const char *) modem, "V.17/9600") == 0) + { + faxtester_set_rx_type(s, T30_MODEM_V17, 9600, short_train, hdlc); + } + else if (strcasecmp((const char *) modem, "V.17/7200") == 0) + { + faxtester_set_rx_type(s, T30_MODEM_V17, 7200, short_train, hdlc); + } + else if (strcasecmp((const char *) modem, "V.29/9600") == 0) + { + faxtester_set_rx_type(s, T30_MODEM_V29, 9600, FALSE, hdlc); + } + else if (strcasecmp((const char *) modem, "V.29/7200") == 0) + { + faxtester_set_rx_type(s, T30_MODEM_V29, 7200, FALSE, hdlc); + } + else if (strcasecmp((const char *) modem, "V.27ter/4800") == 0) + { + faxtester_set_rx_type(s, T30_MODEM_V27TER, 4800, FALSE, hdlc); + } + else if (strcasecmp((const char *) modem, "V.27ter/2400") == 0) + { + faxtester_set_rx_type(s, T30_MODEM_V27TER, 2400, FALSE, hdlc); + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Unrecognised modem\n"); + } + } + + if (strcasecmp((const char *) type, "SET") == 0) + { + if (strcasecmp((const char *) tag, "IDENT") == 0) + strcpy(expected_rx_info.ident, (const char *) value); + else if (strcasecmp((const char *) tag, "SUB") == 0) + strcpy(expected_rx_info.sub_address, (const char *) value); + else if (strcasecmp((const char *) tag, "SEP") == 0) + strcpy(expected_rx_info.selective_polling_address, (const char *) value); + else if (strcasecmp((const char *) tag, "PSA") == 0) + strcpy(expected_rx_info.polled_sub_address, (const char *) value); + else if (strcasecmp((const char *) tag, "SID") == 0) + strcpy(expected_rx_info.sender_ident, (const char *) value); + else if (strcasecmp((const char *) tag, "PWD") == 0) + strcpy(expected_rx_info.password, (const char *) value); + return 0; + } + else if (strcasecmp((const char *) type, "CNG") == 0) + { + /* Look for CNG */ + faxtester_set_rx_type(s, T30_MODEM_CNG, 0, FALSE, FALSE); + faxtester_set_tx_type(s, T30_MODEM_NONE, 0, FALSE, FALSE); + } + else if (strcasecmp((const char *) type, "CED") == 0) + { + /* Look for CED */ + faxtester_set_rx_type(s, T30_MODEM_CED, 0, FALSE, FALSE); + faxtester_set_tx_type(s, T30_MODEM_NONE, 0, FALSE, FALSE); + } + else if (strcasecmp((const char *) type, "HDLC") == 0) + { + i = string_to_msg(buf, mask, (const char *) value); + bit_reverse(awaited, buf, abs(i)); + awaited_len = i; + } + else if (strcasecmp((const char *) type, "TCF") == 0) + { + } + else if (strcasecmp((const char *) type, "MSG") == 0) + { + } + else if (strcasecmp((const char *) type, "PP") == 0) + { + } + else if (strcasecmp((const char *) type, "SILENCE") == 0) + { + faxtest_set_rx_silence(s); + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Unrecognised type '%s'\n", (const char *) type); + return 0; + } + } + else + { + faxtester_set_timeout(s, timer); + if (modem) + { + hdlc = (strcasecmp((const char *) type, "PREAMBLE") == 0); + short_train = (strcasecmp((const char *) type, "TCF") != 0); + faxtester_set_rx_type(s, T30_MODEM_NONE, 0, FALSE, FALSE); + if (strcasecmp((const char *) modem, "V.21") == 0) + { + faxtester_set_tx_type(s, T30_MODEM_V21, 300, FALSE, TRUE); + } + else if (strcasecmp((const char *) modem, "V.17/14400") == 0) + { + faxtester_set_tx_type(s, T30_MODEM_V17, 14400, short_train, hdlc); + } + else if (strcasecmp((const char *) modem, "V.17/12000") == 0) + { + faxtester_set_tx_type(s, T30_MODEM_V17, 12000, short_train, hdlc); + } + else if (strcasecmp((const char *) modem, "V.17/9600") == 0) + { + faxtester_set_tx_type(s, T30_MODEM_V17, 9600, short_train, hdlc); + } + else if (strcasecmp((const char *) modem, "V.17/7200") == 0) + { + faxtester_set_tx_type(s, T30_MODEM_V17, 7200, short_train, hdlc); + } + else if (strcasecmp((const char *) modem, "V.29/9600") == 0) + { + faxtester_set_tx_type(s, T30_MODEM_V29, 9600, FALSE, hdlc); + } + else if (strcasecmp((const char *) modem, "V.29/7200") == 0) + { + faxtester_set_tx_type(s, T30_MODEM_V29, 7200, FALSE, hdlc); + } + else if (strcasecmp((const char *) modem, "V.27ter/4800") == 0) + { + faxtester_set_tx_type(s, T30_MODEM_V27TER, 4800, FALSE, hdlc); + } + else if (strcasecmp((const char *) modem, "V.27ter/2400") == 0) + { + faxtester_set_tx_type(s, T30_MODEM_V27TER, 2400, FALSE, hdlc); + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Unrecognised modem\n"); + } + } + + if (strcasecmp((const char *) type, "SET") == 0) + { + t30 = fax_get_t30_state(fax); + if (strcasecmp((const char *) tag, "IDENT") == 0) + t30_set_tx_ident(t30, (const char *) value); + else if (strcasecmp((const char *) tag, "SUB") == 0) + t30_set_tx_sub_address(t30, (const char *) value); + else if (strcasecmp((const char *) tag, "SEP") == 0) + t30_set_tx_selective_polling_address(t30, (const char *) value); + else if (strcasecmp((const char *) tag, "PSA") == 0) + t30_set_tx_polled_sub_address(t30, (const char *) value); + else if (strcasecmp((const char *) tag, "SID") == 0) + t30_set_tx_sender_ident(t30, (const char *) value); + else if (strcasecmp((const char *) tag, "PWD") == 0) + t30_set_tx_password(t30, (const char *) value); + else if (strcasecmp((const char *) tag, "RXFILE") == 0) + { + if (value) + t30_set_rx_file(t30, (const char *) value, -1); + else + t30_set_rx_file(t30, output_tiff_file_name, -1); + } + else if (strcasecmp((const char *) tag, "TXFILE") == 0) + { + sprintf(next_tx_file, "%s/%s", image_path, (const char *) value); +printf("Push '%s'\n", next_tx_file); + } + return 0; + } + else if (strcasecmp((const char *) type, "CALL") == 0) + { + fax = fax_init(NULL, FALSE); + fax_prepare(); + next_tx_file[0] = '\0'; + t30 = fax_get_t30_state(fax); + t30_set_rx_file(t30, output_tiff_file_name, -1); + /* Avoid libtiff 3.8.2 and earlier bug on complex 2D lines. */ + t30_set_rx_encoding(t30, T4_COMPRESSION_ITU_T4_1D); + if (value) + { + sprintf(path, "%s/%s", image_path, (const char *) value); + t30_set_tx_file(t30, path, -1, -1); + } + return 0; + } + else if (strcasecmp((const char *) type, "ANSWER") == 0) + { + fax = fax_init(NULL, TRUE); + fax_prepare(); + next_tx_file[0] = '\0'; + t30 = fax_get_t30_state(fax); + /* Avoid libtiff 3.8.2 and earlier bug on complex 2D lines. */ + t30_set_rx_encoding(t30, T4_COMPRESSION_ITU_T4_1D); + if (value) + { + sprintf(path, "%s/%s", image_path, (const char *) value); + t30_set_tx_file(t30, path, -1, -1); + } + return 0; + } + else if (strcasecmp((const char *) type, "CNG") == 0) + { + faxtester_set_rx_type(s, T30_MODEM_NONE, 0, FALSE, FALSE); + faxtester_set_tx_type(s, T30_MODEM_CNG, 0, FALSE, FALSE); + } + else if (strcasecmp((const char *) type, "CED") == 0) + { + faxtester_set_rx_type(s, T30_MODEM_NONE, 0, FALSE, FALSE); + faxtester_set_tx_type(s, T30_MODEM_CED, 0, FALSE, FALSE); + } + else if (strcasecmp((const char *) type, "WAIT") == 0) + { + delay = (value) ? atoi((const char *) value) : 1; + faxtester_set_rx_type(s, T30_MODEM_NONE, 0, FALSE, FALSE); + faxtester_set_tx_type(s, T30_MODEM_PAUSE, 0, delay, FALSE); + } + else if (strcasecmp((const char *) type, "PREAMBLE") == 0) + { + flags = (value) ? atoi((const char *) value) : 37; + faxtester_send_hdlc_flags(s, flags); + } + else if (strcasecmp((const char *) type, "POSTAMBLE") == 0) + { + flags = (value) ? atoi((const char *) value) : 5; + faxtester_send_hdlc_flags(s, flags); + } + else if (strcasecmp((const char *) type, "HDLC") == 0) + { + i = string_to_msg(buf, mask, (const char *) value); + bit_reverse(buf, buf, abs(i)); + if (crc_error && strcasecmp((const char *) crc_error, "0") == 0) + faxtester_send_hdlc_msg(s, buf, abs(i), FALSE); + else + faxtester_send_hdlc_msg(s, buf, abs(i), TRUE); + } + else if (strcasecmp((const char *) type, "TCF") == 0) + { + if (value) + i = atoi((const char *) value); + else + i = 450; + if (pattern) + { + /* TODO: implement proper patterns */ + j = atoi((const char *) pattern); + memset(image, 0x55, j); + if (i > j) + memset(image + j, 0, i - j); + } + else + { + memset(image, 0, i); + } + faxtester_set_non_ecm_image_buffer(s, image, i); + } + else if (strcasecmp((const char *) type, "MSG") == 0) + { + /* A non-ECM page */ + min_row_bits = (min_bits) ? atoi((const char *) min_bits) : 0; + sprintf(path, "%s/%s", image_path, (const char *) value); + if (t4_tx_init(&t4_state, path, -1, -1) == NULL) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Failed to init T.4 send\n"); + printf("Test failed\n"); + exit(2); + } + t4_tx_set_min_row_bits(&t4_state, min_row_bits); + t4_tx_set_header_info(&t4_state, NULL); + compression_type = T4_COMPRESSION_ITU_T4_1D; + if (compression) + { + if (strcasecmp((const char *) compression, "T.4 2D") == 0) + compression_type = T4_COMPRESSION_ITU_T4_2D; + else if (strcasecmp((const char *) compression, "T.6") == 0) + compression_type = T4_COMPRESSION_ITU_T6; + } + t4_tx_set_tx_encoding(&t4_state, compression_type); + if (t4_tx_start_page(&t4_state)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Failed to start T.4 send\n"); + printf("Test failed\n"); + exit(2); + } + len = t4_tx_get_chunk(&t4_state, image, sizeof(image)); + if (bad_rows) + { + span_log(&s->logging, SPAN_LOG_FLOW, "We need to corrupt the image\n"); + corrupt_image(s, image, len, (const char *) bad_rows); + } + t4_tx_release(&t4_state); + span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM image is %d bytes\n", len); + faxtester_set_non_ecm_image_buffer(s, image, len); + } + else if (strcasecmp((const char *) type, "PP") == 0) + { + min_row_bits = (min_bits) ? atoi((const char *) min_bits) : 0; + ecm_block = (block) ? atoi((const char *) block) : 0; + ecm_frame_size = (frame_size) ? atoi((const char *) frame_size) : 64; + i = (crc_error) ? atoi((const char *) crc_error) : -1; + sprintf(path, "%s/%s", image_path, (const char *) value); + if (t4_tx_init(&t4_state, path, -1, -1) == NULL) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Failed to init T.4 send\n"); + printf("Test failed\n"); + exit(2); + } + t4_tx_set_min_row_bits(&t4_state, min_row_bits); + t4_tx_set_header_info(&t4_state, NULL); + compression_type = T4_COMPRESSION_ITU_T4_1D; + if (compression) + { + if (strcasecmp((const char *) compression, "T.4 2D") == 0) + compression_type = T4_COMPRESSION_ITU_T4_2D; + else if (strcasecmp((const char *) compression, "T.6") == 0) + compression_type = T4_COMPRESSION_ITU_T6; + } + t4_tx_set_tx_encoding(&t4_state, compression_type); + if (t4_tx_start_page(&t4_state)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Failed to start T.4 send\n"); + printf("Test failed\n"); + exit(2); + } + /*endif*/ + len = t4_tx_get_chunk(&t4_state, image, sizeof(image)); + if (bad_rows) + { + span_log(&s->logging, SPAN_LOG_FLOW, "We need to corrupt the image\n"); + corrupt_image(s, image, len, (const char *) bad_rows); + } + /*endif*/ + t4_tx_release(&t4_state); + span_log(&s->logging, SPAN_LOG_FLOW, "ECM image is %d bytes\n", len); + faxtester_set_ecm_image_buffer(s, image, len, ecm_block, ecm_frame_size, i); + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Unrecognised type '%s'\n", (const char *) type); + return 0; + } + /*endif*/ + } + /*endif*/ + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static void exchange(faxtester_state_t *s) +{ + int16_t amp[SAMPLES_PER_CHUNK]; + int16_t out_amp[2*SAMPLES_PER_CHUNK]; + int len; + int i; + int total_audio_time; + int log_audio; + logging_state_t *logging; + + log_audio = TRUE; + output_tiff_file_name = OUTPUT_TIFF_FILE_NAME; + + if (log_audio) + { + if ((out_handle = sf_open_telephony_write(OUTPUT_FILE_NAME_WAVE, 2)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_FILE_NAME_WAVE); + printf("Test failed\n"); + exit(2); + } + /*endif*/ + } + /*endif*/ + + total_audio_time = 0; + + faxtester_set_transmit_on_idle(&state, TRUE); + faxtester_set_real_time_frame_handler(&state, faxtester_real_time_frame_handler, NULL); + faxtester_set_front_end_step_complete_handler(&state, faxtester_front_end_step_complete_handler, NULL); + faxtester_set_front_end_step_timeout_handler(&state, faxtester_front_end_step_timeout_handler, NULL); + + fax = fax_init(NULL, FALSE); + fax_prepare(); + next_tx_file[0] = '\0'; + + while (next_step(s) == 0) + ; + /*endwhile*/ + for (;;) + { + len = fax_tx(fax, amp, SAMPLES_PER_CHUNK); + faxtester_rx(s, amp, len); + if (log_audio) + { + for (i = 0; i < len; i++) + out_amp[2*i + 0] = amp[i]; + /*endfor*/ + } + /*endif*/ + + total_audio_time += SAMPLES_PER_CHUNK; + + logging = t30_get_logging_state(fax_get_t30_state(fax)); + span_log_bump_samples(logging, len); +#if 0 + span_log_bump_samples(&fax.modems.v27ter_rx.logging, len); + span_log_bump_samples(&fax.modems.v29_rx.logging, len); + span_log_bump_samples(&fax.modems.v17_rx.logging, len); +#endif + logging = fax_get_logging_state(fax); + span_log_bump_samples(logging, len); + + span_log_bump_samples(&s->logging, len); + + len = faxtester_tx(s, amp, 160); + if (fax_rx(fax, amp, len)) + break; + /*endif*/ + if (log_audio) + { + for (i = 0; i < len; i++) + out_amp[2*i + 1] = amp[i]; + /*endfor*/ + if (sf_writef_short(out_handle, out_amp, SAMPLES_PER_CHUNK) != SAMPLES_PER_CHUNK) + break; + /*endif*/ + } + /*endif*/ + } + /*endfor*/ + if (log_audio) + { + if (sf_close(out_handle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME_WAVE); + printf("Test failed\n"); + exit(2); + } + /*endif*/ + } + /*endif*/ +} +/*- End of function --------------------------------------------------------*/ + +static int parse_config(faxtester_state_t *s, xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) +{ + xmlChar *x; + xmlChar *y; + + while (cur) + { + if (xmlStrcmp(cur->name, (const xmlChar *) "path") == 0) + { + if ((x = xmlGetProp(cur, (const xmlChar *) "type")) + && + (y = xmlGetProp(cur, (const xmlChar *) "value"))) + { + if (strcasecmp((const char *) x, "IMAGE") == 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Found '%s' '%s'\n", (char *) x, (char *) y); + strcpy(image_path, (const char *) y); + } + /*endif*/ + } + /*endif*/ + } + /*endif*/ + cur = cur->next; + } + /*endwhile*/ + return -1; +} +/*- End of function --------------------------------------------------------*/ + +static int parse_test_group(faxtester_state_t *s, xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, const char *test) +{ + xmlChar *x; + + while (cur) + { + if (xmlStrcmp(cur->name, (const xmlChar *) "test") == 0) + { + if ((x = xmlGetProp(cur, (const xmlChar *) "name"))) + { + if (xmlStrcmp(x, (const xmlChar *) test) == 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Found '%s'\n", (char *) x); + s->cur = cur->xmlChildrenNode; + return 0; + } + /*endif*/ + } + /*endif*/ + } + /*endif*/ + cur = cur->next; + } + /*endwhile*/ + return -1; +} +/*- End of function --------------------------------------------------------*/ + +static int get_test_set(faxtester_state_t *s, const char *test_file, const char *test) +{ + xmlDocPtr doc; + xmlNsPtr ns; + xmlNodePtr cur; + xmlValidCtxt valid; + + ns = NULL; + xmlKeepBlanksDefault(0); + xmlCleanupParser(); + if ((doc = xmlParseFile(test_file)) == NULL) + { + fprintf(stderr, "No document\n"); + printf("Test failed\n"); + exit(2); + } + /*endif*/ + xmlXIncludeProcess(doc); + if (!xmlValidateDocument(&valid, doc)) + { + fprintf(stderr, "Invalid document\n"); + printf("Test failed\n"); + exit(2); + } + /*endif*/ + + /* Check the document is of the right kind */ + if ((cur = xmlDocGetRootElement(doc)) == NULL) + { + xmlFreeDoc(doc); + fprintf(stderr, "Empty document\n"); + printf("Test failed\n"); + exit(2); + } + /*endif*/ + if (xmlStrcmp(cur->name, (const xmlChar *) "fax-tests")) + { + xmlFreeDoc(doc); + fprintf(stderr, "Document of the wrong type, root node != fax-tests"); + printf("Test failed\n"); + exit(2); + } + /*endif*/ + cur = cur->xmlChildrenNode; + while (cur && xmlIsBlankNode(cur)) + cur = cur->next; + /*endwhile*/ + if (cur == NULL) + { + printf("Test failed\n"); + exit(2); + } + /*endif*/ + while (cur) + { + if (xmlStrcmp(cur->name, (const xmlChar *) "config") == 0) + { + parse_config(s, doc, ns, cur->xmlChildrenNode); + } + /*endif*/ + if (xmlStrcmp(cur->name, (const xmlChar *) "test-group") == 0) + { + if (parse_test_group(s, doc, ns, cur->xmlChildrenNode, test) == 0) + { + /* We found the test we want, so run it. */ + exchange(s); + break; + } + /*endif*/ + } + /*endif*/ + cur = cur->next; + } + /*endwhile*/ + xmlFreeDoc(doc); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + const char *test_name; + + //string_test(); + + test_name = "MRGN01"; + if (argc > 1) + test_name = argv[1]; + + strcpy(image_path, "."); + faxtester_init(&state, TRUE); + memset(&expected_rx_info, 0, sizeof(expected_rx_info)); + span_log_set_level(&state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + span_log_set_tag(&state.logging, "B"); + get_test_set(&state, "../spandsp/tsb85.xml", test_name); + printf("Done\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/tsb85_tests.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/tsb85_tests.sh Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,125 @@ +#!/bin/bash +# +# spandsp fax tests +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 2.1, +# as published by the Free Software Foundation. +# +# 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 Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# $Id: tsb85_tests.sh,v 1.8 2009/05/24 07:18:36 steveu Exp $ +# + +run_tsb85_test() +{ + rm -f fax_tests_1.tif + echo ./tsb85_tests ${TEST} + ./tsb85_tests ${TEST} 2>xyzzy2 + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo tsb85_tests ${TEST} failed! + exit $RETVAL + fi +} + +for TEST in MRGN01 MRGN02 MRGN03 MRGN04 MRGN05 MRGN06a MRGN06b MRGN07 MRGN08 ; do + run_tsb85_test +done + +#MRGN14 fails because we don't adequately distinguish between receiving a +#bad image signal and receiving none at all. +#MRGN16 fails because we don't adequately distinguish between receiving a +#bad image signal and receiving none at all. + +#for TEST in MRGN09 MRGN10 MRGN11 MRGN12 MRGN13 MRGN14 MRGN15 MRGN16 MRGN17 ; do +for TEST in MRGN09 MRGN10 MRGN11 MRGN12 MRGN13 MRGN15 MRGN17 ; do + run_tsb85_test +done + +for TEST in ORGC01 ORGC02 ORGC03 ; do + run_tsb85_test +done + +for TEST in OREN01 OREN02 OREN03 OREN04 OREN05 OREN06 OREN07 OREN08 OREN09 OREN10 ; do + run_tsb85_test +done + +# MRGX03 is failing because the V.27ter modem says it trained on HDLC +# MRGX05 is failing because we don't distinguish MPS immediately after MCF from MPS after +# a corrupt image signal. + +#for TEST in MRGX01 MRGX02 MRGX03 MRGX04 MRGX05 MRGX06 MRGX07 MRGX08 ; do +for TEST in MRGX01 MRGX02 MRGX04 MRGX06 MRGX07 MRGX08 ; do + run_tsb85_test +done + +for TEST in MRGX09 MRGX10 MRGX11 MRGX12 MRGX13 MRGX14 MRGX15 ; do + run_tsb85_test +done + +for TEST in MTGP01 MTGP02 OTGP03 ; do + run_tsb85_test +done + +for TEST in MTGN01 MTGN02 MTGN03 MTGN04 MTGN05 MTGN06 MTGN07 MTGN08 MTGN09 MTGN10 ; do + run_tsb85_test +done + +for TEST in MTGN11 MTGN12 MTGN13 MTGN14 MTGN15 MTGN16 MTGN17 MTGN18 MTGN19 MTGN20 ; do + run_tsb85_test +done + +for TEST in MTGN21 MTGN22 MTGN23 MTGN24 MTGN25 MTGN26 MTGN27 MTGN28 ; do + run_tsb85_test +done + +for TEST in OTGC01 OTGC02 OTGC03 OTGC04 OTGC05 OTGC06 OTGC07 OTGC08 ; do + run_tsb85_test +done + +for TEST in OTGC09-01 OTGC09-02 OTGC09-03 OTGC09-04 OTGC09-05 OTGC09-06 OTGC09-07 OTGC09-08 OTGC09-09 OTGC09-10 OTGC09-11 OTGC09-12 ; do + run_tsb85_test +done + +for TEST in OTGC10 OTGC11 ; do + run_tsb85_test +done + +#OTEN02 fails because ????? + +#for TEST in OTEN01 OTEN02 OTEN03 OTEN04 OTEN05 OTEN06 ; do +for TEST in OTEN01 OTEN03 OTEN04 OTEN05 OTEN06 ; do + run_tsb85_test +done + +#MTGX02 fails because ????? + +#for TEST in MTGX01 MTGX02 MTGX03 MTGX04 MTGX05 MTGX06 MTGX07 MTGX08 ; do +for TEST in MTGX01 MTGX03 MTGX04 MTGX05 MTGX06 MTGX07 MTGX08 ; do + run_tsb85_test +done + +for TEST in MTGX09 MTGX10 MTGX11 MTGX12 MTGX13 MTGX14 MTGX15 MTGX16 ; do + run_tsb85_test +done + +for TEST in MTGX17 MTGX18 MTGX19 MTGX20 MTGX21 MTGX22 MTGX23 ; do + run_tsb85_test +done + +for TEST in MRGP01 MRGP02 MRGP03 MRGP04 MRGP05 MRGP06 MRGP07 MRGP08 ; do + run_tsb85_test +done + +for TEST in ORGP09 ORGP10 ; do + run_tsb85_test +done diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/v17_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/v17_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,499 @@ +//#define ADD_MAINS_INTERFERENCE +/* + * SpanDSP - a series of DSP components for telephony + * + * v17_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v17_tests.c,v 1.104 2009/07/09 13:52:09 steveu Exp $ + */ + +/*! \page v17_tests_page V.17 modem tests +\section v17_tests_page_sec_1 What does it do? +These tests test one way paths, as V.17 is a half-duplex modem. They allow either: + + - A V.17 transmit modem to feed a V.17 receive modem through a telephone line + model. BER testing is then used to evaluate performance under various line + conditions. This is effective for testing the basic performance of the + receive modem. It is also the only test mode provided for evaluating the + transmit modem. + + - A V.17 receive modem is used to decode V.17 audio, stored in a audio file. + This is good way to evaluate performance with audio recorded from other + models of modem, and with real world problematic telephone lines. + +If the appropriate GUI environment exists, the tests are built such that a visual +display of modem status is maintained. + +\section v17_tests_page_sec_2 How is it used? +*/ + +/* Enable the following definition to enable direct probing into the FAX structures */ +#define WITH_SPANDSP_INTERNALS + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#if defined(HAVE_FL_FL_H) && defined(HAVE_FL_FL_CARTESIAN_H) && defined(HAVE_FL_FL_AUDIO_METER_H) +#define ENABLE_GUI +#endif + +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#if defined(ENABLE_GUI) +#include "modem_monitor.h" +#include "line_model_monitor.h" +#endif + +#define BLOCK_LEN 160 + +#define OUT_FILE_NAME "v17.wav" + +char *decode_test_file = NULL; +int use_gui = FALSE; + +int symbol_no = 0; + +int rx_bits = 0; +int tx_bits = 0; + +int test_bps; + +bert_state_t bert; +one_way_line_model_state_t *line_model; + +#if defined(ENABLE_GUI) +qam_monitor_t *qam_monitor; +#endif + +bert_results_t latest_results; + +static void reporter(void *user_data, int reason, bert_results_t *results) +{ + switch (reason) + { + case BERT_REPORT_REGULAR: + fprintf(stderr, "BERT report regular - %d bits, %d bad bits, %d resyncs\n", results->total_bits, results->bad_bits, results->resyncs); + memcpy(&latest_results, results, sizeof(latest_results)); + break; + default: + fprintf(stderr, "BERT report %s\n", bert_event_to_str(reason)); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void v17_rx_status(void *user_data, int status) +{ + v17_rx_state_t *rx; + int i; + int len; + complexf_t *coeffs; + + printf("V.17 rx status is %s (%d)\n", signal_status_to_str(status), status); + rx = (v17_rx_state_t *) user_data; + switch (status) + { + case SIG_STATUS_TRAINING_SUCCEEDED: + len = v17_rx_equalizer_state(rx, &coeffs); + printf("Equalizer:\n"); + for (i = 0; i < len; i++) + printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void v17putbit(void *user_data, int bit) +{ + v17_rx_state_t *rx; + + if (bit < 0) + { + v17_rx_status(user_data, bit); + return; + } + + rx = (v17_rx_state_t *) user_data; + if (decode_test_file) + printf("Rx bit %d - %d\n", rx_bits++, bit); + else + bert_put_bit(&bert, bit); +} +/*- End of function --------------------------------------------------------*/ + +static void v17_tx_status(void *user_data, int status) +{ + printf("V.17 tx status is %s (%d)\n", signal_status_to_str(status), status); +} +/*- End of function --------------------------------------------------------*/ + +static int v17getbit(void *user_data) +{ + return bert_get_bit(&bert); +} +/*- End of function --------------------------------------------------------*/ + +static void qam_report(void *user_data, const complexf_t *constel, const complexf_t *target, int symbol) +{ + int i; + int len; + complexf_t *coeffs; + float fpower; + v17_rx_state_t *rx; + static float smooth_power = 0.0f; + static int update_interval = 100; + + rx = (v17_rx_state_t *) user_data; + if (constel) + { +#if defined(ENABLE_GUI) + if (use_gui) + { + qam_monitor_update_constel(qam_monitor, constel); + qam_monitor_update_carrier_tracking(qam_monitor, v17_rx_carrier_frequency(rx)); + qam_monitor_update_symbol_tracking(qam_monitor, v17_rx_symbol_timing_correction(rx)); + } +#endif + fpower = (constel->re - target->re)*(constel->re - target->re) + + (constel->im - target->im)*(constel->im - target->im); + smooth_power = 0.95f*smooth_power + 0.05f*fpower; + printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %9.4f %7.3f %7.4f\n", + symbol_no, + constel->re, + constel->im, + target->re, + target->im, + symbol, + fpower, + smooth_power, + v17_rx_carrier_frequency(rx), + v17_rx_signal_power(rx), + v17_rx_symbol_timing_correction(rx)); + printf("Carrier %d %f %f\n", symbol_no, v17_rx_carrier_frequency(rx), v17_rx_symbol_timing_correction(rx)); + symbol_no++; + if (--update_interval <= 0) + { + len = v17_rx_equalizer_state(rx, &coeffs); + printf("Equalizer A:\n"); + for (i = 0; i < len; i++) + printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); +#if defined(ENABLE_GUI) + if (use_gui) + qam_monitor_update_equalizer(qam_monitor, coeffs, len); +#endif + update_interval = 100; + } + } +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + v17_rx_state_t *rx; + v17_tx_state_t *tx; + bert_results_t bert_results; + int16_t gen_amp[BLOCK_LEN]; + int16_t amp[BLOCK_LEN]; + SNDFILE *inhandle; + SNDFILE *outhandle; + int outframes; + int samples; + int tep; + int block_no; + int noise_level; + int signal_level; + int bits_per_test; + int line_model_no; + int log_audio; + int channel_codec; + int rbs_pattern; + int opt; + logging_state_t *logging; + + channel_codec = MUNGE_CODEC_NONE; + rbs_pattern = 0; + test_bps = 14400; + tep = FALSE; + line_model_no = 0; + decode_test_file = NULL; + use_gui = FALSE; + noise_level = -70; + signal_level = -13; + bits_per_test = 50000; + log_audio = FALSE; + while ((opt = getopt(argc, argv, "b:B:c:d:glm:n:r:s:t")) != -1) + { + switch (opt) + { + case 'b': + test_bps = atoi(optarg); + if (test_bps != 14400 && test_bps != 12000 && test_bps != 9600 && test_bps != 7200) + { + fprintf(stderr, "Invalid bit rate specified\n"); + exit(2); + } + break; + case 'B': + bits_per_test = atoi(optarg); + break; + case 'c': + channel_codec = atoi(optarg); + break; + case 'd': + decode_test_file = optarg; + break; + case 'g': +#if defined(ENABLE_GUI) + use_gui = TRUE; +#else + fprintf(stderr, "Graphical monitoring not available\n"); + exit(2); +#endif + break; + case 'l': + log_audio = TRUE; + break; + case 'm': + line_model_no = atoi(optarg); + break; + case 'n': + noise_level = atoi(optarg); + break; + case 'r': + rbs_pattern = atoi(optarg); + break; + case 's': + signal_level = atoi(optarg); + break; + case 't': + tep = TRUE; + break; + default: + //usage(); + exit(2); + break; + } + } + inhandle = NULL; + outhandle = NULL; + + if (log_audio) + { + if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + } + + if (decode_test_file) + { + /* We will decode the audio from a file. */ + tx = NULL; + if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", decode_test_file); + exit(2); + } + } + else + { + /* We will generate V.17 audio, and add some noise to it. */ + tx = v17_tx_init(NULL, test_bps, tep, v17getbit, NULL); + logging = v17_tx_get_logging_state(tx); + span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + span_log_set_tag(logging, "V.17 tx"); + v17_tx_power(tx, signal_level); + v17_tx_set_modem_status_handler(tx, v17_tx_status, (void *) tx); +#if defined(WITH_SPANDSP_INTERNALS) + /* Move the carrier off a bit */ + tx->carrier_phase_rate = dds_phase_ratef(1792.0f); + tx->carrier_phase = 0x40000000; +#endif + + bert_init(&bert, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20); + bert_set_report(&bert, 10000, reporter, NULL); + + if ((line_model = one_way_line_model_init(line_model_no, (float) noise_level, channel_codec, rbs_pattern)) == NULL) + { + fprintf(stderr, " Failed to create line model\n"); + exit(2); + } + one_way_line_model_set_dc(line_model, 0.0f); +#if defined(ADD_MAINS_INTERFERENCE) + one_way_line_model_set_mains_pickup(line_model, 50, -40.0f); +#endif + } + + rx = v17_rx_init(NULL, test_bps, v17putbit, NULL); + v17_rx_set_modem_status_handler(rx, v17_rx_status, (void *) rx); + v17_rx_set_qam_report_handler(rx, qam_report, (void *) rx); + logging = v17_rx_get_logging_state(rx); + span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + span_log_set_tag(logging, "V.17 rx"); + +#if defined(ENABLE_GUI) + if (use_gui) + { + qam_monitor = qam_monitor_init(10.0f, NULL); + if (!decode_test_file) + { + start_line_model_monitor(129); + line_model_monitor_line_model_update(line_model->near_filter, line_model->near_filter_len); + } + } +#endif + + memset(&latest_results, 0, sizeof(latest_results)); + for (block_no = 0; block_no < 100000000; block_no++) + { + if (decode_test_file) + { + samples = sf_readf_short(inhandle, amp, BLOCK_LEN); +#if defined(ENABLE_GUI) + if (use_gui) + qam_monitor_update_audio_level(qam_monitor, amp, samples); +#endif + if (samples == 0) + break; + } + else + { + samples = v17_tx(tx, gen_amp, BLOCK_LEN); +#if defined(ENABLE_GUI) + if (use_gui) + qam_monitor_update_audio_level(qam_monitor, gen_amp, samples); +#endif + if (samples == 0) + { + printf("Restarting on zero output\n"); + + /* Push a little silence through, to ensure all the data bits get out of the buffers */ + memset(amp, 0, BLOCK_LEN*sizeof(int16_t)); + v17_rx(rx, amp, BLOCK_LEN); + + /* Note that we might get a few bad bits as the carrier shuts down. */ + bert_result(&bert, &bert_results); + fprintf(stderr, "Final result %ddBm0/%ddBm0, %d bits, %d bad bits, %d resyncs\n", signal_level, noise_level, bert_results.total_bits, bert_results.bad_bits, bert_results.resyncs); + fprintf(stderr, "Last report %ddBm0/%ddBm0, %d bits, %d bad bits, %d resyncs\n", signal_level, noise_level, latest_results.total_bits, latest_results.bad_bits, latest_results.resyncs); + /* See if bit errors are appearing yet. Also check we are getting enough bits out of the receiver. The last regular report + should be error free, though the final report will generally contain bits errors as the carrier was dying. The total + number of bits out of the receiver should be at least the number we sent. Also, since BERT sync should have occurred + rapidly at the start of transmission, the last report should have occurred at not much less than the total number of + bits we sent. */ + if (bert_results.total_bits < bits_per_test + || + latest_results.total_bits < bits_per_test - 100 + || + latest_results.bad_bits != 0) + { + break; + } + memset(&latest_results, 0, sizeof(latest_results)); +#if defined(WITH_SPANDSP_INTERNALS) + signal_level--; + /* Bump the receiver AGC gain by 1dB, to compensate for the above */ + rx->agc_scaling_save *= 1.122f; +#endif + v17_tx_restart(tx, test_bps, tep, TRUE); + v17_tx_power(tx, signal_level); + v17_rx_restart(rx, test_bps, TRUE); + //rx.eq_put_step = rand()%(192*10/3); + bert_init(&bert, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20); + bert_set_report(&bert, 10000, reporter, NULL); + one_way_line_model_release(line_model); + if ((line_model = one_way_line_model_init(line_model_no, (float) noise_level, channel_codec, 0)) == NULL) + { + fprintf(stderr, " Failed to create line model\n"); + exit(2); + } + } + if (log_audio) + { + outframes = sf_writef_short(outhandle, gen_amp, samples); + if (outframes != samples) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + } + one_way_line_model(line_model, amp, gen_amp, samples); + } +#if defined(ENABLE_GUI) + if (use_gui && !decode_test_file) + line_model_monitor_line_spectrum_update(amp, samples); +#endif + v17_rx(rx, amp, samples); + } + if (!decode_test_file) + { + bert_result(&bert, &bert_results); + fprintf(stderr, "At completion:\n"); + fprintf(stderr, "Final result %ddBm0/%ddBm0, %d bits, %d bad bits, %d resyncs\n", signal_level, noise_level, bert_results.total_bits, bert_results.bad_bits, bert_results.resyncs); + fprintf(stderr, "Last report %ddBm0/%ddBm0, %d bits, %d bad bits, %d resyncs\n", signal_level, noise_level, latest_results.total_bits, latest_results.bad_bits, latest_results.resyncs); + one_way_line_model_release(line_model); + + if (signal_level > -43) + { + printf("Tests failed.\n"); + exit(2); + } + + printf("Tests passed.\n"); + } +#if defined(ENABLE_GUI) + if (use_gui) + qam_wait_to_end(qam_monitor); +#endif + if (decode_test_file) + { + if (sf_close(inhandle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", decode_test_file); + exit(2); + } + } + if (log_audio) + { + if (sf_close(outhandle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/v18_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/v18_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,510 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v18_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2004-2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v18_tests.c,v 1.8 2009/05/30 15:23:14 steveu Exp $ + */ + +/*! \page v18_tests_page V.18 tests +\section v18_tests_page_sec_1 What does it do? +*/ + +/* Enable the following definition to enable direct probing into the spandsp structures */ +//#define WITH_SPANDSP_INTERNALS + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define FALSE 0 +#define TRUE (!FALSE) + +#define OUTPUT_FILE_NAME "v18.wav" + +#define SAMPLES_PER_CHUNK 160 + +int log_audio = FALSE; +SNDFILE *outhandle = NULL; + +char *decode_test_file = NULL; + +int good_message_received; + +const char *qbf_tx = "The quick Brown Fox Jumps Over The Lazy dog 0123456789!@#$%^&*()'"; +const char *qbf_rx = "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG 0123456789!X$$/'+.()'"; +const char *full_baudot_rx = + "\b \n\n\n\r?\n\n\n !\"$$/+'().+,-./" + "0123456789:;(=)?" + "XABCDEFGHIJKLMNOPQRSTUVWXYZ(/)' " + "'ABCDEFGHIJKLMNOPQRSTUVWXYZ(!) "; + +#if 1 +static void put_text_msg(void *user_data, const uint8_t *msg, int len) +{ + if (strcmp((const char *) msg, qbf_rx)) + { + printf("Result:\n%s\n", msg); + printf("Reference result:\n%s\n", qbf_rx); + } + else + { + good_message_received = TRUE; + } +} +/*- End of function --------------------------------------------------------*/ + +static void basic_tests(int mode) +{ + int16_t amp[SAMPLES_PER_CHUNK]; + int outframes; + int len; + int push; + int i; + v18_state_t *v18_a; + v18_state_t *v18_b; + + printf("Testing %s\n", v18_mode_to_str(mode)); + v18_a = v18_init(NULL, TRUE, mode, put_text_msg, NULL); + v18_b = v18_init(NULL, FALSE, mode, put_text_msg, NULL); + + /* Fake an OK condition for the first message test */ + good_message_received = TRUE; + push = 0; + if (v18_put(v18_a, qbf_tx, -1) != strlen(qbf_tx)) + { + printf("V.18 put failed\n"); + exit(2); + } + for (i = 0; i < 100000; i++) + { + if (push == 0) + { + if ((len = v18_tx(v18_a, amp, SAMPLES_PER_CHUNK)) == 0) + push = 10; + } + else + { + len = 0; + /* Push a little silence through, to flush things out */ + if (--push == 0) + { + if (!good_message_received) + { + printf("No message received\n"); + exit(2); + } + good_message_received = FALSE; + if (v18_put(v18_a, qbf_tx, -1) != strlen(qbf_tx)) + { + printf("V.18 put failed\n"); + exit(2); + } + } + } + if (len < SAMPLES_PER_CHUNK) + { + memset(&[len], 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - len)); + len = SAMPLES_PER_CHUNK; + } + if (log_audio) + { + outframes = sf_writef_short(outhandle, amp, len); + if (outframes != len) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + } + v18_rx(v18_b, amp, len); + } + v18_free(v18_a); + v18_free(v18_b); +} +/*- End of function --------------------------------------------------------*/ +#endif + +static int test_x_01(void) +{ + /* III.5.4.5.1 Baudot carrier timing and receiver disabling */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_x_02(void) +{ + /* III.5.4.5.2 Baudot bit rate confirmation */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_x_03(void) +{ + /* III.5.4.5.3 Baudot probe bit rate confirmation */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_x_04(void) +{ + char result[1024]; + char *t; + int ch; + int xx; + int yy; + int i; + v18_state_t *v18_state; + + /* III.5.4.5.4 5 Bit to T.50 character conversion */ + v18_state = v18_init(NULL, TRUE, V18_MODE_5BIT_45, NULL, NULL); + printf("Original:\n"); + t = result; + for (i = 0; i < 127; i++) + { + ch = i; + printf("%c", ch); + xx = v18_encode_baudot(v18_state, ch); + if (xx) + { + if ((xx & 0x3E0)) + { + yy = v18_decode_baudot(v18_state, (xx >> 5) & 0x1F); + if (yy) + *t++ = yy; + } + yy = v18_decode_baudot(v18_state, xx & 0x1F); + if (yy) + *t++ = yy; + } + } + printf("\n"); + *t = '\0'; + v18_free(v18_state); + printf("Result:\n%s\n", result); + printf("Reference result:\n%s\n", full_baudot_rx); + if (strcmp(result, full_baudot_rx) != 0) + return -1; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int test_x_06(void) +{ + char msg[128]; + char dtmf[1024]; + char result[1024]; + const char *ref; + int len; + int i; + + /* III.5.4.5.6 DTMF character conversion */ + for (i = 0; i < 127; i++) + msg[i] = i + 1; + msg[127] = '\0'; + printf("%s\n", msg); + + len = v18_encode_dtmf(NULL, dtmf, msg); + printf("%s\n", dtmf); + + len = v18_decode_dtmf(NULL, result, dtmf); + + ref = "\b \n\n\n?\n\n\n %+().+,-.0123456789:;(=)" + "?XABCDEFGHIJKLMNOPQRSTUVWXYZÆØÅ" + " abcdefghijklmnopqrstuvwxyzæøå \b"; + + printf("Result:\n%s\n", result); + printf("Reference result:\n%s\n", ref); + if (strcmp(result, ref) != 0) + return -1; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int test_unimplemented(void) +{ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static void put_v18_msg(void *user_data, const uint8_t *msg, int len) +{ + char buf[1024]; + + memcpy(buf, msg, len); + buf[len] = '\0'; + printf("Received (%d bytes) '%s'\n", len, buf); +} +/*- End of function --------------------------------------------------------*/ + +static int decode_test_data_file(int mode, const char *filename) +{ + v18_state_t *v18_state; + int16_t amp[SAMPLES_PER_CHUNK]; + SNDFILE *inhandle; + int len; + + printf("Decoding as '%s'\n", v18_mode_to_str(mode)); + /* We will decode the audio from a file. */ + if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", decode_test_file); + exit(2); + } + v18_state = v18_init(NULL, FALSE, mode, put_v18_msg, NULL); + for (;;) + { + len = sf_readf_short(inhandle, amp, SAMPLES_PER_CHUNK); + if (len == 0) + break; + v18_rx(v18_state, amp, len); + } + if (sf_close(inhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", decode_test_file); + exit(2); + } + v18_free(v18_state); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +const struct +{ + const char *title; + int (*func)(void); +} test_list[] = +{ + {"III.3.2.1 Operational requirements tests", NULL}, + {"MISC-01 4 (1) No Disconnection Test", test_unimplemented}, + {"MISC-02 4 (2) Automatic resumption of automoding", test_unimplemented}, + {"MISC-03 4 (2) Retention of selected mode on loss of signal", test_unimplemented}, + {"MISC-04 4 (4) Detection of BUSY tone", test_unimplemented}, + {"MISC-05 4 (4) Detection of RINGING", test_unimplemented}, + {"MISC-06 4 (4) LOSS OF CARRIER indication", test_unimplemented}, + {"MISC-07 4 (4) Call progress indication", test_unimplemented}, + {"MISC-08 4 (5) Circuit 135 test", test_unimplemented}, + {"MISC-09 Connection Procedures", test_unimplemented}, + + {"III.3.2.2 Automode originate tests", NULL}, + {"ORG-01 5.1.1 CI & XCI Signal coding and cadence", test_unimplemented}, + {"ORG-02 5.1.3 ANS Signal Detection", test_unimplemented}, + {"ORG-03 5.2.3.1 End of ANS signal detection", test_unimplemented}, + {"ORG-04 5.1.3.2 ANS tone followed by TXP", test_unimplemented}, + {"ORG-05 5.1.3.3 ANS tone followed by 1650Hz", test_unimplemented}, + {"ORG-06 5.1.3.4 ANS tone followed by 1300Hz", test_unimplemented}, + {"ORG-07 5.1.3 ANS tone followed by no tone", test_unimplemented}, + {"ORG-08 5.1.4 Bell 103 (2225Hz Signal) Detection", test_unimplemented}, + {"ORG-09 5.1.5 V.21 (1650Hz Signal) Detection", test_unimplemented}, + {"ORG-10 5.1.6 V.23 (1300Hz Signal) Detection", test_unimplemented}, + {"ORG-11 5.1.7 V.23 (390Hz Signal) Detection", test_unimplemented}, + {"ORG-12a to d 5.1.8 5 Bit Mode (Baudot) Detection Tests", test_unimplemented}, + {"ORG-13 5.1.9 DTMF signal detection", test_unimplemented}, + {"ORG-14 5.1.10 EDT Rate Detection", test_unimplemented}, + {"ORG-15 5.1.10.1 Rate Detection Test", test_unimplemented}, + {"ORG-16 5.1.10.2 980Hz Detection", test_unimplemented}, + {"ORG-17 5.1.10.3 Loss of signal after 980Hz", test_unimplemented}, + {"ORG-18 5.1.10.3 Tr Timer", test_unimplemented}, + {"ORG-19 5.1.11 Bell 103 (1270Hz Signal) Detection", test_unimplemented}, + {"ORG-20 Immunity to Network Tones", test_unimplemented}, + {"ORG-21a to b Immunity to other non-textphone modems", test_unimplemented}, + {"ORG-22 Immunity to Fax Tones", test_unimplemented}, + {"ORG-23 Immunity to Voice", test_unimplemented}, + {"ORG-24 5.1.2 ANSam detection", test_unimplemented}, + {"ORG-25 6.1 V.8 originate call", test_unimplemented}, + + {"III.3.2.3 Automode answer tests", NULL}, + {"ANS-01 5.2.1 Ta timer", test_unimplemented}, + {"ANS-02 5.2.2 CI Signal Detection", test_unimplemented}, + {"ANS-03 5.2.2.1 Early Termination of ANS tone", test_unimplemented}, + {"ANS-04 5.2.2.2 Tt Timer", test_unimplemented}, + {"ANS-05 5.2.3.2 ANS tone followed by 980Hz", test_unimplemented}, + {"ANS-06 5.2.3.2 ANS tone followed by 1300Hz", test_unimplemented}, + {"ANS-07 5.2.3.3 ANS tone followed by 1650Hz", test_unimplemented}, + {"ANS-08 5.2.4.1 980Hz followed by 1650Hz", test_unimplemented}, + {"ANS-09a to d 5.2.4.2 980Hz calling tone detection", test_unimplemented}, + {"ANS-10 5.2.4.3 V.21 Detection by Timer", test_unimplemented}, + {"ANS-11 5.2.4.4.1 EDT Detection by Rate", test_unimplemented}, + {"ANS-12 5.2.4.4.2 V.21 Detection by Rate", test_unimplemented}, + {"ANS-13 5.2.4.4.3 Tr Timer", test_unimplemented}, + {"ANS-14 5.2.4.5 Te Timer", test_unimplemented}, + {"ANS-15a to d 5.2.5 5 Bit Mode (Baudot) Detection Tests", test_unimplemented}, + {"ANS-16 5.2.6 DTMF Signal Detection", test_unimplemented}, + {"ANS-17 5.2.7 Bell 103 (1270Hz signal) detection", test_unimplemented}, + {"ANS-18 5.2.8 Bell 103 (2225Hz signal) detection", test_unimplemented}, + {"ANS-19 5.2.9 V.21 Reverse Mode (1650Hz) Detection", test_unimplemented}, + {"ANS-20a to d 5.2.10 1300Hz Calling Tone Discrimination", test_unimplemented}, + {"ANS-21 5.2.11 V.23 Reverse Mode (1300Hz) Detection", test_unimplemented}, + {"ANS-22 1300Hz with XCI Test", test_unimplemented}, + {"ANS-23 5.2.12 Stimulate Mode Country Settings", test_unimplemented}, + {"ANS-24 5.2.12.1 Stimulate Carrierless Mode Probe Message", test_unimplemented}, + {"ANS-25 5.2.12.1.1 Interrupted Carrierless Mode Probe", test_unimplemented}, + {"ANS-26 5.2.12.2 Stimulate Carrier Mode Probe Time", test_unimplemented}, + {"ANS-27 5.2.12.2.1 V.23 Mode (390Hz) Detection", test_unimplemented}, + {"ANS-28 5.2.12.2.2 Interrupted Carrier Mode Probe", test_unimplemented}, + {"ANS-29 5.2.12.2.2 Stimulate Mode Response During Probe", test_unimplemented}, + {"ANS-30 Immunity to Network Tones", test_unimplemented}, + {"ANS-31 Immunity to Fax Calling Tones", test_unimplemented}, + {"ANS-32 Immunity to Voice", test_unimplemented}, + {"ANS-33 5.2.2.1 V.8 CM detection and V.8 Answering", test_unimplemented}, + + {"III.3.2.4 Automode monitor tests", NULL}, + {"MON-01 to -20 5.3 Repeat all answer mode tests excluding tests ANS-01, ANS-20 and ANS-23 to ANS-29", test_unimplemented}, + {"MON-21 5.3 Automode Monitor Ta timer", test_unimplemented}, + {"MON-22a to d 5.3 Automode Monitor 1300Hz Calling Tone Discrimination", test_unimplemented}, + {"MON-23a to d 5.3 Automode Monitor 980Hz Calling Tone Discrimination", test_unimplemented}, + + {"III.3.2.5 ITU-T V.18 annexes tests", NULL}, + {"X-01 A.1 Baudot carrier timing and receiver disabling", test_x_01}, + {"X-02 A.2 Baudot bit rate confirmation", test_x_02}, + {"X-03 A.3 Baudot probe bit rate confirmation", test_x_03}, + {"X-04 A.4 5 Bit to T.50 Character Conversion", test_x_04}, + {"X-05 B.1 DTMF receiver disabling", test_unimplemented}, + {"X-06 B.2 DTMF character conversion", test_x_06}, + {"X-07 C.1 EDT carrier timing and receiver disabling", test_unimplemented}, + {"X-08 C.2-3 EDT bit rate and character structure", test_unimplemented}, + {"X-09 E V.23 calling mode character format", test_unimplemented}, + {"X-10 E V.23 answer mode character format", test_unimplemented}, + {"X-11 F.4-5 V.21 character structure", test_unimplemented}, + {"X-12 G.1-3 V.18 mode", test_unimplemented}, + + {"", NULL} +}; + +int main(int argc, char *argv[]) +{ + int i; + int res; + int hit; + const char *match; + int test_standard; + int opt; + + match = NULL; + test_standard = -1; + while ((opt = getopt(argc, argv, "d:ls:")) != -1) + { + switch (opt) + { + case 'd': + decode_test_file = optarg; + break; + case 'l': + log_audio = TRUE; + break; + case 's': + test_standard = atoi(optarg); + break; + default: + //usage(); + exit(2); + break; + } + } + if (decode_test_file) + { + decode_test_data_file(test_standard, decode_test_file); + exit(0); + } + argc -= optind; + argv += optind; + if (argc > 0) + match = argv[0]; + + outhandle = NULL; + if (log_audio) + { + if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + } + + hit = FALSE; + for (i = 0; test_list[i].title[0]; i++) + { + if (test_list[i].func + && + (match == NULL + || + (strncmp(match, test_list[i].title, strlen(match)) == 0 + && + test_list[i].title[strlen(match)] == ' '))) + { + hit = TRUE; + printf("%s\n", test_list[i].title); + res = test_list[i].func(); + if (res < 0) + { + printf(" Test failed\n"); + exit(2); + } + if (res == 0) + { + printf(" Test passed\n"); + } + } + else + { + if (match == NULL) + printf("%s\n", test_list[i].title); + } + } + if (!hit) + { + printf("Test not found\n"); + exit(2); + } + basic_tests(V18_MODE_5BIT_45); + if (log_audio) + { + if (sf_close(outhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + } + printf("Tests passed\n"); + return 0; + + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/v22bis_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/v22bis_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,420 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v22bis_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v22bis_tests.c,v 1.63 2009/07/09 13:52:09 steveu Exp $ + */ + +/*! \page v22bis_tests_page V.22bis modem tests +\section v22bis_tests_page_sec_1 What does it do? +These tests connect two V.22bis modems back to back, through a telephone line +model. BER testing is then used to evaluate performance under various line +conditions. + +If the appropriate GUI environment exists, the tests are built such that a visual +display of modem status is maintained. + +\section v22bis_tests_page_sec_2 How is it used? +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#if defined(HAVE_FL_FL_H) && defined(HAVE_FL_FL_CARTESIAN_H) && defined(HAVE_FL_FL_AUDIO_METER_H) +#define ENABLE_GUI +#endif + +#include +#include +#include +#include +#include +#include + +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +#include "spandsp.h" +#include "spandsp-sim.h" + +#if defined(ENABLE_GUI) +#include "modem_monitor.h" +#endif + +#define BLOCK_LEN 160 + +#define OUT_FILE_NAME "v22bis.wav" + +char *decode_test_file = NULL; +int use_gui = FALSE; + +int rx_bits = 0; + +both_ways_line_model_state_t *model; + +typedef struct +{ + v22bis_state_t *v22bis; + bert_state_t bert_tx; + bert_state_t bert_rx; + bert_results_t latest_results; +#if defined(ENABLE_GUI) + qam_monitor_t *qam_monitor; +#endif + float smooth_power; + int symbol_no; +} endpoint_t; + +endpoint_t endpoint[2]; + +static void reporter(void *user_data, int reason, bert_results_t *results) +{ + endpoint_t *s; + + s = (endpoint_t *) user_data; + switch (reason) + { + case BERT_REPORT_REGULAR: + fprintf(stderr, "V.22bis rx %p BERT report regular - %d bits, %d bad bits, %d resyncs\n", + user_data, + results->total_bits, + results->bad_bits, + results->resyncs); + memcpy(&s->latest_results, results, sizeof(s->latest_results)); + break; + default: + fprintf(stderr, + "V.22bis rx %p BERT report %s\n", + user_data, + bert_event_to_str(reason)); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void v22bis_putbit(void *user_data, int bit) +{ + endpoint_t *s; + int i; + int len; + int bit_rate; + complexf_t *coeffs; + + s = (endpoint_t *) user_data; + if (bit < 0) + { + /* Special conditions */ + printf("V.22bis rx %p status is %s (%d)\n", user_data, signal_status_to_str(bit), bit); + switch (bit) + { + case SIG_STATUS_TRAINING_SUCCEEDED: + bit_rate = v22bis_current_bit_rate(s->v22bis); + printf("Negotiated bit rate: %d\n", bit_rate); + len = v22bis_rx_equalizer_state(s->v22bis, &coeffs); + printf("Equalizer:\n"); + for (i = 0; i < len; i++) + printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); + break; + } + return; + } + + if (decode_test_file) + printf("Rx bit %p-%d - %d\n", user_data, rx_bits++, bit); + else + bert_put_bit(&s->bert_rx, bit); +} +/*- End of function --------------------------------------------------------*/ + +static int v22bis_getbit(void *user_data) +{ + endpoint_t *s; + int bit; + + s = (endpoint_t *) user_data; + bit = bert_get_bit(&s->bert_tx); + return bit; +} +/*- End of function --------------------------------------------------------*/ + +static void qam_report(void *user_data, const complexf_t *constel, const complexf_t *target, int symbol) +{ + int i; + int len; + complexf_t *coeffs; + float fpower; + endpoint_t *s; + + s = (endpoint_t *) user_data; + if (constel) + { +#if defined(ENABLE_GUI) + if (use_gui) + { + qam_monitor_update_constel(s->qam_monitor, constel); + qam_monitor_update_carrier_tracking(s->qam_monitor, v22bis_rx_carrier_frequency(s->v22bis)); + qam_monitor_update_symbol_tracking(s->qam_monitor, v22bis_rx_symbol_timing_correction(s->v22bis)); + } +#endif + fpower = (constel->re - target->re)*(constel->re - target->re) + + (constel->im - target->im)*(constel->im - target->im); + s->smooth_power = 0.95f*s->smooth_power + 0.05f*fpower; + + printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %8.4f\n", + s->symbol_no, + constel->re, + constel->im, + target->re, + target->im, + symbol, + fpower, + s->smooth_power, + v22bis_rx_signal_power(s->v22bis)); + s->symbol_no++; + } + else + { + printf("Gardner step %d\n", symbol); + len = v22bis_rx_equalizer_state(s->v22bis, &coeffs); + printf("Equalizer A:\n"); + for (i = 0; i < len; i++) + printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); +#if defined(ENABLE_GUI) + if (use_gui) + qam_monitor_update_equalizer(s->qam_monitor, coeffs, len); +#endif + } +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int16_t amp[2][BLOCK_LEN]; + int16_t model_amp[2][BLOCK_LEN]; + int16_t out_amp[2*BLOCK_LEN]; + SNDFILE *inhandle; + SNDFILE *outhandle; + int outframes; + int samples; + int samples2; + int i; + int j; + int test_bps; + int line_model_no; + int bits_per_test; + int noise_level; + int signal_level; + int log_audio; + int channel_codec; + int opt; + + channel_codec = MUNGE_CODEC_NONE; + test_bps = 2400; + line_model_no = 0; + decode_test_file = NULL; + noise_level = -70; + signal_level = -13; + bits_per_test = 50000; + log_audio = FALSE; + while ((opt = getopt(argc, argv, "b:B:c:d:glm:n:s:")) != -1) + { + switch (opt) + { + case 'b': + test_bps = atoi(optarg); + if (test_bps != 2400 && test_bps != 1200) + { + fprintf(stderr, "Invalid bit rate specified\n"); + exit(2); + } + break; + case 'B': + bits_per_test = atoi(optarg); + break; + case 'c': + channel_codec = atoi(optarg); + break; + case 'd': + decode_test_file = optarg; + break; + case 'g': +#if defined(ENABLE_GUI) + use_gui = TRUE; +#else + fprintf(stderr, "Graphical monitoring not available\n"); + exit(2); +#endif + break; + case 'l': + log_audio = TRUE; + break; + case 'm': + line_model_no = atoi(optarg); + break; + case 'n': + noise_level = atoi(optarg); + break; + case 's': + signal_level = atoi(optarg); + break; + default: + //usage(); + exit(2); + break; + } + } + inhandle = NULL; + if (decode_test_file) + { + /* We will decode the audio from a file. */ + if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", decode_test_file); + exit(2); + } + } + + outhandle = NULL; + if (log_audio) + { + if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 2)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + } + memset(endpoint, 0, sizeof(endpoint)); + + for (i = 0; i < 2; i++) + { + endpoint[i].v22bis = v22bis_init(NULL, test_bps, V22BIS_GUARD_TONE_1800HZ, (i == 0), v22bis_getbit, &endpoint[i], v22bis_putbit, &endpoint[i]); + v22bis_tx_power(endpoint[i].v22bis, signal_level); + /* Move the carrier off a bit */ + endpoint[i].v22bis->tx.carrier_phase_rate = dds_phase_ratef((i == 0) ? 1207.0f : 2407.0f); + v22bis_rx_set_qam_report_handler(endpoint[i].v22bis, qam_report, (void *) &endpoint[i]); + span_log_set_level(&endpoint[i].v22bis->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + span_log_set_tag(&endpoint[i].v22bis->logging, (i == 0) ? "caller" : "answerer"); + endpoint[i].smooth_power = 0.0f; + endpoint[i].symbol_no = 0; + bert_init(&endpoint[i].bert_tx, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20); + bert_init(&endpoint[i].bert_rx, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20); + bert_set_report(&endpoint[i].bert_rx, 10000, reporter, &endpoint[i]); + } + + +#if defined(ENABLE_GUI) + if (use_gui) + { + endpoint[0].qam_monitor = qam_monitor_init(6.0f, "Calling modem"); + endpoint[1].qam_monitor = qam_monitor_init(6.0f, "Answering modem"); + } +#endif + if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, line_model_no, (float) noise_level, channel_codec, 0)) == NULL) + { + fprintf(stderr, " Failed to create line model\n"); + exit(2); + } + samples = 0; + for (;;) + { + for (i = 0; i < 2; i++) + { + samples = v22bis_tx(endpoint[i].v22bis, amp[i], BLOCK_LEN); +#if defined(ENABLE_GUI) + if (use_gui) + qam_monitor_update_audio_level(endpoint[i].qam_monitor, amp[i], samples); +#endif + if (samples == 0) + { + /* Note that we might get a few bad bits as the carrier shuts down. */ + bert_result(&endpoint[i].bert_rx, &endpoint[i].latest_results); + + bert_init(&endpoint[i].bert_tx, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20); + bert_init(&endpoint[i].bert_rx, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20); + bert_set_report(&endpoint[i].bert_rx, 10000, reporter, &endpoint[i]); + + printf("Restarting on zero output\n"); + v22bis_restart(endpoint[i].v22bis, test_bps); + } + } + +#if 1 + both_ways_line_model(model, + model_amp[0], + amp[0], + model_amp[1], + amp[1], + samples); +#else + vec_copyi16(model_amp[0], amp[0], samples); + vec_copyi16(model_amp[1], amp[1], samples); +#endif + if (decode_test_file) + { + samples2 = sf_readf_short(inhandle, model_amp[0], samples); + if (samples2 != samples) + break; + } + for (i = 0; i < 2; i++) + { + span_log_bump_samples(&endpoint[i].v22bis->logging, samples); + v22bis_rx(endpoint[i ^ 1].v22bis, model_amp[i], samples); + for (j = 0; j < samples; j++) + out_amp[2*j + i] = model_amp[i][j]; + for ( ; j < BLOCK_LEN; j++) + out_amp[2*j + i] = 0; + } + + if (log_audio) + { + outframes = sf_writef_short(outhandle, out_amp, BLOCK_LEN); + if (outframes != BLOCK_LEN) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + } + } +#if defined(ENABLE_GUI) + if (use_gui) + qam_wait_to_end(endpoint[0].qam_monitor); +#endif + if (decode_test_file) + { + if (sf_close(inhandle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", decode_test_file); + exit(2); + } + } + if (log_audio) + { + if (sf_close(outhandle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/v27ter_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/v27ter_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,487 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v27ter_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v27ter_tests.c,v 1.106 2009/07/09 13:52:09 steveu Exp $ + */ + +/*! \page v27ter_tests_page V.27ter modem tests +\section v27ter_tests_page_sec_1 What does it do? +These tests test one way paths, as V.27ter is a half-duplex modem. They allow either: + + - A V.27ter transmit modem to feed a V.27ter receive modem through a telephone line + model. BER testing is then used to evaluate performance under various line + conditions. This is effective for testing the basic performance of the + receive modem. It is also the only test mode provided for evaluating the + transmit modem. + + - A V.27ter receive modem is used to decode V.27ter audio, stored in an audio file. + This is good way to evaluate performance with audio recorded from other + models of modem, and with real world problematic telephone lines. + +If the appropriate GUI environment exists, the tests are built such that a visual +display of modem status is maintained. + +\section v27ter_tests_page_sec_2 How is it used? +*/ + +/* Enable the following definition to enable direct probing into the FAX structures */ +#define WITH_SPANDSP_INTERNALS + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#if defined(HAVE_FL_FL_H) && defined(HAVE_FL_FL_CARTESIAN_H) && defined(HAVE_FL_FL_AUDIO_METER_H) +#define ENABLE_GUI +#endif + +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#if defined(ENABLE_GUI) +#include "modem_monitor.h" +#include "line_model_monitor.h" +#endif + +#define BLOCK_LEN 160 + +#define OUT_FILE_NAME "v27ter.wav" + +char *decode_test_file = NULL; +int use_gui = FALSE; + +int symbol_no = 0; + +int rx_bits = 0; + +bert_state_t bert; +one_way_line_model_state_t *line_model; + +#if defined(ENABLE_GUI) +qam_monitor_t *qam_monitor; +#endif + +bert_results_t latest_results; + +static void reporter(void *user_data, int reason, bert_results_t *results) +{ + switch (reason) + { + case BERT_REPORT_REGULAR: + fprintf(stderr, "BERT report regular - %d bits, %d bad bits, %d resyncs\n", results->total_bits, results->bad_bits, results->resyncs); + memcpy(&latest_results, results, sizeof(latest_results)); + break; + default: + fprintf(stderr, "BERT report %s\n", bert_event_to_str(reason)); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void v27ter_rx_status(void *user_data, int status) +{ + printf("V.27ter rx status is %s (%d)\n", signal_status_to_str(status), status); +} +/*- End of function --------------------------------------------------------*/ + +static void v27terputbit(void *user_data, int bit) +{ + if (bit < 0) + { + v27ter_rx_status(user_data, bit); + return; + } + if (decode_test_file) + printf("Rx bit %d - %d\n", rx_bits++, bit); + else + bert_put_bit(&bert, bit); +} +/*- End of function --------------------------------------------------------*/ + +static void v27ter_tx_status(void *user_data, int status) +{ + printf("V.27ter tx status is %s (%d)\n", signal_status_to_str(status), status); +} +/*- End of function --------------------------------------------------------*/ + +static int v27tergetbit(void *user_data) +{ + return bert_get_bit(&bert); +} +/*- End of function --------------------------------------------------------*/ + +static void qam_report(void *user_data, const complexf_t *constel, const complexf_t *target, int symbol) +{ + int i; + int len; + complexf_t *coeffs; + float fpower; + float error; + v27ter_rx_state_t *rx; + static float smooth_power = 0.0f; +#if defined(ENABLE_GUI) + static int reports = 0; +#endif + + rx = (v27ter_rx_state_t *) user_data; + if (constel) + { + fpower = (constel->re - target->re)*(constel->re - target->re) + + (constel->im - target->im)*(constel->im - target->im); + smooth_power = 0.95f*smooth_power + 0.05f*fpower; +#if defined(ENABLE_GUI) + if (use_gui) + { + qam_monitor_update_constel(qam_monitor, constel); + qam_monitor_update_carrier_tracking(qam_monitor, v27ter_rx_carrier_frequency(rx)); + qam_monitor_update_symbol_tracking(qam_monitor, v27ter_rx_symbol_timing_correction(rx)); + } +#endif + error = constel->im*target->re - constel->re*target->im; + printf("Tracking error %f %f %f %f %f %f\n", error, v27ter_rx_carrier_frequency(rx), constel->re, constel->im, target->re, target->im); + printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %9.4f %7.3f %7.4f\n", + symbol_no, + constel->re, + constel->im, + target->re, + target->im, + symbol, + fpower, + smooth_power, + v27ter_rx_carrier_frequency(rx), + v27ter_rx_signal_power(rx), + v27ter_rx_symbol_timing_correction(rx)); + len = v27ter_rx_equalizer_state(rx, &coeffs); + printf("Equalizer B:\n"); + for (i = 0; i < len; i++) + printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); +#if defined(WITH_SPANDSP_INTERNALS) + printf("Gardtest %d %f %d\n", symbol_no, v27ter_rx_symbol_timing_correction(rx), rx->gardner_integrate); +#endif + printf("Carcar %d %f\n", symbol_no, v27ter_rx_carrier_frequency(rx)); +#if defined(ENABLE_GUI) + if (use_gui) + { + if (++reports >= 1000) + { + qam_monitor_update_equalizer(qam_monitor, coeffs, len); + reports = 0; + } + } +#endif + symbol_no++; + } + else + { + printf("Gardner step %d\n", symbol); + len = v27ter_rx_equalizer_state(rx, &coeffs); + printf("Equalizer A:\n"); + for (i = 0; i < len; i++) + printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); +#if defined(ENABLE_GUI) + if (use_gui) + qam_monitor_update_equalizer(qam_monitor, coeffs, len); +#endif + } +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + v27ter_rx_state_t *rx; + v27ter_tx_state_t *tx; + bert_results_t bert_results; + int16_t gen_amp[BLOCK_LEN]; + int16_t amp[BLOCK_LEN]; + SNDFILE *inhandle; + SNDFILE *outhandle; + int outframes; + int samples; + int tep; + int test_bps; + int noise_level; + int signal_level; + int bits_per_test; + int line_model_no; + int block_no; + int log_audio; + int channel_codec; + int rbs_pattern; + int opt; + logging_state_t *logging; + + channel_codec = MUNGE_CODEC_NONE; + rbs_pattern = 0; + test_bps = 4800; + tep = FALSE; + line_model_no = 0; + decode_test_file = NULL; + use_gui = FALSE; + noise_level = -70; + signal_level = -13; + bits_per_test = 50000; + log_audio = FALSE; + while ((opt = getopt(argc, argv, "b:B:c:d:glm:n:r:s:t")) != -1) + { + switch (opt) + { + case 'b': + test_bps = atoi(optarg); + if (test_bps != 4800 && test_bps != 2400) + { + fprintf(stderr, "Invalid bit rate specified\n"); + exit(2); + } + break; + case 'B': + bits_per_test = atoi(optarg); + break; + case 'c': + channel_codec = atoi(optarg); + break; + case 'd': + decode_test_file = optarg; + break; + case 'g': +#if defined(ENABLE_GUI) + use_gui = TRUE; +#else + fprintf(stderr, "Graphical monitoring not available\n"); + exit(2); +#endif + break; + case 'l': + log_audio = TRUE; + break; + case 'm': + line_model_no = atoi(optarg); + break; + case 'n': + noise_level = atoi(optarg); + break; + case 'r': + rbs_pattern = atoi(optarg); + break; + case 's': + signal_level = atoi(optarg); + break; + case 't': + tep = TRUE; + break; + default: + //usage(); + exit(2); + break; + } + } + inhandle = NULL; + outhandle = NULL; + + if (log_audio) + { + if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + } + + if (decode_test_file) + { + /* We will decode the audio from a file. */ + tx = NULL; + if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", decode_test_file); + exit(2); + } + } + else + { + /* We will generate V.27ter audio, and add some noise to it. */ + tx = v27ter_tx_init(NULL, test_bps, tep, v27tergetbit, NULL); + v27ter_tx_power(tx, signal_level); + v27ter_tx_set_modem_status_handler(tx, v27ter_tx_status, (void *) tx); + /* Move the carrier off a bit */ +#if defined(WITH_SPANDSP_INTERNALS) + tx->carrier_phase_rate = dds_phase_ratef(1810.0f); +#endif + bert_init(&bert, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20); + bert_set_report(&bert, 10000, reporter, NULL); + + if ((line_model = one_way_line_model_init(line_model_no, (float) noise_level, channel_codec, rbs_pattern)) == NULL) + { + fprintf(stderr, " Failed to create line model\n"); + exit(2); + } + } + + rx = v27ter_rx_init(NULL, test_bps, v27terputbit, NULL); + v27ter_rx_set_modem_status_handler(rx, v27ter_rx_status, (void *) rx); + v27ter_rx_set_qam_report_handler(rx, qam_report, (void *) rx); + logging = v27ter_rx_get_logging_state(rx); + span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + span_log_set_tag(logging, "V.27ter-rx"); + +#if defined(ENABLE_GUI) + if (use_gui) + { + qam_monitor = qam_monitor_init(2.0f, NULL); + if (!decode_test_file) + { + start_line_model_monitor(129); + line_model_monitor_line_model_update(line_model->near_filter, line_model->near_filter_len); + } + } +#endif + + memset(&latest_results, 0, sizeof(latest_results)); + for (block_no = 0; ; block_no++) + { + if (decode_test_file) + { + samples = sf_readf_short(inhandle, amp, BLOCK_LEN); +#if defined(ENABLE_GUI) + if (use_gui) + qam_monitor_update_audio_level(qam_monitor, amp, samples); +#endif + if (samples == 0) + break; + } + else + { + samples = v27ter_tx(tx, gen_amp, BLOCK_LEN); +#if defined(ENABLE_GUI) + if (use_gui) + qam_monitor_update_audio_level(qam_monitor, gen_amp, samples); +#endif + if (samples == 0) + { + printf("Restarting on zero output\n"); + + /* Push a little silence through, to ensure all the data bits get out of the buffers */ + memset(amp, 0, BLOCK_LEN*sizeof(int16_t)); + v27ter_rx(rx, amp, BLOCK_LEN); + v27ter_rx(rx, amp, BLOCK_LEN); + v27ter_rx(rx, amp, BLOCK_LEN); + + /* Note that we might get a few bad bits as the carrier shuts down. */ + bert_result(&bert, &bert_results); + fprintf(stderr, "Final result %ddBm0/%ddBm0, %d bits, %d bad bits, %d resyncs\n", signal_level, noise_level, bert_results.total_bits, bert_results.bad_bits, bert_results.resyncs); + fprintf(stderr, "Last report %ddBm0/%ddBm0, %d bits, %d bad bits, %d resyncs\n", signal_level, noise_level, latest_results.total_bits, latest_results.bad_bits, latest_results.resyncs); + /* See if bit errors are appearing yet. Also check we are getting enough bits out of the receiver. The last regular report + should be error free, though the final report will generally contain bits errors as the carrier was dying. The total + number of bits out of the receiver should be at least the number we sent. Also, since BERT sync should have occurred + rapidly at the start of transmission, the last report should have occurred at not much less than the total number of + bits we sent. */ + if (bert_results.total_bits < bits_per_test + || + latest_results.total_bits < bits_per_test - 100 + || + latest_results.bad_bits != 0) + { + break; + } + memset(&latest_results, 0, sizeof(latest_results)); + signal_level--; + v27ter_tx_restart(tx, test_bps, tep); + v27ter_tx_power(tx, signal_level); + v27ter_rx_restart(rx, test_bps, FALSE); + bert_init(&bert, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20); + bert_set_report(&bert, 10000, reporter, NULL); + one_way_line_model_release(line_model); + if ((line_model = one_way_line_model_init(line_model_no, (float) noise_level, channel_codec, 0)) == NULL) + { + fprintf(stderr, " Failed to create line model\n"); + exit(2); + } + } + + if (log_audio) + { + outframes = sf_writef_short(outhandle, gen_amp, samples); + if (outframes != samples) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + } + one_way_line_model(line_model, amp, gen_amp, samples); + } +#if defined(ENABLE_GUI) + if (use_gui && !decode_test_file) + line_model_monitor_line_spectrum_update(amp, samples); +#endif + v27ter_rx(rx, amp, samples); + } + if (!decode_test_file) + { + bert_result(&bert, &bert_results); + fprintf(stderr, "At completion:\n"); + fprintf(stderr, "Final result %ddBm0/%ddBm0, %d bits, %d bad bits, %d resyncs\n", signal_level, noise_level, bert_results.total_bits, bert_results.bad_bits, bert_results.resyncs); + fprintf(stderr, "Last report %ddBm0/%ddBm0, %d bits, %d bad bits, %d resyncs\n", signal_level, noise_level, latest_results.total_bits, latest_results.bad_bits, latest_results.resyncs); + one_way_line_model_release(line_model); + if (signal_level > -43) + { + printf("Tests failed.\n"); + exit(2); + } + + printf("Tests passed.\n"); + } +#if defined(ENABLE_GUI) + if (use_gui) + qam_wait_to_end(qam_monitor); +#endif + if (decode_test_file) + { + if (sf_close(inhandle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", decode_test_file); + exit(2); + } + } + if (log_audio) + { + if (sf_close(outhandle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/v29_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/v29_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,516 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v29_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2003 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v29_tests.c,v 1.120 2009/07/09 13:52:09 steveu Exp $ + */ + +/*! \page v29_tests_page V.29 modem tests +\section v29_tests_page_sec_1 What does it do? +These tests test one way paths, as V.29 is a half-duplex modem. They allow either: + + - A V.29 transmit modem to feed a V.29 receive modem through a telephone line + model. BER testing is then used to evaluate performance under various line + conditions. This is effective for testing the basic performance of the + receive modem. It is also the only test mode provided for evaluating the + transmit modem. + + - A V.29 receive modem is used to decode V.29 audio, stored in an audio file. + This is good way to evaluate performance with audio recorded from other + models of modem, and with real world problematic telephone lines. + +If the appropriate GUI environment exists, the tests are built such that a visual +display of modem status is maintained. + +\section v29_tests_page_sec_2 How is it used? +*/ + +/* Enable the following definition to enable direct probing into the FAX structures */ +#define WITH_SPANDSP_INTERNALS + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#if defined(HAVE_FL_FL_H) && defined(HAVE_FL_FL_CARTESIAN_H) && defined(HAVE_FL_FL_AUDIO_METER_H) +#define ENABLE_GUI +#endif + +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#if defined(ENABLE_GUI) +#include "modem_monitor.h" +#include "line_model_monitor.h" +#endif + +#define BLOCK_LEN 160 + +#define OUT_FILE_NAME "v29.wav" + +char *decode_test_file = NULL; +int use_gui = FALSE; + +int symbol_no = 0; +int rx_bits = 0; + +bert_state_t bert; +one_way_line_model_state_t *line_model; + +#if defined(ENABLE_GUI) +qam_monitor_t *qam_monitor; +#endif + +bert_results_t latest_results; + +static void reporter(void *user_data, int reason, bert_results_t *results) +{ + switch (reason) + { + case BERT_REPORT_REGULAR: + fprintf(stderr, "BERT report regular - %d bits, %d bad bits, %d resyncs\n", results->total_bits, results->bad_bits, results->resyncs); + memcpy(&latest_results, results, sizeof(latest_results)); + break; + default: + fprintf(stderr, "BERT report %s\n", bert_event_to_str(reason)); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void v29_rx_status(void *user_data, int status) +{ + v29_rx_state_t *rx; + int i; + int len; +#if defined(SPANDSP_USE_FIXED_POINT) + complexi16_t *coeffs; +#else + complexf_t *coeffs; +#endif + + printf("V.29 rx status is %s (%d)\n", signal_status_to_str(status), status); + rx = (v29_rx_state_t *) user_data; + switch (status) + { + case SIG_STATUS_TRAINING_SUCCEEDED: + printf("Training succeeded\n"); +#if defined(SPANDSP_USE_FIXED_POINT) + len = v29_rx_equalizer_state(rx, &coeffs); + printf("Equalizer:\n"); + for (i = 0; i < len; i++) + printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/4096.0f, coeffs[i].im/4096.0f); +#else + len = v29_rx_equalizer_state(rx, &coeffs); + printf("Equalizer:\n"); + for (i = 0; i < len; i++) + printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); +#endif + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static void v29putbit(void *user_data, int bit) +{ + v29_rx_state_t *rx; + + if (bit < 0) + { + v29_rx_status(user_data, bit); + return; + } + + rx = (v29_rx_state_t *) user_data; + if (decode_test_file) + printf("Rx bit %d - %d\n", rx_bits++, bit); + else + bert_put_bit(&bert, bit); +} +/*- End of function --------------------------------------------------------*/ + +static void v29_tx_status(void *user_data, int status) +{ + printf("V.29 tx status is %s (%d)\n", signal_status_to_str(status), status); +} +/*- End of function --------------------------------------------------------*/ + +static int v29getbit(void *user_data) +{ + return bert_get_bit(&bert); +} +/*- End of function --------------------------------------------------------*/ + +static void qam_report(void *user_data, const complexf_t *constel, const complexf_t *target, int symbol) +{ + int i; + int len; +#if defined(SPANDSP_USE_FIXED_POINT) + complexi16_t *coeffs; +#else + complexf_t *coeffs; +#endif + float fpower; + v29_rx_state_t *rx; + static float smooth_power = 0.0f; + static int update_interval = 100; + + rx = (v29_rx_state_t *) user_data; + if (constel) + { + fpower = (constel->re - target->re)*(constel->re - target->re) + + (constel->im - target->im)*(constel->im - target->im); + smooth_power = 0.95f*smooth_power + 0.05f*fpower; +#if defined(ENABLE_GUI) + if (use_gui) + { + qam_monitor_update_constel(qam_monitor, constel); + qam_monitor_update_carrier_tracking(qam_monitor, v29_rx_carrier_frequency(rx)); + //qam_monitor_update_carrier_tracking(qam_monitor, (fpower) ? fpower : 0.001f); + qam_monitor_update_symbol_tracking(qam_monitor, v29_rx_symbol_timing_correction(rx)); + } +#endif + printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %9.4f %7.3f %7.4f\n", + symbol_no, + constel->re, + constel->im, + target->re, + target->im, + symbol, + fpower, + smooth_power, + v29_rx_carrier_frequency(rx), + v29_rx_signal_power(rx), + v29_rx_symbol_timing_correction(rx)); + symbol_no++; + if (--update_interval <= 0) + { +#if defined(SPANDSP_USE_FIXED_POINT) + len = v29_rx_equalizer_state(rx, &coeffs); + printf("Equalizer A:\n"); + for (i = 0; i < len; i++) + printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/4096.0f, coeffs[i].im/4096.0f); +#if defined(ENABLE_GUI) + if (use_gui) + qam_monitor_update_int_equalizer(qam_monitor, coeffs, len); +#endif +#else + len = v29_rx_equalizer_state(rx, &coeffs); + printf("Equalizer A:\n"); + for (i = 0; i < len; i++) + printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); +#if defined(ENABLE_GUI) + if (use_gui) + qam_monitor_update_equalizer(qam_monitor, coeffs, len); +#endif +#endif + update_interval = 100; + } + } +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + v29_rx_state_t *rx; + v29_tx_state_t *tx; + bert_results_t bert_results; + int16_t gen_amp[BLOCK_LEN]; + int16_t amp[BLOCK_LEN]; + SNDFILE *inhandle; + SNDFILE *outhandle; + int outframes; + int samples; + int tep; + int test_bps; + int noise_level; + int signal_level; + int bits_per_test; + int line_model_no; + int block_no; + int log_audio; + int channel_codec; + int rbs_pattern; + int opt; + logging_state_t *logging; + + channel_codec = MUNGE_CODEC_NONE; + rbs_pattern = 0; + test_bps = 9600; + tep = FALSE; + line_model_no = 0; + decode_test_file = NULL; + use_gui = FALSE; + noise_level = -70; + signal_level = -13; + bits_per_test = 50000; + log_audio = FALSE; + while ((opt = getopt(argc, argv, "b:B:c:d:glm:n:r:s:t")) != -1) + { + switch (opt) + { + case 'b': + test_bps = atoi(optarg); + if (test_bps != 9600 && test_bps != 7200 && test_bps != 4800) + { + fprintf(stderr, "Invalid bit rate specified\n"); + exit(2); + } + break; + case 'B': + bits_per_test = atoi(optarg); + break; + case 'c': + channel_codec = atoi(optarg); + break; + case 'd': + decode_test_file = optarg; + break; + case 'g': +#if defined(ENABLE_GUI) + use_gui = TRUE; +#else + fprintf(stderr, "Graphical monitoring not available\n"); + exit(2); +#endif + break; + case 'l': + log_audio = TRUE; + break; + case 'm': + line_model_no = atoi(optarg); + break; + case 'n': + noise_level = atoi(optarg); + break; + case 'r': + rbs_pattern = atoi(optarg); + break; + case 's': + signal_level = atoi(optarg); + break; + case 't': + tep = TRUE; + break; + default: + //usage(); + exit(2); + break; + } + } + inhandle = NULL; + outhandle = NULL; + + if (log_audio) + { + if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + } + + if (decode_test_file) + { + /* We will decode the audio from a file. */ + tx = NULL; + if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", decode_test_file); + exit(2); + } + } + else + { + /* We will generate V.29 audio, and add some noise to it. */ + tx = v29_tx_init(NULL, test_bps, tep, v29getbit, NULL); + v29_tx_power(tx, signal_level); + v29_tx_set_modem_status_handler(tx, v29_tx_status, (void *) tx); +#if defined(WITH_SPANDSP_INTERNALS) + /* Move the carrier off a bit */ + tx->carrier_phase_rate = dds_phase_ratef(1710.0f); + tx->carrier_phase = 0; +#endif + + bert_init(&bert, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20); + bert_set_report(&bert, 10000, reporter, NULL); + + if ((line_model = one_way_line_model_init(line_model_no, (float) noise_level, channel_codec, rbs_pattern)) == NULL) + { + fprintf(stderr, " Failed to create line model\n"); + exit(2); + } + } + + rx = v29_rx_init(NULL, test_bps, v29putbit, NULL); + v29_rx_signal_cutoff(rx, -45.5f); + v29_rx_set_modem_status_handler(rx, v29_rx_status, (void *) rx); + v29_rx_set_qam_report_handler(rx, qam_report, (void *) rx); +#if defined(WITH_SPANDSP_INTERNALS) + /* Rotate the starting phase */ + rx->carrier_phase = 0x80000000; +#endif + logging = v29_rx_get_logging_state(rx); + span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + span_log_set_tag(logging, "V.29-rx"); + +#if defined(ENABLE_GUI) + if (use_gui) + { + qam_monitor = qam_monitor_init(6.0f, NULL); + if (!decode_test_file) + { + start_line_model_monitor(129); + line_model_monitor_line_model_update(line_model->near_filter, line_model->near_filter_len); + } + } +#endif + + memset(&latest_results, 0, sizeof(latest_results)); + for (block_no = 0; ; block_no++) + { + if (decode_test_file) + { + samples = sf_readf_short(inhandle, amp, BLOCK_LEN); +#if defined(ENABLE_GUI) + if (use_gui) + qam_monitor_update_audio_level(qam_monitor, amp, samples); +#endif + if (samples == 0) + break; + } + else + { + samples = v29_tx(tx, gen_amp, BLOCK_LEN); +#if defined(ENABLE_GUI) + if (use_gui) + qam_monitor_update_audio_level(qam_monitor, gen_amp, samples); +#endif + if (samples == 0) + { + /* Push a little silence through, to ensure all the data bits get out of the buffers */ + memset(amp, 0, BLOCK_LEN*sizeof(int16_t)); + v29_rx(rx, amp, BLOCK_LEN); + + /* Note that we might get a few bad bits as the carrier shuts down. */ + bert_result(&bert, &bert_results); + fprintf(stderr, "Final result %ddBm0/%ddBm0, %d bits, %d bad bits, %d resyncs\n", signal_level, noise_level, bert_results.total_bits, bert_results.bad_bits, bert_results.resyncs); + fprintf(stderr, "Last report %ddBm0/%ddBm0, %d bits, %d bad bits, %d resyncs\n", signal_level, noise_level, latest_results.total_bits, latest_results.bad_bits, latest_results.resyncs); + /* See if bit errors are appearing yet. Also check we are getting enough bits out of the receiver. The last regular report + should be error free, though the final report will generally contain bits errors as the carrier was dying. The total + number of bits out of the receiver should be at least the number we sent. Also, since BERT sync should have occurred + rapidly at the start of transmission, the last report should have occurred at not much less than the total number of + bits we sent. */ + if (bert_results.total_bits < bits_per_test + || + latest_results.total_bits < bits_per_test - 100 + || + latest_results.bad_bits != 0) + { + break; + } + memset(&latest_results, 0, sizeof(latest_results)); + signal_level--; + v29_tx_restart(tx, test_bps, tep); + v29_tx_power(tx, signal_level); + v29_rx_restart(rx, test_bps, FALSE); +#if defined(WITH_SPANDSP_INTERNALS) + rx->eq_put_step = rand()%(48*10/3); +#endif + bert_init(&bert, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20); + bert_set_report(&bert, 10000, reporter, NULL); + one_way_line_model_release(line_model); + if ((line_model = one_way_line_model_init(line_model_no, (float) noise_level, channel_codec, 0)) == NULL) + { + fprintf(stderr, " Failed to create line model\n"); + exit(2); + } + } + if (log_audio) + { + outframes = sf_writef_short(outhandle, gen_amp, samples); + if (outframes != samples) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + } + one_way_line_model(line_model, amp, gen_amp, samples); + } +#if defined(ENABLE_GUI) + if (use_gui && !decode_test_file) + line_model_monitor_line_spectrum_update(amp, samples); +#endif + v29_rx(rx, amp, samples); + } + if (!decode_test_file) + { + bert_result(&bert, &bert_results); + fprintf(stderr, "At completion:\n"); + fprintf(stderr, "Final result %ddBm0/%ddBm0, %d bits, %d bad bits, %d resyncs\n", signal_level, noise_level, bert_results.total_bits, bert_results.bad_bits, bert_results.resyncs); + fprintf(stderr, "Last report %ddBm0/%ddBm0, %d bits, %d bad bits, %d resyncs\n", signal_level, noise_level, latest_results.total_bits, latest_results.bad_bits, latest_results.resyncs); + one_way_line_model_release(line_model); + + if (signal_level > -43) + { + printf("Tests failed.\n"); + exit(2); + } + + printf("Tests passed.\n"); + } +#if defined(ENABLE_GUI) + if (use_gui) + qam_wait_to_end(qam_monitor); +#endif + if (decode_test_file) + { + if (sf_close(inhandle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", decode_test_file); + exit(2); + } + } + if (log_audio) + { + if (sf_close(outhandle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME); + exit(2); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/v42_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/v42_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,124 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v42_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v42_tests.c,v 1.28 2008/11/30 10:17:31 steveu Exp $ + */ + +/* THIS IS A WORK IN PROGRESS. IT IS NOT FINISHED. */ + +/*! \page v42_tests_page V.42 tests +\section v42_tests_page_sec_1 What does it do? +These tests connect two instances of V.42 back to back. V.42 frames are +then exchanged between them. +*/ + +#if defined(HAVE_CONFIG_H) +#include +#endif + +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" + +v42_state_t caller; +v42_state_t answerer; + +int rx_next[3] = {0}; +int tx_next[3] = {0}; + +static void v42_status(void *user_data, int status) +{ + int x; + + x = (intptr_t) user_data; + printf("%d: Status is '%s' (%d)\n", x, lapm_status_to_str(status), status); + //if (status == LAPM_DATA) + // lapm_tx_iframe((x == 1) ? &caller.lapm : &answerer.lapm, "ABCDEFGHIJ", 10, 1); +} + +static void v42_frames(void *user_data, const uint8_t *msg, int len) +{ + int i; + int x; + + x = (intptr_t) user_data; + for (i = 0; i < len; i++) + { + if (msg[i] != (rx_next[x] & 0xFF)) + printf("%d: Mismatch 0x%02X 0x%02X\n", x, msg[i], rx_next[x] & 0xFF); + rx_next[x]++; + } + printf("%d: Got frame len %d\n", x, len); +} + +int main(int argc, char *argv[]) +{ + int i; + int bit; + uint8_t buf[1024]; + + v42_init(&caller, TRUE, TRUE, v42_frames, (void *) 1); + v42_init(&answerer, FALSE, TRUE, v42_frames, (void *) 2); + v42_set_status_callback(&caller, v42_status, (void *) 1); + v42_set_status_callback(&answerer, v42_status, (void *) 2); + span_log_set_level(&caller.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_DEBUG); + span_log_set_tag(&caller.logging, "caller"); + span_log_set_level(&caller.lapm.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_DEBUG); + span_log_set_tag(&caller.lapm.logging, "caller"); + span_log_set_level(&caller.lapm.sched.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_DEBUG); + span_log_set_tag(&caller.lapm.sched.logging, "caller"); + span_log_set_level(&answerer.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_DEBUG); + span_log_set_tag(&answerer.logging, "answerer"); + span_log_set_level(&answerer.lapm.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_DEBUG); + span_log_set_tag(&answerer.lapm.logging, "answerer"); + span_log_set_level(&answerer.lapm.sched.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_DEBUG); + span_log_set_tag(&answerer.lapm.sched.logging, "answerer"); + for (i = 0; i < 100000; i++) + { + bit = v42_tx_bit(&caller); + v42_rx_bit(&answerer, bit); + bit = v42_tx_bit(&answerer); + //if (i%10000 == 0) + // bit ^= 1; + v42_rx_bit(&caller, bit); + span_schedule_update(&caller.lapm.sched, 4); + span_schedule_update(&answerer.lapm.sched, 4); + buf[0] = tx_next[1]; + if (lapm_tx(&caller.lapm, buf, 1) == 1) + tx_next[1]++; + buf[0] = tx_next[2]; + if (lapm_tx(&answerer.lapm, buf, 1) == 1) + tx_next[2]++; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/v42bis_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/v42bis_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,167 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v42bis_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2005 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v42bis_tests.c,v 1.24 2008/11/15 14:43:08 steveu Exp $ + */ + +/* THIS IS A WORK IN PROGRESS. IT IS NOT FINISHED. */ + +/*! \page v42bis_tests_page V.42bis tests +\section v42bis_tests_page_sec_1 What does it do? +These tests compress the contents of a file specified on the command line, writing +the compressed data to v42bis_tests.v42bis. They then read back the contents of the +compressed file, decompress, and write the results to v42bis_tests.out. The contents +of this file should exactly match the original file. +*/ + +#if defined(HAVE_CONFIG_H) +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "spandsp.h" + +#include "spandsp/private/v42bis.h" + +#define COMPRESSED_FILE_NAME "v42bis_tests.v42bis" +#define OUTPUT_FILE_NAME "v42bis_tests.out" + +int in_octets_to_date = 0; +int out_octets_to_date = 0; + +static void frame_handler(void *user_data, const uint8_t *buf, int len) +{ + int ret; + + if ((ret = write((intptr_t) user_data, buf, len)) != len) + fprintf(stderr, "Write error %d/%d\n", ret, errno); + out_octets_to_date += len; +} + +static void data_handler(void *user_data, const uint8_t *buf, int len) +{ + int ret; + + if ((ret = write((intptr_t) user_data, buf, len)) != len) + fprintf(stderr, "Write error %d/%d\n", ret, errno); + out_octets_to_date += len; +} + +int main(int argc, char *argv[]) +{ + int len; + v42bis_state_t state_a; + v42bis_state_t state_b; + uint8_t buf[1024]; + int in_fd; + int v42bis_fd; + int out_fd; + int do_compression; + int do_decompression; + time_t now; + + do_compression = TRUE; + do_decompression = TRUE; + if (argc < 2) + { + fprintf(stderr, "Usage: %s \n", argv[0]); + exit(2); + } + if (do_compression) + { + if ((in_fd = open(argv[1], O_RDONLY)) < 0) + { + fprintf(stderr, "Error opening file '%s'.\n", argv[1]); + exit(2); + } + if ((v42bis_fd = open(COMPRESSED_FILE_NAME, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) + { + fprintf(stderr, "Error opening file '%s'.\n", COMPRESSED_FILE_NAME); + exit(2); + } + + time(&now); + v42bis_init(&state_a, 3, 512, 6, frame_handler, (void *) (intptr_t) v42bis_fd, 512, data_handler, NULL, 512); + v42bis_compression_control(&state_a, V42BIS_COMPRESSION_MODE_ALWAYS); + in_octets_to_date = 0; + out_octets_to_date = 0; + while ((len = read(in_fd, buf, 1024)) > 0) + { + if (v42bis_compress(&state_a, buf, len)) + { + fprintf(stderr, "Bad return code from compression\n"); + exit(2); + } + in_octets_to_date += len; + } + v42bis_compress_flush(&state_a); + printf("%d bytes compressed to %d bytes in %lds\n", in_octets_to_date, out_octets_to_date, time(NULL) - now); + close(in_fd); + close(v42bis_fd); + } + + if (do_decompression) + { + /* Now open the files for the decompression. */ + if ((v42bis_fd = open(COMPRESSED_FILE_NAME, O_RDONLY)) < 0) + { + fprintf(stderr, "Error opening file '%s'.\n", COMPRESSED_FILE_NAME); + exit(2); + } + if ((out_fd = open(OUTPUT_FILE_NAME, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) + { + fprintf(stderr, "Error opening file '%s'.\n", OUTPUT_FILE_NAME); + exit(2); + } + + time(&now); + v42bis_init(&state_b, 3, 512, 6, frame_handler, (void *) (intptr_t) v42bis_fd, 512, data_handler, (void *) (intptr_t) out_fd, 512); + in_octets_to_date = 0; + out_octets_to_date = 0; + while ((len = read(v42bis_fd, buf, 1024)) > 0) + { + if (v42bis_decompress(&state_b, buf, len)) + { + fprintf(stderr, "Bad return code from decompression\n"); + exit(2); + } + in_octets_to_date += len; + } + v42bis_decompress_flush(&state_b); + printf("%d bytes decompressed to %d bytes in %lds\n", in_octets_to_date, out_octets_to_date, time(NULL) - now); + close(v42bis_fd); + close(out_fd); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/v42bis_tests.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/v42bis_tests.sh Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,154 @@ +#!/bin/sh +# +# V.42bis compression/decompression tests, as specified in V.56ter +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 2.1, +# as published by the Free Software Foundation. +# +# 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 Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# $Id: v42bis_tests.sh,v 1.5 2008/05/03 09:34:26 steveu Exp $ +# + +BASE=../test-data/itu/v56ter + +./v42bis_tests ${BASE}/1.TST +RETVAL=$? +if [ $RETVAL != 0 ] +then + exit $RETVAL +fi +diff ${BASE}/1.TST v42bis_tests.out +RETVAL=$? +if [ $RETVAL != 0 ] +then + exit $RETVAL +fi +./v42bis_tests ${BASE}/1X04.TST +RETVAL=$? +if [ $RETVAL != 0 ] +then + exit $RETVAL +fi +diff ${BASE}/1X04.TST v42bis_tests.out +RETVAL=$? +if [ $RETVAL != 0 ] +then + exit $RETVAL +fi +./v42bis_tests ${BASE}/1X30.TST +RETVAL=$? +if [ $RETVAL != 0 ] +then + exit $RETVAL +fi +diff ${BASE}/1X30.TST v42bis_tests.out +RETVAL=$? +if [ $RETVAL != 0 ] +then + exit $RETVAL +fi +./v42bis_tests ${BASE}/2.TST +RETVAL=$? +if [ $RETVAL != 0 ] +then + exit $RETVAL +fi +diff ${BASE}/2.TST v42bis_tests.out +RETVAL=$? +if [ $RETVAL != 0 ] +then + exit $RETVAL +fi +./v42bis_tests ${BASE}/2X10.TST +RETVAL=$? +if [ $RETVAL != 0 ] +then + exit $RETVAL +fi +diff ${BASE}/2X10.TST v42bis_tests.out +RETVAL=$? +if [ $RETVAL != 0 ] +then + exit $RETVAL +fi +./v42bis_tests ${BASE}/3.TST +RETVAL=$? +if [ $RETVAL != 0 ] +then + exit $RETVAL +fi +diff ${BASE}/3.TST v42bis_tests.out +RETVAL=$? +if [ $RETVAL != 0 ] +then + exit $RETVAL +fi +./v42bis_tests ${BASE}/3X06.TST +RETVAL=$? +if [ $RETVAL != 0 ] +then + exit $RETVAL +fi +diff ${BASE}/3X06.TST v42bis_tests.out +RETVAL=$? +if [ $RETVAL != 0 ] +then + exit $RETVAL +fi +./v42bis_tests ${BASE}/4.TST +RETVAL=$? +if [ $RETVAL != 0 ] +then + exit $RETVAL +fi +diff ${BASE}/4.TST v42bis_tests.out +RETVAL=$? +if [ $RETVAL != 0 ] +then + exit $RETVAL +fi +./v42bis_tests ${BASE}/4X04.TST +RETVAL=$? +if [ $RETVAL != 0 ] +then + exit $RETVAL +fi +diff ${BASE}/4X04.TST v42bis_tests.out +RETVAL=$? +if [ $RETVAL != 0 ] +then + exit $RETVAL +fi +./v42bis_tests ${BASE}/5.TST +RETVAL=$? +if [ $RETVAL != 0 ] +then + exit $RETVAL +fi +diff ${BASE}/5.TST v42bis_tests.out +RETVAL=$? +if [ $RETVAL != 0 ] +then + exit $RETVAL +fi +./v42bis_tests ${BASE}/5X16.TST +RETVAL=$? +if [ $RETVAL != 0 ] +then + exit $RETVAL +fi +diff ${BASE}/5X16.TST v42bis_tests.out +RETVAL=$? +if [ $RETVAL != 0 ] +then + exit $RETVAL +fi diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/v8_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/v8_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,585 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * v8_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: v8_tests.c,v 1.36.4.1 2009/12/28 12:32:53 steveu Exp $ + */ + +/*! \page v8_tests_page V.8 tests +\section v8_tests_page_sec_1 What does it do? +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define FALSE 0 +#define TRUE (!FALSE) + +#define SAMPLES_PER_CHUNK 160 + +#define OUTPUT_FILE_NAME "v8.wav" + +int negotiations_ok = 0; + +static int select_modulation(int mask) +{ + /* Select the fastest data modem available */ + if (mask & V8_MOD_V90) + return V8_MOD_V90; + if (mask & V8_MOD_V34) + return V8_MOD_V34; + if (mask & V8_MOD_V32) + return V8_MOD_V32; + if (mask & V8_MOD_V23) + return V8_MOD_V23; + if (mask & V8_MOD_V21) + return V8_MOD_V21; + return V8_MOD_FAILED; +} +/*- End of function --------------------------------------------------------*/ + +static void handler(void *user_data, v8_parms_t *result) +{ + const char *s; + + s = (const char *) user_data; + + if (result == NULL) + { + printf("%s V.8 negotiation failed\n", s); + return; + } + if (result->modem_connect_tone == MODEM_CONNECT_TONES_ANSAM + || + result->modem_connect_tone == MODEM_CONNECT_TONES_ANSAM_PR + || + result->modem_connect_tone == MODEM_CONNECT_TONES_NONE) + { + printf("%s V.8 negotiation result:\n", s); + printf(" Modem connect tone '%s' (%d)\n", modem_connect_tone_to_str(result->modem_connect_tone), result->modem_connect_tone); + printf(" Call function '%s' (%d)\n", v8_call_function_to_str(result->call_function), result->call_function); + printf(" Far end modulations 0x%X\n", result->modulations); + printf(" Protocol '%s' (%d)\n", v8_protocol_to_str(result->protocol), result->protocol); + printf(" PSTN access '%s' (%d)\n", v8_pstn_access_to_str(result->pstn_access), result->pstn_access); + printf(" PCM modem availability '%s' (%d)\n", v8_pcm_modem_availability_to_str(result->pcm_modem_availability), result->pcm_modem_availability); + if (result->t66 >= 0) + printf(" T.66 '%s' (%d)\n", v8_t66_to_str(result->t66), result->t66); + if (result->nsf >= 0) + printf(" NSF %d\n", result->nsf); + if (result->call_function == V8_CALL_V_SERIES + && + result->protocol == V8_PROTOCOL_LAPM_V42) + { + negotiations_ok++; + } + } + else + { + printf("%s V.8 negotiation result:\n", s); + printf(" Modem connect tone '%s' (%d)\n", modem_connect_tone_to_str(result->modem_connect_tone), result->modem_connect_tone); + } +} +/*- End of function --------------------------------------------------------*/ + +static int v8_calls_v8_tests(SNDFILE *outhandle) +{ + v8_state_t *v8_caller; + v8_state_t *v8_answerer; + logging_state_t *caller_logging; + logging_state_t *answerer_logging; + int caller_available_modulations; + int answerer_available_modulations; + int i; + int samples; + int remnant; + int outframes; + int16_t amp[SAMPLES_PER_CHUNK]; + int16_t out_amp[2*SAMPLES_PER_CHUNK]; + v8_parms_t v8_call_parms; + v8_parms_t v8_answer_parms; + + caller_available_modulations = V8_MOD_V17 + | V8_MOD_V21 + | V8_MOD_V22 + | V8_MOD_V23HALF + | V8_MOD_V23 + | V8_MOD_V26BIS + | V8_MOD_V26TER + | V8_MOD_V27TER + | V8_MOD_V29 + | V8_MOD_V32 + | V8_MOD_V34HALF + | V8_MOD_V34 + | V8_MOD_V90 + | V8_MOD_V92; + answerer_available_modulations = V8_MOD_V17 + | V8_MOD_V21 + | V8_MOD_V22 + | V8_MOD_V23HALF + | V8_MOD_V23 + | V8_MOD_V26BIS + | V8_MOD_V26TER + | V8_MOD_V27TER + | V8_MOD_V29 + | V8_MOD_V32 + | V8_MOD_V34HALF + | V8_MOD_V34 + | V8_MOD_V90 + | V8_MOD_V92; + negotiations_ok = 0; + + v8_call_parms.modem_connect_tone = MODEM_CONNECT_TONES_NONE; + v8_call_parms.call_function = V8_CALL_V_SERIES; + v8_call_parms.modulations = caller_available_modulations; + v8_call_parms.protocol = V8_PROTOCOL_LAPM_V42; + v8_call_parms.pcm_modem_availability = 0; + v8_call_parms.pstn_access = 0; + v8_call_parms.nsf = -1; + v8_call_parms.t66 = -1; + v8_caller = v8_init(NULL, + TRUE, + &v8_call_parms, + handler, + (void *) "caller"); + v8_answer_parms.modem_connect_tone = MODEM_CONNECT_TONES_ANSAM_PR; + v8_answer_parms.call_function = V8_CALL_V_SERIES; + v8_answer_parms.modulations = answerer_available_modulations; + v8_answer_parms.protocol = V8_PROTOCOL_LAPM_V42; + v8_answer_parms.pcm_modem_availability = 0; + v8_answer_parms.pstn_access = 0; + v8_answer_parms.nsf = -1; + v8_answer_parms.t66 = -1; + v8_answerer = v8_init(NULL, + FALSE, + &v8_answer_parms, + handler, + (void *) "answerer"); + caller_logging = v8_get_logging_state(v8_caller); + span_log_set_level(caller_logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(caller_logging, "caller"); + answerer_logging = v8_get_logging_state(v8_answerer); + span_log_set_level(answerer_logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(answerer_logging, "answerer"); + for (i = 0; i < 1000; i++) + { + samples = v8_tx(v8_caller, amp, SAMPLES_PER_CHUNK); + if (samples < SAMPLES_PER_CHUNK) + { + memset(amp + samples, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - samples)); + samples = SAMPLES_PER_CHUNK; + } + span_log_bump_samples(caller_logging, samples); + remnant = v8_rx(v8_answerer, amp, samples); + for (i = 0; i < samples; i++) + out_amp[2*i] = amp[i]; + + samples = v8_tx(v8_answerer, amp, SAMPLES_PER_CHUNK); + if (samples < SAMPLES_PER_CHUNK) + { + memset(amp + samples, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - samples)); + samples = SAMPLES_PER_CHUNK; + } + span_log_bump_samples(answerer_logging, samples); + if (v8_rx(v8_caller, amp, samples) && remnant) + break; + for (i = 0; i < samples; i++) + out_amp[2*i + 1] = amp[i]; + + outframes = sf_writef_short(outhandle, out_amp, samples); + if (outframes != samples) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + } + v8_free(v8_caller); + v8_free(v8_answerer); + + if (negotiations_ok != 2) + { + printf("Tests failed.\n"); + exit(2); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int non_v8_calls_v8_tests(SNDFILE *outhandle) +{ + silence_gen_state_t *non_v8_caller_tx; + modem_connect_tones_rx_state_t *non_v8_caller_rx; + v8_state_t *v8_answerer; + logging_state_t *answerer_logging; + int answerer_available_modulations; + int i; + int samples; + int remnant; + int outframes; + int tone; + int16_t amp[SAMPLES_PER_CHUNK]; + int16_t out_amp[2*SAMPLES_PER_CHUNK]; + v8_parms_t v8_answer_parms; + + answerer_available_modulations = V8_MOD_V17 + | V8_MOD_V21 + | V8_MOD_V22 + | V8_MOD_V23HALF + | V8_MOD_V23 + | V8_MOD_V26BIS + | V8_MOD_V26TER + | V8_MOD_V27TER + | V8_MOD_V29 + | V8_MOD_V32 + | V8_MOD_V34HALF + | V8_MOD_V34 + | V8_MOD_V90 + | V8_MOD_V92; + negotiations_ok = 0; + + non_v8_caller_tx = silence_gen_init(NULL, 10*SAMPLE_RATE); + non_v8_caller_rx = modem_connect_tones_rx_init(NULL, MODEM_CONNECT_TONES_ANS_PR, NULL, NULL); + + v8_answer_parms.modem_connect_tone = MODEM_CONNECT_TONES_ANSAM_PR; + v8_answer_parms.call_function = V8_CALL_V_SERIES; + v8_answer_parms.modulations = answerer_available_modulations; + v8_answer_parms.protocol = V8_PROTOCOL_LAPM_V42; + v8_answer_parms.pcm_modem_availability = 0; + v8_answer_parms.pstn_access = 0; + v8_answer_parms.nsf = -1; + v8_answer_parms.t66 = -1; + v8_answerer = v8_init(NULL, + FALSE, + &v8_answer_parms, + handler, + (void *) "answerer"); + answerer_logging = v8_get_logging_state(v8_answerer); + span_log_set_level(answerer_logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(answerer_logging, "answerer"); + for (i = 0; i < 1000; i++) + { + samples = silence_gen(non_v8_caller_tx, amp, SAMPLES_PER_CHUNK); + if (samples < SAMPLES_PER_CHUNK) + { + memset(amp + samples, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - samples)); + samples = SAMPLES_PER_CHUNK; + } + remnant = v8_rx(v8_answerer, amp, samples); + if (remnant) + break; + for (i = 0; i < samples; i++) + out_amp[2*i] = amp[i]; + + samples = v8_tx(v8_answerer, amp, SAMPLES_PER_CHUNK); + if (samples < SAMPLES_PER_CHUNK) + { + memset(amp + samples, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - samples)); + samples = SAMPLES_PER_CHUNK; + } + span_log_bump_samples(answerer_logging, samples); + modem_connect_tones_rx(non_v8_caller_rx, amp, samples); + if ((tone = modem_connect_tones_rx_get(non_v8_caller_rx)) != MODEM_CONNECT_TONES_NONE) + { + printf("Detected %s (%d)\n", modem_connect_tone_to_str(tone), tone); + if (tone == MODEM_CONNECT_TONES_ANSAM_PR) + negotiations_ok++; + } + for (i = 0; i < samples; i++) + out_amp[2*i + 1] = amp[i]; + + outframes = sf_writef_short(outhandle, out_amp, samples); + if (outframes != samples) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + } + silence_gen_free(non_v8_caller_tx); + modem_connect_tones_rx_free(non_v8_caller_rx); + v8_free(v8_answerer); + + if (negotiations_ok != 1) + { + printf("Tests failed.\n"); + exit(2); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int v8_calls_non_v8_tests(SNDFILE *outhandle) +{ + v8_state_t *v8_caller; + modem_connect_tones_tx_state_t *non_v8_answerer_tx; + logging_state_t *caller_logging; + int caller_available_modulations; + int i; + int samples; + int outframes; + int16_t amp[SAMPLES_PER_CHUNK]; + int16_t out_amp[2*SAMPLES_PER_CHUNK]; + v8_parms_t v8_call_parms; + + caller_available_modulations = V8_MOD_V17 + | V8_MOD_V21 + | V8_MOD_V22 + | V8_MOD_V23HALF + | V8_MOD_V23 + | V8_MOD_V26BIS + | V8_MOD_V26TER + | V8_MOD_V27TER + | V8_MOD_V29 + | V8_MOD_V32 + | V8_MOD_V34HALF + | V8_MOD_V34 + | V8_MOD_V90 + | V8_MOD_V92; + negotiations_ok = 0; + + v8_call_parms.modem_connect_tone = MODEM_CONNECT_TONES_NONE; + v8_call_parms.call_function = V8_CALL_V_SERIES; + v8_call_parms.modulations = caller_available_modulations; + v8_call_parms.protocol = V8_PROTOCOL_LAPM_V42; + v8_call_parms.pcm_modem_availability = 0; + v8_call_parms.pstn_access = 0; + v8_call_parms.nsf = -1; + v8_call_parms.t66 = -1; + v8_caller = v8_init(NULL, + TRUE, + &v8_call_parms, + handler, + (void *) "caller"); + non_v8_answerer_tx = modem_connect_tones_tx_init(NULL, MODEM_CONNECT_TONES_ANS_PR); + caller_logging = v8_get_logging_state(v8_caller); + span_log_set_level(caller_logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(caller_logging, "caller"); + for (i = 0; i < 1000; i++) + { + samples = v8_tx(v8_caller, amp, SAMPLES_PER_CHUNK); + if (samples < SAMPLES_PER_CHUNK) + { + memset(amp + samples, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - samples)); + samples = SAMPLES_PER_CHUNK; + } + span_log_bump_samples(caller_logging, samples); + for (i = 0; i < samples; i++) + out_amp[2*i] = amp[i]; + + samples = modem_connect_tones_tx(non_v8_answerer_tx, amp, SAMPLES_PER_CHUNK); + if (samples < SAMPLES_PER_CHUNK) + { + memset(amp + samples, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - samples)); + samples = SAMPLES_PER_CHUNK; + } + if (v8_rx(v8_caller, amp, samples)) + break; + for (i = 0; i < samples; i++) + out_amp[2*i + 1] = amp[i]; + + outframes = sf_writef_short(outhandle, out_amp, samples); + if (outframes != samples) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + } + v8_free(v8_caller); + modem_connect_tones_tx_free(non_v8_answerer_tx); + +#if 0 + if (negotiations_ok != 1) + { + printf("Tests failed.\n"); + exit(2); + } +#endif + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int16_t amp[SAMPLES_PER_CHUNK]; + int samples; + int remnant; + int caller_available_modulations; + int answerer_available_modulations; + SNDFILE *inhandle; + SNDFILE *outhandle; + int opt; + char *decode_test_file; + v8_state_t *v8_caller; + v8_state_t *v8_answerer; + v8_parms_t v8_call_parms; + v8_parms_t v8_answer_parms; + logging_state_t *logging; + + decode_test_file = NULL; + while ((opt = getopt(argc, argv, "d:")) != -1) + { + switch (opt) + { + case 'd': + decode_test_file = optarg; + break; + default: + //usage(); + exit(2); + break; + } + } + + caller_available_modulations = V8_MOD_V17 + | V8_MOD_V21 + | V8_MOD_V22 + | V8_MOD_V23HALF + | V8_MOD_V23 + | V8_MOD_V26BIS + | V8_MOD_V26TER + | V8_MOD_V27TER + | V8_MOD_V29 + | V8_MOD_V32 + | V8_MOD_V34HALF + | V8_MOD_V34 + | V8_MOD_V90 + | V8_MOD_V92; + answerer_available_modulations = V8_MOD_V17 + | V8_MOD_V21 + | V8_MOD_V22 + | V8_MOD_V23HALF + | V8_MOD_V23 + | V8_MOD_V26BIS + | V8_MOD_V26TER + | V8_MOD_V27TER + | V8_MOD_V29 + | V8_MOD_V32 + | V8_MOD_V34HALF + | V8_MOD_V34 + | V8_MOD_V90 + | V8_MOD_V92; + + if (decode_test_file == NULL) + { + if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 2)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + + printf("Test 1: V.8 terminal calls V.8 terminal\n"); + v8_calls_v8_tests(outhandle); + + printf("Test 2: non-V.8 terminal calls V.8 terminal\n"); + non_v8_calls_v8_tests(outhandle); + + printf("Test 3: V.8 terminal calls non-V.8 terminal\n"); + v8_calls_non_v8_tests(outhandle); + + if (sf_close(outhandle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + + printf("Tests passed.\n"); + } + else + { + printf("Decode file '%s'\n", decode_test_file); + v8_call_parms.modem_connect_tone = MODEM_CONNECT_TONES_NONE; + v8_call_parms.call_function = V8_CALL_V_SERIES; + v8_call_parms.modulations = caller_available_modulations; + v8_call_parms.protocol = V8_PROTOCOL_LAPM_V42; + v8_call_parms.pcm_modem_availability = 0; + v8_call_parms.pstn_access = 0; + v8_call_parms.nsf = -1; + v8_call_parms.t66 = -1; + v8_caller = v8_init(NULL, + TRUE, + &v8_call_parms, + handler, + (void *) "caller"); + logging = v8_get_logging_state(v8_caller); + span_log_set_level(logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG); + span_log_set_tag(logging, "caller"); + + v8_answer_parms.modem_connect_tone = MODEM_CONNECT_TONES_ANSAM_PR; + v8_answer_parms.call_function = V8_CALL_V_SERIES; + v8_answer_parms.modulations = answerer_available_modulations; + v8_answer_parms.protocol = V8_PROTOCOL_LAPM_V42; + v8_answer_parms.pcm_modem_availability = 0; + v8_answer_parms.pstn_access = 0; + v8_answer_parms.nsf = -1; + v8_answer_parms.t66 = -1; + v8_answerer = v8_init(NULL, + FALSE, + &v8_answer_parms, + handler, + (void *) "answerer"); + logging = v8_get_logging_state(v8_answerer); + span_log_set_level(logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG); + span_log_set_tag(logging, "answerer"); + + if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL) + { + fprintf(stderr, " Cannot open speech file '%s'\n", decode_test_file); + exit (2); + } + /*endif*/ + + while ((samples = sf_readf_short(inhandle, amp, SAMPLES_PER_CHUNK))) + { + remnant = v8_rx(v8_caller, amp, samples); + remnant = v8_rx(v8_answerer, amp, samples); + remnant = v8_tx(v8_caller, amp, samples); + remnant = v8_tx(v8_answerer, amp, samples); + } + /*endwhile*/ + + v8_free(v8_caller); + v8_free(v8_answerer); + if (sf_close(inhandle) != 0) + { + fprintf(stderr, " Cannot close speech file '%s'\n", decode_test_file); + exit(2); + } + /*endif*/ + } + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/vector_float_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/vector_float_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,652 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * vector_float_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: vector_float_tests.c,v 1.13 2009/04/26 07:00:39 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include + +#include "spandsp.h" + +static void vec_copyf_dumb(float z[], const float x[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]; +} +/*- End of function --------------------------------------------------------*/ + +static int test_vec_copyf(void) +{ + int i; + float x[100]; + float za[100]; + float zb[100]; + + printf("Testing vec_copyf()\n"); + for (i = 0; i < 99; i++) + { + x[i] = i; + za[i] = -1.0f; + zb[i] = -1.0f; + } + vec_copyf_dumb(za + 3, x + 1, 0); + vec_copyf(zb + 3, x + 1, 0); + for (i = 0; i < 99; i++) + { + if (za[i] != zb[i]) + { + printf("vec_copyf() - %d %f %f\n", i, za[i], zb[i]); + printf("Tests failed\n"); + exit(2); + } + } + vec_copyf_dumb(za + 3, x + 1, 1); + vec_copyf(zb + 3, x + 1, 1); + for (i = 0; i < 99; i++) + { + if (za[i] != zb[i]) + { + printf("vec_copyf() - %d %f %f\n", i, za[i], zb[i]); + printf("Tests failed\n"); + exit(2); + } + } + vec_copyf_dumb(za + 3, x + 1, 29); + vec_copyf(zb + 3, x + 1, 29); + for (i = 0; i < 99; i++) + { + if (za[i] != zb[i]) + { + printf("vec_copyf() - %d %f %f\n", i, za[i], zb[i]); + printf("Tests failed\n"); + exit(2); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void vec_negatef_dumb(float z[], const float x[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = -x[i]; +} +/*- End of function --------------------------------------------------------*/ + +static int test_vec_negatef(void) +{ + int i; + float x[100]; + float za[100]; + float zb[100]; + + printf("Testing vec_negatef()\n"); + for (i = 0; i < 99; i++) + { + x[i] = i; + za[i] = -1.0f; + zb[i] = -1.0f; + } + vec_negatef_dumb(za + 3, x + 1, 0); + vec_negatef(zb + 3, x + 1, 0); + for (i = 0; i < 99; i++) + { + if (za[i] != zb[i]) + { + printf("vec_negatef() - %d %f %f\n", i, za[i], zb[i]); + printf("Tests failed\n"); + exit(2); + } + } + vec_negatef_dumb(za + 3, x + 1, 1); + vec_negatef(zb + 3, x + 1, 1); + for (i = 0; i < 99; i++) + { + if (za[i] != zb[i]) + { + printf("vec_megatef() - %d %f %f\n", i, za[i], zb[i]); + printf("Tests failed\n"); + exit(2); + } + } + vec_negatef_dumb(za + 3, x + 1, 29); + vec_negatef(zb + 3, x + 1, 29); + for (i = 0; i < 99; i++) + { + if (za[i] != zb[i]) + { + printf("vec_negatef() - %d %f %f\n", i, za[i], zb[i]); + printf("Tests failed\n"); + exit(2); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void vec_zerof_dumb(float z[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = 0.0f; +} +/*- End of function --------------------------------------------------------*/ + +static int test_vec_zerof(void) +{ + int i; + float za[100]; + float zb[100]; + + printf("Testing vec_zerof()\n"); + for (i = 0; i < 99; i++) + { + za[i] = -1.0f; + zb[i] = -1.0f; + } + vec_zerof_dumb(za + 3, 0); + vec_zerof(zb + 3, 0); + for (i = 0; i < 99; i++) + { + if (za[i] != zb[i]) + { + printf("vec_zerof() - %d %f %f\n", i, za[i], zb[i]); + printf("Tests failed\n"); + exit(2); + } + } + vec_zerof_dumb(za + 3, 1); + vec_zerof(zb + 3, 1); + for (i = 0; i < 99; i++) + { + if (za[i] != zb[i]) + { + printf("vec_zerof() - %d %f %f\n", i, za[i], zb[i]); + printf("Tests failed\n"); + exit(2); + } + } + vec_zerof_dumb(za + 3, 29); + vec_zerof(zb + 3, 29); + for (i = 0; i < 99; i++) + { + if (za[i] != zb[i]) + { + printf("vec_zerof() - %d %f %f\n", i, za[i], zb[i]); + printf("Tests failed\n"); + exit(2); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void vec_setf_dumb(float z[], float x, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x; +} +/*- End of function --------------------------------------------------------*/ + +static int test_vec_setf(void) +{ + int i; + float za[100]; + float zb[100]; + + printf("Testing vec_setf()\n"); + for (i = 0; i < 99; i++) + { + za[i] = -1.0f; + zb[i] = -1.0f; + } + vec_setf_dumb(za + 3, 42.0f, 0); + vec_setf(zb + 3, 42.0f, 0); + for (i = 0; i < 99; i++) + { + if (za[i] != zb[i]) + { + printf("vec_setf() - %d %f %f\n", i, za[i], zb[i]); + printf("Tests failed\n"); + exit(2); + } + } + vec_setf_dumb(za + 3, 42.0f, 1); + vec_setf(zb + 3, 42.0f, 1); + for (i = 0; i < 99; i++) + { + if (za[i] != zb[i]) + { + printf("vec_setf() - %d %f %f\n", i, za[i], zb[i]); + printf("Tests failed\n"); + exit(2); + } + } + vec_setf_dumb(za + 3, 42.0f, 29); + vec_setf(zb + 3, 42.0f, 29); + for (i = 0; i < 99; i++) + { + if (za[i] != zb[i]) + { + printf("vec_setf() - %d %f %f\n", i, za[i], zb[i]); + printf("Tests failed\n"); + exit(2); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static double vec_dot_prod_dumb(const double x[], const double y[], int n) +{ + int i; + double z; + + z = 0.0; + for (i = 0; i < n; i++) + z += x[i]*y[i]; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static int test_vec_dot_prod(void) +{ + int i; + double x[100]; + double y[100]; + double zsa; + double zsb; + double ratio; + + printf("Testing vec_dot_prod()\n"); + for (i = 0; i < 99; i++) + { + x[i] = rand(); + y[i] = rand(); + } + for (i = 1; i < 99; i++) + { + zsa = vec_dot_prod(x, y, i); + zsb = vec_dot_prod_dumb(x, y, i); + ratio = zsa/zsb; + if (ratio < 0.9999 || ratio > 1.0001) + { + printf("vec_dot_prod() - %f %f\n", zsa, zsb); + printf("Tests failed\n"); + exit(2); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static float vec_dot_prodf_dumb(const float x[], const float y[], int n) +{ + int i; + float z; + + z = 0.0; + for (i = 0; i < n; i++) + z += x[i]*y[i]; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static int test_vec_dot_prodf(void) +{ + int i; + float x[100]; + float y[100]; + float zsa; + float zsb; + float ratio; + + printf("Testing vec_dot_prodf()\n"); + for (i = 0; i < 99; i++) + { + x[i] = rand(); + y[i] = rand(); + } + for (i = 1; i < 99; i++) + { + zsa = vec_dot_prodf(x, y, i); + zsb = vec_dot_prodf_dumb(x, y, i); + ratio = zsa/zsb; + if (ratio < 0.9999f || ratio > 1.0001f) + { + printf("vec_dot_prodf() - %e %e\n", zsa, zsb); + printf("Tests failed\n"); + exit(2); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void vec_addf_dumb(float z[], const float x[], const float y[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i] + y[i]; +} +/*- End of function --------------------------------------------------------*/ + +static int test_vec_addf(void) +{ + int i; + int j; + float x[100]; + float y[100]; + float zsa[100]; + float zsb[100]; + float ratio; + + printf("Testing vec_addf()\n"); + for (i = 0; i < 99; i++) + { + x[i] = rand(); + y[i] = rand(); + } + for (i = 1; i < 90; i++) + { + /* Force address misalignment, to check this works OK */ + vec_addf(zsa + 1, x + 1, y + 1, i); + vec_addf_dumb(zsb + 1, x + 1, y + 1, i); + for (j = 1; j <= i; j++) + { + ratio = zsa[j]/zsb[j]; + if (ratio < 0.9999f || ratio > 1.0001f) + { + printf("vec_mulf() - %d %e %e\n", j, zsa[j], zsb[j]); + printf("Tests failed\n"); + exit(2); + } + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void vec_subf_dumb(float z[], const float x[], const float y[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i] - y[i]; +} +/*- End of function --------------------------------------------------------*/ + +static int test_vec_subf(void) +{ + int i; + int j; + float x[100]; + float y[100]; + float zsa[100]; + float zsb[100]; + float ratio; + + printf("Testing vec_subf()\n"); + for (i = 0; i < 99; i++) + { + x[i] = rand(); + y[i] = rand(); + } + for (i = 1; i < 90; i++) + { + /* Force address misalignment, to check this works OK */ + vec_subf(zsa + 1, x + 1, y + 1, i); + vec_subf_dumb(zsb + 1, x + 1, y + 1, i); + for (j = 1; j <= i; j++) + { + ratio = zsa[j]/zsb[j]; + if (ratio < 0.9999f || ratio > 1.0001f) + { + printf("vec_mulf() - %d %e %e\n", j, zsa[j], zsb[j]); + printf("Tests failed\n"); + exit(2); + } + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void vec_mulf_dumb(float z[], const float x[], const float y[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]*y[i]; +} +/*- End of function --------------------------------------------------------*/ + +static int test_vec_mulf(void) +{ + int i; + int j; + float x[100]; + float y[100]; + float zsa[100]; + float zsb[100]; + float ratio; + + printf("Testing vec_mulf()\n"); + for (i = 0; i < 99; i++) + { + x[i] = rand(); + y[i] = rand(); + } + for (i = 1; i < 90; i++) + { + /* Force address misalignment, to check this works OK */ + vec_mulf(zsa + 1, x + 1, y + 1, i); + vec_mulf_dumb(zsb + 1, x + 1, y + 1, i); + for (j = 1; j <= i; j++) + { + ratio = zsa[j]/zsb[j]; + if (ratio < 0.9999f || ratio > 1.0001f) + { + printf("vec_mulf() - %d %e %e\n", j, zsa[j], zsb[j]); + printf("Tests failed\n"); + exit(2); + } + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +#define LMS_LEAK_RATE 0.9999f + +static void vec_lmsf_dumb(const float x[], float y[], int n, float error) +{ + int i; + + for (i = 0; i < n; i++) + { + /* Leak a little to tame uncontrolled wandering */ + y[i] = y[i]*LMS_LEAK_RATE + x[i]*error; + } +} +/*- End of function --------------------------------------------------------*/ + +static int test_vec_lmsf(void) +{ + int i; + int j; + float x[100]; + float ya[100]; + float yb[100]; + float ratio; + + printf("Testing vec_lmsf()\n"); + for (i = 0; i < 99; i++) + { + x[i] = rand(); + ya[i] = + yb[i] = rand(); + } + for (i = 1; i < 99; i++) + { + vec_lmsf(x, ya, i, 0.1f); + vec_lmsf_dumb(x, yb, i, 0.1f); + for (j = 0; j < i; j++) + { + ratio = ya[j]/yb[j]; + if (ratio < 0.9999f || ratio > 1.0001f) + { + printf("vec_lmsf() - %d %e %e\n", j, ya[j], yb[j]); + printf("Tests failed\n"); + exit(2); + } + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void vec_scaledxy_addf_dumb(float z[], const float x[], float x_scale, const float y[], float y_scale, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]*x_scale + y[i]*y_scale; +} +/*- End of function --------------------------------------------------------*/ + +static int test_vec_scaledxy_addf(void) +{ + int i; + int j; + float x[100]; + float y[100]; + float za[100]; + float zb[100]; + float ratio; + + printf("Testing vec_scaledxy_addf()\n"); + for (i = 0; i < 99; i++) + { + x[i] = rand(); + y[i] = rand(); + } + for (i = 1; i < 99; i++) + { + vec_scaledxy_addf(za, x, 2.5f, y, 1.5f, i); + vec_scaledxy_addf_dumb(zb, x, 2.5f, y, 1.5f, i); + for (j = 0; j < i; j++) + { + ratio = za[j]/zb[j]; + if (ratio < 0.9999f || ratio > 1.0001f) + { + printf("vec_scaledxy_addf() - %d %e %e\n", j, za[j], zb[j]); + printf("Tests failed\n"); + exit(2); + } + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void vec_scaledy_addf_dumb(float z[], const float x[], const float y[], float y_scale, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i] + y[i]*y_scale; +} +/*- End of function --------------------------------------------------------*/ + +static int test_vec_scaledy_addf(void) +{ + int i; + int j; + float x[100]; + float y[100]; + float za[100]; + float zb[100]; + float ratio; + + printf("Testing vec_scaledy_addf()\n"); + for (i = 0; i < 99; i++) + { + x[i] = rand(); + y[i] = rand(); + } + for (i = 1; i < 99; i++) + { + vec_scaledy_addf(za, x, y, 1.5f, i); + vec_scaledy_addf_dumb(zb, x, y, 1.5f, i); + for (j = 0; j < i; j++) + { + ratio = za[j]/zb[j]; + if (ratio < 0.9999f || ratio > 1.0001f) + { + printf("vec_scaledy_addf() - %d %e %e\n", j, za[j], zb[j]); + printf("Tests failed\n"); + exit(2); + } + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + test_vec_copyf(); + test_vec_negatef(); + test_vec_zerof(); + test_vec_setf(); + test_vec_addf(); + test_vec_subf(); + test_vec_mulf(); + test_vec_scaledxy_addf(); + test_vec_scaledy_addf(); + test_vec_dot_prod(); + test_vec_dot_prodf(); + test_vec_lmsf(); + + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/tests/vector_int_tests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/tests/vector_int_tests.c Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,191 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * complex_vector_int_tests.c + * + * Written by Steve Underwood + * + * Copyright (C) 2006 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id: vector_int_tests.c,v 1.11 2009/04/26 07:00:39 steveu Exp $ + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include + +#include "spandsp.h" + +static int32_t vec_dot_prodi16_dumb(const int16_t x[], const int16_t y[], int n) +{ + int32_t z; + int i; + + z = 0; + for (i = 0; i < n; i++) + z += (int32_t) x[i]*(int32_t) y[i]; + return z; +} +/*- End of function --------------------------------------------------------*/ + +static int test_vec_dot_prodi16(void) +{ + int i; + int32_t za; + int32_t zb; + int16_t x[99]; + int16_t y[99]; + + for (i = 0; i < 99; i++) + { + x[i] = rand(); + y[i] = rand(); + } + + for (i = 1; i < 99; i++) + { + za = vec_dot_prodi16(x, y, i); + zb = vec_dot_prodi16_dumb(x, y, i); + if (za != zb) + { + printf("Tests failed\n"); + exit(2); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int32_t vec_min_maxi16_dumb(const int16_t x[], int n, int16_t out[]) +{ + int i; + int16_t min; + int16_t max; + int16_t temp; + int32_t z; + + max = INT16_MIN; + min = INT16_MAX; + for (i = 0; i < n; i++) + { + temp = x[i]; + if (temp > max) + max = temp; + /*endif*/ + if (temp < min) + min = temp; + /*endif*/ + } + /*endfor*/ + out[0] = max; + out[1] = min; + z = abs(min); + if (z > max) + return z; + return max; +} +/*- End of function --------------------------------------------------------*/ + +static int test_vec_min_maxi16(void) +{ + int i; + int32_t za; + int32_t zb; + int16_t x[99]; + int16_t y[99]; + int16_t outa[2]; + int16_t outb[2]; + + for (i = 0; i < 99; i++) + { + x[i] = rand(); + y[i] = rand(); + } + + x[42] = -32768; + za = vec_min_maxi16_dumb(x, 99, outa); + zb = vec_min_maxi16(x, 99, outb); + if (za != zb + || + outa[0] != outb[0] + || + outa[1] != outb[1]) + { + printf("Tests failed\n"); + exit(2); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int test_vec_circular_dot_prodi16(void) +{ + int i; + int j; + int pos; + int len; + int32_t za; + int32_t zb; + int16_t x[99]; + int16_t y[99]; + + /* Verify that we can do circular sample buffer "dot" linear coefficient buffer + operations properly, by doing two sub-dot products. */ + for (i = 0; i < 99; i++) + { + x[i] = rand(); + y[i] = rand(); + } + + len = 95; + for (pos = 0; pos < len; pos++) + { + za = vec_circular_dot_prodi16(x, y, len, pos); + zb = 0; + for (i = 0; i < len; i++) + { + j = (pos + i) % len; + zb += (int32_t) x[j]*(int32_t) y[i]; + } + + if (za != zb) + { + printf("Tests failed\n"); + exit(2); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + test_vec_dot_prodi16(); + test_vec_min_maxi16(); + test_vec_circular_dot_prodi16(); + + printf("Tests passed.\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/unpack_g722_data.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/unpack_g722_data.sh Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,59 @@ +#!/bin/sh +# +# SpanDSP - a series of DSP components for telephony +# +# unpack_g722_data.sh +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 2.1, +# as published by the Free Software Foundation. +# +# 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 Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# $Id: unpack_g722_data.sh,v 1.5 2008/05/03 07:55:04 steveu Exp $ +# + +ITUDATA="../../../T-REC-G.722-198703-I!AppII!ZPF-E.zip" + +cd test-data/itu +if [ -d g722 ] +then + cd g722 +else + mkdir g722 + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo Cannot create test-data/itu/g722! + exit $RETVAL + fi + cd g722 +fi + +rm -rf T* +rm -rf software +unzip ${ITUDATA} >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo Cannot unpack the ITU test vectors for G.722! + exit $RETVAL +fi +#rm ${ITUDATA} +unzip ./software/G722ap2/G722E/Software.zip >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo Cannot unpack the ITU test vectors for G.722! + exit $RETVAL +fi +mv ./software/G722ap2/G722E/T* . +rm -rf software +echo The ITU test vectors for G.722 should now be in the g722 directory diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/unpack_g726_data.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/unpack_g726_data.sh Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,64 @@ +#!/bin/sh +# +# SpanDSP - a series of DSP components for telephony +# +# unpack_g726_data.sh +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 2.1, +# as published by the Free Software Foundation. +# +# 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 Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# $Id: unpack_g726_data.sh,v 1.6 2008/05/03 07:55:04 steveu Exp $ +# + +ITUDATA="../../../T-REC-G.726-199103-I!AppII!SOFT-ZST-E.zip" + +cd test-data/itu +if [ -d g726 ] +then + cd g726 +else + mkdir g726 + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo Cannot create test-data/itu/g726! + exit $RETVAL + fi + cd g726 +fi + +rm -rf DISK1 +rm -rf DISK2 +rm -rf G726piiE.WW7.doc +rm -rf Software.zip +unzip ${ITUDATA} >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo Cannot unpack the ITU test vectors for G.726! + exit $RETVAL +fi +#rm $(ITUDATA} +rm G726piiE.WW7.doc +unzip Software.zip >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo Cannot unpack the ITU test vectors for G.726! + exit $RETVAL +fi +rm Software.zip +mv ./software/G726ap2/G726ap2e/DISK1 . +mv ./software/G726ap2/G726ap2e/DISK2 . +rm -rf ./software +echo The ITU test vectors for G.726 should now be in the g726 directory diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/unpack_gsm0610_data.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/unpack_gsm0610_data.sh Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,320 @@ +#!/bin/sh +# +# SpanDSP - a series of DSP components for telephony +# +# unpack_gsm0610_data.sh +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 2.1, +# as published by the Free Software Foundation. +# +# 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 Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# $Id: unpack_gsm0610_data.sh,v 1.7 2008/05/03 10:59:44 steveu Exp $ +# + +# The ETSI distribution file extracts to 5 ZIP files, called DISK1.ZIP to DISK5.ZIP +# These were originally the contents of 5 floppy disks. Disks 1 to 3 contain data +# files. However, disks 4 and 5 contain .EXE files, which unpack.... but only in an +# MS environment. These files need to be executed in a Windows or DOS environment, +# or a good emulation like FreeDOS or Wine. + +ETSIDATA="../../../en_300961v080101p0.zip" + +cd test-data +if [ -d etsi ] +then + cd etsi +else + mkdir etsi + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo Cannot create test-data/etsi! + exit $RETVAL + fi + cd etsi +fi +if [ -d gsm0610 ] +then + cd gsm0610 +else + mkdir gsm0610 + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo Cannot create test-data/etsi/gsm0610! + exit $RETVAL + fi + cd gsm0610 +fi + +if [ $1x == --no-exe-runx ] +then + # Run the .exe files, which should be here + ./FR_A.EXE + ./FR_HOM_A.EXE + ./FR_SYN_A.EXE + ./FR_U.EXE + ./FR_HOM_U.EXE + ./FR_SYN_U.EXE + exit 0 +fi + +# Clear out any leftovers from the past +rm -rf ASN.1.txt +rm -rf DISK1.ZIP +rm -rf DISK2.ZIP +rm -rf DISK3.ZIP +rm -rf DISK4.ZIP +rm -rf DISK5.ZIP +rm -rf *.EXE +rm -rf READ_FRA.TXT +rm -rf ACTION +rm -rf unpacked + +if [ $1x == --no-exex ] +then + # We need to prepare the .exe files to be run separately + rm -rf *.INP + rm -rf *.COD + rm -rf *.OUT + + unzip ${ETSIDATA} >/dev/null + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo Cannot unpack the ETSI test vectors for GSM 06.10! + exit $RETVAL + fi + unzip ./DISK4.ZIP >/dev/null + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo Cannot unpack the ETSI test vectors for GSM 06.10! + exit $RETVAL + fi + unzip ./DISK5.ZIP >/dev/null + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo Cannot unpack the ETSI test vectors for GSM 06.10! + exit $RETVAL + fi + rm -rf ASN.1.txt + rm -rf DISK1.ZIP + rm -rf DISK2.ZIP + rm -rf DISK3.ZIP + rm -rf DISK4.ZIP + rm -rf DISK5.ZIP + rm -rf READ_FRA.TXT + + # An environment which is emulating an MS one will probably need + # to make the .EXE files actually executable. + chmod 755 *.EXE + + echo "Now copy the files from the test-data/etsi/gsm0610 directory to a Windows," + echo "DOS or other machine which can run .exe files. Run each of the .exe" + echo "files (there are 6 of them), and copy the whole directory back here." + echo "You can then complete the creation of the working data directories" + echo "with the command:" + echo $0 "--no-exe-continue" + exit 0 +fi + +unzip ${ETSIDATA} >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo Cannot unpack the ETSI test vectors for GSM 06.10! + exit $RETVAL +fi +#rm ${ETSIDATA} + +rm -rf ASN.1.txt + +if [ $1x != --no-exe-continuex ] +then + # We need to extract and run the .exe files right now. For this to succeed + # we must be running in an environment which can run .exe files. This has been + # tested with Cygwin on a Windows XP machine. + rm -rf *.INP + rm -rf *.COD + rm -rf *.OUT + + unzip ./DISK4.ZIP >/dev/null + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo Cannot unpack the ETSI test vectors for GSM 06.10! + exit $RETVAL + fi + unzip ./DISK5.ZIP >/dev/null + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo Cannot unpack the ETSI test vectors for GSM 06.10! + exit $RETVAL + fi + # An environment which is emulating an MS one will probably need + # to make the .EXE files actually executable. + chmod 755 *.EXE + ./FR_HOM_A.EXE >/dev/null + ./FR_SYN_A.EXE >/dev/null + ./FR_A.EXE >/dev/null + ./FR_HOM_U.EXE >/dev/null + ./FR_SYN_U.EXE >/dev/null + ./FR_U.EXE >/dev/null + + rm -rf READ_FRA.TXT +fi + +rm -rf DISK4.ZIP +rm -rf DISK5.ZIP +rm -rf *.EXE + +chmod 644 *.INP +chmod 644 *.OUT +chmod 644 *.COD + +# Create the directories where we want to put the test data files. +mkdir unpacked +mkdir unpacked/fr_A +mkdir unpacked/fr_L +mkdir unpacked/fr_U +mkdir unpacked/fr_homing_A +mkdir unpacked/fr_homing_L +mkdir unpacked/fr_homing_U +mkdir unpacked/fr_sync_A +mkdir unpacked/fr_sync_L +mkdir unpacked/fr_sync_U + +# Disks 1, 2 and 3 simply unzip, and the files have sensible file names. We +# just need to rearrange the directories in which they are located. +unzip ./DISK1.ZIP >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo Cannot unpack the ETSI test vectors for GSM 06.10! + exit $RETVAL +fi +unzip ./DISK2.ZIP >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo Cannot unpack the ETSI test vectors for GSM 06.10! + exit $RETVAL +fi +unzip ./DISK3.ZIP >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo Cannot unpack the ETSI test vectors for GSM 06.10! + exit $RETVAL +fi +rm -rf DISK1.ZIP +rm -rf DISK2.ZIP +rm -rf DISK3.ZIP + +mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK1/"* ./unpacked/fr_L +mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK3/"Sync*.cod ./unpacked/fr_sync_L +mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK2/"Seq*h.* ./unpacked/fr_homing_L +mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK3/"Seq*h.* ./unpacked/fr_homing_L +mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK3/Bitsync.inp" ./unpacked/fr_sync_L +mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK3/Seqsync.inp" ./unpacked/fr_sync_L + +mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK3/Homing01.cod" ./unpacked/fr_homing_L +mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK3/Homing01.out" ./unpacked/fr_homing_L + +rm -rf ACTION + +# The files extracted by the .EXE files have messy naming, and are not in +# a sane directory layout. We rename and move them, to make the final result of +# the files extracted from all five of the original .ZIP files reasonably +# consistent, and easy to follow. +rm -rf READ_FRA.TXT + +for I in SYN*_A.COD ; +do + mv $I `echo $I | sed -e "s|SYN|./unpacked/fr_sync_A/Sync|" | sed -e "s/COD/cod/"` +done + +for I in SYN*_U.COD ; +do + mv $I `echo $I | sed -e "s|SYN|./unpacked/fr_sync_U/Sync|" | sed -e "s/COD/cod/"` +done + +for I in SEQ*H_A.COD ; +do + mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_homing_A/Seq|" | sed -e "s/COD/cod/"` +done + +for I in SEQ*H_U.COD ; +do + mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_homing_U/Seq|" | sed -e "s/COD/cod/"` +done + +for I in SEQ*H_A.INP ; +do + mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_homing_A/Seq|" | sed -e "s/INP/inp/"` +done + +for I in SEQ*H_U.INP ; +do + mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_homing_U/Seq|" | sed -e "s/INP/inp/"` +done + +for I in SEQ*H_A.OUT ; +do + mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_homing_A/Seq|" | sed -e "s/OUT/out/"` +done + +for I in SEQ*H_U.OUT ; +do + mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_homing_U/Seq|" | sed -e "s/OUT/out/"` +done + +for I in SEQ*-A.COD ; +do + mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_A/Seq|" | sed -e "s/COD/cod/"` +done + +for I in SEQ*-U.COD ; +do + mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_U/Seq|" | sed -e "s/COD/cod/"` +done + +for I in SEQ*-A.INP ; +do + mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_A/Seq|" | sed -e "s/INP/inp/"` +done + +for I in SEQ*-U.INP ; +do + mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_U/Seq|" | sed -e "s/INP/inp/"` +done + +for I in SEQ*-A.OUT ; +do + mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_A/Seq|" | sed -e "s/OUT/out/"` +done + +for I in SEQ*-U.OUT ; +do + mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_U/Seq|" | sed -e "s/OUT/out/"` +done + +mv HOM01_A.OUT ./unpacked/fr_homing_A/Homing01_A.out +mv HOM01_U.OUT ./unpacked/fr_homing_U/Homing01_U.out +mv SEQSYN_A.INP ./unpacked/fr_sync_A/Seqsync_A.inp +mv SEQSYN_U.INP ./unpacked/fr_sync_U/Seqsync_U.inp + +echo "The ETSI test vectors for GSM 06.10 should now be correctly laid out in the" +echo "gsm0610 directory" diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/unpack_v56ter_data.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/unpack_v56ter_data.sh Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,60 @@ +#!/bin/sh +# +# SpanDSP - a series of DSP components for telephony +# +# unpack_v56ter_data.sh +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 2.1, +# as published by the Free Software Foundation. +# +# 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 Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# $Id: unpack_v56ter_data.sh,v 1.5 2008/05/03 07:55:04 steveu Exp $ +# + +ITUDATA="../../../T-REC-V.56ter-199608-I!!ZPF-E.zip" + +cd test-data/itu +if [ -d v56ter ] +then + cd v56ter +else + mkdir v56ter + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo Cannot create test-data/itu/v56ter! + exit $RETVAL + fi + cd v56ter +fi + +rm -rf software +rm -rf *.TST +unzip ${ITUDATA} >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo Cannot unpack the ITU test vectors for V.56ter! + exit $RETVAL +fi +#rm ${ITUDATA} +unzip software/V56ter/V56tere/Software.zip >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo Cannot unpack the ITU test vectors for V.56ter! + exit $RETVAL +fi +mv ./software/V56ter/V56tere/*.TST . +chmod 644 *.TST +rm -rf software +echo The ITU test vectors for V.56ter should now be in the v56ter directory diff -r c6c5a16ce2f2 -r 26cd8f1ef0b1 spandsp-0.0.6pre17/wrapper.xsl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spandsp-0.0.6pre17/wrapper.xsl Fri Jun 25 15:50:58 2010 +0200 @@ -0,0 +1,5 @@ + + + css.css + \ No newline at end of file